add system ringtone alert set
[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_EMAIL_ALERT_RINGTONE,  /**< The file path of the current email alert ringtone */
57 } system_settings_key_e;
58
59
60 /**
61  * @brief Enumeration of font size
62  */
63 typedef enum
64 {
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;
71
72
73 /**
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()
80  */
81 typedef void (*system_settings_changed_cb)(system_settings_key_e key, void *user_data);
82
83 /**
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
91  */
92 int system_settings_set_value_int(system_settings_key_e key, int value);
93
94 /**
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
102  */
103 int system_settings_get_value_int(system_settings_key_e key, int *value);
104
105
106 /**
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
114  */
115 int system_settings_set_value_bool(system_settings_key_e key, bool value);
116
117 /**
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
125  */
126 int system_settings_get_value_bool(system_settings_key_e key, bool *value);
127
128
129 /**
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
137  */
138 int system_settings_set_value_double(system_settings_key_e key, double value);
139
140 /**
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
148  */
149 int system_settings_get_value_double(system_settings_key_e key, double *value);
150
151
152 /**
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
160  */
161 int system_settings_set_value_string(system_settings_key_e key, const char *value);
162
163 /**
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
172  */
173 int system_settings_get_value_string(system_settings_key_e key, char **value);
174
175
176 /**
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.
185  *
186  * @see system_settings_unset_changed_cb()
187  * @see system_settings_changed_cb()
188 */
189 int system_settings_set_changed_cb(system_settings_key_e key, system_settings_changed_cb callback, void *user_data);
190
191
192 /**
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
198  *
199  * @see system_settings_set_changed_cb()
200  */
201 int system_settings_unset_changed_cb(system_settings_key_e key);
202
203
204 /**
205  * @}
206  */
207
208
209 #ifdef __cplusplus
210 }
211 #endif
212
213 #endif /* __TIZEN_SYSTEM_SYSTEM_SETTINGS_H__ */