Update change log and spec for wrt-plugins-tizen_0.4.13
[framework/web/wrt-plugins-tizen.git] / src / NFC / NFCDefaultAdapter.h
1 //
2 // Tizen Web Device API
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
20 #ifndef _NFCDEFAULTADAPTER_H_
21 #define _NFCDEFAULTADAPTER_H_
22
23 #include <vector>
24 #include <dpl/shared_ptr.h>
25 #include <dpl/singleton.h>
26 #include <Commons/Emitters.h>
27
28 #include "EventNFCChanged.h"
29 #include "NFCAdapter.h"
30
31
32 namespace DeviceAPI {
33 namespace NFC {
34 class NFCDefaultAdapter
35 {
36     public:
37                 NFCDefaultAdapter();
38         virtual  ~NFCDefaultAdapter();
39
40 public:
41      /**
42      * watchNFCTag
43      */
44         int setTagListener(NFCAdapter* adapter);
45         int setPeerListener(NFCAdapter * adapter);
46         /**
47      * clearWatch
48      */
49         void unsetTagListener(NFCAdapter * adapter);
50         void unsetPeerListener(NFCAdapter * adapter);
51
52         void NFCTagHasDetected(void *props);
53         void NFCTargetHasDetected(void *props);
54
55         void *getCachedMessage();
56         void getCurrentNFC();
57
58         bool getPowerState();
59         void setPowered(const bool state, NFCAdapter * adapter);
60         void setPoweredManualAnswer(int error);
61
62         bool isSupported();
63         void deinitialze();
64 private:
65         /**
66      * Initialize NFC.
67      */
68         int initialize();
69
70         std::vector<NFCAdapter *> m_NFCTagListeners;
71         std::vector<NFCAdapter *> m_NFCTargetListeners;
72          
73         NFCAdapter * m_poweredAdapter;
74         bool m_initialized;
75
76         friend class DPL::Singleton<NFCDefaultAdapter>;
77
78 };
79 typedef DPL::Singleton<NFCDefaultAdapter> NFCDefaultAdapterSingleton;
80
81 }
82 }
83
84 #endif /* _NFCDEFAULTADAPTER_H_ */