Update change log and spec for wrt-plugins-tizen_0.4.70
[framework/web/wrt-plugins-tizen.git] / src / Bluetooth / BluetoothHealthChannel.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18 #ifndef __TIZEN_BLUETOOTH_HEALTH_CHANNEL_H__
19 #define __TIZEN_BLUETOOTH_HEALTH_CHANNEL_H__
20
21 #include <string>
22 #include <bluetooth.h>
23 #include <JavaScriptCore/JavaScript.h>
24 #include <Security.h>
25 #include <MultiCallbackUserData.h>
26 #include "BluetoothDevice.h"
27 #include "BluetoothHealthApplication.h"
28
29 namespace DeviceAPI {
30 namespace Bluetooth {
31
32 class BluetoothHealthChannel : public Common::SecurityAccessor
33 {
34 public:
35     BluetoothHealthChannel(unsigned int channel, BluetoothDeviceSharedPtr remoteDevice, bt_hdp_channel_type_e type, BluetoothHealthApplicationSharedPtr application);
36     virtual ~BluetoothHealthChannel();
37
38     bool getConnectionState() const;
39     void setConnectionState(bool isConnected);
40     unsigned int getChannel() const;
41     std::string getChannelTypeStr() const;
42     bt_hdp_channel_type_e getChannelType() const;
43     JSValueRef getApp(JSContextRef context);
44     JSValueRef getPeer(JSContextRef context);    
45     Common::MultiCallbackUserDataPtr getListener() const;
46     
47     unsigned long sendData(char* data, unsigned long size);
48     void close();
49     void setListener(Common::MultiCallbackUserDataPtr callback);
50     void unsetListener();    
51
52 private:
53     unsigned int mChannel;
54     bool mIsConnected;
55     std::string mChannelTypeStr;
56     bt_hdp_channel_type_e mChannelType;
57     BluetoothDeviceSharedPtr mRemoteDevice;
58     BluetoothHealthApplicationSharedPtr mApp;
59
60     Common::MultiCallbackUserDataPtr mListener;
61 };
62
63 typedef BluetoothHealthChannel* BluetoothHealthChannelPtr;
64
65 } // Bluetooth
66 } // DeviceAPI
67
68 #endif // __TIZEN_BLUETOOTH_HEALTH_CHANNEL_H__