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