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 7096af2..59f9d38 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 c6838e7..f5bb401 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 76f4a5b..cd4f26e 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 285c6f5..57ad78d 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 45f29fc..07c4001 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;