diff options
Diffstat (limited to 'src/FNetBt_BluetoothDeviceEventArg.h')
-rw-r--r-- | src/FNetBt_BluetoothDeviceEventArg.h | 170 |
1 files changed, 170 insertions, 0 deletions
diff --git a/src/FNetBt_BluetoothDeviceEventArg.h b/src/FNetBt_BluetoothDeviceEventArg.h new file mode 100644 index 0000000..af93a97 --- /dev/null +++ b/src/FNetBt_BluetoothDeviceEventArg.h @@ -0,0 +1,170 @@ +// +// 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_BluetoothDeviceEventArg.h + * @brief This is the header file for the _BluetoothDeviceEventArg class. + * + * This header file contains the declarations of the _BluetoothDeviceEventArg class which includes information to be + * passed to the event listeners + */ +#ifndef _FNET_BT_INTERNAL_BLUETOOTH_DEVICE_EVENT_ARG_H_ +#define _FNET_BT_INTERNAL_BLUETOOTH_DEVICE_EVENT_ARG_H_ + +#include <FBaseObject.h> +#include <FBaseResult.h> +#include <FOspConfig.h> +#include <FBaseRtIEventArg.h> + + +namespace Tizen { namespace Net { namespace Bluetooth +{ + +// Forward declaration +class BluetoothDevice; + +/** + * @enum _BluetoothDeviceEventType + * Type for specifying the type of _BluetoothDeviceEvent + */ +enum _BluetoothDeviceEventType +{ + _BT_DEVICE_EVENT_DISCOVERY_STARTED, /**< For notifying that the device discovery process is started */ + _BT_DEVICE_EVENT_DEVICE_FOUND, /**< For notifying that a new remote device is found */ + _BT_DEVICE_EVENT_DISCOVERY_DONE, /**< For notifying that the device discovery process is done */ + _BT_DEVICE_EVENT_SVCLIST_RECEIVED, /**< For notifying that the service list is received from a remote device */ + _BT_DEVICE_EVENT_PAIRED, /**< For notifying that the local device is newly paired with a remote device */ + _BT_DEVICE_EVENT_UNPAIRED, /**< For notifying that the local device is unpaired with the paired device */ +}; + +/** + * @class _BluetoothDeviceEventArg + * @brief This class is used as an argument for callback methods of the _IBluetoothDeviceEventListener class. + * + * When a _BluetoothDeviceEvent occurs, the _BluetoothDeviceEvent finds a _IBluetoothDeviceEventListener instance + * which is registered for the _BluetoothDeviceEvent and calls an appropriate method of the listener. + * @see _IBluetoothDeviceEventListener + */ +class _BluetoothDeviceEventArg + : public Tizen::Base::Object + , public Tizen::Base::Runtime::IEventArg +{ +public: + /** + * This is a class constructor for _BT_DEVICE_EVENT_DISCOVERY_STARTED event. + * + * @param[in] r The result of the event + * @exception E_SUCCESS The action was successful. + * @exception E_SYSTEM The action failed due to a system error. + */ + _BluetoothDeviceEventArg(result r); + + /** + * This is a class constructor for _BT_DEVICE_EVENT_DISCOVERY_DONE event. + * + * @param[in] isCompleted @c true, if the discovery is completely done @n + * @c false, otherwise + */ + _BluetoothDeviceEventArg(bool isCompleted); + + /** + * This is a class constructor for _BT_DEVICE_EVENT_SVCLIST_RECEIVED event. + * + * @param[in] device The target device which sent its service list + * @param[in] serviceList The service list received from the remote device + * @param[in] r The result of the event + * @exception E_SUCCESS The action was successful. + * @exception E_REMOTE_SERVICE_NOT_FOUND The action failed because the service list of the remote device is not found. + * @exception E_SYSTEM The action failed due to a system error. + */ + _BluetoothDeviceEventArg(const BluetoothDevice& device, unsigned long serviceList, result r); + + /** + * This is a class constructor for _BT_DEVICE_EVENT_DEVICE_FOUND and _BT_DEVICE_EVENT_UNPAIRED event. + * + * @param[in] type The type of the event - only _BT_DEVICE_EVENT_DEVICE_FOUND and + * _BT_DEVICE_EVENT_UNPAIRED are allowed + * @param[in] device The remote device + */ + _BluetoothDeviceEventArg(_BluetoothDeviceEventType type, const BluetoothDevice& device); + + /** + * This is a class constructor for _BT_DEVICE_EVENT_PAIRED. + * + * @param[in] pDevice The paired device + * @param[in] r The result of pairing + * @exception E_SUCCESS The method is successful. + * @exception E_SYSTEM A system error occurred. + */ + _BluetoothDeviceEventArg(const BluetoothDevice* pDevice, result r); + + /** + * This is the class destructor. + */ + ~_BluetoothDeviceEventArg(void); + + /** + * Gets the type of this event. + * + * @return The type of the event + */ + _BluetoothDeviceEventType GetEventType(void) const; + + /** + * Gets the remote device. + * + * @return The pointer of the remote device which is a found device, a paired, or an unpaired device + */ + const BluetoothDevice* GetRemoteDevice(void) const; + + /** + * Checks if the discovery is completely done. + * + * @return @c true, if the discovery is completely done @n + * @c false, otherwise + */ + bool IsDiscoveryCompleted(void) const; + + /** + * Gets the service list retrieved from a remote device. + * + * @return the service list which consists of masked BluetoothServiceType values + */ + unsigned long GetServiceList(void) const; + + /** + * Gets the error result of this event. + * + * @return The result of the event + */ + result GetErrorResult(void) const; + +private: + _BluetoothDeviceEventArg(void); + _BluetoothDeviceEventArg(const _BluetoothDeviceEventArg& eventArg); + _BluetoothDeviceEventArg& operator =(const _BluetoothDeviceEventArg& rValue); + +private: + _BluetoothDeviceEventType __evtType; + BluetoothDevice* __pRemoteDevice; + bool __isCompleted; + unsigned long __serviceList; + result __result; + +}; // _BluetoothDeviceEventArg + +} } } +#endif // _FNET_BT_INTERNAL_BLUETOOTH_DEVICE_EVENT_ARG_H_ |