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.
17 #ifndef __TIZEN_SYSTEM_SYSTEM_SETTINGS_H__
18 #define __TIZEN_SYSTEM_SYSTEM_SETTINGS_H__
28 * @file system_settings.h
32 * @addtogroup CAPI_SYSTEM_SYSTEM_SETTINGS_MODULE
38 * @brief Enumeration for system settings error.
43 SYSTEM_SETTINGS_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
44 SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
45 SYSTEM_SETTINGS_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
46 SYSTEM_SETTINGS_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< Internal I/O error */
47 SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permition denied */
48 SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported @if MOBILE (Since 2.3.1) @endif */
49 SYSTEM_SETTINGS_ERROR_CALL_UNSUPPORTED_API = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported @if MOBILE (Since 2.3.1) @endif */
51 /* lock screen app error code */
52 SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE = TIZEN_ERROR_SYSTEM_SETTING | 0x01, /**< Current lock screen app set 'password' type */
54 system_settings_error_e;
58 * @brief Enumeration for System Settings Key.
62 SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, /**< (string) The file path of the current ringtone */
63 SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, /**< (string) The file path of the current home screen wallpaper */
64 SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, /**< (string) The file path of the current lock screen wallpaper */
65 SYSTEM_SETTINGS_KEY_FONT_SIZE, /**< (int) The current system font size */
66 SYSTEM_SETTINGS_KEY_FONT_TYPE, /**< (string) The current system font type */
68 SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, /**< (bool) Indicates whether the motion service is activated */
69 SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, /**< (string) The file path of the current email alert ringtone */
70 SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, /**< (bool) Indicates whether the USB debugging is enabled (Since 2.4) */
71 SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, /**< bool) Indicates whether the 3G data network is enabled (Since 2.4) */
72 SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP = SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED+2, /**< (string) Indicates lockscreen app pkg name */
74 SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE,/**< (string) The current system default font type (only support Get) */
75 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 */
76 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. */
77 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. */
78 SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, /**< (string) Indicates the current time zone. */
80 SYSTEM_SETTINGS_KEY_TIME_CHANGED, /**< (int) Once System changes time, this event occurs to notify time change. */
81 SYSTEM_SETTINGS_KEY_SOUND_LOCK, /**< GET (bool) Indicates whether the screen lock sound is enabled on the device. ex) LCD on/off sound */
82 SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, /**< GET (bool) Indicates whether the device is in the silent mode. */
83 SYSTEM_SETTINGS_KEY_SOUND_TOUCH, /**< GET (bool) Indicates whether the screen touch sound is enabled on the device. */
84 SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, /**< GET (bool) Indicates whether rotation control is automatic.*/
86 SYSTEM_SETTINGS_KEY_DEVICE_NAME, /**< GET (string) Indicates device name. */
87 SYSTEM_SETTINGS_KEY_MOTION_ENABLED, /**< GET (bool) Indicates whether the device user has enabled the motion feature. */
88 SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, /**< GET (bool) Indicates whether Wi-Fi-related notifications are enabled on the device. */
89 SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, /**< GET (bool) Indicates whether the device is in the flight mode. */
90 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. */
92 SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION, /**< (string) Indicates the file path of the current notification tone set by the user. */
93 SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION_REPETITION_PERIOD, /**< (int) Indicates the time period for notification repetitions. */
94 SYSTEM_SETTINGS_KEY_MAX,
96 } system_settings_key_e;
100 * @brief Enumeration for font size.
104 SYSTEM_SETTINGS_FONT_SIZE_SMALL = 0, /**< A small size */
105 SYSTEM_SETTINGS_FONT_SIZE_NORMAL, /**< A normal size */
106 SYSTEM_SETTINGS_FONT_SIZE_LARGE, /**< A large size */
107 SYSTEM_SETTINGS_FONT_SIZE_HUGE, /**< A huge size */
108 SYSTEM_SETTINGS_FONT_SIZE_GIANT, /**< A giant size */
109 } system_settings_font_size_e;
113 * @brief Called when the system settings changes.
115 * @param[in] key The key name of the system settings changed system settings
116 * @param[in] user_data The user data passed from the callback registration function
117 * @pre system_settings_set_changed_cb() will invoke this callback function.
118 * @see system_settings_set_changed_cb()
119 * @see system_settings_unset_changed_cb()
121 typedef void (*system_settings_changed_cb)(system_settings_key_e key, void *user_data);
125 * @brief Sets the system settings value associated with the given key as an integer.
127 * @privlevel platform
128 * @privilege %http://tizen.org/privilege/systemsettings.admin
129 * @param[in] key The key name of the system settings changed
130 * @param[in] key The key name of the system settings
131 * @param[out] value The new system settings value of the given key
132 * @return @c 0 on success, otherwise a negative error value
133 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
134 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
135 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
136 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
138 int system_settings_set_value_int(system_settings_key_e key, int value);
141 * @brief Gets the system settings value associated with the given key as an integer.
144 * @param[in] key The key name of the system settings
145 * @param[out] value The current system settings value of the given key
146 * @return @c 0 on success, otherwise a negative error value
147 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
148 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
149 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
150 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
152 int system_settings_get_value_int(system_settings_key_e key, int *value);
157 * @brief Sets the system settings value associated with the given key as a boolean.
159 * @privlevel platform
160 * @privilege %http://tizen.org/privilege/systemsettings.admin
161 * @param[in] key The key name of the system settings
162 * @param[out] value The new 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
169 int system_settings_set_value_bool(system_settings_key_e key, bool value);
172 * @brief Gets the system settings value associated with the given key as a boolean.
175 * @param[in] key The key name of the system settings
176 * @param[out] value The current system settings value of the given key
177 * @return @c 0 on success, otherwise a negative error value
178 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
179 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
180 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
181 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
183 int system_settings_get_value_bool(system_settings_key_e key, bool *value);
187 * @brief Sets the system settings value associated with the given key as a string.
189 * @privlevel platform
190 * @privilege %http://tizen.org/privilege/systemsettings.admin
191 * @remarks #SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE is not available for setting.
192 * @param[in] key The key name of the system settings
193 * @param[out] value The new system settings value of the given key
194 * @return @c 0 on success, otherwise a negative error value
195 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
196 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
197 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
198 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
200 int system_settings_set_value_string(system_settings_key_e key, const char *value);
203 * @brief Gets the system settings value associated with the given key as a string.
206 * @remarks You must release @a value using free().
207 * @param[in] key The key name of the system settings
208 * @param[out] value The current system settings value of the given key
209 * @return 0 on success, otherwise a negative error value
210 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
211 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
212 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
213 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
215 int system_settings_get_value_string(system_settings_key_e key, char **value);
218 * @brief Registers a change event callback for the given system settings key.
221 * @remarks #SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE is not available for set_changed_cb.
222 * @param[in] key The key name of the system settings
223 * @param[in] callback The callback function to invoke
224 * @param[in] user_data The user data to be passed to the callback function
225 * @return 0 on success, otherwise a negative error value
226 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
227 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
228 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
229 * @post system_settings_changed_cb() will be invoked.
231 * @see system_settings_unset_changed_cb()
232 * @see system_settings_changed_cb()
235 int system_settings_set_changed_cb(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
238 * @brief Unregisters the callback function.
241 * @remarks #SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE is not available for set_changed_cb.
242 * @param[in] key The key name of the system settings
243 * @return 0 on success, otherwise a negative error value
244 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
245 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
246 * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
248 * @see system_settings_set_changed_cb()
250 int system_settings_unset_changed_cb(system_settings_key_e key);
262 #endif /* __TIZEN_SYSTEM_SYSTEM_SETTINGS_H__ */