merge with master
[framework/osp/net.git] / src / wifi / FNetWifi_WifiDirectEventArg.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 /**
19  * @file                FNetWifi_WifiDirectEventArg.h
20  * @brief               This is the header file for the _WifiDirectEventArg Class.
21  *
22  * This header file contains declaration of the _WifiDirectEventArg Class.
23  */
24
25 #ifndef _FNET_WIFI_INTERNAL_WIFI_DIRECT_EVENT_ARG_H_
26 #define _FNET_WIFI_INTERNAL_WIFI_DIRECT_EVENT_ARG_H_
27
28 #include <FBaseObject.h>
29 #include <FBaseRtIEventArg.h>
30 #include <FNetWifiWifiTypes.h>
31
32 namespace Tizen {       namespace Base { namespace Collection {
33 class IList;
34 class ArrayList;
35 }}}// Tizen::Base::Collection
36
37
38 namespace Tizen {       namespace Net {
39 class NetConnection;
40
41 namespace Wifi {
42 class WifiDirectGroupInfo;
43 class WifiDirectDeviceInfo;
44 class WifiDirectGroupMember;
45
46 /**
47  * @enum __WifiDirectDeviceEventType
48  * Enumeration type to specify the type of WifiDirect events.
49  */
50 enum _WifiDirectEventType
51 {
52         WIFI_DIRECT_DEVICE_EVENT_NONE,
53         WIFI_DIRECT_DEVICE_EVENT_ACTIVATED,
54         WIFI_DIRECT_DEVICE_EVENT_DEACTIVATED,
55         WIFI_DIRECT_DEVICE_EVENT_GROUP_CREATED,
56         WIFI_DIRECT_DEVICE_EVENT_SCAN_FOUND,
57         WIFI_DIRECT_DEVICE_EVENT_SCAN_COMPLETED,
58         WIFI_DIRECT_DEVICE_EVENT_ASSOCIATED,
59         WIFI_DIRECT_DEVICE_EVENT_CONNECTED,
60         WIFI_DIRECT_DEVICE_EVENT_DISCONNECTED,
61         WIFI_DIRECT_DEVICE_EVENT_AUTONOMOS_GROUP_CREATED,
62         WIFI_DIRECT_DEVICE_EVENT_GROUP_LEFT,
63     WIFI_DIRECT_GO_EVENT_CLIENT_ASSOCIATED,
64     WIFI_DIRECT_GO_EVENT_CLIENT_DISASSOCIATED,
65     WIFI_DIRECT_GO_EVENT_GROUP_DESTROYED,
66     WIFI_DIRECT_GO_EVENT_SERVICE_STARTED,
67     WIFI_DIRECT_GO_EVENT_SERVICE_STOPPED,
68     WIFI_DIRECT_GC_EVENT_DISASSOCIATED,
69     WIFI_DIRECT_GC_EVENT_GROUP_OWNER_INFO_RESPONDED,
70     WIFI_DIRECT_GC_EVENT_GROUP_MEMBER_INFO_LIST_RESPONDED
71 };
72 /**
73  * @class       _WifiDirectEventArg
74  * @brief       This class is used as an argument of methods of the IWifiDirectDeviceListener class.
75  *
76  * @since       2.0
77  *
78  * This class is used as an argument of IWifiDirectDeviceListener's methods.
79  * When a %WifiDirectDevice event occurs, the __WifiDirectDeviceEvent object finds a IWifiDirectDeviceListener object
80  * which is registered for the WifiDirectDevice object and calls an appropriate method of the listener.
81  */
82
83 class _WifiDirectEventArg:
84         public Tizen::Base::Runtime::IEventArg,
85         public Tizen::Base::Object
86 {
87 public:
88         /**
89          * This is the default constructor for this class.                
90          */
91         _WifiDirectEventArg(void);
92
93         /**
94      * This is the copy constructor.
95      *
96      * @param[in]   rhs   An instance of %_WifiDirectEventArg
97      */
98     _WifiDirectEventArg(const _WifiDirectEventArg& rhs);
99
100         /**
101          * This destructor overrides Tizen::Base::Object::~Object().
102          *
103          */
104         virtual ~_WifiDirectEventArg(void);
105
106     /**
107          * This constructor initializes the instance of this class with the specified values.
108          *
109      * @param[in]       memberType              The type of the member.
110          * @param[in]   eventType               The type of the WifiDirectDeviceEvent.
111          * @param[in]   localDeviceId   An Id for a Wi-Fi Direct device.
112          * @param[in]   r                               The error code.
113          *
114          * @remarks     This method can be used for WIFI_DIRECT_DEVICE_EVENT_ACTIVATED, WIFI_DIRECT_DEVICE_EVENT_DEACTIVATED,
115          *          WIFI_DIRECT_GO_EVENT_GROUP_DESTROYED, WIFI_DIRECT_GO_EVENT_SERVICE_STOPPED
116          *          WIFI_DIRECT_DEVICE_EVENT_AUTONOMOS_GROUP_CREATED or WIFI_DIRECT_DEVICE_EVENT_GROUP_LEFT events.
117          */
118         _WifiDirectEventArg(_WifiDirectEventType eventType, WifiDirectDeviceId localDeviceId, result r = E_SUCCESS);
119
120         /**
121          * This constructor initializes the instance of this class with the specified values.
122          *
123      * @param[in]       memberType                              The type of the member.
124          * @param[in]   eventType                                               The type of the WifiDirectDeviceEvent.
125          * @param[in]   localDeviceId                                   An Id for a Wi-Fi Direct device.
126          * @param[in]   wifiDirectGroupInfo                             A reference to the WifiDirecrGroupInfo instance.
127          * @param[in]   wifiDirectGroupOwnerDeviceInfo  A reference to the WifiDirectDeviceInfo instance of the group owner.
128          * @param[in]   wifiDirectMemberType                    the type of a Wi-Fi Direct device.
129          * @param[in]   r                                                               The error code.
130          *
131          * @remarks     This method can be used for WIFI_DIRECT_DEVICE_EVENT_GROUP_CREATED event.
132          */
133
134         _WifiDirectEventArg(_WifiDirectEventType eventType, WifiDirectDeviceId localDeviceId,
135                 const WifiDirectGroupInfo& wifiDirectGroupInfo, const WifiDirectDeviceInfo& wifiDirectGroupOwnerDeviceInfo,
136                 const WifiDirectGroupMemberType wifiDirectMemberType, result r = E_SUCCESS);
137
138         /**
139          * This constructor initializes the instance of this class with the specified values.
140          *
141      * @param[in]       memberType                          The type of the member.
142          * @param[in]   eventType                                       The type of the WifiDirectDeviceEvent.
143          * @param[in]   localDeviceId                           An Id for a Wi-Fi Direct device.
144          * @param[in]   pGroupOwnerInfoList                     The list of WifiDirectDeviceInfo information.
145          * @param[in]   pDeviceInfoList                         The list of WifiDirectDeviceInfo information.
146          * @param[in]   r                                                       The error code.
147          *
148          * @remarks     This method can be used for WIFI_DIRECT_DEVICE_EVENT_SCAN_COMPLETED
149          *          or WIFI_DIRECT_GC_EVENT_GROUP_MEMBER_INFO_LIST_RESPONDED event.
150          */
151         _WifiDirectEventArg(_WifiDirectEventType eventType, WifiDirectDeviceId localDeviceId,
152                 Tizen::Base::Collection::IList* pDeviceInfoList, result r = E_SUCCESS);
153
154         /**
155          * This constructor initializes the instance of this class with the specified values.
156          *
157      * @param[in]       memberType                              The type of the member.
158          * @param[in]   eventType                                               The type of the WifiDirectDeviceEvent.
159          * @param[in]   localDeviceId                                   An Id for a Wi-Fi Direct device.
160          * @param[in]   wifiDirectGroupOwnerDeviceInfo  A reference to the WifiDirectDeviceInfo instance of the group owner.
161          * @param[in]   r                                                               The error code.
162          *
163          * @remarks     This method can be used for WIFI_DIRECT_DEVICE_EVENT_SCAN_FOUND, WIFI_DIRECT_DEVICE_EVENT_ASSOCIATED, WIFI_DIRECT_GO_EVENT_CLIENT_ASSOCIATED
164          *          ,WIFI_DIRECT_GC_EVENT_GROUP_OWNER_INFO_RESPONDED or WIFI_DIRECT_DEVICE_EVENT_CONNECTED event.
165          */
166         _WifiDirectEventArg(_WifiDirectEventType eventType, WifiDirectDeviceId localDeviceId,
167                 const WifiDirectDeviceInfo& wifiDirectDeviceInfo, result r = E_SUCCESS);
168
169     /**
170          * This constructor initializes the instance of this class with the specified values.
171          *
172      * @param[in]       memberType                      The type of the member.
173          * @param[in]   eventType                               The type of the WifiDirectGroupOwnerEvent.
174          * @param[in]   localDeviceId                   An Id for a Wi-Fi Direct device.
175          * @param[in]   wifiDirectDeviceInfo    A reference to the WifiDirectDeviceInfo instance.
176          * @param[in]   disassociationReason    The reason of association termination
177          * @param[in]   r                                               The error code.
178          *
179          * @remarks     This method can be used for WIFI_DIRECT_GO_EVENT_CLIENT_ASSOCIATED or WIFI_DIRECT_GO_EVENT_CLIENT_DISASSOCIATED
180          */
181         _WifiDirectEventArg(_WifiDirectEventType eventType, WifiDirectDeviceId localDeviceId,
182                 const WifiDirectDeviceInfo& wifiDirectDeviceInfo, WifiDirectAssociationTerminationReason disassociationReason,
183                 result r = E_SUCCESS);
184
185     /**
186          * This constructor initializes the instance of this class with the specified values.
187          *
188      * @param[in]       memberType                      The type of the member.
189          * @param[in]   eventType                               The type of the WifiDirectGroupClientEvent.
190          * @param[in]   localDeviceId                   An Id for a Wi-Fi Direct device.
191          * @param[in]   disassociationReason    The reason of association termination
192          * @param[in]   r                                               The error code.
193          *
194          * @remarks     This method can be used for WIFI_DIRECT_GC_EVENT_DISASSOCIATED event.
195          */
196         _WifiDirectEventArg(_WifiDirectEventType eventType, WifiDirectDeviceId localDeviceId,
197                 WifiDirectAssociationTerminationReason disassociationReason, result r = E_SUCCESS);
198
199         /**
200      * This constructor initializes the instance of this class with the specified values.
201      *
202      * @param[in]   memberType              The type of the member.
203      * @param[in]   eventType               The type of the WifiDirectGroupClientEvent.
204      * @param[in]   localDeviceId           An Id for a Wi-Fi Direct device.
205      * @param[in]   pNetConnection          The network connection that started with the Wi-Fi Direct net account.
206      * @param[in]   r                       The error code.
207      *
208      * @remarks This method can be used for WIFI_DIRECT_GO_EVENT_SERVICE_STARTED event.
209      */
210     _WifiDirectEventArg(_WifiDirectEventType eventType, WifiDirectDeviceId localDeviceId,
211             Tizen::Net::NetConnection* pNetConnection, result r = E_SUCCESS);
212
213     /**
214      * This constructor initializes the instance of this class with the specified values.
215      *
216      * @param[in]   memberType              The type of the member.
217      * @param[in]   eventType               The type of the WifiDirectGroupClientEvent.
218      * @param[in]   localDeviceId           An Id for a Wi-Fi Direct device.
219      * @param[in]   pNetConnection          The network connection that started with the Wi-Fi Direct net account.
220      * @param[in]   r                       The error code.
221      *
222      * @remarks This method can be used for WIFI_DIRECT_DEVICE_EVENT_DISCONNECTED event.
223      */
224     _WifiDirectEventArg(_WifiDirectEventType eventType, WifiDirectDeviceId localDeviceId,
225             const Tizen::Base::String& remoteDeviceMacAddress, result r = E_SUCCESS);
226
227
228     /**
229      * Sets the group member instance.
230      *
231      * @param[in]   pGroupMember            The WifiDirectGroupMember instance.
232      *
233      * @remark This takes the ownership of @c arg. So arg should be created on a heap and should not be deleted.
234      */
235     void SetGroupMember(WifiDirectGroupMember* pGroupMember);
236
237     /**
238      * Gets the group member instance.
239      *
240      * @return  WifiDirectGroupMember     Group member instance.
241      *
242      */
243     WifiDirectGroupMember* GetGroupMember(void) const;
244
245         /**
246          * Gets the event type.
247          *
248          * @return      __WifiDirectDeviceEventType             Event type of this argument.
249          *
250          * @see         __WifiDirectDeviceEventType
251          */
252         _WifiDirectEventType GetEventType(void) const;
253
254         /**
255          * Gets the error code.
256          *
257          * @return      WifiDirectManagerError          Error code of this argument.
258          *
259          * @see         WifiDirectManagerError
260          */
261         result GetError(void) const;
262
263         /**
264          * Gets the device Id.
265          *
266          * @return The Id of Wi-Fi Direct device.
267          *
268          * @see         WifiDirectDeviceId
269          */
270
271         WifiDirectDeviceId GetDeviceId(void) const;
272
273         /**
274          * Gets the list of WifiDirectDeviceInfo.
275          *
276          * @return      Pointer to the ArrayList object which contains information of group members' information @n
277          *                      @c null, if no associated node exists
278          */
279         Tizen::Base::Collection::IList* GetDeviceInfoList(void) const;
280
281         /**
282          * Gets the WifiDirectGroupInfo.
283          *
284          * @return Pointer to the WifiDirectGroupInfo object
285          *
286          */
287         WifiDirectGroupInfo* GetGroupInfo(void) const;
288
289         /**
290          * Gets the WifiDirectDeviceInfo
291          *
292          * @return Pointer to the WifiDirectDeviceInfo object
293          *
294          */
295     WifiDirectDeviceInfo* GetDeviceInfo(void) const;
296
297         /**
298          * Gets the WifiDirectGroupMemberType.
299          *
300          * @return the type of a Wi-Fi Direct device.
301          *
302          */
303         WifiDirectGroupMemberType GetGroupMemberType(void) const;
304
305         /**
306          * Sets the list of WifiDirectDeviceInfo information
307          *
308          * @param[in]   pDeviceInfoList         Pointer to the ArrayList object which contains information of group members' information.
309          *
310          */
311         void SetDeviceInfoList(Tizen::Base::Collection::IList* pDeviceInfoList);
312
313     /**
314          * Gets the reason of Wi-Fi Direct group client association termination.
315          *
316          * @return The reason of association termination
317          *
318          */
319         WifiDirectAssociationTerminationReason GetDisassociationReason(void) const;
320
321
322         /**
323      * Gets the network connection that started with the Wi-Fi Direct net account.
324      *
325      * @return The network connection
326      *
327      */
328         Tizen::Net::NetConnection* GetNetConnection(void) const;
329
330         /**
331      * Gets the mac address of remote device.
332      *
333      * @return The mac address
334      *
335      */
336         Tizen::Base::String GetMacAddress(void) const;
337
338
339     /**
340      * Copying of objects using this copy assignment operator is allowed.
341      *
342      * @param[in]   rhs     An instance of %_WifiDirectEventArg
343      */
344         _WifiDirectEventArg& operator =(const _WifiDirectEventArg& rhs);
345
346 private:
347     _WifiDirectEventType __eventType;
348     WifiDirectDeviceId __localDeviceId;
349     result __error;
350
351     WifiDirectGroupInfo* __pGroupInfo;
352     WifiDirectDeviceInfo* __pDeviceInfo;
353     Tizen::Base::Collection::ArrayList* __pDeviceInfoList;
354
355     WifiDirectGroupMemberType __wifiDirectGroupMemberType;
356     WifiDirectAssociationTerminationReason __disassociationReason;
357
358     Tizen::Net::NetConnection* __pNetConnection;
359     Tizen::Base::String __remoteDeviceMacAddress;
360     WifiDirectGroupMember* __pGroupMember;
361
362 }; // _WifiDirectEventArg
363
364 }}}// Tizen::Net::Wifi
365
366 #endif // _FNET_WIFI_INTERNAL_WIFI_DIRECT_EVENT_ARG_H_
367