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