Tizen 2.1 base
[platform/framework/native/app-service.git] / plugins / accessory-condition-handler / AccessoryMonitor.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://floralicense.org/license/
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        AccessoryManager.h
20  * @brief       This is the declaration file of the AccessoryManager class.
21  */
22
23 #ifndef _ACCESSORY_MONITOR_
24 #define _ACCESSORY_MONITOR_
25
26 #include <FApp.h>
27 #include <FBase.h>
28 #include <FIo.h>
29 #include <FIo_IDataRouterEventListener.h>
30 #include <FIo_DataRouter.h>
31
32 class AccessoryConditionHandler;
33
34 class AccessoryMonitor
35         : public Tizen::Base::Object
36         , public Tizen::Io::_IDataRouterEventListener
37 {
38 private:
39         AccessoryMonitor();
40         ~AccessoryMonitor();
41
42 public:
43         result Construct(AccessoryConditionHandler* pConditionHandler);
44         result SendData(char* buffer, int length);
45         Tizen::App::AppId GetClientId(void) const;
46         void SetClientId(Tizen::App::AppId appId);
47         void RemoveClientId(Tizen::App::AppId appId);
48         Tizen::Io::_DataRouter* GetDataRouter(void) const;
49         virtual void OnDataRouterDataReceivedN(const char* buffer, int length);
50         virtual void OnDataRouterStateChanged(Tizen::Io::_DataRouterState state);
51
52         static AccessoryMonitor* GetInstance(void);
53         static void ReleaseInstance(void);
54
55 private:
56         AccessoryConditionHandler* __pAccessoryConditionHandler;
57         Tizen::Io::_DataRouter* __pDataRouter;
58         Tizen::App::AppId       __clientAppId;
59 };
60
61 #endif //AccessoryMonitor