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_BluetoothDeviceEventArg.h
19 * @brief This is the header file for the _BluetoothDeviceEventArg class.
21 * This header file contains the declarations of the _BluetoothDeviceEventArg class which includes information to be
22 * passed to the event listeners
24 #ifndef _FNET_BT_INTERNAL_BLUETOOTH_DEVICE_EVENT_ARG_H_
25 #define _FNET_BT_INTERNAL_BLUETOOTH_DEVICE_EVENT_ARG_H_
27 #include <FBaseObject.h>
28 #include <FBaseResult.h>
29 #include <FOspConfig.h>
30 #include <FBaseRtIEventArg.h>
33 namespace Tizen { namespace Net { namespace Bluetooth
36 // Forward declaration
37 class BluetoothDevice;
40 * @enum _BluetoothDeviceEventType
41 * Type for specifying the type of _BluetoothDeviceEvent
43 enum _BluetoothDeviceEventType
45 _BT_DEVICE_EVENT_DISCOVERY_STARTED, /**< For notifying that the device discovery process is started */
46 _BT_DEVICE_EVENT_DEVICE_FOUND, /**< For notifying that a new remote device is found */
47 _BT_DEVICE_EVENT_DISCOVERY_DONE, /**< For notifying that the device discovery process is done */
48 _BT_DEVICE_EVENT_SVCLIST_RECEIVED, /**< For notifying that the service list is received from a remote device */
49 _BT_DEVICE_EVENT_PAIRED, /**< For notifying that the local device is newly paired with a remote device */
50 _BT_DEVICE_EVENT_UNPAIRED, /**< For notifying that the local device is unpaired with the paired device */
54 * @class _BluetoothDeviceEventArg
55 * @brief This class is used as an argument for callback methods of the _IBluetoothDeviceEventListener class.
57 * When a _BluetoothDeviceEvent occurs, the _BluetoothDeviceEvent finds a _IBluetoothDeviceEventListener instance
58 * which is registered for the _BluetoothDeviceEvent and calls an appropriate method of the listener.
59 * @see _IBluetoothDeviceEventListener
61 class _BluetoothDeviceEventArg
62 : public Tizen::Base::Object
63 , public Tizen::Base::Runtime::IEventArg
67 * This is a class constructor for _BT_DEVICE_EVENT_DISCOVERY_STARTED event.
69 * @param[in] r The result of the event
70 * @exception E_SUCCESS The action was successful.
71 * @exception E_SYSTEM The action failed due to a system error.
73 _BluetoothDeviceEventArg(result r);
76 * This is a class constructor for _BT_DEVICE_EVENT_DISCOVERY_DONE event.
78 * @param[in] isCompleted @c true, if the discovery is completely done @n
81 _BluetoothDeviceEventArg(bool isCompleted);
84 * This is a class constructor for _BT_DEVICE_EVENT_SVCLIST_RECEIVED event.
86 * @param[in] device The target device which sent its service list
87 * @param[in] serviceList The service list received from the remote device
88 * @param[in] r The result of the event
89 * @exception E_SUCCESS The action was successful.
90 * @exception E_REMOTE_SERVICE_NOT_FOUND The action failed because the service list of the remote device is not found.
91 * @exception E_SYSTEM The action failed due to a system error.
93 _BluetoothDeviceEventArg(const BluetoothDevice& device, unsigned long serviceList, result r);
96 * This is a class constructor for _BT_DEVICE_EVENT_DEVICE_FOUND and _BT_DEVICE_EVENT_UNPAIRED event.
98 * @param[in] type The type of the event - only _BT_DEVICE_EVENT_DEVICE_FOUND and
99 * _BT_DEVICE_EVENT_UNPAIRED are allowed
100 * @param[in] device The remote device
102 _BluetoothDeviceEventArg(_BluetoothDeviceEventType type, const BluetoothDevice& device);
105 * This is a class constructor for _BT_DEVICE_EVENT_PAIRED.
107 * @param[in] pDevice The paired device
108 * @param[in] r The result of pairing
109 * @exception E_SUCCESS The method is successful.
110 * @exception E_SYSTEM A system error occurred.
112 _BluetoothDeviceEventArg(const BluetoothDevice* pDevice, result r);
115 * This is the class destructor.
117 ~_BluetoothDeviceEventArg(void);
120 * Gets the type of this event.
122 * @return The type of the event
124 _BluetoothDeviceEventType GetEventType(void) const;
127 * Gets the remote device.
129 * @return The pointer of the remote device which is a found device, a paired, or an unpaired device
131 const BluetoothDevice* GetRemoteDevice(void) const;
134 * Checks if the discovery is completely done.
136 * @return @c true, if the discovery is completely done @n
137 * @c false, otherwise
139 bool IsDiscoveryCompleted(void) const;
142 * Gets the service list retrieved from a remote device.
144 * @return the service list which consists of masked BluetoothServiceType values
146 unsigned long GetServiceList(void) const;
149 * Gets the error result of this event.
151 * @return The result of the event
153 result GetErrorResult(void) const;
156 _BluetoothDeviceEventArg(void);
157 _BluetoothDeviceEventArg(const _BluetoothDeviceEventArg& eventArg);
158 _BluetoothDeviceEventArg& operator =(const _BluetoothDeviceEventArg& rValue);
161 _BluetoothDeviceEventType __evtType;
162 BluetoothDevice* __pRemoteDevice;
164 unsigned long __serviceList;
167 }; // _BluetoothDeviceEventArg
170 #endif // _FNET_BT_INTERNAL_BLUETOOTH_DEVICE_EVENT_ARG_H_