2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #ifndef _JS_TIZEN_NDEFMESSAGE_H_
20 #define _JS_TIZEN_NDEFMESSAGE_H_
22 #include <JavaScriptCore/JavaScript.h>
23 #include <API/NFC/INdefMessage.h>
24 #include <CommonsJavaScript/PrivateObject.h>
29 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<Api::NFC::INdefMessagePtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> NdefMessagePrivObject;
35 static const JSClassDefinition* getClassInfo();
37 static const JSClassRef getClassRef();
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);
46 * This member variable contains the values which has to be passed when
47 * the this class is embedded into JS Engine.
49 static JSClassDefinition m_classInfo;
52 * This structure describes a statically declared function property.
54 static JSStaticFunction m_function[];
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.
61 static JSStaticValue m_property[];
63 static JSClassRef m_jsClassRef;
66 * The callback invoked when an object is first created.
68 static void initialize(JSContextRef context, JSObjectRef object);
71 * The callback invoked when an object is finalized.
73 static void finalize(JSObjectRef object);
76 * Getters and setters for properties
78 static JSValueRef getProperty(JSContextRef context, JSObjectRef object,
79 JSStringRef propertyName, JSValueRef* exception);
81 static JSValueRef toByte(JSContextRef context,
83 JSObjectRef thisObject,
85 const JSValueRef arguments[],
86 JSValueRef* exception);
88 static JSValueRef getNDEFRecord(JSContextRef context,
90 JSObjectRef thisObject,
92 const JSValueRef arguments[],
93 JSValueRef* exception);
95 static JSValueRef insertNDEFRecord(JSContextRef context,
97 JSObjectRef thisObject,
99 const JSValueRef arguments[],
100 JSValueRef* exception);
102 static JSValueRef appendNDEFRecord(JSContextRef context,
104 JSObjectRef thisObject,
105 size_t argumentCount,
106 const JSValueRef arguments[],
107 JSValueRef* exception);
109 static JSValueRef removeNDEFRecord(JSContextRef context,
111 JSObjectRef thisObject,
112 size_t argumentCount,
113 const JSValueRef arguments[],
114 JSValueRef* exception);
120 #endif /* _JS_TIZEN_NDEFMESSAGE_H_ */