Update change log and spec for wrt-plugins-tizen_0.4.70
[framework/web/wrt-plugins-tizen.git] / src / NFC / JSNFCTag.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_NFCTAG_H_
21 #define _JS_TIZEN_NFCTAG_H_
22
23 #include <JavaScriptCore/JavaScript.h>
24 #include <CommonsJavaScript/PrivateObject.h>
25 #include <Security.h>
26 #include "INFCTag.h"
27 #include "EventNFCChangedPrivateData.h"
28
29
30 namespace DeviceAPI {
31 namespace NFC {
32
33 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<INFCTagPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> NFCTagPrivObjectBase;
34 class  NFCTagPrivObject :
35     public DeviceAPI::Common::SecurityAccessor,
36     public NFCTagPrivObjectBase
37 {
38 public:
39      NFCTagPrivObject(JSContextRef context, INFCTagPtr nfcTag) :
40         DeviceAPI::Common::SecurityAccessor(),
41         NFCTagPrivObjectBase(context, nfcTag)
42     {
43     }
44
45     virtual ~NFCTagPrivObject()
46     {
47     }
48 };
49
50 class JSNFCTag
51 {
52 public:
53
54     static const JSClassDefinition* getClassInfo();
55
56     static const JSClassRef getClassRef();
57
58     static JSObjectRef createJSObject(JSContextRef context, void *tagHandle, EventNFCChangedPrivateDataPtr eventNFCChangedPriv);
59
60 private:
61     /**
62      * This member variable contains the values which has to be passed when 
63      * the this class is embedded into JS Engine.
64      */
65     static JSClassDefinition m_classInfo;
66
67     /**
68      * This structure describes a statically declared function property.
69      */
70     static JSStaticFunction m_function[];
71
72     /**
73      * This member variable contains the initialization values for the 
74      * properties of this class. The values are given according to the
75      * data structure JSPropertySpec.
76      */
77     static JSStaticValue m_property[];
78
79     static JSClassRef m_jsClassRef;
80
81     /**
82      * The callback invoked when an object is first created.
83      */
84     static void initialize(JSContextRef context, JSObjectRef object);
85
86     /**
87      * The callback invoked when an object is finalized.
88      */
89     static void finalize(JSObjectRef object);
90
91     /**
92      * Getters for properties
93      */
94     static JSValueRef getProperty(JSContextRef context, JSObjectRef object,
95             JSStringRef propertyName, JSValueRef* exception);
96
97     /**
98      * The callback invoked when an object is used as the target of an 'instanceof' expression.
99      */
100     static bool hasInstance(JSContextRef context,
101             JSObjectRef constructor,
102             JSValueRef possibleInstance,
103             JSValueRef* exception);
104
105     static JSValueRef readNDEF(JSContextRef context,
106                 JSObjectRef object,
107                 JSObjectRef thisObject,
108                 size_t argumentCount,
109                 const JSValueRef arguments[],
110                 JSValueRef* exception);
111         
112     static JSValueRef writeNDEF(JSContextRef context,
113                 JSObjectRef object,
114                 JSObjectRef thisObject,
115                 size_t argumentCount,
116                 const JSValueRef arguments[],
117                 JSValueRef* exception);
118         
119     static JSValueRef transceive(JSContextRef context,
120                 JSObjectRef object,
121                 JSObjectRef thisObject,
122                 size_t argumentCount,
123                 const JSValueRef arguments[],
124                 JSValueRef* exception);
125
126 };
127
128 }
129 }
130
131 #endif /* _JS_TIZEN_NFCTAG_H_ */