Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Bluetooth / BluetoothConverter.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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. 
15 */
16
17
18 #include <dpl/log/log.h>
19 #include <CommonsJavaScript/Converter.h>
20 #include <API/Bluetooth/BTDevice.h>
21 #include "BluetoothMultiCallback.h"
22
23 #ifndef TIZENAPIS_TIZEN_BLUETOOTH_CONVERTER_H_
24 #define TIZENAPIS_TIZEN_BLUETOOTH_CONVERTER_H_
25
26 namespace TizenApis {
27 namespace Tizen1_0 {
28         
29 class BluetoothConverter : public WrtDeviceApis::CommonsJavaScript::Converter
30 {
31   public:
32     using WrtDeviceApis::CommonsJavaScript::Converter::toJSValueRef;
33
34     explicit BluetoothConverter(JSContextRef context);
35     virtual ~BluetoothConverter();
36
37     JSValueRef toFunctionOrNull(const JSValueRef& arg);
38     JSValueRef toFunction(const JSValueRef& arg);
39         EventBTOnDiscoveryDevicesPrivateDataPtr 
40                 toEventBTOnDiscoveryDevicesPrivateData(JSObjectRef thisObject, 
41                 JSValueRef successParam, JSValueRef errorParam);
42         BluetoothSocketNotifierPrivateDataPtr getInitalBluetoothSocketNotifierPrivateData();
43         void setBluetoothSocketNotifierCallback(JSStringRef propertyName, JSValueRef value, 
44                 JSObjectRef object, BluetoothSocketNotifierPrivateDataPtr& privData);
45         JSObjectRef toBluetoothDevices(const std::vector<TizenApis::Api::Bluetooth::BluetoothDeviceData>& devices);
46         JSObjectRef toBluetoothByteArray(std::vector<char>& data);
47         unsigned short toBluetoothSecurityLevelInt(JSValueRef level);
48         JSValueRef toBluetoothSecurityLevelJSValueRef(unsigned short level);
49         std::string toBluetoothDeviceAddress(JSValueRef deviceAddress);
50         std::string toBluetoothUUIDString(JSValueRef uuidString);
51         JSValueRef toBluetoothProtocolJSValue(unsigned short int protocol);
52         JSValueRef toBluetoothStateJSValue(unsigned short int state);
53 };
54 }
55 }
56
57 #endif
58