From 8a8e76de7f8d311b13b99a4571548c174eceb4e9 Mon Sep 17 00:00:00 2001 From: "pr.jung" Date: Thu, 31 Jan 2019 17:18:59 +0900 Subject: [PATCH] Change VibrateEffect to VibratePattern Change-Id: Id4c49bd11dc0e68af709930dfcba3bbbf658d939 Signed-off-by: pr.jung --- src/auto-test/haptic.c | 8 ++++---- src/auto-test/main.c | 2 +- src/haptic/haptic.c | 30 +++++++++++++++--------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/auto-test/haptic.c b/src/auto-test/haptic.c index fb9195f..bca8159 100644 --- a/src/auto-test/haptic.c +++ b/src/auto-test/haptic.c @@ -22,7 +22,7 @@ #define METHOD_HAPTIC_CLOSEDEVICE "CloseDevice" #define METHOD_HAPTIC_STOPDEVICE "StopDevice" #define METHOD_HAPTIC_VIBRATEMONOTONE "VibrateMonotone" -#define METHOD_HAPTIC_VIBRATEEFFECT "VibrateEffect" +#define METHOD_HAPTIC_VIBRATEEFFECT "VibratePattern" #define METHOD_HAPTIC_GETSTATE "GetState" #define METHOD_HAPTIC_SHOWHANDLELIST "ShowHandleList" #define METHOD_HAPTIC_ISSUPPORTED "IsSupported" @@ -129,7 +129,7 @@ static bool haptic_vibratemonotone(int duration, int level, int priority) return request_haptic_method(METHOD_HAPTIC_VIBRATEMONOTONE, g_variant_new("(uiii)", handle, duration, level, priority)); } -static bool haptic_vibrateeffect(char *pattern, int level, int priority) +static bool haptic_vibratepattern(char *pattern, int level, int priority) { GVariant *msg; int handle; @@ -246,7 +246,7 @@ void haptic_test_all(int *success, int *fail) nanosleep(&time, NULL); (haptic_vibratemonotone(300, 100, 0)) ? s++ : f++; nanosleep(&time, NULL); - (haptic_vibrateeffect("FEEDBACK_PATTERN_SIP", 100, 0)) ? s++ : f++; + (haptic_vibratepattern("FEEDBACK_PATTERN_SIP", 100, 0)) ? s++ : f++; nanosleep(&time, NULL); (haptic_getstate(0)) ? s++ : f++; (haptic_showhandlelist()) ? s++ : f++; @@ -300,7 +300,7 @@ static int haptic_unit(int argc, char **argv) time.tv_sec = 1 + (atoi(argv[2]) / 1000); nanosleep(&time, NULL); } else if (0 == strcasecmp(argv[1], METHOD_HAPTIC_VIBRATEEFFECT)) { - haptic_vibrateeffect(argv[2], atoi(argv[3]), atoi(argv[4])); + haptic_vibratepattern(argv[2], atoi(argv[3]), atoi(argv[4])); time.tv_sec = 2; nanosleep(&time, NULL); } else if (0 == strcasecmp(argv[1], METHOD_HAPTIC_GETSTATE)) { diff --git a/src/auto-test/main.c b/src/auto-test/main.c index 5c98fe9..069528f 100644 --- a/src/auto-test/main.c +++ b/src/auto-test/main.c @@ -48,7 +48,7 @@ void show_usage() printf("CloseDevice 0\n"); printf("StopDevice 0\n"); printf("VibrateMonotone duration, level, priority\n"); - printf("VibrateEffect pattern string, level, priority\n"); + printf("VibratePattern pattern string, level, priority\n"); printf("GetState 0\n"); printf("ShowHandleList 0\n"); printf("IsSupported pattern string\n"); diff --git a/src/haptic/haptic.c b/src/haptic/haptic.c index a473ac0..6fad15b 100644 --- a/src/haptic/haptic.c +++ b/src/haptic/haptic.c @@ -105,7 +105,7 @@ struct haptic_info { guint id_watch; }; -struct vibrate_effect_info { +struct vibrate_pattern_info { unsigned int handle; char *pattern; int level; @@ -918,9 +918,9 @@ out: return G_SOURCE_REMOVE; } -static void vibrate_effect_idler_cb(void *data) +static void vibrate_pattern_idler_cb(void *data) { - struct vibrate_effect_info *vibrate_info; + struct vibrate_pattern_info *vibrate_info; dd_list *elem; struct vibration_config *conf; char pattern[PATH_MAX]; @@ -930,7 +930,7 @@ static void vibrate_effect_idler_cb(void *data) if (!data) return; - vibrate_info = (struct vibrate_effect_info *)data; + vibrate_info = (struct vibrate_pattern_info *)data; if (!(vibrate_info->pattern)) { free(vibrate_info); @@ -985,11 +985,11 @@ out: free(vibrate_info); } -GVariant *hdbus_vibrate_effect(GDBusConnection *conn, +GVariant *hdbus_vibrate_pattern(GDBusConnection *conn, const gchar *sender, const gchar *path, const gchar *iface, const gchar *name, GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data) { - struct vibrate_effect_info *vibrate_info; + struct vibrate_pattern_info *vibrate_info; unsigned int handle; char *pattern = NULL; int level, priority, ret = 0; @@ -1013,7 +1013,7 @@ GVariant *hdbus_vibrate_effect(GDBusConnection *conn, else if (priority > PRIORITY_TOP) priority = PRIORITY_TOP; - vibrate_info = calloc(1, sizeof(struct vibrate_effect_info)); + vibrate_info = calloc(1, sizeof(struct vibrate_pattern_info)); if (!vibrate_info) { _E("Failed to allocate memory for vibrate_info."); ret = -errno; @@ -1031,7 +1031,7 @@ GVariant *hdbus_vibrate_effect(GDBusConnection *conn, vibrate_info->level = level; vibrate_info->priority = priority; - ret = add_idle_request(vibrate_effect_idler_cb, (void *)vibrate_info); + ret = add_idle_request(vibrate_pattern_idler_cb, (void *)vibrate_info); exit: g_free(pattern); @@ -1325,14 +1325,14 @@ out: } static const dbus_method_s hdbus_methods[] = { - { "GetCount", NULL, "i", hdbus_get_count }, - { "OpenDevice", "i", "i", hdbus_open_device }, - { "CloseDevice", "u", "i", hdbus_close_device }, - { "StopDevice", "u", "i", hdbus_stop_device }, - { "VibrateMonotone", "uiii", "i", hdbus_vibrate_monotone }, - { "VibrateEffect", "usii", "i", hdbus_vibrate_effect }, + { "GetCount", NULL, "i", hdbus_get_count }, // device_haptic_get_count + { "OpenDevice", "i", "i", hdbus_open_device }, // device_haptic_open, feedback_initialize + { "CloseDevice", "u", "i", hdbus_close_device }, // device_haptic_close, feedback_deinitialize + { "StopDevice", "u", "i", hdbus_stop_device }, // device_haptic_stop, feedback_stop + { "VibrateMonotone", "uiii", "i", hdbus_vibrate_monotone }, // device_haptic_vibrate + { "VibratePattern", "usii", "i", hdbus_vibrate_pattern }, // feedback_play* { "ShowHandleList", NULL, NULL, hdbus_show_handle_list }, - { "IsSupported", "s", "i", hdbus_pattern_is_supported }, + { "IsSupported", "s", "i", hdbus_pattern_is_supported }, // feedback_is_supported_pattern /* Add methods here */ }; -- 2.7.4