2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 #ifndef WRTPLUGINS_API_EVENT_SE_SERVICE_H_
20 #define WRTPLUGINS_API_EVENT_SE_SERVICE_H_
23 #include <Commons/IEvent.h>
24 #include <Commons/ListenerEvent.h>
25 #include <Commons/ListenerEventEmitter.h>
26 #include <dpl/shared_ptr.h>
29 namespace SecureElement {
31 template <class templateClass>
32 class EventSETemplate : public WrtDeviceApis::Commons::IEvent<templateClass>
36 std::string errorCode;
38 void setResult(const bool value) {result = value;}
39 bool getResult() const {return result;}
40 void setError(const std::string &error) { errorCode= error;}
41 std::string getError() {return errorCode;}
42 EventSETemplate() :result(true) { }
45 template <class templateEventClass>
49 DPL::SharedPtr<templateEventClass> eventPtr;
52 DPL::SharedPtr<templateEventClass> getEventPtrs() const {return eventPtr;}
53 void *getThisPtr() {return thisPtr;}
54 EventSEPtrs(const DPL::SharedPtr<templateEventClass> &event, void *myPtr) : eventPtr(event), thisPtr(myPtr) {}
62 class EventSEStateChanged : public WrtDeviceApis::Commons::ListenerEvent<EventSEStateChanged>
68 void setSEState(SEState value) {state = value;}
69 SEState getSEState() {return state;}
70 void setReader(void *changedReader) {reader = changedReader;}
71 void *getReader() {return reader;}
72 EventSEStateChanged(): state(SE_NOCHANED){ }
75 class EventListSEs : public EventSETemplate<EventListSEs>
78 std::vector<void *> seList;
81 std::vector<void *> getListSEs() {return seList;}
82 void addSEs(void *se) {seList.push_back(se);}
85 class EventSEOpenSession : public EventSETemplate<EventSEOpenSession>
90 EventSEOpenSession() {}
91 void setSession(void *session) {m_session = session;}
92 void *getSession() {return m_session;}
95 class EventSEOpenChannel : public EventSETemplate<EventSEOpenChannel>
98 std::vector<unsigned char> m_AID;
102 EventSEOpenChannel(std::vector<unsigned char> aid, bool isBasicChannel) {m_AID = aid; this->bBasicChannel = isBasicChannel;}
103 std::vector<unsigned char> getAID() {return m_AID;}
104 void setChannel(void *channel) {m_channel = channel;}
105 void *getChannel() {return m_channel;}
106 bool isBasicChannel() {return bBasicChannel;}
109 class EventSEChannelTransmit : public EventSETemplate<EventSEChannelTransmit>
112 std::vector<unsigned char> m_sendData;
113 std::vector<unsigned char> m_respData;
115 EventSEChannelTransmit(std::vector<unsigned char> data) {m_sendData = data;}
116 std::vector<unsigned char> getSendData() {return m_sendData;}
117 void setResponse(std::vector<unsigned char> resp) {m_respData = resp;}
118 std::vector<unsigned char> getResponse() {return m_respData;}
121 typedef DPL::SharedPtr<EventSEStateChanged> EventSEStateChangedPtr;
122 typedef WrtDeviceApis::Commons::ListenerEventEmitter<EventSEStateChanged> EventSEStateChangedEmitter;
123 typedef DPL::SharedPtr<EventSEStateChangedEmitter> EventSEStateChangedEmitterPtr;
125 typedef DPL::SharedPtr<EventListSEs> EventListSEsPtr;
126 typedef DPL::SharedPtr<EventSEOpenSession> EventSEOpenSessionPtr;
127 typedef DPL::SharedPtr<EventSEOpenChannel> EventSEOpenChannelPtr;
128 typedef DPL::SharedPtr<EventSEChannelTransmit> EventSEChannelTransmitPtr;
132 #endif //WRTPLUGINS_API_EVENT_SE_SERVICE_H_