6eea3290aa58ab6f1b74b296845ac3310a5a037b
[framework/web/wrt-plugins-tizen.git] / src / NFC / EventNFCChanged.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 #ifndef WRTPLUGINS_API_NFC_EVENT_NFC_CHANGED_H_
19 #define WRTPLUGINS_API_NFC_EVENT_NFC_CHANGED_H_
20
21 #include <vector>
22 #include <dpl/shared_ptr.h>
23 #include <Commons/ListenerEvent.h>
24 #include <Commons/ListenerEventEmitter.h>
25 #include "EventNFC.h"
26
27 namespace DeviceAPI {
28 namespace NFC {
29 enum EventNFCType {
30         NFC_TAG_TYPE,
31         NFC_TARGET_TYPE
32 };
33 enum EventNFCStatus {
34         NFC_ATTATCHED,
35         NFC_DETATCHED
36 };
37
38 enum EventNFCSEType {
39         NFC_SE_NONE,
40         NFC_SE_ESE,
41         NFC_SE_UICC,
42         NFC_SE_INVALID
43 };
44
45 class EventNFCChanged : public WrtDeviceApis::Commons::ListenerEvent<EventNFCChanged>
46 {
47 private:
48         void  *m_props;
49         EventNFCType m_type;
50         EventNFCStatus m_status;
51 public:
52         void *getNFCProperties() { return m_props; }
53         void setNFCProperties(void *props) { m_props = props; }
54          EventNFCType getNFCType() const {return m_type;}
55          void setNFCType(const EventNFCType type) {m_type = type;}
56          EventNFCStatus getNFCStatus() const {return m_status;}
57          void setNFCStatus(const EventNFCStatus type) {m_status = type;}         
58         EventNFCChanged() {}
59 };
60 class EventNFCChangedSetPowered : public EventNFCTemplate<EventNFCChangedSetPowered>
61 {
62 private:
63         bool powerState;
64 public:
65         bool getState()  {return powerState;}
66         EventNFCChangedSetPowered(bool state): powerState(state) { }
67 };
68
69 class EventNFCSetCardEmulation : public EventNFCTemplate<EventNFCSetCardEmulation>
70 {
71 private:
72         EventNFCSEType seType;
73 public:
74         EventNFCSEType getSEType()  {return seType;}
75         EventNFCSetCardEmulation(EventNFCSEType type): seType(type) { }
76 };
77
78 class EventNFCChangedCardEmulation : public WrtDeviceApis::Commons::ListenerEvent<EventNFCChangedCardEmulation>
79 {
80 private:
81         EventNFCSEType seType;
82 public:
83         EventNFCSEType getSEType()  {return seType;}
84         void setSEType(EventNFCSEType type) {seType = type;}
85         EventNFCChangedCardEmulation():seType(NFC_SE_NONE) { }
86 };
87
88 typedef DPL::SharedPtr<EventNFCChanged> EventNFCChangedPtr;
89 typedef WrtDeviceApis::Commons::ListenerEventEmitter<EventNFCChanged> EventNFCChangedEmitter;
90 typedef DPL::SharedPtr<EventNFCChangedEmitter> EventNFCChangedEmitterPtr;
91 typedef DPL::SharedPtr<EventNFCChangedSetPowered> EventNFCChangedSetPoweredPtr;
92 typedef DPL::SharedPtr<EventNFCSetCardEmulation> EventNFCSetCardEmulationPtr;
93 typedef DPL::SharedPtr<EventNFCChangedCardEmulation> EventNFCChangedCardEmulationPtr;
94 typedef WrtDeviceApis::Commons::ListenerEventEmitter<EventNFCChangedCardEmulation> EventNFCChangedCardEmulationEmitter;
95 typedef DPL::SharedPtr<EventNFCChangedCardEmulationEmitter> EventNFCChangedCardEmulationEmitterPtr;
96 } // NFC
97 } // DeviceAPI
98
99 #endif //WRTPLUGINS_API_NFC_EVENT_NFC_CHANGED_H_