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 * @addtogroup CAPI_SYSTEM_SYSTEM_SETTINGS_MODULE
34 * @brief Enumeration of error code for system settings
38 SYSTEM_SETTINGS_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
39 SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
40 SYSTEM_SETTINGS_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
41 SYSTEM_SETTINGS_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< Internal I/O error */
42 } system_settings_error_e;
46 * @brief Enumeration of key for system settings
50 SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, /**< The file path of the current ringtone */
51 SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, /**< The file path of the current home screen wallpaper */
52 SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, /**< The file path of the current lock screen wallpaper */
53 SYSTEM_SETTINGS_KEY_FONT_SIZE, /**< The current system font size */
54 SYSTEM_SETTINGS_KEY_FONT_TYPE, /**< The current system font type */
55 SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, /**< Indicates whether the motion service is activated */
56 SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, /**< The file path of the current email alert ringtone */
57 SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, /**< Indicates whether the usb debugging is enabled */
58 SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, /**< Indicates whether the 3G data network is enabled */
59 } system_settings_key_e;
63 * @brief Enumeration of font size
67 SYSTEM_SETTINGS_FONT_SIZE_SMALL = 0, /**< A small size */
68 SYSTEM_SETTINGS_FONT_SIZE_NORMAL, /**< A normal size */
69 SYSTEM_SETTINGS_FONT_SIZE_LARGE, /**< A large size */
70 SYSTEM_SETTINGS_FONT_SIZE_HUGE, /**< A huge size */
71 SYSTEM_SETTINGS_FONT_SIZE_GIANT, /**< A giant size */
72 } system_settings_font_size_e;
76 * @brief Called when the system settings changes
77 * @param[in] key The key name of the system settings changed
78 * @param[in] user_data The user data passed from the callback registration function
79 * @pre system_settings_set_changed_cb() will invoke this callback function.
80 * @see system_settings_set_changed_cb()
81 * @see system_settings_unset_changed_cb()
83 typedef void (*system_settings_changed_cb)(system_settings_key_e key, void *user_data);
86 * @brief Sets the system settings value associated with the given key as an integer.
87 * @param[in] key The key name of the system settings
88 * @param[out] value The new system settings value of the given key
89 * @return 0 on success, otherwise a negative error value.
90 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
91 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
92 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
94 int system_settings_set_value_int(system_settings_key_e key, int value);
97 * @brief Gets the system settings value associated with the given key as an integer.
98 * @param[in] key The key name of the system settings
99 * @param[out] value The current system settings value of the given key
100 * @return 0 on success, otherwise a negative error value.
101 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
102 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
103 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
105 int system_settings_get_value_int(system_settings_key_e key, int *value);
109 * @brief Sets the system settings value associated with the given key as a boolean.
110 * @param[in] key The key name of the system settings
111 * @param[out] value The new system settings value of the given key
112 * @return 0 on success, otherwise a negative error value.
113 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
114 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
115 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
117 int system_settings_set_value_bool(system_settings_key_e key, bool value);
120 * @brief Gets the system settings value associated with the given key as a boolean.
121 * @param[in] key The key name of the system settings
122 * @param[out] value The current system settings value of the given key
123 * @return 0 on success, otherwise a negative error value.
124 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
125 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
126 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
128 int system_settings_get_value_bool(system_settings_key_e key, bool *value);
132 * @brief Sets the system settings value associated with the given key as a double.
133 * @param[in] key The key name of the system settings
134 * @param[out] value The new system settings value of the given key
135 * @return 0 on success, otherwise a negative error value.
136 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
137 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
138 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
140 int system_settings_set_value_double(system_settings_key_e key, double value);
143 * @brief Gets the system settings value associated with the given key as a double.
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 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
151 int system_settings_get_value_double(system_settings_key_e key, double *value);
155 * @brief Sets the system settings value associated with the given key as a string.
156 * @param[in] key The key name of the system settings
157 * @param[out] value The new system settings value of the given key
158 * @return 0 on success, otherwise a negative error value.
159 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
160 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
161 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
163 int system_settings_set_value_string(system_settings_key_e key, const char *value);
166 * @brief Gets the system settings value associated with the given key as a string.
167 * @remarks @a value must be released with @c free() by you.
168 * @param[in] key The key name of the system settings
169 * @param[out] value The current system settings value of the given key
170 * @return 0 on success, otherwise a negative error value.
171 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
172 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
173 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
175 int system_settings_get_value_string(system_settings_key_e key, char **value);
179 * @brief Registers a change event callback for the given system settings key.
180 * @param[in] key The key name of the system settings
181 * @param[in] callback The callback function to invoke
182 * @param[in] user_data The user data to be passed to the callback function
183 * @return 0 on success, otherwise a negative error value.
184 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
185 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
186 * @post system_settings_changed_cb() will be invoked.
188 * @see system_settings_unset_changed_cb()
189 * @see system_settings_changed_cb()
191 int system_settings_set_changed_cb(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
195 * @brief Unregisters the callback function.
196 * @param[in] key The key name of the system settings
197 * @return 0 on success, otherwise a negative error value.
198 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
199 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
201 * @see system_settings_set_changed_cb()
203 int system_settings_unset_changed_cb(system_settings_key_e key);
215 #endif /* __TIZEN_SYSTEM_SYSTEM_SETTINGS_H__ */