summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaemin.yeom <taemin.yeom@samsung.com>2021-03-09 10:26:18 +0900
committertaemin.yeom <taemin.yeom@samsung.com>2021-03-09 10:26:18 +0900
commite61256343c2927c0517949ad078d42468199bcd7 (patch)
tree341e117866fd95998794cf93aa5afba7a1255784
parent70ccbb485ec97f61be5d989bfd6ccdff307548d4 (diff)
downloadlibsvi-e61256343c2927c0517949ad078d42468199bcd7.tar.gz
libsvi-e61256343c2927c0517949ad078d42468199bcd7.tar.bz2
libsvi-e61256343c2927c0517949ad078d42468199bcd7.zip
Apply libsyscommon gdbus api improvement on error handlingsubmit/tizen/20210309.090957accepted/tizen/unified/20210310.144949
Change-Id: Ib602f152dcc49aecd903cc24f727d88a41c71400 Signed-off-by: taemin.yeom <taemin.yeom@samsung.com>
-rw-r--r--src/vibrator.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/src/vibrator.c b/src/vibrator.c
index 17cc70e..385ef31 100644
--- a/src/vibrator.c
+++ b/src/vibrator.c
@@ -77,23 +77,35 @@ inline int is_vibration_mode(void)
static int haptic_open(void)
{
- return dbus_handle_method_sync_var(VIBRATOR_BUS_NAME, VIBRATOR_PATH_HAPTIC,
+ int err, ret;
+ err = dbus_handle_method_sync_var(VIBRATOR_BUS_NAME, VIBRATOR_PATH_HAPTIC,
VIBRATOR_INTERFACE_HAPTIC, METHOD_OPEN,
- g_variant_new("(i)", HAPTIC_DEVICE));
+ g_variant_new("(i)", HAPTIC_DEVICE), &ret);
+ if (err < 0)
+ return err;
+ return ret;
}
static int haptic_close(unsigned int handle)
{
- return dbus_handle_method_sync_var(VIBRATOR_BUS_NAME, VIBRATOR_PATH_HAPTIC,
+ int err, ret;
+ err = dbus_handle_method_sync_var(VIBRATOR_BUS_NAME, VIBRATOR_PATH_HAPTIC,
VIBRATOR_INTERFACE_HAPTIC, METHOD_CLOSE,
- g_variant_new("(u)", handle));
+ g_variant_new("(u)", handle), &ret);
+ if (err < 0)
+ return err;
+ return ret;
}
static int haptic_is_supported(const char *pattern)
{
- return dbus_handle_method_sync_var(VIBRATOR_BUS_NAME, VIBRATOR_PATH_HAPTIC,
+ int err, ret;
+ err = dbus_handle_method_sync_var(VIBRATOR_BUS_NAME, VIBRATOR_PATH_HAPTIC,
VIBRATOR_INTERFACE_HAPTIC, METHOD_IS_SUPPORTED,
- g_variant_new("(s)", pattern));
+ g_variant_new("(s)", pattern), &ret);
+ if (err < 0)
+ return err;
+ return ret;
}
static int haptic_vibrate_effect(unsigned int handle,
@@ -101,16 +113,24 @@ static int haptic_vibrate_effect(unsigned int handle,
int feedback,
int priority)
{
- return dbus_handle_method_sync_var(VIBRATOR_BUS_NAME, VIBRATOR_PATH_HAPTIC,
+ int err, ret;
+ err = dbus_handle_method_sync_var(VIBRATOR_BUS_NAME, VIBRATOR_PATH_HAPTIC,
VIBRATOR_INTERFACE_HAPTIC, METHOD_VIBRATE_PATTERN,
- g_variant_new("(usii)", handle, pattern, feedback, priority));
+ g_variant_new("(usii)", handle, pattern, feedback, priority), &ret);
+ if (err < 0)
+ return err;
+ return ret;
}
static int haptic_vibrate_stop(unsigned int handle)
{
+ int err, ret;
return dbus_handle_method_sync_var(VIBRATOR_BUS_NAME, VIBRATOR_PATH_HAPTIC,
VIBRATOR_INTERFACE_HAPTIC, METHOD_STOP,
- g_variant_new("(u)", handle));
+ g_variant_new("(u)", handle), &ret);
+ if (err < 0)
+ return err;
+ return ret;
}
static int get_priority(feedback_pattern_e pattern)