// // Open Service Platform // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the License); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // /** * @file FNetBt_BluetoothHealthEventArg.h * @brief This is the header file for the _BluetoothHealthEventArg class. * * This header file contains the declarations of the _BluetoothHealthEventArg class which includes information to be * passed to the event listeners */ #ifndef _FNET_BT_INTERNAL_BLUETOOTH_HEALTH_EVENT_ARG_H_ #define _FNET_BT_INTERNAL_BLUETOOTH_HEALTH_EVENT_ARG_H_ #include #include #include #include // Forward declaration namespace Tizen { namespace Base { class ByteBuffer; } } namespace Tizen { namespace Net { namespace Bluetooth { // Forward declaration class BluetoothDevice; /** * @enum _BluetoothHealthEventType * Type for specifying the type of _BluetoothHealthEvent */ enum _BluetoothHealthEventType { _BT_HEALTH_EVENT_CONNECTED, /**< For notifying that the connection is established */ _BT_HEALTH_EVENT_DISCONNECTED, /**< For notifying that the connection is disconnected */ _BT_HEALTH_EVENT_DATA_RECEIVED, /**< For notifying that the data has been received */ }; /** * @class _BluetoothHealthEventArg * @brief This class is used as an argument for callback methods of the IBluetoothHealthEventListener class. * * When a _BluetoothHealthEvent occurs, the _BluetoothHealthEvent finds a IBluetoothHealthEventListener instance * which is registered for the _BluetoothHealthEvent and calls an appropriate method of the listener. * @see IBluetoothHealthEventListener */ class _BluetoothHealthEventArg : public Tizen::Base::Object , public Tizen::Base::Runtime::IEventArg { public: /** * This is a class constructor for _BT_HEALTH_EVENT_CONNECTED event. * * @param[in] channelId The channel ID of the established connection, @n * else an invalid ID (-1) if the method is not successful * @param[in] dataType dataType represents the type of health device (eg thermometer, BP device) * and is defined in ISO/IEEE 11073-20601 standard * @param[in] channelType The data channel type of the established connection * @param[in] pRemoteDevice The remote health device which the local device connects with, @n * else @c null if the method is not successful * @param[in] r The result of the connection request * @exception E_SUCCESS The connection request is accepted by the target health device. * @exception E_REJECTED The connection request is rejected by the target health device. * @exception E_TIMEOUT The connection request has timed out. * @exception E_OPERATION_FAILED The connection request has failed. */ _BluetoothHealthEventArg(int channelId, int dataType, BluetoothHealthDataChannelType channelType, const BluetoothDevice* pDevice, result r); /** * This is a class constructor for _BT_HEALTH_EVENT_DISCONNECTED event. * * @param[in] channelId The channel ID of the terminated connection * @param[in] r The disconnection status * @exception E_SUCCESS The specified connection (channel) is terminated successfully. * @exception E_OPERATION_FAILED The method has failed to disconnect. */ _BluetoothHealthEventArg(int channelId, result r); /** * This is a class constructor for _BT_HEALTH_EVENT_DATA_RECEIVED event. * * @param[in] channelId The channel ID of the conneciton which data is received on * @param[in] buffer The received data */ _BluetoothHealthEventArg(int channelId, const Tizen::Base::ByteBuffer& buffer); /** * This is the class destructor. */ ~_BluetoothHealthEventArg(void); /** * Gets the type of this event. * * @return The type of the event */ _BluetoothHealthEventType GetEventType(void) const; /** * Gets the socket client device. * * @return The pointer of the source device which is connect with */ const BluetoothDevice* GetSourceDevice(void) const; /** * Gets the channel ID. * * @return The channel ID */ int GetChannelId(void) const; /** * Gets the Data Type. * * @return The Data Type */ int GetDataType(void) const; /** * Gets the data channel type. * * @return The data channel type */ BluetoothHealthDataChannelType GetChannelType(void) const; /** * Gets the error result of this event. * * @return The result of the event */ result GetErrorResult(void) const; /** * Gets The received data. * * @return The received data */ Tizen::Base::ByteBuffer* GetReceivedData(void) const; private: _BluetoothHealthEventArg(void); _BluetoothHealthEventArg(const _BluetoothHealthEventArg& eventArg); _BluetoothHealthEventArg& operator =(const _BluetoothHealthEventArg& rValue); private: _BluetoothHealthEventType __evtType; BluetoothDevice* __pTargetDevice; int __channelId; int __dataType; BluetoothHealthDataChannelType __channelType; result __result; Tizen::Base::ByteBuffer* __pData; }; // _BluetoothHealthEventArg } } } #endif // _FNET_BT_INTERNAL_BLUETOOTH_HEALTH_EVENT_ARG_H_