Apply reviewed header files.
[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 the methods to handle the %Bluetooth Health Device Profile (HDP), such as the
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 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.
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 class _OSP_EXPORT_ BluetoothHealth
61         : public Tizen::Base::Object
62 {
63 public:
64         /**
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.
67          *
68          * @since 2.0
69          */
70         BluetoothHealth(void);
71
72         /**
73          * This destructor overrides Tizen::Base::Object::~Object().
74          *
75          * @since 2.0
76          */
77         virtual ~BluetoothHealth(void);
78
79         /**
80          * Constructs an instance of %BluetoothHealth with the specified listener.
81          *
82          * @since 2.0
83          * @feature     %http://tizen.org/feature/network.bluetooth
84          *
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()
96          *              methods.
97          */
98         result Construct(IBluetoothHealthEventListener& listener);
99
100         /**
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.
105          *
106          * @since 2.0
107          * @privlevel   public
108          * @privilege   %http://tizen.org/privilege/bluetooth.health
109          *
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
118          *                                      operation. @n
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.
124          */
125         result StartAsSink(int dataType);
126
127         /**
128          * Stops %Bluetooth health as a role of sink. @n
129          * The %Stop() method disconnects all established channels before stop.
130          *
131          * @since 2.0
132          * @privlevel   public
133          * @privilege   %http://tizen.org/privilege/bluetooth.health
134          *
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
139          *                                      operation. @n
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.
143          */
144         result Stop(void);
145
146         /**
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.
149          *
150          * @since 2.0
151          * @privlevel   public
152          * @privilege   %http://tizen.org/privilege/bluetooth.health
153          *
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
159          *                                      operation. @n
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()
167          */
168         result ConnectToSource(const BluetoothDevice& remoteDevice);
169
170         /**
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.
174          *
175          * @since 2.0
176          * @privlevel   public
177          * @privilege   %http://tizen.org/privilege/bluetooth.health
178          *
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
186          *                                      operation. @n
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.
190          */
191         result Disconnect(int channelId);
192
193         /**
194          * Sends the specified data on the specified channel.
195          *
196          * @since 2.0
197          * @privlevel   public
198          * @privilege   %http://tizen.org/privilege/bluetooth.health
199          *
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
208          *                                      operation. @n
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()
214          */
215         result SendData(int channelId, const Tizen::Base::ByteBuffer& buffer);
216
217 private:
218         //
219         // The implementation of this copy constructor is intentionally blank to prohibit copying of objects.
220         //
221         BluetoothHealth(const BluetoothHealth& value);
222
223         //
224         // The implementation of this copy assignment operator is intentionally blank to prohibit copying of objects.
225         //
226         BluetoothHealth& operator =(const BluetoothHealth& rhs);
227
228 private:
229         _BluetoothHealthImpl* __pImpl;
230
231 }; // BluetoothHealth
232
233 } } }
234 #endif // _FNET_BT_BLUETOOTH_HEALTH_H_