{
GError *error = NULL;
peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
+ gint value = 0;
if (gpio_proxy == NULL) return PERIPHERAL_ERROR_UNKNOWN;
if (peripheral_io_gdbus_gpio_call_get_direction_sync(
gpio_proxy,
gpio->handle,
- (gint*)direction,
+ &value,
&ret,
NULL,
&error) == FALSE) {
_E("Error in %s() : %s\n", __func__, error->message);
g_error_free(error);
- return PERIPHERAL_ERROR_UNKNOWN;
}
+ if (value >= PERIPHERAL_GPIO_DIRECTION_IN && value <= PERIPHERAL_GPIO_DIRECTION_OUT_HIGH)
+ *direction = value;
+ else
+ return PERIPHERAL_ERROR_UNKNOWN;
+
return ret;
}
{
GError *error = NULL;
peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
+ gint value = 0;
if (gpio_proxy == NULL) return PERIPHERAL_ERROR_UNKNOWN;
if (peripheral_io_gdbus_gpio_call_get_edge_mode_sync(
gpio_proxy,
gpio->handle,
- (int*)edge,
+ &value,
&ret,
NULL,
&error) == FALSE) {
return PERIPHERAL_ERROR_UNKNOWN;
}
+ if (value >= PERIPHERAL_GPIO_EDGE_NONE && value <= PERIPHERAL_GPIO_EDGE_BOTH)
+ *edge = value;
+ else
+ return PERIPHERAL_ERROR_UNKNOWN;
+
return ret;
}
{
GError *error = NULL;
peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
+ gint value = 0;
if (pwm_proxy == NULL) return PERIPHERAL_ERROR_UNKNOWN;
if (peripheral_io_gdbus_pwm_call_get_period_sync(
pwm_proxy,
pwm->handle,
- (gint*)period,
+ &value,
&ret,
NULL,
&error) == FALSE) {
return PERIPHERAL_ERROR_UNKNOWN;
}
+ *period = value;
+
return ret;
}
{
GError *error = NULL;
peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
+ gint value = 0;
if (pwm_proxy == NULL) return PERIPHERAL_ERROR_UNKNOWN;
if (peripheral_io_gdbus_pwm_call_get_duty_cycle_sync(
pwm_proxy,
pwm->handle,
- (gint*)duty_cycle,
+ &value,
&ret,
NULL,
&error) == FALSE) {
return PERIPHERAL_ERROR_UNKNOWN;
}
+ *duty_cycle = value;
+
return ret;
}
{
GError *error = NULL;
peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
+ gint value = 0;
if (pwm_proxy == NULL) return PERIPHERAL_ERROR_UNKNOWN;
if (peripheral_io_gdbus_pwm_call_get_polarity_sync(
pwm_proxy,
pwm->handle,
- (gint*)polarity,
+ &value,
&ret,
NULL,
&error) == FALSE) {
return PERIPHERAL_ERROR_UNKNOWN;
}
+ if (!value)
+ *polarity = PERIPHERAL_PWM_POLARITY_NORMAL;
+ else
+ *polarity = PERIPHERAL_PWM_POLARITY_INVERSED;
+
return ret;
}
{
GError *error = NULL;
peripheral_error_e ret = PERIPHERAL_ERROR_NONE;
+ gboolean value = 0;
if (pwm_proxy == NULL) return PERIPHERAL_ERROR_UNKNOWN;
if (peripheral_io_gdbus_pwm_call_get_enable_sync(
pwm_proxy,
pwm->handle,
- (gint*)enable,
+ &value,
&ret,
NULL,
&error) == FALSE) {
return PERIPHERAL_ERROR_UNKNOWN;
}
+ if (!value)
+ *enable = false;
+ else
+ *enable = true;
+
return ret;
}