upload tizen1.0 source
[profile/ivi/wrt-plugins-tizen.git] / src / platform / API / NFC / INFCTag.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 _ABSTRACT_LAYER_NFCTAG_H_
20 #define _ABSTRACT_LAYER_NFCTAG_H_
21
22 #include <dpl/shared_ptr.h>
23 #include <vector>
24 #include <Commons/ThreadPool.h>
25 #include "EventTagAction.h"
26 #include "NFCTagProperties.h"
27
28 using namespace WrtDeviceApis::Commons;
29
30 namespace TizenApis {
31 namespace Api {
32 namespace NFC {
33
34         enum nfcTagType {
35                 NFC_TAGTYPE_GENERIC_PICC = 0x00,
36                 NFC_TAGTYPE_ISO14443_A_PICC = 0x01,
37                 NFC_TAGTYPE_ISO14443_4A_PICC = 0x02,
38                 NFC_TAGTYPE_ISO14443_3A_PICC = 0x03,
39                 NFC_TAGTYPE_MIFARE_MINI_PICC = 0x04,
40                 NFC_TAGTYPE_MIFARE_1K_PICC = 0x05,
41                 NFC_TAGTYPE_MIFARE_4K_PICC = 0x06,
42                 NFC_TAGTYPE_MIFARE_ULTRA_PICC = 0x07,
43                 NFC_TAGTYPE_MIFARE_DESFIRE_PICC = 0x08,
44                 NFC_TAGTYPE_ISO14443_B_PICC = 0x09,
45                 NFC_TAGTYPE_ISO14443_4B_PICC = 0x0a,
46                 NFC_TAGTYPE_ISO14443_BPRIME_PICC = 0x0b,
47                 NFC_TAGTYPE_FELICA_PICC = 0x0c,
48                 NFC_TAGTYPE_JEWEL_PICC = 0x0d,
49                 NFC_TAGTYPE_ISO15693_PICC = 0x0e,
50                 NFC_TAGTYPE_UNKNOWN_TARGET = 0xff
51         };
52         
53 class INFCTag :
54                 public EventRequestReceiver<EventTagActionRead>,
55                 public EventRequestReceiver<EventTagActionWrite>,
56                 public EventRequestReceiver<EventTagActionTransceive>,
57                 public EventRequestReceiver<EventTagActionFormat>
58 {
59     public:
60
61         
62         virtual                     ~INFCTag();
63         virtual void *getHandle() = 0;
64         virtual nfcTagType getTagType() = 0;
65         virtual bool isNDEFSupport() = 0;
66         virtual long getNdefSize() = 0;
67         virtual std::vector<NFCTagProperties> getProperties() = 0;
68         virtual void readNdef(const EventTagActionReadPtr& event) = 0;
69         virtual void writeNdef(const EventTagActionWritePtr& event) = 0;
70         virtual void transceive(const EventTagActionTransceivePtr& event) = 0;
71         virtual void format(const EventTagActionFormatPtr& event) = 0;
72
73         virtual void setPrivateNFCAdapterPtr(void* priv) {privNFCAdapter = priv;}
74         virtual void *getPrivateNFCAdapterPtr() {return privNFCAdapter;}
75     protected:
76                 INFCTag();
77                 virtual void OnRequestReceived(const EventTagActionReadPtr& event) = 0;
78                 virtual void OnRequestReceived(const EventTagActionWritePtr& event) = 0;
79                 virtual void OnRequestReceived(const EventTagActionTransceivePtr& event) = 0;
80                 virtual void OnRequestReceived(const EventTagActionFormatPtr& event) = 0;
81
82                 void *privNFCAdapter;
83 };
84
85 typedef DPL::SharedPtr<INFCTag> INFCTagPtr;
86
87 }
88 }
89 }
90
91 #endif /* _ABSTRACT_LAYER_NFCTAG_H_ */