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.
17 #ifndef TIZENAPIS_TIZEN_JS_BLUETOOTH_SOCKET_H_
18 #define TIZENAPIS_TIZEN_JS_BLUETOOTH_SOCKET_H_
20 #include <JavaScriptCore/JavaScript.h>
21 #include <CommonsJavaScript/PrivateObject.h>
22 #include <API/Bluetooth/BTDevice.h>
23 #include <API/Bluetooth/IBluetoothSocketManager.h>
25 using namespace WrtDeviceApis::CommonsJavaScript;
30 typedef PrivateObjectT<Api::Bluetooth::IBluetoothSocketManagerPtr>::Type JSBluetoothSocketPriv;
31 class JSBluetoothSocket
34 static const JSClassDefinition* getClassInfo();
35 static const JSClassRef getClassRef();
36 static JSObjectRef createJSObject(JSContextRef context, BluetoothSocketData socketData);
37 static JSObjectRef createJSObject(JSContextRef context, BluetoothSocketData socketData,
38 EventBTReadDataType readData);
41 static void initialize(JSContextRef context, JSObjectRef object);
42 static void finalize(JSObjectRef object);
43 static bool hasInstance(JSContextRef context, JSObjectRef constructor,
44 JSValueRef possibleInstance, JSValueRef* exception);
46 static bool setProperty(JSContextRef context,
48 JSStringRef propertyName,
50 JSValueRef* exception);
52 static bool setOnConnect(JSContextRef context, JSObjectRef object,
53 JSStringRef propertyName, JSValueRef value,
54 JSValueRef* exception);
57 static JSValueRef setSocketNotifier(JSContextRef context, JSObjectRef object,
58 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
59 JSValueRef* exception);
61 static JSValueRef writeData(JSContextRef context, JSObjectRef object,
62 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
63 JSValueRef* exception);
66 static JSValueRef readData(JSContextRef context, JSObjectRef object,
67 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
68 JSValueRef* exception);
71 static JSValueRef close(JSContextRef context, JSObjectRef object,
72 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
73 JSValueRef* exception);
76 static JSValueRef getProperty(JSContextRef context,
78 JSStringRef propertyName,
79 JSValueRef* exception);
81 static JSClassDefinition m_classInfo;
82 static JSStaticFunction m_function[];
83 static JSStaticValue m_properties[];
85 static JSClassRef m_jsClassRef;