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_e;
61 * @brief Enumeration of font size
65 SYSTEM_SETTINGS_FONT_SIZE_SMALL = 0, /**< A small size */
66 SYSTEM_SETTINGS_FONT_SIZE_NORMAL, /**< A normal size */
67 SYSTEM_SETTINGS_FONT_SIZE_LARGE, /**< A large size */
68 SYSTEM_SETTINGS_FONT_SIZE_HUGE, /**< A huge size */
69 SYSTEM_SETTINGS_FONT_SIZE_GIANT, /**< A giant size */
70 } system_settings_font_size_e;
74 * @brief Called when the system settings changes
75 * @param[in] key The key name of the system settings changed
76 * @param[in] user_data The user data passed from the callback registration function
77 * @pre system_settings_set_changed_cb() will invoke this callback function.
78 * @see system_settings_set_changed_cb()
79 * @see system_settings_unset_changed_cb()
81 typedef void (*system_settings_changed_cb)(system_settings_key_e key, void *user_data);
84 * @brief Sets the system settings value associated with the given key as an integer.
85 * @param[in] key The key name of the system settings
86 * @param[out] value The new system settings value of the given key
87 * @return 0 on success, otherwise a negative error value.
88 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
89 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
90 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
92 int system_settings_set_value_int(system_settings_key_e key, int value);
95 * @brief Gets the system settings value associated with the given key as an integer.
96 * @param[in] key The key name of the system settings
97 * @param[out] value The current system settings value of the given key
98 * @return 0 on success, otherwise a negative error value.
99 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
100 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
101 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
103 int system_settings_get_value_int(system_settings_key_e key, int *value);
107 * @brief Sets the system settings value associated with the given key as a boolean.
108 * @param[in] key The key name of the system settings
109 * @param[out] value The new system settings value of the given key
110 * @return 0 on success, otherwise a negative error value.
111 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
112 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
113 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
115 int system_settings_set_value_bool(system_settings_key_e key, bool value);
118 * @brief Gets the system settings value associated with the given key as a boolean.
119 * @param[in] key The key name of the system settings
120 * @param[out] value The current system settings value of the given key
121 * @return 0 on success, otherwise a negative error value.
122 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
123 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
124 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
126 int system_settings_get_value_bool(system_settings_key_e key, bool *value);
130 * @brief Sets the system settings value associated with the given key as a double.
131 * @param[in] key The key name of the system settings
132 * @param[out] value The new system settings value of the given key
133 * @return 0 on success, otherwise a negative error value.
134 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
135 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
136 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
138 int system_settings_set_value_double(system_settings_key_e key, double value);
141 * @brief Gets the system settings value associated with the given key as a double.
142 * @param[in] key The key name of the system settings
143 * @param[out] value The current system settings value of the given key
144 * @return 0 on success, otherwise a negative error value.
145 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
146 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
147 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
149 int system_settings_get_value_double(system_settings_key_e key, double *value);
153 * @brief Sets the system settings value associated with the given key as a string.
154 * @param[in] key The key name of the system settings
155 * @param[out] value The new system settings value of the given key
156 * @return 0 on success, otherwise a negative error value.
157 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
158 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
159 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
161 int system_settings_set_value_string(system_settings_key_e key, const char *value);
164 * @brief Gets the system settings value associated with the given key as a string.
165 * @remarks @a value must be released with @c free() by you.
166 * @param[in] key The key name of the system settings
167 * @param[out] value The current system settings value of the given key
168 * @return 0 on success, otherwise a negative error value.
169 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
170 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
171 * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
173 int system_settings_get_value_string(system_settings_key_e key, char **value);
177 * @brief Registers a change event callback for the given system settings key.
178 * @param[in] key The key name of the system settings
179 * @param[in] callback The callback function to invoke
180 * @param[in] user_data The user data to be passed to the callback function
181 * @return 0 on success, otherwise a negative error value.
182 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
183 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
184 * @post system_settings_changed_cb() will be invoked.
186 * @see system_settings_unset_changed_cb()
187 * @see system_settings_changed_cb()
189 int system_settings_set_changed_cb(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
193 * @brief Unregisters the callback function.
194 * @param[in] key The key name of the system settings
195 * @return 0 on success, otherwise a negative error value.
196 * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful
197 * @retval #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
199 * @see system_settings_set_changed_cb()
201 int system_settings_unset_changed_cb(system_settings_key_e key);
213 #endif /* __TIZEN_SYSTEM_SYSTEM_SETTINGS_H__ */