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.
18 * @file FNetBt_BluetoothHealthEventArg.h
19 * @brief This is the header file for the _BluetoothHealthEventArg class.
21 * This header file contains the declarations of the _BluetoothHealthEventArg class which includes information to be
22 * passed to the event listeners
24 #ifndef _FNET_BT_INTERNAL_BLUETOOTH_HEALTH_EVENT_ARG_H_
25 #define _FNET_BT_INTERNAL_BLUETOOTH_HEALTH_EVENT_ARG_H_
27 #include <FBaseObject.h>
28 #include <FBaseResult.h>
29 #include <FBaseRtIEventArg.h>
30 #include <FNetBtBluetoothTypes.h>
32 // Forward declaration
33 namespace Tizen { namespace Base {
37 namespace Tizen { namespace Net { namespace Bluetooth
40 // Forward declaration
41 class BluetoothDevice;
44 * @enum _BluetoothHealthEventType
45 * Type for specifying the type of _BluetoothHealthEvent
47 enum _BluetoothHealthEventType
49 _BT_HEALTH_EVENT_CONNECTED, /**< For notifying that the connection is established */
50 _BT_HEALTH_EVENT_DISCONNECTED, /**< For notifying that the connection is disconnected */
51 _BT_HEALTH_EVENT_DATA_RECEIVED, /**< For notifying that the data has been received */
55 * @class _BluetoothHealthEventArg
56 * @brief This class is used as an argument for callback methods of the IBluetoothHealthEventListener class.
58 * When a _BluetoothHealthEvent occurs, the _BluetoothHealthEvent finds a IBluetoothHealthEventListener instance
59 * which is registered for the _BluetoothHealthEvent and calls an appropriate method of the listener.
60 * @see IBluetoothHealthEventListener
62 class _BluetoothHealthEventArg
63 : public Tizen::Base::Object
64 , public Tizen::Base::Runtime::IEventArg
68 * This is a class constructor for _BT_HEALTH_EVENT_CONNECTED event.
70 * @param[in] channelId The channel ID of the established connection, @n
71 * else an invalid ID (-1) if the method is not successful
72 * @param[in] dataType dataType represents the type of health device (eg thermometer, BP device)
73 * and is defined in ISO/IEEE 11073-20601 standard
74 * @param[in] channelType The data channel type of the established connection
75 * @param[in] pRemoteDevice The remote health device which the local device connects with, @n
76 * else @c null if the method is not successful
77 * @param[in] r The result of the connection request
78 * @exception E_SUCCESS The connection request is accepted by the target health device.
79 * @exception E_REJECTED The connection request is rejected by the target health device.
80 * @exception E_TIMEOUT The connection request has timed out.
81 * @exception E_OPERATION_FAILED The connection request has failed.
83 _BluetoothHealthEventArg(int channelId, int dataType, BluetoothHealthDataChannelType channelType,
84 const BluetoothDevice* pDevice, result r);
87 * This is a class constructor for _BT_HEALTH_EVENT_DISCONNECTED event.
89 * @param[in] channelId The channel ID of the terminated connection
90 * @param[in] r The disconnection status
91 * @exception E_SUCCESS The specified connection (channel) is terminated successfully.
92 * @exception E_OPERATION_FAILED The method has failed to disconnect.
94 _BluetoothHealthEventArg(int channelId, result r);
97 * This is a class constructor for _BT_HEALTH_EVENT_DATA_RECEIVED event.
99 * @param[in] channelId The channel ID of the conneciton which data is received on
100 * @param[in] buffer The received data
102 _BluetoothHealthEventArg(int channelId, const Tizen::Base::ByteBuffer& buffer);
105 * This is the class destructor.
107 ~_BluetoothHealthEventArg(void);
110 * Gets the type of this event.
112 * @return The type of the event
114 _BluetoothHealthEventType GetEventType(void) const;
117 * Gets the socket client device.
119 * @return The pointer of the source device which is connect with
121 const BluetoothDevice* GetSourceDevice(void) const;
124 * Gets the channel ID.
126 * @return The channel ID
128 int GetChannelId(void) const;
131 * Gets the Data Type.
133 * @return The Data Type
135 int GetDataType(void) const;
138 * Gets the data channel type.
140 * @return The data channel type
142 BluetoothHealthDataChannelType GetChannelType(void) const;
145 * Gets the error result of this event.
147 * @return The result of the event
149 result GetErrorResult(void) const;
152 * Gets The received data.
154 * @return The received data
156 Tizen::Base::ByteBuffer* GetReceivedData(void) const;
159 _BluetoothHealthEventArg(void);
160 _BluetoothHealthEventArg(const _BluetoothHealthEventArg& eventArg);
161 _BluetoothHealthEventArg& operator =(const _BluetoothHealthEventArg& rValue);
164 _BluetoothHealthEventType __evtType;
165 BluetoothDevice* __pTargetDevice;
168 BluetoothHealthDataChannelType __channelType;
170 Tizen::Base::ByteBuffer* __pData;
172 }; // _BluetoothHealthEventArg
175 #endif // _FNET_BT_INTERNAL_BLUETOOTH_HEALTH_EVENT_ARG_H_