2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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.
18 * @file FSysSettingInfo.h
19 * @brief This is the header file for the %SettingInfo class.
21 * This header file contains the declarations of the %SettingInfo class.
24 #ifndef _FSYS_SETTING_INFO_H_
25 #define _FSYS_SETTING_INFO_H_
27 #include <FBaseString.h>
28 #include <FBaseUuId.h>
29 #include <FBaseColIList.h>
30 #include <FSysISettingEventListener.h>
31 #include <FSysISettingInfoSetValueAsyncResultListener.h>
33 namespace Tizen { namespace System
38 * @brief This class provides methods for managing setting information.
42 * @final This class is not intended for extension.
44 * The %SettingInfo class provides methods to managing the variety user setting elements. Please refer <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">SettingInfo key</a>.
46 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">Settings Information</a>.
48 * The following example demonstrates how to use the %SettingInfo class.
53 * #include <FSystem.h>
55 * using namespace Tizen::Base;
56 * using namespace Tizen::System;
59 * MyClass::GetSettingInfomation(void)
61 * result r = E_SUCCESS;
63 * String key(L"http://tizen.org/setting/location.gps");
64 * bool gpsEnabled = false;
66 * r = SettingInfo::GetValue(key, gpsEnabled);
67 * TryCatch(r == E_SUCCESS, , "MySettingInfo: To get a value is failed");
77 class _OSP_EXPORT_ SettingInfo
78 : public Tizen::Base::Object
83 * Gets the specific Tizen::Base::String type setting information based on the specified
88 * @return An error code
89 * @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information @n
91 * The following key values are updated: @n
92 * - Since Tizen, refer <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">here</a>.
93 * - @b Deprecated All the key values provided prior to %Tizen 2.0 are deprecated. For more detailed information, refer
94 * <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info_deprecated.htm">here</a>.
96 * @param[out] value The setting information of type Tizen::Base::String
97 * @exception E_SUCCESS The method is successful.
98 * @exception E_OBJ_NOT_FOUND The specified @c key is not found.
99 * @exception E_UNSUPPORTED_OPERATION The specified @c key exists. However, it is not supported by this device.
100 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
102 static result GetValue(const Tizen::Base::String& key, Tizen::Base::String& value);
105 * Gets the specific integer type setting information based on the specified
106 * designators (keys).
110 * @return An error code
111 * @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information @n
113 * The following key values are updated: @n
114 * - Since Tizen, refer <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">here</a>.
115 * - @b Deprecated All the key values provided prior to %Tizen 2.0 are deprecated. For more detailed information, refer
116 * <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info_deprecated.htm">here</a>.
118 * @param[out] value The setting information of type integer
119 * @exception E_SUCCESS The method is successful.
120 * @exception E_OBJ_NOT_FOUND The specified @c key is not found.
121 * @exception E_UNSUPPORTED_OPERATION The specified @c key exists. However, it is not supported by this device.
122 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
124 static result GetValue(const Tizen::Base::String& key, int& value);
127 * Gets the specific @c long @c long type setting information based on the specified
132 * @return An error code
133 * @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
134 * @param[out] value The setting information of type @c long @c long
135 * @exception E_SUCCESS The method is successful.
136 * @exception E_OBJ_NOT_FOUND The specified @c key is not found.
137 * @exception E_UNSUPPORTED_OPERATION The specified @c key exists. However, it is not supported by this device.
138 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
140 static result GetValue(const Tizen::Base::String& key, long long& value);
143 * Gets the specific double type setting information based on the specified
148 * @return An error code
149 * @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
150 * @param[out] value The setting information of type double
151 * @exception E_SUCCESS The method is successful.
152 * @exception E_OBJ_NOT_FOUND The specified @c key is not found.
153 * @exception E_UNSUPPORTED_OPERATION The specified @c key exists. However, it is not supported by this device.
154 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
156 static result GetValue(const Tizen::Base::String& key, double& value);
159 * Gets the specific @c bool type setting information based on the specified
164 * @return An error code
165 * @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information @n
167 * The following key values are updated: @n
168 * - Since Tizen, refer <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">here</a>.
169 * - @b Deprecated All the key values provided prior to %Tizen 2.0 are deprecated. For more detailed information, refer
170 * <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info_deprecated.htm">here</a>.
172 * @param[out] value The setting information of type bool
173 * @exception E_SUCCESS The method is successful.
174 * @exception E_OBJ_NOT_FOUND The specified @c key is not found.
175 * @exception E_UNSUPPORTED_OPERATION The specified @c key exists. However, it is not supported by this device.
176 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
178 static result GetValue(const Tizen::Base::String& key, bool& value);
181 * Gets the specific UuId type setting information based on the specified
186 * @return An error code
187 * @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
188 * @param[out] value The setting information of type UuId
189 * @exception E_SUCCESS The method is successful.
190 * @exception E_OBJ_NOT_FOUND The specified @c key is not found.
191 * @exception E_UNSUPPORTED_OPERATION The specified @c key exists. However, it is not supported by this device.
192 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
194 static result GetValue(const Tizen::Base::String& key, Tizen::Base::UuId& value);
197 * Checks whether specific designator(key) is supported or not.
201 * @return @c true if the key is supported, @n
203 * @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
206 static bool HasKey(const Tizen::Base::String& key);
209 * Sets the specific @c bool type setting information based on the specified designators (key).
214 * @privilege %http://tizen.org/privilege/setting
216 * @return An error code
217 * @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
218 * @param[in] value The setting information of type bool
219 * @exception E_SUCCESS The method is successful.
220 * @exception E_PRIVILEGED_DENIED The application does not have the privilege to call this method.
221 * @exception E_INVALID_ARG The specified @c value is invalid value.
222 * @exception E_OBJ_NOT_FOUND The specified @c key is not found.
223 * @exception E_UNSUPPORTED_OPERATION The specified @c key exists. However, it is not supported by this device.
224 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
226 static result SetValue(const Tizen::Base::String& key, bool value);
229 * Sets the specific @c int type setting information based on the specified designators (key).
234 * @privilege %http://tizen.org/privilege/setting
236 * @return An error code
237 * @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
238 * @param[in] value The setting information of type int
239 * @exception E_SUCCESS The method is successful.
240 * @exception E_PRIVILEGED_DENIED The application does not have the privilege to call this method.
241 * @exception E_INVALID_ARG The specified @c value is invalid value.
242 * @exception E_OBJ_NOT_FOUND The specified @c key is not found.
243 * @exception E_UNSUPPORTED_OPERATION The specified @c key exists. However, it is not supported by this device.
244 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
246 static result SetValue(const Tizen::Base::String& key, int value);
249 * Sets the specific Tizen::Base::String type setting information based on the specified designators (key).
254 * @privilege %http://tizen.org/privilege/setting
256 * @return An error code
257 * @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
258 * @param[in] value The setting information of type Tizen::Base::String
259 * @exception E_SUCCESS The method is successful.
260 * @exception E_PRIVILEGED_DENIED The application does not have the privilege to call this method.
261 * @exception E_INVALID_ARG The specified @c value is invalid value.
262 * @exception E_OBJ_NOT_FOUND The specified @c key is not found.
263 * @exception E_UNSUPPORTED_OPERATION The specified @c key exists. However, it is not supported by this device.
264 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
266 static result SetValue(const Tizen::Base::String& key, Tizen::Base::String value);
269 * Sets the system wallpaper.
274 * @privilege %http://tizen.org/privilege/setting
276 * @return An error code
277 * @param[in] filePath The file path of the wallpaper
278 * @exception E_SUCCESS The method is successful.
279 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
280 * @exception E_FILE_NOT_FOUND The entry for the specified wallpaper file or the file path cannot be found.
281 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
284 static result SetWallpaper(const Tizen::Base::String& filePath);
287 * Sets the system ringtone.
292 * @privilege %http://tizen.org/privilege/setting
294 * @return An error code
295 * @param[in] filePath The file path of the ringtone
296 * @exception E_SUCCESS The method is successful.
297 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
298 * @exception E_FILE_NOT_FOUND The entry for the specified wallpaper file or the file path cannot be found.
299 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
301 static result SetRingtone(const Tizen::Base::String& filePath);
304 * Sets the sound volume level.
309 * @privilege %http://tizen.org/privilege/setting
311 * @return An error code
312 * @param[in] soundCategory The sound volume category
313 * @param[in] level The sound volume level of the designated category
314 * @exception E_SUCCESS The method is successful.
315 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
316 * @exception E_INVALID_ARG The specified @c soundCategory is invalid.
317 * @exception E_OUT_OF_RANGE The specified @c level is outside the bounds of @c soundCategory.
318 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
320 static result SetVolume(const Tizen::Base::String& soundCategory, int level);
323 * Adds the setting event listener. @n
324 * This listener is called when a setting value is changed.
328 * @return An error code
329 * @param[in] listener The setting event listener
330 * @exception E_SUCCESS The method is successful.
331 * @exception E_OBJ_ALREADY_EXIST The listener is already added.
332 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
333 * @see RemoveSettingEventListener()
335 static result AddSettingEventListener(ISettingEventListener& listener);
338 * Removes the setting event listener.
342 * @return An error code
343 * @param[in] listener The setting event listener
344 * @exception E_SUCCESS The method is successful.
345 * @exception E_OBJ_NOT_FOUND The listener is not added.
346 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
347 * @see AddSettingEventListener()
349 static result RemoveSettingEventListener(ISettingEventListener& listener);
352 * Gets the specific @c bool type setting information based on the specified designators (key).
356 * @privlevel platform
357 * @privilege %http://tizen.org/privilege/settingmanager.read @n
358 * (%http://tizen.org/privilege/systemsetting.read is deprecated.)
360 * @return An error code
361 * @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
362 * @param[out] value The setting information of type bool
363 * @exception E_SUCCESS The method is successful.
364 * @exception E_PRIVILEGED_DENIED The application does not have the privilege to call this method.
365 * @exception E_OBJ_NOT_FOUND The specified @c key is not found.
366 * @exception E_UNSUPPORTED_OPERATION The specified @c key exists. However, it is not supported by this device.
367 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
369 static result GetValueForPrivilegedKey(const Tizen::Base::String& key, bool& value);
372 * Sets the specific @c bool type setting information based on the specified designators (key).
376 * @privlevel platform
377 * @privilege %http://tizen.org/privilege/settingmanager.write @n
378 * (%http://tizen.org/privilege/systemsetting.write is deprecated.)
380 * @return An error code
381 * @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
382 * @param[in] value The setting information of type bool
383 * @exception E_SUCCESS The method is successful.
384 * @exception E_PRIVILEGED_DENIED The application does not have the privilege to call this method.
385 * @exception E_INVALID_ARG The specified @c value is invalid value.
386 * @exception E_OBJ_NOT_FOUND The specified @c key is not found.
387 * @exception E_UNSUPPORTED_OPERATION The specified @c key exists. However, it is not supported by this device.
388 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
390 static result SetValueForPrivilegedKey(const Tizen::Base::String& key, bool value);
393 * Sets the specific @c bool type setting information based on the specified designators (key) asynchronously.
396 * @privlevel platform
397 * @privilege %http://tizen.org/privilege/settingmanager.write @n
398 * (%http://tizen.org/privilege/systemsetting.write is deprecated.)
400 * @return An error code
401 * @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
402 * @param[in] value The setting information of type bool
403 * @param[in] listener The result listener.
404 * @exception E_SUCCESS The method is successful.
405 * @exception E_PRIVILEGED_DENIED The application does not have the privilege to call this method.
406 * @exception E_INVALID_ARG The specified @c value is invalid value.
407 * @exception E_OBJ_NOT_FOUND The specified @c key is not found.
408 * @exception E_UNSUPPORTED_OPERATION The specified @c key is existed, However it is not supported by this device.
409 * @exception E_IN_PROGRESS The specified key is under processing or invalid state.
410 * @exception E_SYSTEM Either of the following conditions has occured:
411 * - The method cannot proceed due to a severe system error.
412 * - This error can occur and Wi-Fi Directâ„¢ is not activated if the @c key is %http://tizen.org/setting/network.wifi.direct and Wi-Fi is activated.-
413 Directâ„¢ is not activated if the @c key is %http://tizen.org/setting/network.wifi.direct and Wi-Fi is activated.
416 static result SetValueAsyncForPrivilegedKey(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener);
419 * Sets the specific @c bool type setting information based on the specified designators (key) asynchronously.
422 * @privlevel platform
423 * @privilege %http://tizen.org/privilege/setting
425 * @return An error code
426 * @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
427 * @param[in] value The setting information of type bool
428 * @param[in] listener The result listener.
429 * @exception E_SUCCESS The method is successful.
430 * @exception E_PRIVILEGED_DENIED The application does not have the privilege to call this method.
431 * @exception E_INVALID_ARG The specified @c value is invalid value.
432 * @exception E_OBJ_NOT_FOUND The specified @c key is not found.
433 * @exception E_UNSUPPORTED_OPERATION The specified @c key is existed, However it is not supported by this device.
434 * @exception E_IN_PROGRESS The specified key is under processing or invalid state.
435 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
437 static result SetValueAsync(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener);
441 * Sets the specific Tizen::Base::String type setting information based on the specified designators (key).
445 * @privlevel platform
446 * @privilege %http://tizen.org/privilege/settingmanager.write @n
447 * (%http://tizen.org/privilege/systemsetting.write is deprecated.)
449 * @return An error code
450 * @param[in] key The <a href="../org.tizen.native.appprogramming/html/guide/system/settings_info.htm">key name</a> of the setting information
451 * @param[in] value The setting information of type Tizen::Base::String
452 * @exception E_SUCCESS The method is successful.
453 * @exception E_PRIVILEGED_DENIED The application does not have the privilege to call this method.
454 * @exception E_INVALID_ARG The specified @c value is invalid value.
455 * @exception E_OBJ_NOT_FOUND The specified @c key is not found.
456 * @exception E_UNSUPPORTED_OPERATION The specified @c key exists. However, it is not supported by this device.
457 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
459 static result SetValueForPrivilegedKey(const Tizen::Base::String& key, Tizen::Base::String value);
462 * Resets current device. @n
463 * All data is removed and device is initialized.
467 * @privlevel platform
468 * @privilege %http://tizen.org/privilege/settingmanager.write @n
469 * (%http://tizen.org/privilege/systemsetting.write is deprecated.)
471 * @return An error code
472 * @exception E_SUCCESS The method is successful.
473 * @exception E_PRIVILEGED_DENIED The application does not have the privilege to call this method.
474 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
476 static result ResetToFactoryDefault(void);
481 * Sets the setting event listener.
483 * @deprecated This method is provided only for backward compatibility and will be deleted in the near future. Instead of using this method, it is recommended to use AddSettingEventListener() and RemoveSettingEventListener().
486 * @return An error code
487 * @param[in] pListener The setting event listener
488 * @exception E_SUCCESS The method is successful.
489 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
490 * @remarks If the value of the listener object (pListener) is @c null, the setting event listener is not called.
494 static result SetSettingEventListener(ISettingEventListener* pListener);
499 * This is the default constructor for this class. This default constructor is intentionally
500 declared as private so that only the platform can create an instance.
505 * This is the destructor for this class. This destructor overrides Tizen::Base::Object::~Object().
507 virtual ~SettingInfo(void);
510 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
512 SettingInfo(const SettingInfo& value);
515 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
517 SettingInfo& operator =(const SettingInfo& value);
520 friend class _SettingInfoImpl;
521 class _SettingInfoImpl* __pSettingInfoImpl;
526 #endif // _FSYS_SETTING_INFO_H_