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