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.
18 #ifndef TIZENAPIS_TIZEN_JS_BLUETOOTH_ADAPTER_H_
19 #define TIZENAPIS_TIZEN_JS_BLUETOOTH_ADAPTER_H_
21 #include <JavaScriptCore/JavaScript.h>
22 #include <CommonsJavaScript/PrivateObject.h>
23 #include <API/Bluetooth/IBluetoothAdapterManager.h>
25 using namespace TizenApis::Api::Bluetooth;
26 using namespace WrtDeviceApis::CommonsJavaScript;
32 typedef PrivateObjectT<Api::Bluetooth::IBluetoothAdapterManagerPtr>::Type JSBluetoothAdapterPriv;
33 class JSBluetoothAdapter {
35 static const JSClassDefinition* getClassInfo();
36 static const JSClassRef getClassRef();
37 static JSObjectRef createJSObject(JSContextRef context);
39 static void initialize(JSContextRef context, JSObjectRef object);
40 static void finalize(JSObjectRef object);
41 static bool hasInstance(JSContextRef context, JSObjectRef constructor,
42 JSValueRef possibleInstance, JSValueRef* exception);
44 static JSValueRef setPowered(
45 JSContextRef context, JSObjectRef object,
46 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
47 JSValueRef* exception);
49 static JSValueRef getPowered(
50 JSContextRef context, JSObjectRef object,
51 JSStringRef propertyName, JSValueRef* exception);
53 static JSValueRef setVisible(
54 JSContextRef context, JSObjectRef object,
55 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
56 JSValueRef* exception);
58 static JSValueRef getVisible(
59 JSContextRef context, JSObjectRef object,
60 JSStringRef propertyName, JSValueRef* exception);
62 static JSValueRef setName(
63 JSContextRef context, JSObjectRef object,
64 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
65 JSValueRef* exception);
67 static JSValueRef getName(
68 JSContextRef context, JSObjectRef object,
69 JSStringRef propertyName, JSValueRef* exception);
73 static JSValueRef discoveryDevices(
74 JSContextRef context, JSObjectRef object,
75 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
76 JSValueRef* exception);
78 static JSValueRef stopDiscovery(
79 JSContextRef context, JSObjectRef object,
80 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
81 JSValueRef* exception);
84 static JSValueRef getKnownDevices(
85 JSContextRef context, JSObjectRef object,
86 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
87 JSValueRef* exception);
90 static JSValueRef getDevice(
91 JSContextRef context, JSObjectRef object,
92 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
93 JSValueRef* exception);
96 static JSValueRef createBonding(
97 JSContextRef context, JSObjectRef object,
98 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
99 JSValueRef* exception);
101 static JSValueRef destroyBonding(
102 JSContextRef context, JSObjectRef object,
103 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
104 JSValueRef* exception);
106 static JSValueRef registerRFCOMMServiceByUUID(
107 JSContextRef context, JSObjectRef object,
108 JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
109 JSValueRef* exception);
111 static JSValueRef getAddress(
112 JSContextRef context, JSObjectRef object,
113 JSStringRef propertyName, JSValueRef* exception);
115 static JSClassDefinition m_classInfo;
117 static JSStaticFunction m_function[];
118 static JSStaticValue m_properties[];
120 static JSClassRef m_jsClassRef;
121 static bool m_AdapterEnabled;