Merge "Flow control for DataControl" into tizen_2.1
[platform/framework/native/appfw.git] / src / system / FSys_DeviceManagerImpl.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_DeviceManagerImpl.h
20  * @brief               This is the header file for the _DeviceManagerImpl class.
21  */
22
23 #ifndef _FSYS_INTERNAL_DEVICE_MANAGER_IMPL_H_
24 #define _FSYS_INTERNAL_DEVICE_MANAGER_IMPL_H_
25
26 #include <runtime_info.h>
27 #include <vconf.h>
28
29 #include <FBaseColArrayListT.h>
30 #include <FBaseColHashMap.h>
31 #include <FBaseResult.h>
32 #include <FBaseString.h>
33 #include <FBaseUuId.h>
34 #include <FSysDeviceManager.h>
35
36 #include <FIo_IpcClient.h>
37 #include <FSys_ICommunicationDispatcherListener.h>
38 #include <FSys_DeviceEventListenerContainer.h>
39
40 namespace Tizen { namespace Base
41 {
42 namespace Collection {
43 class ArrayList;
44 }
45 }}
46
47 namespace Tizen { namespace Io
48 {
49 class _IpcClient;
50 }}
51
52 namespace Tizen { namespace System
53 {
54
55 class _DeviceManagerImpl
56         : public Tizen::System::_ICommunicationDispatcherListener
57 {
58 private:
59         _DeviceManagerImpl();
60
61         virtual ~_DeviceManagerImpl();
62
63 public:
64         result GetState(DeviceType deviceType, Tizen::Base::String& state);
65
66         result AddDeviceEventListener(DeviceType deviceType, IDeviceEventListener* pListener);
67
68         result RemoveDeviceEventListener(DeviceType deviceType, IDeviceEventListener* pListener);
69
70         result RemoveAllDeviceEventListeners(void);
71
72
73         void OnDataReceived(const Tizen::Base::Collection::ArrayList& data);
74
75         void SendEvent(runtime_info_key_e key);
76
77         void SendEvent(DeviceType deviceType, Tizen::Base::String& state);
78
79         static _DeviceManagerImpl* GetInstance(void);
80
81 private:
82         _DeviceManagerImpl(const _DeviceManagerImpl& deviceManagerImpl);
83
84         _DeviceManagerImpl& operator =(const _DeviceManagerImpl& deviceManagerImpl);
85
86         result AddOnExistedListener(DeviceType deviceType, const IDeviceEventListener* pListener);
87
88         result RequireBluetoothEvent(void);
89
90         result ReleaseBluetoothEvent(void);
91
92         static void OnDeviceStateChanged(runtime_info_key_e key, void* pData);
93
94         static void DeviceEventVConfCallBack(keynode_t* node, void* userData);
95
96         static void MmcEventVconfCallback(keynode_t* node, void* userData);
97
98         static void InitDeviceManagerImpl(void);
99
100 private:
101         Tizen::Io::_IpcClient*          __pIpcClient;
102
103         DeviceType                      __headSetType;
104
105         int                             __bluetoothReferenceCount;
106
107         Tizen::Base::Collection::ArrayListT<_DeviceEventListenerContainer*>     __deviceEventList;
108
109         static _DeviceManagerImpl*      __pDeviceManagerImpl;
110 };
111
112 }} // Tizen::System
113
114 #endif  // _FSYS_INTERNAL_DEVICE_MANAGER_IMPL_H_