7c101c0af254ac82a96ae545fe46bc5a29cb9156
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / NFC / JSNFCTarget.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 _JS_TIZEN_NFCTARGET_H_
20 #define _JS_TIZEN_NFCTARGET_H_
21
22 #include <JavaScriptCore/JavaScript.h>
23 #include <API/NFC/INFCTarget.h>
24 #include <CommonsJavaScript/PrivateObject.h>
25
26 namespace TizenApis {
27 namespace Tizen1_0 {
28
29 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<Api::NFC::INFCTargetPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> NFCTargetPrivObject;
30
31 class JSNFCTarget
32 {
33 public:
34
35     static const JSClassDefinition* getClassInfo();
36
37     static const JSClassRef getClassRef();
38
39     static JSObjectRef createJSObject(JSContextRef context, void *tagHandle, void* privManager);
40
41 private:
42     /**
43      * This member variable contains the values which has to be passed when
44      * the this class is embedded into JS Engine.
45      */
46     static JSClassDefinition m_classInfo;
47
48     /**
49      * This structure describes a statically declared function property.
50      */
51     static JSStaticFunction m_function[];
52
53     /**
54      * This member variable contains the initialization values for the
55      * properties of this class. The values are given according to the
56      * data structure JSPropertySpec.
57      */
58     static JSStaticValue m_property[];
59
60     static JSClassRef m_jsClassRef;
61
62     /**
63      * The callback invoked when an object is first created.
64      */
65     static void initialize(JSContextRef context, JSObjectRef object);
66
67     /**
68      * The callback invoked when an object is finalized.
69      */
70     static void finalize(JSObjectRef object);
71
72     /**
73      * Getters and setters for properties
74      */
75     static JSValueRef getProperty(JSContextRef context, JSObjectRef object,
76             JSStringRef propertyName, JSValueRef* exception);
77
78     static JSValueRef setReceiveNDEFListener(JSContextRef context,
79                 JSObjectRef object,
80                 JSObjectRef thisObject,
81                 size_t argumentCount,
82                 const JSValueRef arguments[],
83                 JSValueRef* exception);
84
85     static JSValueRef unsetReceiveNDEFListener(JSContextRef context,
86                 JSObjectRef object,
87                 JSObjectRef thisObject,
88                 size_t argumentCount,
89                 const JSValueRef arguments[],
90                 JSValueRef* exception);
91
92     static JSValueRef sendNDEF(JSContextRef context,
93                 JSObjectRef object,
94                 JSObjectRef thisObject,
95                 size_t argumentCount,
96                 const JSValueRef arguments[],
97                 JSValueRef* exception);
98 };
99
100 }
101 }
102
103 #endif /* _JS_TIZEN_NFCTARGET_H_ */