2 // Open Service Platform
3 // Copyright (c) 2012-2013 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.
19 * @file FNetBtBluetoothHealth.h
20 * @brief This is the header file for the %BluetoothHealth class.
22 * This header file contains the declarations of the %BluetoothHealth class.
24 #ifndef _FNET_BT_BLUETOOTH_HEALTH_H_
25 #define _FNET_BT_BLUETOOTH_HEALTH_H_
27 #include <FBaseObject.h>
28 #include <FBaseResult.h>
29 #include <FNetBtBluetoothTypes.h>
31 namespace Tizen { namespace Base
36 namespace Tizen { namespace Net { namespace Bluetooth
39 class BluetoothDevice;
40 class IBluetoothHealthEventListener;
41 class _BluetoothHealthImpl;
44 * @class BluetoothHealth
45 * @brief This class provides the methods to handle the %Bluetooth Health Device Profile (HDP), such as the
46 * establishing a connection and exchanging data through the data channel.
49 * @final This class is not intended for extension.
51 * This %BluetoothHealth class provides the methods to handle the %Bluetooth Health Device Profile (HDP), which is a
52 * profile that defines the requirements for qualified %Bluetooth healthcare and fitness (referred to as 'health')
53 * device implementations. @n
54 * This class allows Sink device such as mobile phone to establish a connection and exchange data to Source devices
55 * such as blood pressure monitors, weight scales, glucose meters, thermometers, and pulse oximeters.
57 * For more information on the class features, see
58 * <a href="../org.tizen.native.appprogramming/html/guide/net/bluetooth_namespace.htm">Bluetooth Guide</a>.
60 class _OSP_EXPORT_ BluetoothHealth
61 : public Tizen::Base::Object
65 * The object is not fully constructed after this constructor is called. For full construction, the Construct()
66 * method must be called right after calling this constructor.
70 BluetoothHealth(void);
73 * This destructor overrides Tizen::Base::Object::~Object().
77 virtual ~BluetoothHealth(void);
80 * Constructs an instance of %BluetoothHealth with the specified listener.
83 * @feature %http://tizen.org/feature/network.bluetooth
85 * @return An error code
86 * @param[in] listener The event listener for the %BluetoothHealth @n
87 * The specified listener must be allocated at heap, not stack.
88 * @exception E_SUCCESS The method is successful.
89 * @exception E_OUT_OF_MEMORY The memory is insufficient.
90 * @exception E_UNSUPPORTED_OPERATION The Emulator or target device does not support the required feature.
91 * For more information, see
92 * <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">
93 * Application Filtering</a>.
94 * @exception E_OPERATION_FAILED The method has failed.
95 * @remarks Before calling this method, check whether the feature is supported by %Tizen::System::SystemInfo::GetValue()
98 result Construct(IBluetoothHealthEventListener& listener);
101 * Starts %Bluetooth health as a role of sink with the specified data type. @n
102 * One %BluetoothHealth instance supports only a sink role with the specific data type at one time and only one
103 * sink role for the specific data type can be enabled system-widely. @n
104 * For providing sink roles with various data types, make multiple %BluetoothHealth instances with different data types.
108 * @privilege %http://tizen.org/privilege/bluetooth.health
110 * @return An error code
111 * @param[in] dataType The type of data used in communication which is defined in ISO/IEEE
112 * 11073-20601 and represents type of health device such as thermometer,
113 * heart rate monitor, weight scale, and so on
114 * @exception E_SUCCESS The method is successful.
115 * @exception E_INVALID_STATE %Bluetooth is not activated.
116 * @exception E_IN_PROGRESS The sink role with the specified data type has already started.
117 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
119 * For example, the sink role already started with another data type.
120 * @exception E_SERVICE_UNAVAILABLE The sink role with the specified data type is currently busy with another
121 * instance or application.
122 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
123 * @exception E_OPERATION_FAILED The method has failed.
125 result StartAsSink(int dataType);
128 * Stops %Bluetooth health as a role of sink. @n
129 * The %Stop() method disconnects all established channels before stop.
133 * @privilege %http://tizen.org/privilege/bluetooth.health
135 * @return An error code
136 * @exception E_SUCCESS The method is successful.
137 * @exception E_INVALID_STATE %Bluetooth is not activated.
138 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
140 * For example, the sink role is not started yet.
141 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
142 * @exception E_OPERATION_FAILED The method has failed.
147 * Connects to a new channel with a remote health device which has source role. @n
148 * The %ConnectToSource() method establishes a channel after the source device accepts the request.
152 * @privilege %http://tizen.org/privilege/bluetooth.health
154 * @return An error code
155 * @param[in] remoteDevice The remote device to connect
156 * @exception E_SUCCESS The method is successful.
157 * @exception E_INVALID_STATE %Bluetooth is not activated.
158 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
160 * For example, the sink role is not started yet.
161 * @exception E_DEVICE_BUSY The pairing and connection process is in progress.
162 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
163 * @exception E_OPERATION_FAILED The method has failed.
164 * @remarks If the local device is not paired with the specified target device, the pairing process starts
165 * internally before the connect request is sent.
166 * @see IBluetoothHealthEventListener::OnHealthConnected()
168 result ConnectToSource(const BluetoothDevice& remoteDevice);
171 * Disconnects the connection which has the specified channel ID. @n
172 * After calling the %Disconnect() method, the IBluetoothHealthEventListener::OnHealthDisconnected() method is called regardless of
173 * whether this method is called during connection or before connection is established.
177 * @privilege %http://tizen.org/privilege/bluetooth.health
179 * @return An error code
180 * @param[in] channelId The ID of the specified channel to disconnect @n
181 * The ID can be obtained by IBluetoothHealthEventListener::OnHealthConnected()
182 * after the specific channel is established.
183 * @exception E_SUCCESS The method is successful.
184 * @exception E_INVALID_STATE %Bluetooth is not activated.
185 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
187 * For example, there is no connection with the specified channel ID.
188 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
189 * @exception E_OPERATION_FAILED The method has failed.
191 result Disconnect(int channelId);
194 * Sends the specified data on the specified channel.
198 * @privilege %http://tizen.org/privilege/bluetooth.health
200 * @return An error code
201 * @param[in] channelId The ID of the specified channel on which the data is sent @n
202 * The ID can be obtained by IBluetoothHealthEventListener::OnHealthConnected()
203 * after the specific channel is established.
204 * @param[in] buffer The data to send
205 * @exception E_SUCCESS The method is successful.
206 * @exception E_INVALID_STATE %Bluetooth is not activated.
207 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
209 * For example, there is no connection with the specified channel ID.
210 * @exception E_INVALID_ARG The input buffer has no data.
211 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
212 * @exception E_OPERATION_FAILED The operation has failed.
213 * @see IBluetoothHealthEventListener::OnHealthDataReceived()
215 result SendData(int channelId, const Tizen::Base::ByteBuffer& buffer);
219 // The implementation of this copy constructor is intentionally blank to prohibit copying of objects.
221 BluetoothHealth(const BluetoothHealth& value);
224 // The implementation of this copy assignment operator is intentionally blank to prohibit copying of objects.
226 BluetoothHealth& operator =(const BluetoothHealth& rhs);
229 _BluetoothHealthImpl* __pImpl;
231 }; // BluetoothHealth
234 #endif // _FNET_BT_BLUETOOTH_HEALTH_H_