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, Api::NFC::INdefMessagePtr message);
42 static JSObjectRef createJSObject(JSContextRef context, std::vector<void *> ndefRcords);
43 static JSObjectRef createJSObject(JSContextRef context, std::vector<unsigned char> rawdata);
47 * This member variable contains the values which has to be passed when
48 * the this class is embedded into JS Engine.
50 static JSClassDefinition m_classInfo;
53 * This structure describes a statically declared function property.
55 static JSStaticFunction m_function[];
58 * This member variable contains the initialization values for the
59 * properties of this class. The values are given according to the
60 * data structure JSPropertySpec.
62 static JSStaticValue m_property[];
64 static JSClassRef m_jsClassRef;
67 * The callback invoked when an object is first created.
69 static void initialize(JSContextRef context, JSObjectRef object);
72 * The callback invoked when an object is finalized.
74 static void finalize(JSObjectRef object);
76 static JSObjectRef constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception);
79 * Getters and setters for properties
81 static JSValueRef getProperty(JSContextRef context, JSObjectRef object,
82 JSStringRef propertyName, JSValueRef* exception);
83 static bool setProperty(JSContextRef context, JSObjectRef object,
84 JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
86 * The callback invoked when an object is used as the target of an 'instanceof' expression.
88 static bool hasInstance(JSContextRef context,
89 JSObjectRef constructor,
90 JSValueRef possibleInstance,
91 JSValueRef* exception);
93 static JSValueRef toByte(JSContextRef context,
95 JSObjectRef thisObject,
97 const JSValueRef arguments[],
98 JSValueRef* exception);
104 #endif /* _JS_TIZEN_NDEFMESSAGE_H_ */