1 /* * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 * Licensed under the Apache License, Version 2.0 (the License);
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an AS IS BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef __TIZEN_SYSTEM_SYSTEM_SETTINGS_H__
17 #define __TIZEN_SYSTEM_SYSTEM_SETTINGS_H__
27 * @file system_settings.h
31 * @addtogroup CAPI_SYSTEM_SYSTEM_SETTINGS_MODULE
37 * @brief Enumeration for system settings error.
41 SYSTEM_SETTINGS_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
42 SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
43 SYSTEM_SETTINGS_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
44 SYSTEM_SETTINGS_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< Internal I/O error */
45 SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
46 SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported @if MOBILE (Since 2.3.1) @endif */
47 SYSTEM_SETTINGS_ERROR_CALL_UNSUPPORTED_API = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported @if MOBILE (Since 2.3.1) @endif */
49 /* lock screen app error code */
50 SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE = TIZEN_ERROR_SYSTEM_SETTING | 0x01, /**< Current lock screen app set 'password' type */
52 system_settings_error_e;
56 * @brief Enumeration for System Settings Key.
60 SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, /**< (string) The file path of the current ringtone */
61 SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, /**< (string) The file path of the current home screen wallpaper */
62 SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, /**< (string) The file path of the current lock screen wallpaper */
63 SYSTEM_SETTINGS_KEY_FONT_SIZE, /**< (int) The current system font size */
64 SYSTEM_SETTINGS_KEY_FONT_TYPE, /**< (string) The current system font type */
65 SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, /**< (bool) Indicates whether the motion service is activated */
66 SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, /**< (string) The file path of the current email alert ringtone */
67 SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, /**< (bool) Indicates whether the USB debugging is enabled (Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif) */
68 SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, /**< (bool) Indicates whether the 3G data network is enabled (Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif) */
69 SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP = SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED+2, /**< (string) Indicates lockscreen app pkg name */
70 SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE,/**< (string) The current system default font type (only support Get) */
71 SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, /**< (string) Indicates the current country setting in the <LANGUAGE>_<REGION> syntax. The country setting is in the ISO 639-2 format, and the region setting is in the ISO 3166-1 alpha-2 format */
72 SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, /**< (string) Indicates the current language setting in the <LANGUAGE>_<REGION> syntax. The language setting is in the ISO 639-2 format and the region setting is in the ISO 3166-1 alpha-2 format. */
73 SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, /**< (bool) Indicates whether the 24-hour clock is used. If the value is @c false, the 12-hour clock is used. */
74 SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, /**< (string) Indicates the current time zone. */
75 SYSTEM_SETTINGS_KEY_TIME_CHANGED, /**< (int) Once System changes time, this event occurs to notify time change. */
76 SYSTEM_SETTINGS_KEY_SOUND_LOCK, /**< GET (bool) Indicates whether the screen lock sound is enabled on the device. ex) LCD on/off sound */
77 SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, /**< GET (bool) Indicates whether the device is in the silent mode. */
78 SYSTEM_SETTINGS_KEY_SOUND_TOUCH, /**< GET (bool) Indicates whether the screen touch sound is enabled on the device. */
79 SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, /**< GET (bool) Indicates whether rotation control is automatic.*/
80 SYSTEM_SETTINGS_KEY_DEVICE_NAME, /**< GET (string) Indicates device name. */
81 SYSTEM_SETTINGS_KEY_MOTION_ENABLED, /**< GET (bool) Indicates whether the device user has enabled the motion feature. */
82 SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, /**< GET (bool) Indicates whether Wi-Fi-related notifications are enabled on the device. */
83 SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, /**< GET (bool) Indicates whether the device is in the flight mode. */
84 SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, /**< (int) Indicates the backlight time (in seconds). @internal The following values can be used: 15, 30, 60, 120, 300, and 600. */
85 SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION, /**< (string) Indicates the file path of the current notification tone set by the user. */
86 SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION_REPETITION_PERIOD, /**< (int) Indicates the time period for notification repetitions. */
87 SYSTEM_SETTINGS_KEY_LOCK_STATE, /**< (int) Indicates the current lock state */
88 SYSTEM_SETTINGS_KEY_ADS_ID, /**< (string) Indicates Ads ID for each device (Since 3.0) */
89 SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE, /**< (int) Indicates Ultra Data Save status, one of #system_settings_uds_state_e values (Since 4.0) */
90 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 (;) */
91 SYSTEM_SETTINGS_KEY_MAX,
92 } system_settings_key_e;
95 * @brief Enumeration for Idle Lock State
99 SYSTEM_SETTINGS_LOCK_STATE_UNLOCK = 0, /**< Device is unlocked */
100 SYSTEM_SETTINGS_LOCK_STATE_LOCK, /**< Device is locked */
101 SYSTEM_SETTINGS_LOCK_STATE_LAUNCHING_LOCK /**< Device is being locked */
102 } system_settings_idle_lock_state_e;
106 * @brief Enumeration for font size.
110 SYSTEM_SETTINGS_FONT_SIZE_SMALL = 0, /**< A small size */
111 SYSTEM_SETTINGS_FONT_SIZE_NORMAL, /**< A normal size */
112 SYSTEM_SETTINGS_FONT_SIZE_LARGE, /**< A large size */
113 SYSTEM_SETTINGS_FONT_SIZE_HUGE, /**< A huge size */
114 SYSTEM_SETTINGS_FONT_SIZE_GIANT, /**< A giant size */
115 } system_settings_font_size_e;
118 * @brief Enumeration for Ultra Data Save
122 SYSTEM_SETTINGS_UDS_OFF = 0, /**< OFF */
123 SYSTEM_SETTINGS_UDS_ON, /**< ON */
124 SYSTEM_SETTINGS_UDS_ON_WHITELISTED, /**< UDS on and the app is whitelisted */
125 } system_settings_uds_state_e;
130 * @brief Called when the system settings changes.
132 * @param[in] key The key name of the system settings changed system settings
133 * @param[in] user_data The user data passed from the callback registration function
134 * @pre system_settings_set_changed_cb() will invoke this callback function.
135 * @see system_settings_set_changed_cb()
136 * @see system_settings_unset_changed_cb()
138 typedef void (*system_settings_changed_cb)(system_settings_key_e key, void *user_data);
142 * @brief Sets the system settings value associated with the given key as an integer.
144 * @privlevel platform
145 * @privilege %http://tizen.org/privilege/systemsettings.admin
146 * @param[in] key The key name of the system settings changed
147 * @param[in] key The key name of the system settings
148 * @param[out] value The new system settings value of the given key
149 * @return @c 0 on success, otherwise a negative error value
150 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
151 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
152 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
153 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
154 * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
156 int system_settings_set_value_int(system_settings_key_e key, int value);
159 * @brief Gets the system settings value associated with the given key as an integer.
161 * @param[in] key The key name of the system settings
162 * @param[out] value The current system settings value of the given key
163 * @return @c 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
168 * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
169 * @warning %http://tizen.org/privilege/systemsettings (public level privilege) <b>MUST NOT</b> be declared to use this API since 2.3.1.
171 int system_settings_get_value_int(system_settings_key_e key, int *value);
176 * @brief Sets the system settings value associated with the given key as a boolean.
178 * @privlevel platform
179 * @privilege %http://tizen.org/privilege/systemsettings.admin
180 * @param[in] key The key name of the system settings
181 * @param[out] value The new system settings value of the given key
182 * @return @c 0 on success, otherwise a negative error value
183 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
184 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
185 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
186 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
187 * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
189 int system_settings_set_value_bool(system_settings_key_e key, bool value);
192 * @brief Gets the system settings value associated with the given key as a boolean.
194 * @param[in] key The key name of the system settings
195 * @param[out] value The current system settings value of the given key
196 * @return @c 0 on success, otherwise a negative error value
197 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
198 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
199 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
200 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
201 * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
202 * @warning %http://tizen.org/privilege/systemsettings (public level privilege) <b>MUST NOT</b> be declared to use this API since 2.3.1.
204 int system_settings_get_value_bool(system_settings_key_e key, bool *value);
208 * @brief Sets the system settings value associated with the given key as a string.
210 * @privlevel platform
211 * @privilege %http://tizen.org/privilege/systemsettings.admin
212 * @remarks #SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE is not available for setting.
213 * @param[in] key The key name of the system settings
214 * @param[out] value The new system settings value of the given key
215 * @return @c 0 on success, otherwise a negative error value
216 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
217 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
218 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
219 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
220 * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
222 int system_settings_set_value_string(system_settings_key_e key, const char *value);
225 * @brief Gets the system settings value associated with the given key as a string.
227 * @remarks You must release @a value using free().
228 * @param[in] key The key name of the system settings
229 * @param[out] value The current system settings value of the given key
230 * @return 0 on success, otherwise a negative error value
231 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
232 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
233 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
234 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
235 * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
236 * @warning %http://tizen.org/privilege/systemsettings (public level privilege) <b>MUST NOT</b> be declared to use this API since 2.3.1.
238 int system_settings_get_value_string(system_settings_key_e key, char **value);
241 * @brief Registers a change event callback for the given system settings key.
243 * @remarks #SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE is not available for set_changed_cb.
244 * @param[in] key The key name of the system settings
245 * @param[in] callback The callback function to invoke
246 * @param[in] user_data The user data to be passed to the callback function
247 * @return 0 on success, otherwise a negative error value
248 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
249 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
250 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
251 * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
252 * @post system_settings_changed_cb() will be invoked.
254 * @see system_settings_unset_changed_cb()
255 * @see system_settings_changed_cb()
256 * @warning %http://tizen.org/privilege/systemsettings (public level privilege) <b>MUST NOT</b> be declared to use this API since 2.3.1.
259 int system_settings_set_changed_cb(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
262 * @brief Unregisters the callback function.
264 * @remarks #SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE is not available for set_changed_cb.
265 * @param[in] key The key name of the system settings
266 * @return 0 on success, otherwise a negative error value
267 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
268 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
269 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
270 * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
272 * @see system_settings_set_changed_cb()
273 * @warning %http://tizen.org/privilege/systemsettings (public level privilege) <b>MUST NOT</b> be declared to use this API since 2.3.1.
275 int system_settings_unset_changed_cb(system_settings_key_e key);
280 * @brief Called to get each string value from string typed list.
282 * @param[in] index zero based number indicating index of node in a list
283 * @param[in] value value returned from the list
284 * @param[in] cb_data The user data passed from the foreach function
285 * @return @c true to continue with the next iteration of the loop, otherwise false to break out of the loop
287 typedef bool (*system_settings_iter_cb)(int index, const char* value, void *cb_data);
291 * @brief Iterate the system settings value associated with the given key as a string type.
293 * @privlevel platform
294 * @privilege %http://tizen.org/privilege/systemsettings.admin
295 * @param[in] key The key name of the system settings
296 * @param[in] callback The callback-function name for iteration
297 * @param[in] user_data The user data passed from caller-side
298 * @return @c 0 on success, otherwise a negative error value
299 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
300 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
301 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
302 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
303 * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
305 int system_settings_foreach_value_string(system_settings_key_e key, system_settings_iter_cb callback, void *user_value);
309 * @brief Adds the system settings value associated with the given key as a string type if it supports List iteration.
311 * @privlevel platform
312 * @privilege %http://tizen.org/privilege/systemsettings.admin
313 * @param[in] key The key name of the system settings
314 * @param[in] value string typed value to be appended
315 * @return @c 0 on success, otherwise a negative error value
316 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
317 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
318 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
319 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
320 * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
322 int system_settings_add_value_string(system_settings_key_e key, const char *value);
326 * @brief Delete the system settings value associated with the given key as an string type if it supports List iteration.
328 * @privlevel platform
329 * @privilege %http://tizen.org/privilege/systemsettings.admin
330 * @param[in] key The key name of the system settings
331 * @param[in] value string typed value to be removed
332 * @return @c 0 on success, otherwise a negative error value
333 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
334 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
335 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
336 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
337 * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
339 int system_settings_delete_value_string(system_settings_key_e key, const char *value);
350 #endif /* __TIZEN_SYSTEM_SYSTEM_SETTINGS_H__ */