fixed build error.
[platform/framework/native/bluetooth.git] / inc / FNetBtBluetoothHealth.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 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 /**
19  * @file    FNetBtBluetoothHealth.h
20  * @brief   This is the header file for the %BluetoothHealth class.
21  *
22  * This header file contains the declarations of the %BluetoothHealth class.
23  */
24 #ifndef _FNET_BT_BLUETOOTH_HEALTH_H_
25 #define _FNET_BT_BLUETOOTH_HEALTH_H_
26
27 #include <FBaseObject.h>
28 #include <FBaseResult.h>
29 #include <FNetBtBluetoothTypes.h>
30
31 namespace Tizen { namespace Base
32 {
33 class ByteBuffer;
34 } }
35
36 namespace Tizen { namespace Net { namespace Bluetooth
37 {
38
39 class BluetoothDevice;
40 class IBluetoothHealthEventListener;
41 class _BluetoothHealthImpl;
42
43 /**
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.
47  * @since 2.0
48  *
49  * @final   This class is not intended for extension.
50  *
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.
56  *
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>.
59  *
60  * The following diagram illustrates the interactions between this class and the application.
61  * @image html net_bluetooth_health_sequence_diagram.png
62  */
63 class _OSP_EXPORT_ BluetoothHealth
64         : public Tizen::Base::Object
65 {
66 public:
67         /**
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.
70          *
71          * @since 2.0
72          */
73         BluetoothHealth(void);
74
75         /**
76          * This destructor overrides Tizen::Base::Object::~Object().
77          *
78          * @since 2.0
79          */
80         virtual ~BluetoothHealth(void);
81
82         /**
83          * Constructs an instance of %BluetoothHealth with the specified listener.
84          *
85          * @since 2.0
86          * @feature     %http://tizen.org/feature/network.bluetooth
87          *
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&).
100          */
101         result Construct(IBluetoothHealthEventListener& listener);
102
103         /**
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.
108          *
109          * @since 2.0
110          * @privlevel   public
111          * @privilege   %http://tizen.org/privilege/bluetooth.health
112          *
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
121          *                                      operation. @n
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.
128          */
129         result StartAsSink(int dataType);
130
131         /**
132          * Stops %BluetoothHealth as a role of sink. @n
133          * The %Stop() method disconnects all established channels before stopping %BluetoothHealth.
134          *
135          * @since 2.0
136          * @privlevel   public
137          * @privilege   %http://tizen.org/privilege/bluetooth.health
138          *
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
143          *                                      operation. @n
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.
148          */
149         result Stop(void);
150
151         /**
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.
154          *
155          * @since 2.0
156          * @privlevel   public
157          * @privilege   %http://tizen.org/privilege/bluetooth.health
158          *
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
164          *                                      operation. @n
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()
173          */
174         result ConnectToSource(const BluetoothDevice& remoteDevice);
175
176         /**
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.
180          *
181          * @since 2.0
182          * @privlevel   public
183          * @privilege   %http://tizen.org/privilege/bluetooth.health
184          *
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
192          *                                      operation. @n
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.
197          */
198         result Disconnect(int channelId);
199
200         /**
201          * Sends the specified data on the specified channel.
202          *
203          * @since 2.0
204          * @privlevel   public
205          * @privilege   %http://tizen.org/privilege/bluetooth.health
206          *
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
215          *                                      operation. @n
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()
222          */
223         result SendData(int channelId, const Tizen::Base::ByteBuffer& buffer);
224
225 private:
226         //
227         // The implementation of this copy constructor is intentionally blank to prohibit copying of objects.
228         //
229         BluetoothHealth(const BluetoothHealth& value);
230
231         //
232         // The implementation of this copy assignment operator is intentionally blank to prohibit copying of objects.
233         //
234         BluetoothHealth& operator =(const BluetoothHealth& rhs);
235
236 private:
237         _BluetoothHealthImpl* __pImpl;
238
239 }; // BluetoothHealth
240
241 } } }
242 #endif // _FNET_BT_BLUETOOTH_HEALTH_H_