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 methods to handle the %Bluetooth Health Device Profile (HDP), such as
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 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 a sink device such as a 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 * The following diagram illustrates the interactions between this class and the application.
61 * @image html net_bluetooth_health_sequence_diagram.png
63 class _OSP_EXPORT_ BluetoothHealth
64 : public Tizen::Base::Object
68 * The object is not fully constructed after this constructor is called. @n
69 * For full construction, the Construct() method must be called right after calling this constructor.
73 BluetoothHealth(void);
76 * This destructor overrides Tizen::Base::Object::~Object().
80 virtual ~BluetoothHealth(void);
83 * Constructs an instance of %BluetoothHealth with the specified listener.
86 * @feature %http://tizen.org/feature/network.bluetooth
88 * @return An error code
89 * @param[in] listener The event listener for %BluetoothHealth @n
90 * The specified listener must be allocated at heap, not stack.
91 * @exception E_SUCCESS The method is successful.
92 * @exception E_OUT_OF_MEMORY The memory is insufficient.
93 * @exception E_UNSUPPORTED_OPERATION The Emulator or target device does not support the required feature.
94 * For more information, see
95 * <a href="../org.tizen.gettingstarted/html/tizen_overview/application_filtering.htm">
96 * Application Filtering</a>.
97 * @exception E_OPERATION_FAILED The method has failed.
98 * @remarks Before calling this method, check whether the feature is supported by
99 * Tizen::System::SystemInfo::GetValue(const Tizen::Base::String&, bool&).
101 result Construct(IBluetoothHealthEventListener& listener);
104 * Starts %BluetoothHealth as a role of sink with the specified data type. @n
105 * One %BluetoothHealth instance supports only one sink role with the specific data type at one time and only one
106 * sink role for the specific data type can be enabled system-wide. @n
107 * For providing sink roles with various data types, make multiple %BluetoothHealth instances with different data types.
111 * @privilege %http://tizen.org/privilege/bluetooth.health
113 * @return An error code
114 * @param[in] dataType The type of data used in communication which is defined in ISO/IEEE
115 * 11073-20601 and represents the type of health device such as thermometer,
116 * heart rate monitor, weight scale, and so on
117 * @exception E_SUCCESS The method is successful.
118 * @exception E_INVALID_STATE %Bluetooth is not activated.
119 * @exception E_IN_PROGRESS The sink role with the specified data type has already started.
120 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
122 * For example, the sink role has already started with another data type.
123 * @exception E_SERVICE_UNAVAILABLE The sink role with the specified data type is currently busy with another
124 * instance or application.
125 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
126 * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
127 * @exception E_OPERATION_FAILED The method has failed.
129 result StartAsSink(int dataType);
132 * Stops %BluetoothHealth as a role of sink. @n
133 * The %Stop() method disconnects all established channels before stopping %BluetoothHealth.
137 * @privilege %http://tizen.org/privilege/bluetooth.health
139 * @return An error code
140 * @exception E_SUCCESS The method is successful.
141 * @exception E_INVALID_STATE %Bluetooth is not activated.
142 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
144 * For example, the sink role is not started yet.
145 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
146 * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
147 * @exception E_OPERATION_FAILED The method has failed.
152 * Connects to a new channel with a remote health device which has a source role. @n
153 * The %ConnectToSource() method establishes a channel after the source device accepts the request.
157 * @privilege %http://tizen.org/privilege/bluetooth.health
159 * @return An error code
160 * @param[in] remoteDevice The remote device to connect
161 * @exception E_SUCCESS The method is successful.
162 * @exception E_INVALID_STATE %Bluetooth is not activated.
163 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
165 * For example, the sink role is not started yet.
166 * @exception E_DEVICE_BUSY The pairing and connection process is in progress.
167 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
168 * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
169 * @exception E_OPERATION_FAILED The method has failed.
170 * @remarks If the local device is not paired with the specified target device, the pairing process starts
171 * internally before the connection request is sent.
172 * @see IBluetoothHealthEventListener::OnHealthConnected()
174 result ConnectToSource(const BluetoothDevice& remoteDevice);
177 * Disconnects the connection which has the specified channel ID. @n
178 * After calling the %Disconnect() method, the IBluetoothHealthEventListener::OnHealthDisconnected() method is called regardless of
179 * whether this method is called during the connection or before the connection is established.
183 * @privilege %http://tizen.org/privilege/bluetooth.health
185 * @return An error code
186 * @param[in] channelId The ID of the specified channel to disconnect @n
187 * The ID can be obtained by the IBluetoothHealthEventListener::OnHealthConnected()
188 * method after the specific channel is established.
189 * @exception E_SUCCESS The method is successful.
190 * @exception E_INVALID_STATE %Bluetooth is not activated.
191 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
193 * For example, there is no connection with the specified channel ID.
194 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
195 * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
196 * @exception E_OPERATION_FAILED The method has failed.
198 result Disconnect(int channelId);
201 * Sends the specified data on the specified channel.
205 * @privilege %http://tizen.org/privilege/bluetooth.health
207 * @return An error code
208 * @param[in] channelId The ID of the specified channel on which the data is sent @n
209 * The ID can be obtained by the IBluetoothHealthEventListener::OnHealthConnected()
210 * method after the specific channel is established.
211 * @param[in] buffer The data to send
212 * @exception E_SUCCESS The method is successful.
213 * @exception E_INVALID_STATE %Bluetooth is not activated.
214 * @exception E_INVALID_OPERATION The current state of the instance prohibits the execution of the specified
216 * For example, there is no connection with the specified channel ID.
217 * @exception E_INVALID_ARG The input buffer has no data.
218 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
219 * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method. @b Since: @b 2.1
220 * @exception E_OPERATION_FAILED The operation has failed.
221 * @see IBluetoothHealthEventListener::OnHealthDataReceived()
223 result SendData(int channelId, const Tizen::Base::ByteBuffer& buffer);
227 // The implementation of this copy constructor is intentionally blank to prohibit copying of objects.
229 BluetoothHealth(const BluetoothHealth& value);
232 // The implementation of this copy assignment operator is intentionally blank to prohibit copying of objects.
234 BluetoothHealth& operator =(const BluetoothHealth& rhs);
237 _BluetoothHealthImpl* __pImpl;
239 }; // BluetoothHealth
242 #endif // _FNET_BT_BLUETOOTH_HEALTH_H_