update for beta universally
[profile/ivi/wrt-plugins-tizen.git] / src / platform / Tizen / NFC / NFCAdapter.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17
18
19 #ifndef _NFCADAPTER_H_
20 #define _NFCADAPTER_H_
21
22 #include <dpl/shared_ptr.h>
23 #include <Commons/Emitters.h>
24
25 #include <API/NFC/INFCAdapter.h>
26 #include <API/NFC/NFCFactory.h>
27 #include <API/NFC/EventNFCChanged.h>
28 #include <API/NFC/TagFilter.h>
29
30 using namespace TizenApis::Api::NFC;
31
32 namespace TizenApis {
33 namespace Platform {
34 namespace NFC {
35 class NFCAdapter : public INFCAdapter
36 {
37         friend class  NFCFactory;
38     public:
39                 NFCAdapter();
40         virtual  ~NFCAdapter();
41
42 public:
43      /**
44      * watchNFCTag
45      */
46         virtual int setTagListener(const EventNFCChangedEmitterPtr& emitter, TagFilterPtr filter, void *managerPriv);
47         virtual int setPeerListener(const EventNFCChangedEmitterPtr& emitter, void *managerPriv);
48         /**
49      * clearWatch
50      */
51         virtual void unsetTagListener();
52         virtual void unsetPeerListener();
53
54         void NFCHasDetected(void *props, EventNFCType type);
55
56         virtual void *getCachedMessage();
57         virtual bool isValidHandle(void * handle);
58         void updateCurrentHandle(void *handle);
59         void getCurrentNFC();
60
61         virtual bool getPowerState();
62         virtual void setPowered(const EventNFCChangedSetPoweredPtr& event);
63         void setPoweredManualAnswer(int error);
64
65         virtual void deinitialze();
66 private:
67         /**
68      * Initialize NFC.
69      */
70         int initialize();
71
72         EventNFCChangedEmitterPtr m_NFCTagEmitterPtr;
73         EventNFCChangedEmitterPtr m_NFCTargetEmitterPtr;
74         EventNFCChangedSetPoweredPtr m_EventNFCChangedSetPoweredPtr;
75         TagFilterPtr m_tagFilter;
76         void *m_managerPriv;
77         bool m_initialized;
78   protected:
79         virtual void OnRequestReceived(const EventNFCChangedSetPoweredPtr& event);
80 };
81 }
82 }
83 }
84
85 #endif /* _NFCADAPTER_H_ */