2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #ifndef __TIZEN_BLUETOOTH_CALLBACK_UTIL_H__
19 #define __TIZEN_BLUETOOTH_CALLBACK_UTIL_H__
22 #include <JavaScriptCore/JavaScript.h>
23 #include <MultiCallbackUserData.h>
24 #include <PlatformException.h>
31 class BluetoothCallbackUserData
43 BluetoothCallbackUserData(DeviceAPI::Common::MultiCallbackUserDataPtr userData, callbackTypeE type)
49 BluetoothCallbackUserData(DeviceAPI::Common::MultiCallbackUserDataPtr userData, Common::BasePlatformException *error)
53 mCBType = BT_CB_ERROR;
56 BluetoothCallbackUserData(DeviceAPI::Common::MultiCallbackUserDataPtr userData, std::string &uuid, std::string &name)
59 mCBType = BT_CB_SERVICE;
64 BluetoothCallbackUserData(DeviceAPI::Common::MultiCallbackUserDataPtr userData, std::string &address)
67 mCBType = BT_CB_DEVICE;
71 virtual ~BluetoothCallbackUserData()
73 if(mCBType == BT_CB_ERROR)
78 callbackTypeE mCBType;
79 DeviceAPI::Common::MultiCallbackUserDataPtr mUserData;
80 Common::BasePlatformException *mError;
86 typedef BluetoothCallbackUserData* BluetoothCallbackUserDataPtr;
89 class BluetoothCallbackUtil
92 static void syncToAsyncSuccessCallback(DeviceAPI::Common::MultiCallbackUserDataPtr userData);
93 static void syncToAsyncErrorCallback(DeviceAPI::Common::MultiCallbackUserDataPtr userData, Common::BasePlatformException *error);
94 static void syncToAsyncDeviceCallback(DeviceAPI::Common::MultiCallbackUserDataPtr userData, std::string &address);
95 static void syncToAsyncDeviceArrayCallback(DeviceAPI::Common::MultiCallbackUserDataPtr userData);
96 static void syncToAsyncServiceCallback(DeviceAPI::Common::MultiCallbackUserDataPtr userData, std::string &uuid, std::string &name);
105 #endif // __TIZEN_BLUETOOTH_CALLBACK_UTIL_H__