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