2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef __TIZEN_SYSTEM_SETTING_PRIVATE_H__
19 #define __TIZEN_SYSTEM_SETTING_PRIVATE_H__
32 #define LOG_TAG "SYSTEM-SETTINGS"
34 #define SYSTEM_SETTINGS_ENABLE_TRACE
36 #ifdef SYSTEM_SETTINGS_ENABLE_TRACE
38 #define SETTING_TRACE_DEBUG(fmt, arg...) \
40 LOGD("\n\033[0;32mDEBUG: " fmt "\033[0m\t%s:%d\n", \
41 ##arg, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
44 #define SETTING_TRACE(fmt, arg...) \
46 LOGI("\n\033[0;36m" fmt "\033[0m\t%s:%d\n", \
47 ##arg, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
50 #define SETTING_TRACE_BEGIN do {\
52 printf("\n[SETTING]\033[0;35mENTER FUNCTION: %s. \033[0m\t%s:%d\n", \
53 __FUNCTION__, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
57 #define SETTING_TRACE_END do {\
59 printf("\n[SETTING]\033[0;35mEXIT FUNCTION: %s. \033[0m\t%s:%d\n", \
60 __FUNCTION__, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
65 #define SETTING_TRACE_DEBUG(fmt, arg...)
66 #define SETTING_TRACE(fmt, arg...)
67 #define SETTING_TRACE_BEGIN
68 #define SETTING_TRACE_END
72 #define VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME "db/setting/accessibility/font_name"
77 * Enumeration for data type of internal getter/setter.
80 SYSTEM_SETTING_DATA_TYPE_STRING, /**< string */
81 SYSTEM_SETTING_DATA_TYPE_INT, /**< integer */
82 SYSTEM_SETTING_DATA_TYPE_BOOL, /**< boolean */
84 //SYSTEM_SETTING_DATA_TYPE_FLOAT,
85 //SYSTEM_SETTING_DATA_TYPE_DOULBE,
87 } system_setting_data_type_e;
93 * @return 0 on success, otherwise a negative error value
94 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
95 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
96 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
97 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
99 typedef int (*system_setting_get_value_cb) (system_settings_key_e key, system_setting_data_type_e data_type, void** value);
104 * @return 0 on success, otherwise a negative error value
105 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
106 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
107 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
108 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
110 typedef int (*system_setting_set_value_cb) (system_settings_key_e key, system_setting_data_type_e data_type, void* value);
115 * @return 0 on success, otherwise a negative error value
116 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
117 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
118 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
119 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
121 typedef int (*system_setting_set_changed_callback_cb)(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
126 * @return 0 on success, otherwise a negative error value
127 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
128 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
129 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
130 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
132 typedef int (*system_setting_unset_changed_callback_cb)(system_settings_key_e key);
138 * @return 0 on success, otherwise a negative error value
139 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
140 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
141 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
144 system_settings_key_e key; /**< key */
145 system_setting_data_type_e data_type; /**< data type */
146 system_setting_get_value_cb get_value_cb; /**< function pointer for getter */
147 system_setting_set_value_cb set_value_cb; /**< function pointer for setter */
149 system_setting_set_changed_callback_cb set_changed_cb; /**< function pointer to register for notification callback */
150 system_setting_unset_changed_callback_cb unset_changed_cb ; /**< function pointer to un-register for notification callback */
152 system_settings_changed_cb changed_cb; /* registered by user application */
153 void* user_data; /* user_data */
157 typedef system_setting_s* system_setting_h;
163 * @return 0 on success, otherwise a negative error value
164 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
165 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
166 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
167 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
169 int system_settings_get_item(system_settings_key_e key, system_setting_h *item);
176 * @brief get vconf of in type value
179 * @param[in] vconf_key string
180 * @param[out] value get the integer type value
182 * @return 0 on success, -1 on error
183 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
185 int system_setting_vconf_get_value_int(const char *vconf_key, int *value);
189 * @brief get vconf of in bool value
192 * @param[in] vconf_key string
193 * @param[out] value get the bool type value
195 * @return 0 on success, -1 on error
196 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
198 int system_setting_vconf_get_value_bool(const char *vconf_key, bool *value);
202 * @brief get vconf of string type value
205 * @param[in] vconf_key string
206 * @param[out] value get the string(char*) type value
208 * @return 0 on success, -1 on error
209 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
211 int system_setting_vconf_get_value_string(const char *vconf_key, char **value);
215 * @brief set the int type vconf value
218 * @param[in] vconf_key key name
219 * @param[in] value int type value
221 * @return 0 on success, -1 on error
222 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
224 int system_setting_vconf_set_value_int(const char *vconf_key, int value);
228 * @brief set the bool type vconf value
231 * @param[in] vconf_key key name
232 * @param[in] value bool type value
234 * @return 0 on success, -1 on error
235 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
237 int system_setting_vconf_set_value_bool(const char *vconf_key, bool value);
241 * @brief set the string type vconf value
244 * @param[in] vconf_key key name
245 * @param[in] value string type value
247 * @return 0 on success, -1 on error
248 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
250 int system_setting_vconf_set_value_string(const char *vconf_key, char *value);
254 * @brief Set the system settings notification callback
256 * @param[in] vconf_key
258 * @param[in] slot internal slot to set the key (0~4)
259 * @param[in] user_data user data
260 * @return 0 on success, otherwise a negative error value
261 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
262 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
263 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
265 int system_setting_vconf_set_changed_cb(const char *vconf_key, system_settings_key_e key, int slot, void* user_data);
269 * @brief Unset the system settings notification callback
271 * @param[in] vconf_key vconf key name used in the code
272 * @param[in] slot internal slot to set the key (0~4)
273 * @return 0 on success, otherwise a negative error value
274 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
275 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
276 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
278 int system_setting_vconf_unset_changed_cb(const char *vconf_key, int slot);
280 int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void** value);
281 int system_setting_get_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void** value);
282 int system_setting_get_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void** value);
283 int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void** value);
284 int system_setting_get_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void** value);
285 int system_setting_get_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void** value);
286 int system_setting_get_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void** value);
287 int system_setting_get_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void** value);
288 int system_setting_get_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void** value);
290 int system_setting_set_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void* value);
291 int system_setting_set_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void* value);
292 int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void* value);
293 int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void* value);
294 int system_setting_set_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void* value);
295 int system_setting_set_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void* value);
296 int system_setting_set_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void* value);
297 int system_setting_set_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void* value);
298 int system_setting_set_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void* value);
300 int system_setting_set_changed_callback_incoming_call_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
301 int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings_key_e key);
303 int system_setting_set_changed_callback_email_alert_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
304 int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_key_e key);
306 int system_setting_set_changed_callback_wallpaper_home_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
307 int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_key_e key);
309 int system_setting_set_changed_callback_wallpaper_lock_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
310 int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_key_e key);
312 int system_setting_set_changed_callback_font_size(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
313 int system_setting_unset_changed_callback_font_size(system_settings_key_e key);
315 int system_setting_set_changed_callback_font_type(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
316 int system_setting_unset_changed_callback_font_type(system_settings_key_e key);
318 int system_setting_set_changed_callback_motion_activation(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
319 int system_setting_unset_changed_callback_motion_activation(system_settings_key_e key);
321 int system_setting_set_changed_callback_usb_debugging_option(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
322 int system_setting_unset_changed_callback_usb_debugging_option(system_settings_key_e key);
324 int system_setting_set_changed_callback_3g_data_network(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
325 int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e key);
331 #endif /* __TIZEN_SYSTEM_SETTING_PRIVATE_H__ */