From ef2e1aeabcfa11990edaf5b18ef7c95c054b2428 Mon Sep 17 00:00:00 2001 From: "jinwang.an" Date: Fri, 22 Sep 2017 20:38:49 +0900 Subject: [PATCH] Added SYSTEM_SETTINGS_KEY_VIBRATION. Change-Id: I42359510fcd3c3863c7fb7152a29029f157cba5e Signed-off-by: jinwang.an --- include/system_settings.h | 1 + include/system_settings_private.h | 41 ++++++++++++++++++++++++++++++++++++++- src/system_setting_platform.c | 39 +++++++++++++++++++++++++++++++++++++ src/system_settings.c | 14 +++++++++++++ 4 files changed, 94 insertions(+), 1 deletion(-) diff --git a/include/system_settings.h b/include/system_settings.h index f3e96bc..86b0fe9 100644 --- a/include/system_settings.h +++ b/include/system_settings.h @@ -89,6 +89,7 @@ typedef enum { SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE, /**< (int) Indicates Ultra Data Save status, one of #system_settings_uds_state_e values (Since 4.0) */ SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE_PKG_LIST, /**< (string) Indicates Ultra Data Save Package List (Since 4.0), the list is a string containing whitelisted package names separated with semicolons (;) */ SYSTEM_SETTINGS_KEY_ACCESSIBILITY_TTS, /**< GET (bool) Indicates whether the accessibility TTS is enabled on the device. (Since 4.0) */ + SYSTEM_SETTINGS_KEY_VIBRATION, /**< (bool) Indicates whether vibration is enabled on the device. (Since 4.0) */ SYSTEM_SETTINGS_KEY_MAX, } system_settings_key_e; diff --git a/include/system_settings_private.h b/include/system_settings_private.h index f638a93..431af71 100644 --- a/include/system_settings_private.h +++ b/include/system_settings_private.h @@ -1439,6 +1439,46 @@ int system_setting_unset_changed_callback_accessibility_tts(system_settings_key_ /** * @internal + * @since_tizen 4.0 + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error + * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error + */ +int system_setting_get_vibration(system_settings_key_e key, system_setting_data_type_e data_type, void **value); + +/** + * @internal + * @since_tizen 4.0 + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error + * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error + */ +int system_setting_set_vibration(system_settings_key_e key, system_setting_data_type_e data_type, void *value); + +/** + * @internal + * @since_tizen 4.0 + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error + * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error + */ +int system_setting_set_changed_callback_vibration(system_settings_key_e key, system_settings_changed_cb callback, void *user_data); + +/** + * @internal + * @since_tizen 4.0 + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error + * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error + */ +int system_setting_unset_changed_callback_vibration(system_settings_key_e key); + +/** + * @internal * @since_tizen 3.0 * @return 0 on success, otherwise a negative error value * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful @@ -1447,7 +1487,6 @@ int system_setting_unset_changed_callback_accessibility_tts(system_settings_key_ */ int system_setting_unset_changed_callback_uds_pkg_list(system_settings_key_e key); - /** * @internal * @since_tizen 4.0 diff --git a/src/system_setting_platform.c b/src/system_setting_platform.c index 3f77713..de0f702 100644 --- a/src/system_setting_platform.c +++ b/src/system_setting_platform.c @@ -2368,3 +2368,42 @@ int system_setting_unset_changed_callback_accessibility_tts(system_settings_key_ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, 2); } +/* SYSTEM_SETTINGS_KEY_VIBRATION */ +int system_setting_get_vibration(system_settings_key_e key, system_setting_data_type_e data_type, void **value) +{ + SETTING_TRACE_BEGIN; + bool vconf_value; + + if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vconf_value)) { + return SYSTEM_SETTINGS_ERROR_IO_ERROR; + } + *value = (void *)vconf_value; + + return SYSTEM_SETTINGS_ERROR_NONE; +} + +/* LCOV_EXCL_START */ +int system_setting_set_vibration(system_settings_key_e key, system_setting_data_type_e data_type, void *value) +{ + SETTING_TRACE_BEGIN; + bool *vconf_value; + vconf_value = (bool *)value; + if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, *vconf_value)) { + return SYSTEM_SETTINGS_ERROR_IO_ERROR; + } + + return SYSTEM_SETTINGS_ERROR_NONE; +} +/* LCOV_EXCL_STOP */ + +int system_setting_set_changed_callback_vibration(system_settings_key_e key, system_settings_changed_cb callback, void *user_data) +{ + SETTING_TRACE_BEGIN; + return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, SYSTEM_SETTINGS_KEY_VIBRATION, 2, user_data); +} + +int system_setting_unset_changed_callback_vibration(system_settings_key_e key) +{ + SETTING_TRACE_BEGIN; + return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, 2); +} diff --git a/src/system_settings.c b/src/system_settings.c index fd3898e..b44a3a1 100644 --- a/src/system_settings.c +++ b/src/system_settings.c @@ -494,6 +494,20 @@ system_setting_s system_setting_table[] = { NULL, /* user data */ }, { + SYSTEM_SETTINGS_KEY_VIBRATION, + SYSTEM_SETTING_DATA_TYPE_BOOL, + system_setting_get_vibration, + system_setting_set_vibration, + system_setting_set_changed_callback_vibration, + system_setting_unset_changed_callback_vibration, + NULL, + NULL, /* ADD */ + NULL, /* DEL */ + NULL, /* LIST */ + NULL, /* feature check */ + NULL, /* user data */ + }, + { SYSTEM_SETTINGS_MAX, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } }; -- 2.7.4