sync with master
[platform/framework/native/appfw.git] / src / system / FSys_SettingClient.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FSys_SettingClient.h
20  * @brief               This is the header file for _SettingClient class.
21  */
22
23 #ifndef _FSYSTEM_INTERNAL_SETTING_CLIENT_H_
24 #define _FSYSTEM_INTERNAL_SETTING_CLIENT_H_
25
26 #include <FIo_IpcClient.h>
27
28 #include <FBaseColArrayList.h>
29 #include <FBaseColHashMap.h>
30 #include <FBaseObject.h>
31 #include <FBaseRtEvent.h>
32 #include <FBaseRtIEventArg.h>
33 #include <FBaseRtIEventListener.h>
34 #include <FBaseString.h>
35 #include <FBaseInteger.h>
36 #include <FBaseUuId.h>
37 #include <FSysISettingEventListener.h>
38 #include <FSys_ICommunicationDispatcherListener.h>
39 #include <FSysISettingInfoSetValueAsyncResultListener.h>
40
41 namespace Tizen { namespace System
42 {
43
44 class _SettingClient
45         : public Tizen::Base::Object
46         , public Tizen::System::_ICommunicationDispatcherListener
47 {
48 private:
49         _SettingClient(void);
50         virtual ~_SettingClient(void);
51
52 public:
53         result GetValue(const Tizen::Base::String& key, bool& value);
54         result GetValueForPrivilegedKey(const Tizen::Base::String& key, bool& value);
55         result GetValue(const Tizen::Base::String& key, double& value);
56         result GetValue(const Tizen::Base::String& key, int& value);
57         result GetValue(const Tizen::Base::String& key, long long& value);
58         result GetValue(const Tizen::Base::String& key, Tizen::Base::String& value);
59         result GetValue(const Tizen::Base::String& key, Tizen::Base::UuId& value);
60
61         bool HasKey(const Tizen::Base::String& key);
62
63         result SetValue(const Tizen::Base::String& key, const bool& value);
64         result SetValueForPrivilegedKey(const Tizen::Base::String& key, bool value);
65         result SetValueAsyncForPrivilegedKey(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener);
66         result SetValue(const Tizen::Base::String& key, const int& value);
67         result SetValue(const Tizen::Base::String& key, const Tizen::Base::String& value);
68         result SetValueForPrivilegedKey(const Tizen::Base::String& key, Tizen::Base::String value);
69
70         result AddSettingEventListenerForInternal(ISettingEventListener& listener);
71         result RemoveSettingEventListenerForInternal(ISettingEventListener& listener);
72         result AddSettingEventListener(ISettingEventListener& listener);
73         result RemoveSettingEventListener(ISettingEventListener& listener);
74
75         result SetSettingEventListener(ISettingEventListener* pListener);
76
77         result ResetToFactoryDefault(void);
78
79         static _SettingClient* GetInstance(void);
80
81 private:
82         void OnDataReceived(const Tizen::Base::Collection::ArrayList& data);
83         result ConvertCode(Tizen::Base::String code);
84
85         Tizen::Base::String ConvertKeyOspToTizen(Tizen::Base::String ospKey);
86         result ConvertKeyTizenToOsp(Tizen::Base::String tizenKey, Tizen::Base::String& ospKey);
87
88         result GetOnService(Tizen::Base::String commandId, Tizen::Base::String key, Tizen::Base::String& response);
89         result SetOnService(Tizen::Base::String commandId, Tizen::Base::String key, Tizen::Base::String& value);
90         result SetVolume(const Tizen::Base::String& soundCategory, int level);
91
92         result SubscribeEvent(void);
93
94         static void InitSettingClient(void);
95 private:
96         Tizen::Base::Collection::HashMap __asyncEventList;
97         Tizen::Base::Runtime::Event*    __pSettingEvent;
98         Tizen::Base::Runtime::Event*    __pSettingEventForInternal;
99         bool                            __subscribed;
100
101         Tizen::Io::_IpcClient* __pIpcClient;
102         ISettingEventListener* __pListener;
103
104         static _SettingClient*          __pSettingClient;
105
106 };
107
108 } } // Tizen::System
109
110 #endif //_FSYSTEM_INTERNAL_SETTING_CLIENT_H_