Update change log and spec for wrt-plugins-tizen_0.4.13
[framework/web/wrt-plugins-tizen.git] / src / NFC / NFCConverter.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 _JS_TIZEN_NFC_CONVERTER_H_
21 #define _JS_TIZEN_NFC_CONVERTER_H_
22
23 #include <vector>
24 #include <string>
25 #include <JavaScriptCore/JavaScript.h>
26 #include <CommonsJavaScript/Converter.h>
27 #include "TagFilter.h"
28 #include "NdefRecordProperties.h"
29 #include "NFCTagProperties.h"
30 #include "INdefRecord.h"
31 #include "EventNFCChanged.h"
32 #include "NFCChangedCallback.h"
33
34 namespace DeviceAPI {
35 namespace NFC {
36
37
38 class NFCConverter : public WrtDeviceApis::CommonsJavaScript::Converter
39 {
40     public:
41         using WrtDeviceApis::CommonsJavaScript::Converter::toJSValueRef;
42     public:
43         explicit NFCConverter(JSContextRef context);
44         virtual  ~NFCConverter();
45         TagFilterPtr toNFCTagFilter(JSValueRef jsValue);
46         nfcTagType toNfcTagType(std::string typeString);
47         std::string toNfcTagTypeString(nfcTagType type);
48         nfcTextEncodeUTF toNfcTextEncodeUTF(std::string encodeString);
49         std::string toNfcTextEncodeUTFString(nfcTextEncodeUTF encode);
50         nfcTNF toNfcTNF(const JSValueRef& arg);
51         JSValueRef toJSValueRef(const std::vector<unsigned char>& arg);
52         JSValueRef toJSValueRef(std::vector<NFCTagProperties> props);
53         JSValueRef toJSValueRef(NdefRecordData arg);
54         bool isNdefRecord(const JSValueRef& arg);
55         std::vector<void *> toVectorOfRecordHandles(const JSValueRef& arg);
56         std::string toRecordClassName(NdefRecordData arg);
57         void *getRecordHandle(const JSValueRef& arg);
58         void *getMessageHandle(const JSValueRef& arg);
59         NFCChangedCallback toNFCChangedCallback(const JSValueRef& arg);
60   private:
61     bool initializeAllowedProperties();
62     static std::vector<std::string> m_allowedTagFilterProperties;
63 };
64
65 }
66 }
67
68 #endif /* _JS_TIZEN_NFC_CONVERTER_H_ */