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_e;
60 * @brief Enumeration of font size
64 SYSTEM_SETTINGS_FONT_SIZE_SMALL = 0, /**< A small size */
65 SYSTEM_SETTINGS_FONT_SIZE_NORMAL, /**< A normal size */
66 SYSTEM_SETTINGS_FONT_SIZE_LARGE, /**< A large size */
67 SYSTEM_SETTINGS_FONT_SIZE_HUGE, /**< A huge size */
68 SYSTEM_SETTINGS_FONT_SIZE_GIANT, /**< A giant size */
69 } system_settings_font_size_e;
73 * @brief Called when the system settings changes
74 * @param[in] key The key name of the system settings changed
75 * @param[in] user_data The user data passed from the callback registration function
76 * @pre system_settings_set_changed_cb() will invoke this callback function.
77 * @see system_settings_set_changed_cb()
78 * @see system_settings_unset_changed_cb()
80 typedef void (*system_settings_changed_cb)(system_settings_key_e key, void *user_data);
83 * @brief Sets the system settings value associated with the given key as an integer.
84 * @param[in] key The key name of the system settings
85 * @param[out] value The new system settings value of the given key
86 * @return 0 on success, otherwise a negative error value.
87 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
88 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
89 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
91 int system_settings_set_value_int(system_settings_key_e key, int value);
94 * @brief Gets the system settings value associated with the given key as an integer.
95 * @param[in] key The key name of the system settings
96 * @param[out] value The current system settings value of the given key
97 * @return 0 on success, otherwise a negative error value.
98 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
99 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
100 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
102 int system_settings_get_value_int(system_settings_key_e key, int *value);
106 * @brief Sets the system settings value associated with the given key as a boolean.
107 * @param[in] key The key name of the system settings
108 * @param[out] value The new system settings value of the given key
109 * @return 0 on success, otherwise a negative error value.
110 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
111 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
112 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
114 int system_settings_set_value_bool(system_settings_key_e key, bool value);
117 * @brief Gets the system settings value associated with the given key as a boolean.
118 * @param[in] key The key name of the system settings
119 * @param[out] value The current system settings value of the given key
120 * @return 0 on success, otherwise a negative error value.
121 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
122 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
123 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
125 int system_settings_get_value_bool(system_settings_key_e key, bool *value);
129 * @brief Sets the system settings value associated with the given key as a double.
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 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
137 int system_settings_set_value_double(system_settings_key_e key, double value);
140 * @brief Gets the system settings value associated with the given key as a double.
141 * @param[in] key The key name of the system settings
142 * @param[out] value The current system settings value of the given key
143 * @return 0 on success, otherwise a negative error value.
144 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
145 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
146 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
148 int system_settings_get_value_double(system_settings_key_e key, double *value);
152 * @brief Sets the system settings value associated with the given key as a string.
153 * @param[in] key The key name of the system settings
154 * @param[out] value The new system settings value of the given key
155 * @return 0 on success, otherwise a negative error value.
156 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
157 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
158 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
160 int system_settings_set_value_string(system_settings_key_e key, const char *value);
163 * @brief Gets the system settings value associated with the given key as a string.
164 * @remarks @a value must be released with @c free() by you.
165 * @param[in] key The key name of the system settings
166 * @param[out] value The current system settings value of the given key
167 * @return 0 on success, otherwise a negative error value.
168 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
169 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
170 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
172 int system_settings_get_value_string(system_settings_key_e key, char **value);
176 * @brief Registers a change event callback for the given system settings key.
177 * @param[in] key The key name of the system settings
178 * @param[in] callback The callback function to invoke
179 * @param[in] user_data The user data to be passed to the callback function
180 * @return 0 on success, otherwise a negative error value.
181 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
182 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
183 * @post system_settings_changed_cb() will be invoked.
185 * @see system_settings_unset_changed_cb()
186 * @see system_settings_changed_cb()
188 int system_settings_set_changed_cb(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
192 * @brief Unregisters the callback function.
193 * @param[in] key The key name of the system settings
194 * @return 0 on success, otherwise a negative error value.
195 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
196 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
198 * @see system_settings_set_changed_cb()
200 int system_settings_unset_changed_cb(system_settings_key_e key);
212 #endif /* __TIZEN_SYSTEM_SYSTEM_SETTINGS_H__ */