Fixed bug.
[platform/framework/native/net.git] / inc / FNetWifiIWifiDirectDeviceListener.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        FNetWifiIWifiDirectDeviceListener.h
19  * @brief       This is the header file for the %IWifiDirectDeviceListener interface.
20  *
21  * This header file contains the declarations of the %IWifiDirectDeviceListener interface.
22  */
23 #ifndef _FNET_WIFI_IWIFI_DIRECT_DEVICE_LISTENER_H_
24 #define _FNET_WIFI_IWIFI_DIRECT_DEVICE_LISTENER_H_
25
26 #include <FBaseRtIEventListener.h>
27 #include <FNetWifiWifiTypes.h>
28 #include <FNetWifiWifiDirectGroupMember.h>
29
30 namespace Tizen { namespace Base { namespace Collection
31 {
32 class IList;
33 } } } // Tizen::Base::Collection
34
35 namespace Tizen { namespace Net { namespace Wifi
36 {
37 class WifiDirectGroupInfo;
38 class WifiDirectDeviceInfo;
39
40 /**
41  * @interface   IWifiDirectDeviceListener
42  * @brief       This interface implements listeners for the WifiDirectDevice events.
43  *
44  * @since       2.0
45  *
46  * The %IWifiDirectDeviceListener interface represents a listener to get the Wi-Fi Direct device status or information.
47  *
48  * For more information on the class features, see
49  * <a href="../org.tizen.native.appprogramming/html/guide/net/wi-fi_direct_connectivity.htm">Wi-Fi Direct Connectivity</a>.
50  */
51
52 class _OSP_EXPORT_ IWifiDirectDeviceListener
53         : virtual public Tizen::Base::Runtime::IEventListener
54 {
55 public:
56         /**
57          * This polymorphic destructor should be overridden if required. This way,
58          * the destructors of the derived classes are called when the destructor of this interface is called.
59          *
60          * @since       2.0
61          */
62         virtual ~IWifiDirectDeviceListener(void) {}
63
64         /**
65          * Called to notify the application that the local Wi-Fi Direct mode is enabled.
66          *
67          * @since       2.0
68          *
69          * @param[in]   localDeviceId   The ID of the Wi-Fi Direct device
70          * @param[in]   r               An error code
71          * @exception   E_SUCCESS       The activation is successful.
72          * @exception   E_SYSTEM        A system error has occurred.
73          * @see         WifiDirectDevice::Activate()
74          */
75         virtual void OnWifiDirectDeviceActivated(WifiDirectDeviceId localDeviceId, result r) = 0;
76
77         /**
78          * Called to notify the application that the local Wi-Fi Direct mode is disabled.
79          *
80          * @since       2.0
81          *
82          * @param[in]   localDeviceId   An ID for a Wi-Fi Direct device
83          * @param[in]   r               An error code
84          * @exception   E_SUCCESS       The deactivation is successful.
85          * @exception   E_SYSTEM        A system error has occurred.
86          * @see         WifiDirectDevice::Deactivate()
87          */
88         virtual void OnWifiDirectDeviceDeactivated(WifiDirectDeviceId localDeviceId, result r) = 0;
89
90         /**
91          * Called to notify the application when a Wi-Fi Direct connection is established with a remote device.
92          *
93          * @since       2.0
94          *
95          * @param[in]   localDeviceId           An ID for a Wi-Fi Direct device
96          * @param[in]   remoteDeviceInfo        The remote device
97          * @param[in]   r                       An error code
98          *
99          * @exception   E_SUCCESS               The Wi-Fi Direct group has been created successfully.
100          * @exception   E_SYSTEM                A system error has occurred.
101          * @exception   E_OPERATION_CANCELED    The operation has been cancelled explicitly.
102          * @exception   E_AUTHENTICATION        The authentication has failed during the Wi-Fi connection process.
103          * @exception   E_NOT_RESPONDING        The remote device is not responding.
104          * @see         WifiDirectDevice::Connect()
105          * @see         WifiDirectDevice::CancelConnect()
106          */
107         virtual void OnWifiDirectConnected(WifiDirectDeviceId localDeviceId, const WifiDirectDeviceInfo& remoteDeviceInfo,
108                         result r) = 0;
109
110         /**
111          * Called to notify the application when the Wi-Fi Direct connection is disconnected with a peer device.
112          *
113          * @since       2.0
114          *
115          * @param[in]   localDeviceId   An ID for a Wi-Fi Direct device
116          * @param[in]   peerMacAddress  The mac address of the peer device
117          * @param[in]   r               An error code
118          * @exception   E_SUCCESS       The method is successful.
119          * @exception   E_SYSTEM        A system error has occurred.
120          * @see         WifiDirectDevice::Disconnect()
121          */
122         virtual void OnWifiDirectDisconnected(WifiDirectDeviceId localDeviceId, const Tizen::Base::String& peerMacAddress,
123                         result r) = 0;
124
125         /**
126           * Called to notify the application when an autonomous group is created.
127           *
128           * @since      2.0
129           *
130           * @param[in]  localDeviceId   An ID for a Wi-Fi Direct device
131           * @param[in]  r               An error code
132           * @exception  E_SUCCESS       The method is successful.
133           * @exception  E_SYSTEM        A system error has occurred.
134           * @see        WifiDirectDevice::CreateAutonomousGroup()
135           */
136         virtual void OnWifiDirectAutonomousGroupCreated(WifiDirectDeviceId localDeviceId, result r) = 0;
137
138         /**
139          * Called to notify the application when a local device leaves the group.
140          *
141          * @since       2.0
142          *
143          * @param[in]   localDeviceId   An ID for a Wi-Fi Direct device
144          * @param[in]   r               An error code
145          * @exception   E_SUCCESS       The method is successful.
146          * @exception   E_SYSTEM        A system error has occurred.
147          * @see         WifiDirectDevice::LeaveGroup()
148          */
149         virtual void OnWifiDirectGroupLeft(WifiDirectDeviceId localDeviceId, result r) = 0;
150
151         /**
152          * @if OSPDEPREC
153          * Called to notify the application about the result and related information when a group is created or when a
154          * request to create a group is cancelled.
155          *
156          * @brief       <i> [Deprecated] </i>
157          * @deprecated  This method is deprecated because the Wi-Fi direct APIs have been revised to allow the use of APIs
158          *              with ease irrespective of the role (for example, group owner, group client, and so on). @n
159          *              Earlier, the Wi-Fi Direct APIs were strictly provided depending on the role and so it was necessary
160          *              to use these APIs. @n
161          *              Instead of using this method, use OnWifiDirectConnected() or OnWifiDirectAutonomousGroupCreated()
162          *              method.
163          *
164          * @since       2.0
165          *
166          * @param[in]   localDeviceId                   An ID for a Wi-Fi Direct device
167          * @param[in]   wifiDirectGroupInfo             The WifiDirectGroupInfo instance set by the winning group owner after
168          *                                              negotiation
169          * @param[in]   wifiDirectGroupOwnerDeviceInfo  The WifiDirectDeviceInfo instance of the group owner
170          * @param[in]   pWifiDirectMember               The WifiDirectGroupMember instance that is casted to the instance of
171          *                                              WifiDirectGroupOwner or WifiDirectGroupClient as a result of negotiation
172          *                                              after the creation of a group
173          * @param[in]   r                               An error code
174          * @exception   E_SUCCESS                       The Wi-Fi Direct group creation is successful.
175          * @exception   E_SYSTEM                        A system error has occurred.
176          * @exception   E_OPERATION_CANCELED            The operation has been cancelled explicitly.
177          * @exception   E_AUTHENTICATION                The authentication has failed during the Wi-Fi connection process.
178          * @exception   E_DHCP                          The DHCP operation has failed.
179          * @exception   E_NOT_RESPONDING                The target is not responding.
180          * @exception   E_REJECTED                      The connection request has been rejected.
181          * @exception   E_REMOTE_DEVICE_NOT_FOUND       The Wi-Fi Direct device has not been found.
182          * @remarks     If a device becomes a group client, then the WifiDirectGroupInfo::GetGroupOwnerIntent() and
183          *              WifiDirectGroupInfo::GetMaxNumberOfClients() methods will not contain valid information.
184          * @see         WifiDirectDevice::CreateGroup()
185          * @see         WifiDirectDevice::CancelGroupCreation()
186          * @endif
187          */
188         virtual void OnWifiDirectGroupCreatedN(WifiDirectDeviceId localDeviceId, const WifiDirectGroupInfo& wifiDirectGroupInfo,
189                         const WifiDirectDeviceInfo& wifiDirectGroupOwnerDeviceInfo, WifiDirectGroupMember* pWifiDirectMember, result r)
190         { delete pWifiDirectMember; }
191
192         /**
193          * Called to notify the application when the scan is completed.
194          *
195          * @since       2.0
196          *
197          * @param[in]   localDeviceId               An ID for a Wi-Fi Direct device
198          * @param[in]   pWifiDirectDeviceInfoList   The WifiDirectDeviceInfo information list representing the
199          *                                          Wi-Fi Direct devices discovered by scan
200          * @param[in]   r                           An error code
201          * @exception   E_SUCCESS                   The scan is successful.
202          * @exception   E_SYSTEM                    A system error has occurred.
203          * @exception   E_OPERATION_CANCELED        The operation has been cancelled explicitly.
204          * @see         WifiDirectDevice::Scan()
205          * @see         WifiDirectDevice::CancelScan()
206          */
207         virtual void OnWifiDirectScanCompletedN(WifiDirectDeviceId localDeviceId,
208                         Tizen::Base::Collection::IList* pWifiDirectDeviceInfoList, result r) = 0;
209
210         /**
211          * @if OSPDEPREC
212          * Called to notify the application when the connection to a Wi-Fi Direct group owner is completely established.
213          *
214          * @brief       <i> [Deprecated] </i>
215          * @deprecated  This method is deprecated because the Wi-Fi direct APIs have been revised to allow the use of APIs
216          *              with ease irrespective of the role (for example, group owner, group client, and so on). @n
217          *              Earlier, the Wi-Fi Direct APIs were strictly provided depending on the role and so it was necessary
218          *              to use these APIs. @n
219          *              Instead of using this method, use OnWifiDirectConnected() method.
220          *
221          * @since       2.0
222          *
223          * @param[in]   localDeviceId                   An ID for a Wi-Fi Direct device
224          * @param[in]   wifiDirectGroupOwnerDeviceInfo  The WifiDirectDeviceInfo of the connected Wi-Fi Direct group
225          *                                              owner
226          * @param[in]   r                               An error code
227          * @exception   E_SUCCESS                       The association is successful.
228          * @exception   E_SYSTEM                        A system error has occurred.
229          * @exception   E_AUTHENTICATION                The authentication has failed during the Wi-Fi connection process.
230          * @exception   E_DHCP                          The DHCP operation has failed.
231          * @exception   E_NOT_RESPONDING                The target is not responding.
232          * @exception   E_REJECTED                      The connection request has been rejected.
233          * @exception   E_REMOTE_DEVICE_NOT_FOUND       The Wi-Fi Direct device has not been found.
234          * @see         WifiDirectDevice::Associate()
235          * @endif
236          */
237         virtual void OnWifiDirectAssociationCompleted(WifiDirectDeviceId localDeviceId,
238                         const WifiDirectDeviceInfo& wifiDirectGroupOwnerDeviceInfo, result r) {}
239
240         /**
241          * Called to notify the application when a remote device is found during the Wi-Fi Direct scan process.
242          *
243          * @since       2.1
244          *
245          * @param[in]   localDeviceId       An ID for a Wi-Fi Direct device
246          * @param[in]   remoteDeviceInfo    The remote device that is found
247          * @see         WifiDirectDevice::Scan()
248          */
249         virtual void OnWifiDirectRemoteDeviceFound(WifiDirectDeviceId localDeviceId, const WifiDirectDeviceInfo& remoteDeviceInfo) {}
250
251 protected:
252         //
253         // This method is for internal use only. Using this method can cause behavioral, security-related,
254         // and consistency-related issues in the application.
255         //
256         // This method is reserved and may change its name at any time without prior notice.
257         //
258         // @since       2.0
259         //
260         virtual void OnWifiDirectDeviceListener_Reserved1(void) {}
261
262         //
263         // This method is for internal use only. Using this method can cause behavioral, security-related,
264         // and consistency-related issues in the application.
265         //
266         // This method is reserved and may change its name at any time without prior notice.
267         //
268         // @since       2.0
269         //
270         virtual void OnWifiDirectDeviceListener_Reserved2(void) {}
271
272         //
273         // This method is for internal use only. Using this method can cause behavioral, security-related,
274         // and consistency-related issues in the application.
275         //
276         // This method is reserved and may change its name at any time without prior notice.
277         //
278         // @since       2.0
279         //
280         virtual void OnWifiDirectDeviceListener_Reserved3(void) {}
281
282         //
283         // This method is for internal use only. Using this method can cause behavioral, security-related,
284         // and consistency-related issues in the application.
285         //
286         // This method is reserved and may change its name at any time without prior notice.
287         //
288         // @since       2.0
289         //
290         virtual void OnWifiDirectDeviceListener_Reserved4(void) {}
291
292 }; // IWifiDirectDeviceListener
293
294 } } } //Tizen::Net::Wifi
295 #endif // _FNET_WIFI_IWIFI_DIRECT_DEVICE_LISTENER_H_