diff options
Diffstat (limited to 'mobile_src/NFC/JSNFCTarget.h')
-rwxr-xr-x | mobile_src/NFC/JSNFCTarget.h | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/mobile_src/NFC/JSNFCTarget.h b/mobile_src/NFC/JSNFCTarget.h new file mode 100755 index 0000000..7f3d17d --- /dev/null +++ b/mobile_src/NFC/JSNFCTarget.h @@ -0,0 +1,129 @@ +// +// Tizen Web Device API +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + + + +#ifndef _JS_TIZEN_NFCTARGET_H_ +#define _JS_TIZEN_NFCTARGET_H_ + +#include <JavaScriptCore/JavaScript.h> +#include <CommonsJavaScript/PrivateObject.h> +#include <Security.h> +#include "EventNFCChangedPrivateData.h" +#include "INFCTarget.h" + +namespace DeviceAPI { +namespace NFC { + +typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<INFCTargetPtr, WrtDeviceApis::CommonsJavaScript::NoOwnership> NFCTargetPrivObjectBase; +class NFCTargetPrivObject : + public DeviceAPI::Common::SecurityAccessor, + public NFCTargetPrivObjectBase +{ +public: + NFCTargetPrivObject(JSContextRef context, INFCTargetPtr nfcTarget) : + DeviceAPI::Common::SecurityAccessor(), + NFCTargetPrivObjectBase(context, nfcTarget) + { + } + + virtual ~NFCTargetPrivObject() + { + } +}; + +class JSNFCTarget +{ +public: + + static const JSClassDefinition* getClassInfo(); + + static const JSClassRef getClassRef(); + + static JSObjectRef createJSObject(JSContextRef context, void *tagHandle, EventNFCChangedPrivateDataPtr eventNFCChangedPriv); + +private: + /** + * This member variable contains the values which has to be passed when + * the this class is embedded into JS Engine. + */ + static JSClassDefinition m_classInfo; + + /** + * This structure describes a statically declared function property. + */ + static JSStaticFunction m_function[]; + + /** + * This member variable contains the initialization values for the + * properties of this class. The values are given according to the + * data structure JSPropertySpec. + */ + static JSStaticValue m_property[]; + + static JSClassRef m_jsClassRef; + + /** + * The callback invoked when an object is first created. + */ + static void initialize(JSContextRef context, JSObjectRef object); + + /** + * The callback invoked when an object is finalized. + */ + static void finalize(JSObjectRef object); + + /** + * Getters and setters for properties + */ + static JSValueRef getProperty(JSContextRef context, JSObjectRef object, + JSStringRef propertyName, JSValueRef* exception); + + /** + * The callback invoked when an object is used as the target of an 'instanceof' expression. + */ + static bool hasInstance(JSContextRef context, + JSObjectRef constructor, + JSValueRef possibleInstance, + JSValueRef* exception); + + static JSValueRef setReceiveNDEFListener(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); + + static JSValueRef unsetReceiveNDEFListener(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); + + static JSValueRef sendNDEF(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); +}; + +} +} + +#endif /* _JS_TIZEN_NFCTARGET_H_ */ |