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