new release for RSA
[platform/core/api/system-settings.git] / include / system_settings.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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. 
15  */
16
17 #ifndef __TIZEN_SYSTEM_SYSTEM_SETTINGS_H__
18 #define __TIZEN_SYSTEM_SYSTEM_SETTINGS_H__
19
20 #include <tizen.h>
21
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif
26
27  /**
28  * @addtogroup CAPI_SYSTEM_SYSTEM_SETTINGS_MODULE
29  * @{
30  */
31
32
33 /**
34  * @brief Enumeration of error code for system settings
35  */
36 typedef enum
37 {
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;
43
44
45 /**
46  * @brief Enumeration of key for system settings
47  */
48 typedef enum
49 {
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;
57
58
59 /**
60  * @brief Enumeration of font size
61  */
62 typedef enum
63 {
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;
70
71
72 /**
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()
79  */
80 typedef void (*system_settings_changed_cb)(system_settings_key_e key, void *user_data);
81
82 /**
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
90  */
91 int system_settings_set_value_int(system_settings_key_e key, int value);
92
93 /**
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
101  */
102 int system_settings_get_value_int(system_settings_key_e key, int *value);
103
104
105 /**
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
113  */
114 int system_settings_set_value_bool(system_settings_key_e key, bool value);
115
116 /**
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
124  */
125 int system_settings_get_value_bool(system_settings_key_e key, bool *value);
126
127
128 /**
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
136  */
137 int system_settings_set_value_double(system_settings_key_e key, double value);
138
139 /**
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
147  */
148 int system_settings_get_value_double(system_settings_key_e key, double *value);
149
150
151 /**
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
159  */
160 int system_settings_set_value_string(system_settings_key_e key, const char *value);
161
162 /**
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
171  */
172 int system_settings_get_value_string(system_settings_key_e key, char **value);
173
174
175 /**
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.
184  *
185  * @see system_settings_unset_changed_cb()
186  * @see system_settings_changed_cb()
187 */
188 int system_settings_set_changed_cb(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
189
190
191 /**
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
197  *
198  * @see system_settings_set_changed_cb()
199  */
200 int system_settings_unset_changed_cb(system_settings_key_e key);
201
202
203 /**
204  * @}
205  */
206
207
208 #ifdef __cplusplus
209 }
210 #endif
211
212 #endif /* __TIZEN_SYSTEM_SYSTEM_SETTINGS_H__ */