update the header for Doxygen
[platform/framework/native/bluetooth.git] / src / FNetBt_BluetoothDeviceEventArg.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  * @file    FNetBt_BluetoothDeviceEventArg.h
19  * @brief   This is the header file for the _BluetoothDeviceEventArg class.
20  *
21  * This header file contains the declarations of the _BluetoothDeviceEventArg class which includes information to be
22  * passed to the event listeners
23  */
24 #ifndef _FNET_BT_INTERNAL_BLUETOOTH_DEVICE_EVENT_ARG_H_
25 #define _FNET_BT_INTERNAL_BLUETOOTH_DEVICE_EVENT_ARG_H_
26
27 #include <FBaseObject.h>
28 #include <FBaseResult.h>
29 #include <FOspConfig.h>
30 #include <FBaseRtIEventArg.h>
31
32
33 namespace Tizen { namespace Net { namespace Bluetooth
34 {
35
36 // Forward declaration
37 class BluetoothDevice;
38
39 /**
40   * @enum    _BluetoothDeviceEventType
41   * Type for specifying the type of _BluetoothDeviceEvent
42   */
43 enum _BluetoothDeviceEventType
44 {
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 */
51 };
52
53 /**
54  * @class   _BluetoothDeviceEventArg
55  * @brief   This class is used as an argument for callback methods of the _IBluetoothDeviceEventListener class.
56  *
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
60  */
61 class _BluetoothDeviceEventArg
62         : public Tizen::Base::Object
63         , public Tizen::Base::Runtime::IEventArg
64 {
65 public:
66         /**
67          * This is a class constructor for _BT_DEVICE_EVENT_DISCOVERY_STARTED event.
68          *
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.
72          */
73         _BluetoothDeviceEventArg(result r);
74
75         /**
76          * This is a class constructor for _BT_DEVICE_EVENT_DISCOVERY_DONE event.
77          *
78          * @param[in]   isCompleted         @c true, if the discovery is completely done @n
79          *                                  @c false, otherwise
80          */
81         _BluetoothDeviceEventArg(bool isCompleted);
82
83         /**
84          * This is a class constructor for _BT_DEVICE_EVENT_SVCLIST_RECEIVED event.
85          *
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.
92          */
93         _BluetoothDeviceEventArg(const BluetoothDevice& device, unsigned long serviceList, result r);
94
95         /**
96          * This is a class constructor for _BT_DEVICE_EVENT_DEVICE_FOUND and _BT_DEVICE_EVENT_UNPAIRED event.
97          *
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
101          */
102         _BluetoothDeviceEventArg(_BluetoothDeviceEventType type, const BluetoothDevice& device);
103
104         /**
105          * This is a class constructor for _BT_DEVICE_EVENT_PAIRED.
106          *
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.
111          */
112         _BluetoothDeviceEventArg(const BluetoothDevice* pDevice, result r);
113
114         /**
115          * This is the class destructor.
116          */
117         ~_BluetoothDeviceEventArg(void);
118
119         /**
120          * Gets the type of this event.
121          *
122          * @return      The type of the event
123          */
124         _BluetoothDeviceEventType GetEventType(void) const;
125
126         /**
127          * Gets the remote device.
128          *
129          * @return      The pointer of the remote device which is a found device, a paired, or an unpaired device
130          */
131         const BluetoothDevice* GetRemoteDevice(void) const;
132
133         /**
134          * Checks if the discovery is completely done.
135          *
136          * @return      @c true, if the discovery is completely done @n
137          *              @c false, otherwise
138          */
139         bool IsDiscoveryCompleted(void) const;
140
141         /**
142          * Gets the service list retrieved from a remote device.
143          *
144          * @return      the service list which consists of masked BluetoothServiceType values
145          */
146         unsigned long GetServiceList(void) const;
147
148         /**
149          * Gets the error result of this event.
150          *
151          * @return      The result of the event
152          */
153         result GetErrorResult(void) const;
154
155 private:
156         _BluetoothDeviceEventArg(void);
157         _BluetoothDeviceEventArg(const _BluetoothDeviceEventArg& eventArg);
158         _BluetoothDeviceEventArg& operator =(const _BluetoothDeviceEventArg& rValue);
159
160 private:
161         _BluetoothDeviceEventType __evtType;
162         BluetoothDevice* __pRemoteDevice;
163         bool __isCompleted;
164         unsigned long __serviceList;
165         result __result;
166
167 }; // _BluetoothDeviceEventArg
168
169 } } }
170 #endif // _FNET_BT_INTERNAL_BLUETOOTH_DEVICE_EVENT_ARG_H_