Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / NFC / JSNFCManager.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_NFCMANAGER_H_
20 #define _JS_TIZEN_NFCMANAGER_H_
21
22 #include <JavaScriptCore/JavaScript.h>
23 #include <API/NFC/INFCManager.h>
24 #include <CommonsJavaScript/PrivateObject.h>
25
26 namespace TizenApis {
27 namespace Tizen1_0 {
28
29 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<Api::NFC::INFCManagerPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> NFCManagerPrivObject;
30
31 class JSNFCManager
32 {
33 public:
34
35     static const JSClassDefinition* getClassInfo();
36
37     static const JSClassRef getClassRef();
38
39 private:
40     /**
41      * This member variable contains the values which has to be passed when
42      * the this class is embedded into JS Engine.
43      */
44     static JSClassDefinition m_classInfo;
45
46     /**
47      * This structure describes a statically declared function property.
48      */
49     static JSStaticFunction m_function[];
50
51     /**
52      * This member variable contains the initialization values for the
53      * properties of this class. The values are given according to the
54      * data structure JSPropertySpec.
55      */
56     static JSStaticValue m_property[];
57
58     static JSClassRef m_jsClassRef;
59
60     /**
61      * The callback invoked when an object is first created.
62      */
63     static void initialize(JSContextRef context, JSObjectRef object);
64
65     /**
66      * The callback invoked when an object is finalized.
67      */
68     static void finalize(JSObjectRef object);
69
70     /**
71      * Getters  for properties
72      */
73     static JSValueRef getProperty(JSContextRef context, JSObjectRef object,
74             JSStringRef propertyName, JSValueRef* exception);
75
76         /**
77      * register a listener to watch NFC tag.
78      */
79         static JSValueRef setTagListener(JSContextRef context, JSObjectRef object,
80                 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
81                 JSValueRef* exception);
82         /**
83      * deregister the listener which was registered by using setTagListener api.
84      */
85         static JSValueRef unsetTagListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject,
86                         size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
87
88         /**
89      * register a listener to watch NFC tag.
90      */
91         static JSValueRef setPeerListener(JSContextRef context, JSObjectRef object,
92                 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
93                 JSValueRef* exception);
94         /**
95      * deregister the listener which was registered by using setTagListener api.
96      */
97         static JSValueRef unsetPeerListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject,
98                         size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
99
100         /**
101      * register a listener to watch NFC tag.
102      */
103         static JSValueRef setNDEFListener(JSContextRef context, JSObjectRef object,
104                 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
105                 JSValueRef* exception);
106         /**
107      * deregister the listener which was registered by using setTagListener api.
108      */
109         static JSValueRef unsetNDEFListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject,
110                         size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
111
112         /**
113      * register a listener to watch NFC SE Event.
114      */
115         static JSValueRef setSEEventListener(JSContextRef context, JSObjectRef object,
116                 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
117                 JSValueRef* exception);
118         /**
119      * deregister the listener which was registered by using setSEEventListener api.
120      */
121         static JSValueRef unsetSEEventListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject,
122                         size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
123
124     static JSValueRef getCachedMessage(JSContextRef context,
125                 JSObjectRef object,
126                 JSObjectRef thisObject,
127                 size_t argumentCount,
128                 const JSValueRef arguments[],
129                 JSValueRef* exception);
130 };
131
132 }
133 }
134
135 #endif /* _JS_TIZEN_NFCMANAGER_H_ */