Change data type for parameter to a boolean 64/129564/1
authorjino.cho <jino.cho@samsung.com>
Wed, 17 May 2017 03:30:55 +0000 (12:30 +0900)
committerjino.cho <jino.cho@samsung.com>
Wed, 17 May 2017 03:30:55 +0000 (12:30 +0900)
The parameter('enable') have only two state just like enabled/disabled.
Therefore, change it to a boolean.

Change-Id: Icefe77a4b62d3e63b882c9106a48134f9036fc16
Signed-off-by: jino.cho <jino.cho@samsung.com>
include/peripheral_gdbus_pwm.h
include/peripheral_io.h
src/peripheral_gdbus_pwm.c
src/peripheral_io.xml
src/peripheral_pwm.c

index 7096af248d62383d470f65d73883eade9ccdbebd..59f9d383a552e641503e93be3e283a9ef0cdc7d7 100644 (file)
@@ -26,7 +26,7 @@ int peripheral_gdbus_pwm_set_period(peripheral_pwm_h pwm, int period);
 int peripheral_gdbus_pwm_get_period(peripheral_pwm_h pwm, int *period);
 int peripheral_gdbus_pwm_set_duty_cycle(peripheral_pwm_h pwm, int duty_cycle);
 int peripheral_gdbus_pwm_get_duty_cycle(peripheral_pwm_h pwm, int *duty_cycle);
-int peripheral_gdbus_pwm_set_enable(peripheral_pwm_h pwm, peripheral_pwm_state_e enable);
-int peripheral_gdbus_pwm_get_enable(peripheral_pwm_h pwm, peripheral_pwm_state_e *enable);
+int peripheral_gdbus_pwm_set_enable(peripheral_pwm_h pwm, bool enable);
+int peripheral_gdbus_pwm_get_enable(peripheral_pwm_h pwm, bool *enable);
 
 #endif /* __PERIPHERAL_GDBUS_PWM_H__ */
index c6838e7ff19937710f30f842eeae23dd49dc4021..f5bb401013310ed27659fc94ba47a3237cb0a5c1 100644 (file)
@@ -375,11 +375,6 @@ int peripheral_i2c_write(peripheral_i2c_h i2c, uint8_t *data, int length);
  */
 typedef struct _peripheral_pwm_s *peripheral_pwm_h;
 
-typedef enum {
-       PERIPHERAL_PWM_DISABLE = 0,
-       PERIPHERAL_PWM_ENABLE,
-} peripheral_pwm_state_e;
-
 int peripheral_pwm_open(int device, int channel, peripheral_pwm_h *pwm);
 
 int peripheral_pwm_close(peripheral_pwm_h pwm);
@@ -393,9 +388,9 @@ int peripheral_pwm_set_duty_cycle(peripheral_pwm_h pwm, int duty_cycle);
 
 int peripheral_pwm_get_duty_cycle(peripheral_pwm_h pwm, int *duty_cycle);
 
-int peripheral_pwm_set_enable(peripheral_pwm_h pwm, peripheral_pwm_state_e enable);
+int peripheral_pwm_set_enable(peripheral_pwm_h pwm, bool enable);
 
-int peripheral_pwm_get_enable(peripheral_pwm_h pwm, peripheral_pwm_state_e *enable);
+int peripheral_pwm_get_enable(peripheral_pwm_h pwm, bool *enable);
 
 /**
 * @}
index 76f4a5bc1cc5c8f355cb3f99171d2758ba7dcfcb..cd4f26e4e27191fd9bdca659a65318cdda5508af 100644 (file)
@@ -187,7 +187,7 @@ int peripheral_gdbus_pwm_get_duty_cycle(peripheral_pwm_h pwm, int *duty_cycle)
        return ret;
 }
 
-int peripheral_gdbus_pwm_set_enable(peripheral_pwm_h pwm, peripheral_pwm_state_e enable)
+int peripheral_gdbus_pwm_set_enable(peripheral_pwm_h pwm, bool enable)
 {
        GError *error = NULL;
        gint32 ret = PERIPHERAL_ERROR_NONE;
index 285c6f565d44a1ff4738bb042b1f0e3aa2508344..57ad78d8f6a8a22cd19dfce524ecf36469d9206d 100644 (file)
                </method>
                <method name="SetEnable">
                        <arg type="u" name="handle" direction="in"/>
-                       <arg type="i" name="enable" direction="in"/>
+                       <arg type="b" name="enable" direction="in"/>
                        <arg type="i" name="result" direction="out"/>
                </method>
                <method name="GetEnable">
                        <arg type="u" name="handle" direction="in"/>
-                       <arg type="i" name="enable" direction="out"/>
+                       <arg type="b" name="enable" direction="out"/>
                        <arg type="i" name="result" direction="out"/>
                </method>
        </interface>
index 45f29fc24d16f295a3e6e5e8abf22069b9aa5911..07c40016c41d1c4bc968e7b325571274640b0da6 100644 (file)
@@ -100,14 +100,14 @@ int peripheral_pwm_get_duty_cycle(peripheral_pwm_h pwm, int *duty_cycle)
        return peripheral_gdbus_pwm_get_duty_cycle(pwm, duty_cycle);
 }
 
-int peripheral_pwm_set_enable(peripheral_pwm_h pwm, peripheral_pwm_state_e enable)
+int peripheral_pwm_set_enable(peripheral_pwm_h pwm, bool enable)
 {
        if (pwm == NULL) return PERIPHERAL_ERROR_INVALID_PARAMETER;
 
        return peripheral_gdbus_pwm_set_enable(pwm, enable);
 }
 
-int peripheral_pwm_get_enable(peripheral_pwm_h pwm, peripheral_pwm_state_e *enable)
+int peripheral_pwm_get_enable(peripheral_pwm_h pwm, bool *enable)
 {
        if (pwm == NULL) return PERIPHERAL_ERROR_INVALID_PARAMETER;