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_HEALTH_PROFILE_HANDLER_H__
19 #define __TIZEN_HEALTH_PROFILE_HANDLER_H__
25 #include <JavaScriptCore/JavaScript.h>
27 #include <MultiCallbackUserData.h>
28 #include <PlatformException.h>
29 #include <bluetooth.h>
31 #include "BluetoothHealthChannel.h"
32 #include "BluetoothHealthApplication.h"
33 #include "BluetoothDevice.h"
42 HealthConnReq(BluetoothDeviceSharedPtr remoteDevice, Common::MultiCallbackUserDataPtr userData)
44 mRemoteDevice = remoteDevice;
48 BluetoothDeviceSharedPtr mRemoteDevice;
49 Common::MultiCallbackUserDataPtr mUserData;
51 typedef HealthConnReq* HealthConnReqPtr;
53 class BluetoothHealthProfileHandler : public Common::SecurityAccessor
56 static BluetoothHealthProfileHandler* getInstance();
57 void registerSinkApp(unsigned short dataType, std::string name, Common::MultiCallbackUserDataPtr callback);
58 void returnRegisteringSinkAppResult(unsigned short dataType, std::string name, Common::MultiCallbackUserDataPtr callback);
59 // void unregisterSinkApplication(JSObjectRef appObj, Common::MultiCallbackUserDataPtr callback);
60 // void returnUnregisteringResult(JSObjectRef appObj, Common::MultiCallbackUserDataPtr callback);
61 void unregisterApp(std::string appID, Common::MultiCallbackUserDataPtr callback);
62 void returnUnregisteringAppResult(std::string appID, Common::MultiCallbackUserDataPtr callback);
63 void connectToSource(JSObjectRef remoteDeviceObj, JSObjectRef appObj, Common::MultiCallbackUserDataPtr callback);
66 BluetoothHealthProfileHandler();
67 virtual ~BluetoothHealthProfileHandler();
69 static void onConnected(int result, const char *remote_address, const char *app_id,
70 bt_hdp_channel_type_e type, unsigned int channel, void *userData);
71 static void onDisconnected(int result, const char *remote_address, unsigned int channel, void *userData);
72 static void onDataReceivedCB(unsigned int channel, const char *data, unsigned int size, void *userData);
74 typedef std::map<BluetoothHealthApplicationSharedPtr, HealthConnReqPtr> HealthConnReqMapT;
75 typedef std::map<unsigned int, BluetoothHealthChannelPtr> HealthConnectedSocketMapT; // <channel, BluetoothHealthChannelPtr>
76 typedef std::map<std::string, BluetoothHealthApplicationSharedPtr> RegisteredHealthAppMapT; // <app_id, BluetoothHealthApplicationSharedPtr>
79 HealthConnReqMapT mHealthConnReqMap;
80 HealthConnectedSocketMapT mConnectedSocketMap;
81 RegisteredHealthAppMapT mRegisteredHealthAppMap;
84 typedef BluetoothHealthProfileHandler* HealthProfileHandlerPtr;
89 #endif // __TIZEN_HEALTH_PROFILE_HANDLER_H__