b5973be8a15ccb1b75d9072a8eaa94f68ef8d12a
[platform/core/api/wifi-direct.git] / include / wifi-direct.h
1 /*
2  * wifi-direct
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Sungsik Jang <sungsik.jang@samsung.com>, Dongwook Lee <dwmax.lee@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 #ifndef __TIZEN_NET_WIFI_DIRECT_H__
22 #define __TIZEN_NET_WIFI_DIRECT_H__
23
24 #include <tizen.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 /**
31  * @addtogroup CAPI_NETWORK_WIFI_DIRECT_MODULE
32  * @{
33  */
34
35 /**
36  * @brief Wi-Fi Direct Device Name maximum length.
37  * @since_tizen 5.0
38  */
39 #define WIFI_DIRECT_MAX_DEVICE_NAME_LEN 32
40
41 /**
42  * @brief Wi-Fi Direct MAC Address length.
43  * @since_tizen 5.0
44  */
45 #define WIFI_DIRECT_MAC_ADDRESS_LEN 18
46
47 /**
48  * @brief Enumeration for Wi-Fi Direct error code.
49  * @since_tizen 2.3
50  */
51 typedef enum {
52         WIFI_DIRECT_ERROR_NONE                  = TIZEN_ERROR_NONE,                 /**< Successful */
53         WIFI_DIRECT_ERROR_NOT_PERMITTED         = TIZEN_ERROR_NOT_PERMITTED,        /**< Operation not permitted(1) */
54         WIFI_DIRECT_ERROR_OUT_OF_MEMORY         = TIZEN_ERROR_OUT_OF_MEMORY,        /**< Out of memory(12) */
55         WIFI_DIRECT_ERROR_PERMISSION_DENIED     = TIZEN_ERROR_PERMISSION_DENIED,    /**< Permission denied(13) */
56         WIFI_DIRECT_ERROR_RESOURCE_BUSY         = TIZEN_ERROR_RESOURCE_BUSY,        /**< Device or resource busy(16) */
57         WIFI_DIRECT_ERROR_INVALID_PARAMETER     = TIZEN_ERROR_INVALID_PARAMETER,    /**< Invalid function parameter(22) */
58         WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT   = TIZEN_ERROR_CONNECTION_TIME_OUT,  /**< Connection timed out(110) */
59         WIFI_DIRECT_ERROR_NOT_SUPPORTED         = TIZEN_ERROR_NOT_SUPPORTED,        /**< Not supported */
60         WIFI_DIRECT_ERROR_NOT_INITIALIZED       = TIZEN_ERROR_WIFI_DIRECT|0x01,     /**< Not initialized */
61         WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  = TIZEN_ERROR_WIFI_DIRECT|0x02,     /**< I/O error */
62         WIFI_DIRECT_ERROR_WIFI_USED             = TIZEN_ERROR_WIFI_DIRECT|0x03,     /**< WiFi is being used */
63         WIFI_DIRECT_ERROR_MOBILE_AP_USED        = TIZEN_ERROR_WIFI_DIRECT|0x04,     /**< Mobile AP is being used */
64         WIFI_DIRECT_ERROR_CONNECTION_FAILED     = TIZEN_ERROR_WIFI_DIRECT|0x05,     /**< Connection failed */
65         WIFI_DIRECT_ERROR_AUTH_FAILED           = TIZEN_ERROR_WIFI_DIRECT|0x06,     /**< Authentication failed */
66         WIFI_DIRECT_ERROR_OPERATION_FAILED      = TIZEN_ERROR_WIFI_DIRECT|0x07,     /**< Operation failed */
67         WIFI_DIRECT_ERROR_TOO_MANY_CLIENT       = TIZEN_ERROR_WIFI_DIRECT|0x08,     /**< Too many client */
68         WIFI_DIRECT_ERROR_ALREADY_INITIALIZED   = TIZEN_ERROR_WIFI_DIRECT|0x09,     /**< Already initialized client */
69         WIFI_DIRECT_ERROR_CONNECTION_CANCELED   = TIZEN_ERROR_WIFI_DIRECT|0x10,     /**< Connection canceled by local device */
70 } wifi_direct_error_e;
71
72
73 /**
74  * @brief Enumeration for Wi-Fi Direct link status.
75  * @since_tizen 2.3
76  * @see wifi_direct_state_changed_cb()
77  * @see wifi_direct_get_state()
78  */
79 typedef enum {
80         WIFI_DIRECT_STATE_DEACTIVATED,    /**< Deactivated */
81         WIFI_DIRECT_STATE_DEACTIVATING,   /**< Deactivating */
82         WIFI_DIRECT_STATE_ACTIVATING,     /**< Activating */
83         WIFI_DIRECT_STATE_ACTIVATED,      /**< Activated */
84         WIFI_DIRECT_STATE_DISCOVERING,    /**< Discovering */
85         WIFI_DIRECT_STATE_CONNECTING,     /**< Connecting */
86         WIFI_DIRECT_STATE_DISCONNECTING,  /**< Disconnecting */
87         WIFI_DIRECT_STATE_CONNECTED,      /**< Connected */
88         WIFI_DIRECT_STATE_GROUP_OWNER     /**< Group owner */
89 } wifi_direct_state_e;
90
91
92 /**
93  * @brief Enumeration for Wi-Fi Direct device state.
94  * @since_tizen 2.3
95  * @see wifi_direct_device_state_changed_cb()
96  */
97 typedef enum {
98         WIFI_DIRECT_DEVICE_STATE_ACTIVATED,    /**< Activated */
99         WIFI_DIRECT_DEVICE_STATE_DEACTIVATED,  /**< Deactivated */
100 } wifi_direct_device_state_e;
101
102
103 /**
104  * @brief Enumeration for Wi-Fi Direct discovery state.
105  * @since_tizen 2.3
106  * @see wifi_direct_discovery_state_chagned_cb()
107  * @see wifi_direct_peer_found_cb()
108  */
109 typedef enum {
110         WIFI_DIRECT_ONLY_LISTEN_STARTED,  /**< Only listen started */
111         WIFI_DIRECT_DISCOVERY_STARTED,    /**< Discovery started */
112         WIFI_DIRECT_DISCOVERY_FOUND,      /**< A remote peer is found */
113         WIFI_DIRECT_DISCOVERY_FINISHED,   /**< Discovery finished */
114         WIFI_DIRECT_DISCOVERY_LOST,       /**< A remote peer is lost (Since 3.0)*/
115 } wifi_direct_discovery_state_e;
116
117
118 /**
119  * @brief Enumeration for Wi-Fi Direct connection state.
120  * @since_tizen 2.3
121  * @see wifi_direct_connection_state_changed_cb()
122  */
123 typedef enum {
124         WIFI_DIRECT_CONNECTION_REQ,          /**< Connection is requested */
125         WIFI_DIRECT_CONNECTION_WPS_REQ,      /**< WPS is requested */
126         WIFI_DIRECT_CONNECTION_IN_PROGRESS,  /**< Connection in progress */
127         WIFI_DIRECT_CONNECTION_RSP,          /**< Connection response */
128         WIFI_DIRECT_DISASSOCIATION_IND,      /**< Disconnected by remote Group Client */
129         WIFI_DIRECT_DISCONNECTION_RSP,       /**< Disconnected by local device */
130         WIFI_DIRECT_DISCONNECTION_IND,       /**< Disconnected by remote Group Owner */
131         WIFI_DIRECT_GROUP_CREATED,           /**< Group is created */
132         WIFI_DIRECT_GROUP_DESTROYED,         /**< Group is destroyed */
133 } wifi_direct_connection_state_e;
134
135 /**
136  * @brief Enumeration for WPS Config Method type.
137  * @since_tizen 5.0
138  */
139 typedef enum {
140         WIFI_DIRECT_CONFIG_METHOD_DEFAULT = 0x00,      /**< Use default config method */
141         WIFI_DIRECT_CONFIG_METHOD_PBC = 0x01,          /**< Push Button Configuration */
142         WIFI_DIRECT_CONFIG_METHOD_PIN_DISPLAY = 0x02,  /**< Display PIN code */
143         WIFI_DIRECT_CONFIG_METHOD_PIN_KEYPAD = 0x04,   /**< Provide the keypad to input the PIN */
144 } wifi_direct_config_method_type_e;
145
146 /**
147  * @brief Enumeration for Wi-Fi Direct secondary device type.
148  * @since_tizen 2.3
149  * @see wifi_direct_get_secondary_device_type()
150  */
151 typedef enum {
152         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_PC = 1,                  /**< PC */
153         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_SERVER = 2,              /**< Server */
154         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_MEDIA_CENTER = 3,        /**< Media Center */
155         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_UMPC = 4,                /**< UMPC */
156         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_NOTEBOOK = 5,            /**< Notebook */
157         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_DESKTOP = 6,             /**< Desktop */
158         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_MID = 7,                 /**< MID */
159         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_NETBOOK = 8,             /**< Netbook */
160         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_KEYBOARD = 1,               /**< Keyboard */
161         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_MOUSE = 2,                  /**< Mouse */
162         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_JOYSTICK = 3,               /**< Joystick */
163         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_TRACKBALL = 4,              /**< Trackball */
164         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_CONTROLLER = 5,             /**< Controller */
165         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_REMOTE = 6,                 /**< Remote */
166         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_TOUCHSCREEN = 7,            /**< Touchscreen */
167         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_BIOMETRIC_READER = 8,       /**< Biometric reader */
168         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_BARCODE_READER = 9,         /**< Barcode reader */
169         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_PRINTER = 1,              /**< Printer */
170         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_SCANNER = 2,              /**< Scanner */
171         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_FAX = 3,                  /**< Fax */
172         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_COPIER = 4,               /**< Copier */
173         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_ALL_IN_ONE = 5,           /**< All-in-one */
174         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_DIGITAL_STILL = 1,         /**< Digital still camera */
175         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_VIDEO = 2,                 /**< Video camera */
176         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_WEBCAM = 3,                /**< Webcam */
177         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_SECURITY = 4,              /**< Security camera */
178         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_STORAGE_NAS = 1,                  /**< NAS */
179         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_NETWORK_INFRA_AP = 1,             /**< AP */
180         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_NETWORK_INFRA_ROUTER = 2,         /**< Router */
181         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_NETWORK_INFRA_SWITCH = 3,         /**< Switch */
182         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_NETWORK_INFRA_GATEWAY = 4,        /**< Gateway */
183         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_TV = 1,                   /**< TV */
184         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_PIC_FRAME = 2,            /**< Picture frame */
185         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_PROJECTOR = 3,            /**< Projector */
186         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_MONITOR = 4,              /**< Monitor */
187         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_DAR = 1,               /**< DAR */
188         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVR = 2,               /**< PVR */
189         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MCX = 3,               /**< MCX */
190         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_STB = 4,               /**< Set-top box */
191         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MS_MA_ME = 5,          /**< Media Server / Media Adapter / Media Extender */
192         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVP = 6,               /**< Portable video player */
193         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_XBOX = 1,                    /**< Xbox */
194         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_XBOX_360 = 2,                /**< Xbox 360 */
195         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_PS = 3,                      /**< Playstation */
196         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_CONSOLE = 4,                 /**< Console */
197         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_PORTABLE = 5,                /**< Portable */
198         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_WINDOWS_MOBILE = 1,     /**< Windows Mobile */
199         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_PHONE_SINGLE = 2,       /**< Phone - single mode */
200         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_PHONE_DUAL = 3,         /**< Phone - dual mode */
201         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_SMARTPHONE_SINGLE = 4,  /**< Smart Phone - single mode */
202         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_SMARTPHONE_DUAL = 5,    /**< Smart Phone - dual mode */
203         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_TUNER = 1,                  /**< Tuner */
204         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_SPEAKER = 2,                /**< Speaker */
205         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_PMP = 3,                    /**< Portable Music Player */
206         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_HEADSET = 4,                /**< Headset */
207         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_HEADPHONE = 5,              /**< Headphone */
208         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_MIC = 6,                    /**< Microphone */
209 } wifi_direct_secondary_device_type_e;
210
211
212 /**
213  * @brief Enumeration for Wi-Fi Direct primary device type.
214  * @since_tizen 2.3
215  * @see wifi_direct_get_primary_device_type()
216  */
217 typedef enum {
218         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_COMPUTER = 1,           /**< Computer */
219         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_INPUT_DEVICE = 2,       /**< Input device */
220         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_PRINTER = 3,            /**< Printer */
221         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_CAMERA = 4,             /**< Camera */
222         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_STORAGE = 5,            /**< Storage */
223         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_NETWORK_INFRA = 6,      /**< Network Infrastructure */
224         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_DISPLAY = 7,            /**< Display */
225         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_MULTIMEDIA_DEVICE = 8,  /**< Multimedia device */
226         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_GAME_DEVICE = 9,        /**< Game device */
227         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE = 10,         /**< Telephone */
228         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_AUDIO = 11,             /**< Audio */
229         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_OTHER =  255            /**< Others */
230 } wifi_direct_primary_device_type_e;
231
232
233 /**
234  * @brief Enumeration for Wi-Fi WPS type.
235  * @since_tizen 2.3
236  * @see wifi_direct_supported_wps_type_cb()
237  * @see wifi_direct_get_local_wps_type()
238  * @see wifi_direct_set_req_wps_type()
239  * @see wifi_direct_get_req_wps_type()
240  */
241 typedef enum {
242         WIFI_DIRECT_WPS_TYPE_NONE = 0x00,         /**< No WPS type */
243         WIFI_DIRECT_WPS_TYPE_PBC = 0x01,          /**< Push Button Configuration */
244         WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY = 0x02,  /**< Display PIN code */
245         WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD = 0x04,   /**< Provide the keypad to input the PIN */
246 } wifi_direct_wps_type_e;
247
248
249 /**
250  * @deprecated Deprecated since 5.0. Use #wifi_direct_display_type_e instead.
251  * @brief Enumeration for Wi-Fi Display device type.
252  * @since_tizen 2.3
253  */
254 typedef enum {
255         WIFI_DISPLAY_TYPE_NONE,  /**< Configure as WFD Source*/
256         WIFI_DISPLAY_TYPE_SINK,  /**< Configure as WFD Primary Sink */
257         WIFI_DISPLAY_TYPE_SRC,   /**< Configure as WFD Secondary Sink */
258         WIFI_DISPLAY_TYPE_DUAL,  /**< Configure as WFD Dual Role */
259         WIFI_DISPLAY_TYPE_MAX,   /**< Not configured */
260 } wifi_display_type_e;
261
262
263 /**
264  * @brief Enumeration for Service Discovery type.
265  * @since_tizen 2.3
266  * @see wifi_direct_service_state_changed_cb()
267  * @see wifi_direct_start_service_discovery()
268  * @see wifi_direct_cancel_service_discovery()
269  * @see wifi_direct_register_service()
270  */
271 typedef enum {
272         WIFI_DIRECT_SERVICE_TYPE_ALL,            /**< Service discovery type all */
273         WIFI_DIRECT_SERVICE_TYPE_BONJOUR,        /**< Service discovery type bonjour */
274         WIFI_DIRECT_SERVICE_TYPE_UPNP,           /**< Service discovery type UPNP */
275         WIFI_DIRECT_SERVICE_TYPE_WS_DISCOVERY,   /**< Service discovery type ws discovery */
276         WIFI_DIRECT_SERVICE_TYPE_WIFI_DISPLAY,   /**< Service discovery type wifi-display */
277         WIFI_DIRECT_SERVICE_TYPE_BT_ADDR,        /**< Service discovery type bt address */
278         WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO,   /**< Service discovery type contact info */
279         WIFI_DIRECT_SERVICE_TYPE_VENDOR = 0xff,  /**< Service discovery type vendor-specific */
280 } wifi_direct_service_type_e;
281
282
283 /**
284  * @brief Enumeration for Wi-Fi Display device type.
285  * @since_tizen 2.4
286  * @see wifi_direct_set_display()
287  * @see wifi_direct_get_peer_display_type()
288  */
289 typedef enum {
290         WIFI_DIRECT_DISPLAY_TYPE_SOURCE,   /**< Configure as WFD Source*/
291         WIFI_DIRECT_DISPLAY_TYPE_PRISINK,  /**< Configure as WFD Primary Sink */
292         WIFI_DIRECT_DISPLAY_TYPE_SECSINK,  /**< Configure as WFD Secondary Sink */
293         WIFI_DIRECT_DISPLAY_TYPE_DUAL,     /**< Configure as WFD Dual Role */
294         WIFI_DIRECT_DISPLAY_TYPE_MAX,      /**< Not configured */
295 } wifi_direct_display_type_e;
296
297
298 /**
299  * @brief Enumeration for Wi-Fi Direct service Discovery state.
300  * @since_tizen 2.3
301  * @see wifi_direct_service_state_changed_cb()
302  */
303 typedef enum {
304         WIFI_DIRECT_SERVICE_DISCOVERY_STARTED,   /**< Service discovery started */
305         WIFI_DIRECT_SERVICE_DISCOVERY_FOUND,     /**< Service discovery found */
306         WIFI_DIRECT_SERVICE_DISCOVERY_FINISHED,  /**< Service discovery finished */
307 } wifi_direct_service_discovery_state_e;
308
309
310 /**
311  * @brief Enumeration for Wi-Fi Direct Discovery Channel.
312  * @since_tizen 2.3
313  * @see wifi_direct_start_discovery_specific_channel()
314  */
315 typedef enum {
316         WIFI_DIRECT_DISCOVERY_FULL_SCAN = 0,          /**< Scan full channel */
317         WIFI_DIRECT_DISCOVERY_SOCIAL_CHANNEL = 1611,  /**< Scan social channel */
318         WIFI_DIRECT_DISCOVERY_CHANNEL1 = 1,           /**< Scan channel 1 */
319         WIFI_DIRECT_DISCOVERY_CHANNEL6 = 6,           /**< Scan channel 6 */
320         WIFI_DIRECT_DISCOVERY_CHANNEL11 = 11,         /**< Scan channel 11 */
321 } wifi_direct_discovery_channel_e;
322
323 /**
324  * @brief Enumeration for Wi-Fi Frame type.
325  * @since_tizen 4.0
326  * @see wifi_direct_add_vsie()
327  * @see wifi_direct_remove_vsie()
328  * @see wifi_direct_get_vsie()
329  */
330 typedef enum {
331         /**
332          * P2P probe request frame
333          */
334         WIFI_DIRECT_VSIE_FRAME_P2P_PROBE_REQ,
335
336         /**
337          * P2P probe response frame
338          */
339         WIFI_DIRECT_VSIE_FRAME_P2P_PROBE_RESP,
340
341         /**
342          * P2P group owner probe response frame
343          */
344         WIFI_DIRECT_VSIE_FRAME_P2P_GO_PROBE_RESP,
345
346         /**
347          * P2P probe request frame
348          */
349         WIFI_DIRECT_VSIE_FRAME_P2P_GO_BEACON,
350
351         /**
352          * P2P provision discovery request frame
353          */
354         WIFI_DIRECT_VSIE_FRAME_P2P_PD_REQ,
355
356         /**
357          * P2P provision discovery response frame
358          */
359         WIFI_DIRECT_VSIE_FRAME_P2P_PD_RESP,
360
361         /**
362          * P2P probe request frame
363          */
364         WIFI_DIRECT_VSIE_FRAME_P2P_GO_NEG_REQ,
365
366         /**
367          * P2P group owner negotiation response frame
368          */
369         WIFI_DIRECT_VSIE_FRAME_P2P_GO_NEG_RESP,
370
371         /**
372          * P2P group owner negotiation confirmation frame
373          */
374         WIFI_DIRECT_VSIE_FRAME_P2P_GO_NEG_CONF,
375
376         /**
377          * P2P invitation request frame
378          */
379         WIFI_DIRECT_VSIE_FRAME_P2P_INV_REQ,
380
381         /**
382          * P2P invitation response frame
383          */
384         WIFI_DIRECT_VSIE_FRAME_P2P_INV_RESP,
385
386         /**
387          * P2P association request frame
388          */
389         WIFI_DIRECT_VSIE_FRAME_P2P_ASSOC_REQ,
390
391         /**
392          * P2P association response frame
393          */
394         WIFI_DIRECT_VSIE_FRAME_P2P_ASSOC_RESP,
395
396         /**
397          * Association request frame
398          */
399         WIFI_DIRECT_VSIE_FRAME_ASSOC_REQ,
400 } wifi_direct_vsie_frames_e;
401
402 /**
403  * @brief Wi-Fi Direct connection state structure to store result of new connection state callback.
404  * @since_tizen 5.0
405  */
406 typedef struct {
407         char device_name[WIFI_DIRECT_MAX_DEVICE_NAME_LEN+1];  /**< Null-terminated device friendly name. */
408         char mac_address[WIFI_DIRECT_MAC_ADDRESS_LEN+1];      /**< Null-terminated Device's P2P Device Address */
409 } wifi_direct_connection_state_cb_data_s;
410
411 /**
412  * @brief Wi-Fi Direct buffer structure to store result of peer discovery.
413  * @since_tizen 2.3
414  * @remarks You can use APIs for Wi-Fi Direct display function instead of is_miracast_device value
415  *          which is deprecated since 2.4.
416  * @see wifi_direct_discovered_peer_cb()
417  * @see wifi_direct_get_peer_info()
418  * @see wifi_direct_get_connecting_peer_info()
419  */
420 typedef struct {
421         /**
422          * Device's friendly name
423          */
424         char *device_name;
425
426         /**
427          * Device's P2P Device Address
428          */
429         char *mac_address;
430
431         /**
432          * Device's P2P Interface Address, Valid only if device is a P2P GO
433          */
434         char *interface_address;
435
436         /**
437          * Channel the device is listening on
438          */
439         int channel;
440
441         /**
442          * Is peer connected
443          */
444         bool is_connected;
445
446         /**
447          * Is an active P2P Group Owner
448          */
449         bool is_group_owner;
450
451         /**
452          * Is a stored Persistent GO
453          */
454         bool is_persistent_group_owner;
455
456         /**
457          * Primary category of device
458          */
459         wifi_direct_primary_device_type_e primary_device_type;
460
461         /**
462          * Sub category of device
463          */
464         wifi_direct_secondary_device_type_e secondary_device_type;
465
466         /**
467          * The list of supported WPS type. The OR operation on
468          * #wifi_direct_wps_type_e can be used like
469          * #WIFI_DIRECT_WPS_TYPE_PBC | #WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY
470          */
471         int supported_wps_types;
472
473         /**
474          * Is capable of processing P2P Invitation Procedure signaling
475          */
476         bool is_p2p_invitation_procedure_supported;
477
478         /**
479          * The number of Registered services
480          */
481         unsigned int service_count;
482
483         /**
484          * The list of registered services
485          */
486         char **service_list;
487
488         /**
489          * Is a wifi display device
490          * @deprecated Deprecated since 2.4, use wifi direct display APIs instead of
491          * is_miracast_device value.
492          */
493         bool is_miracast_device;
494
495         /**
496          * The information for vendor specific information element
497          * @deprecated Deprecated since 5.0, use wifi_direct_get_peer_vsie() API instead of
498          * vsie_info value.
499          */
500         void *vsie_info;
501 } wifi_direct_discovered_peer_info_s;
502
503
504 /**
505  * @brief Wi-Fi Direct buffer structure to store information of connected peer.
506  * @since_tizen 2.3
507  * @remarks You can use APIs for wifi-direct display function instead of is_miracast_device value
508  *          which is deprecated since 2.4.
509  * @see wifi_direct_connected_peer_cb()
510  */
511 typedef struct {
512         /**
513          * Device's friendly name
514          */
515         char *device_name;
516
517         /**
518          * The IP address
519          */
520         char *ip_address;
521
522         /**
523          * Device's P2P Device Address
524          */
525         char *mac_address;
526
527         /**
528          * Device's P2P Interface Address
529          */
530         char *interface_address;
531
532         /**
533          * Operating channel
534          */
535         int channel;
536
537         /**
538          * Whether peer is a P2P device
539          */
540         bool p2p_supported;
541
542         /**
543          * Primary category of device
544          */
545         wifi_direct_primary_device_type_e primary_device_type;
546
547         /**
548          * Sub category of device
549          */
550         wifi_direct_secondary_device_type_e secondary_device_type;
551
552         /**
553          * The number of Registered services
554          */
555         unsigned int service_count;
556
557         /**
558          * The list of registered services
559          */
560         char **service_list;
561
562         /**
563          * Is a wifi display device
564          * @deprecated since tizen 2.4, use wifi direct display APIs instead of
565          * is_miracast_device value.
566          */
567         bool is_miracast_device;
568 } wifi_direct_connected_peer_info_s;
569
570
571 /**
572  * @brief Called when the state of discovery is changed.
573  * @details The following error codes can be delivered
574  *          #WIFI_DIRECT_ERROR_NONE
575  *          #WIFI_DIRECT_ERROR_OPERATION_FAILED
576  *          #WIFI_DIRECT_ERROR_NOT_PERMITTED
577  * @since_tizen 2.3
578  * @param[in] error_code       The error code
579  * @param[in] discovery_state  The discovery state
580  * @param[in] user_data        The user data passed from the callback registration function
581  * @pre Either wifi_direct_start_discovery() or wifi_direct_cancel_discovery()
582  *      will invoke this callback in the thread-default main context of the thread
583  *      from which you registered this callback using wifi_direct_set_discovery_state_changed_cb().
584  * @see wifi_direct_start_discovery()
585  * @see wifi_direct_cancel_discovery()
586  * @see wifi_direct_set_discovery_state_changed_cb()
587  * @see wifi_direct_unset_discovery_state_changed_cb()
588  */
589 typedef void (*wifi_direct_discovery_state_chagned_cb) (int error_code,
590                                                         wifi_direct_discovery_state_e discovery_state,
591                                                         void *user_data);
592
593
594 /**
595  * @brief Called when the peer is found.
596  * @details The following error codes can be delivered
597  *          #WIFI_DIRECT_ERROR_NONE
598  *          #WIFI_DIRECT_ERROR_OPERATION_FAILED
599  *          #WIFI_DIRECT_ERROR_NOT_PERMITTED
600  * @since_tizen 2.3
601  * @remarks The @a mac_address can be used only in the callback. To use outside, make a copy.
602  * @param[in] error_code       The error code
603  * @param[in] discovery_state  The discovery state
604  * @param[in] mac_address      The MAC address of found peer
605  * @param[in] user_data        The user data passed from the callback registration function
606  * @pre Either wifi_direct_start_discovery() or wifi_direct_cancel_discovery()
607  *      will invoke this callback in the thread-default main context of the thread
608  *      from which you registered this callback using wifi_direct_set_peer_found_cb().
609  * @see wifi_direct_start_discovery()
610  * @see wifi_direct_cancel_discovery()
611  * @see wifi_direct_set_peer_found_cb()
612  * @see wifi_direct_unset_peer_found_cb()
613  */
614 typedef void (*wifi_direct_peer_found_cb) (int error_code,
615                                            wifi_direct_discovery_state_e discovery_state,
616                                            const char *mac_address,
617                                            void *user_data);
618
619
620 /**
621  * @brief Called when the state of device is changed.
622  * @details The following error codes can be delivered
623  *          #WIFI_DIRECT_ERROR_NONE
624  *          #WIFI_DIRECT_ERROR_OPERATION_FAILED
625  *          #WIFI_DIRECT_ERROR_NOT_PERMITTED
626  * @since_tizen 2.3
627  * @param[in] error_code    The error code
628  * @param[in] device_state  The device state
629  * @param[in] user_data     The user data passed from the callback registration function
630  * @pre Either wifi_direct_activate() or wifi_direct_deactivate() will invoke
631  *      this callback in the thread-default main context of the thread from which you
632  *      registered this callback using wifi_direct_set_device_state_changed_cb().
633  * @see wifi_direct_activate()
634  * @see wifi_direct_deactivate()
635  * @see wifi_direct_set_device_state_changed_cb()
636  * @see wifi_direct_unset_device_state_changed_cb()
637  */
638 typedef void (*wifi_direct_device_state_changed_cb) (int error_code,
639                                                      wifi_direct_device_state_e device_state,
640                                                      void *user_data);
641
642
643 /**
644  * @brief Called when the state of connection is changed.
645  * @details The following error codes can be delivered
646  *          #WIFI_DIRECT_ERROR_NONE
647  *          #WIFI_DIRECT_ERROR_OPERATION_FAILED
648  *          #WIFI_DIRECT_ERROR_NOT_PERMITTED
649  *          #WIFI_DIRECT_ERROR_CONNECTION_FAILED
650  * @since_tizen 2.3
651  * @remarks The @a mac_address can be used only in the callback. To use outside, make a copy.
652  * @param[in] error_code        The error code
653  * @param[in] connection_state  The connection state
654  * @param[in] mac_address       The MAC address of the connection peer
655  * @param[in] user_data         The user data passed from the callback registration function
656  * @pre wifi_direct_create_group(), wifi_direct_destroy_group(),
657  *      wifi_direct_connect(), wifi_direct_disconnect() or
658  *      wifi_direct_disconnect_all() will invoke this callback in the thread-default
659  *      main context of the thread from which you registered this callback using
660  *      using wifi_direct_set_connection_state_changed_cb().
661  * @see wifi_direct_connect()
662  * @see wifi_direct_disconnect()
663  * @see wifi_direct_disconnect_all()
664  * @see wifi_direct_set_connection_state_changed_cb()
665  * @see wifi_direct_unset_connection_state_changed_cb()
666  */
667 typedef void (*wifi_direct_connection_state_changed_cb) (int error_code,
668                                                          wifi_direct_connection_state_e connection_state,
669                                                          const char *mac_address,
670                                                          void *user_data);
671
672 /**
673  * @brief Called when the state of connection is changed.
674  * @details The following error codes can be delivered:\n
675  *     #WIFI_DIRECT_ERROR_NONE\n
676  *     #WIFI_DIRECT_ERROR_OPERATION_FAILED\n
677  *     #WIFI_DIRECT_ERROR_NOT_PERMITTED
678  * @since_tizen 5.0
679  * @param[in] error_code  The error code
680  * @param[in] connection_state  The connection state
681  * @param[in] data_s The structure for peer data
682  * @param[in] user_data  The user data passed from the callback registration function
683  * @pre wifi_direct_create_group(), wifi_direct_destroy_group(), wifi_direct_connect(), wifi_direct_disconnect() or wifi_direct_disconnect_all() will invoke this callback
684  * if you register this callback using wifi_direct_set_peer_info_connection_state_changed_cb().
685  * @see wifi_direct_connect()
686  * @see wifi_direct_disconnect()
687  * @see wifi_direct_disconnect_all()
688  * @see wifi_direct_set_peer_info_connection_state_changed_cb()
689  * @see wifi_direct_unset_peer_info_connection_state_changed_cb()
690  */
691 typedef void (*wifi_direct_peer_info_connection_state_changed_cb)(wifi_direct_error_e error_code,
692                                                 wifi_direct_connection_state_e connection_state,
693                                                 wifi_direct_connection_state_cb_data_s data_s,
694                                                 void *user_data);
695
696 /**
697  * @brief Called when IP address of client is assigned when your device is the group owner.
698  * @details The following error codes can be delivered
699  *          #WIFI_DIRECT_ERROR_NONE
700  *          #WIFI_DIRECT_ERROR_OPERATION_FAILED
701  *          #WIFI_DIRECT_ERROR_NOT_PERMITTED
702  * @since_tizen 2.3
703  * @remarks The @a mac_address can be used only in the callback. To use outside, make a copy.
704  *          The @a ip_address can be used only in the callback. To use outside, make a copy.
705  *          The @a interface_address can be used only in the callback. To use outside, make a copy.
706  * @param[in] mac_address        The MAC address of connection peer
707  * @param[in] ip_address         The IP address of connection peer
708  * @param[in] interface_address  The interface address of connection peer
709  * @param[in] user_data          The user data passed from the callback registration function
710  * @pre This callback will be invoked in the thread-default main context of the
711  *      thread from which you registered this callback using wifi_direct_set_client_ip_address_assigned_cb().
712  * @see wifi_direct_set_client_ip_address_assigned_cb()
713  * @see wifi_direct_unset_client_ip_address_assigned_cb()
714  */
715 typedef void (*wifi_direct_client_ip_address_assigned_cb) (const char *mac_address,
716                                                            const char *ip_address,
717                                                            const char *interface_address,
718                                                            void *user_data);
719
720
721 /**
722  * @brief Called when the state of Service discovery is changed.
723  * @details The following error codes can be delivered
724  *          #WIFI_DIRECT_ERROR_NONE
725  *          #WIFI_DIRECT_ERROR_OPERATION_FAILED
726  *          #WIFI_DIRECT_ERROR_NOT_PERMITTED
727  * @since_tizen 2.3
728  * @remarks The @a mac_address can be used only in the callback. To use outside, make a copy.
729  * @param[in] error_code     The error code
730  * @param[in] service_state  The service discovery state
731  * @param[in] service_type   Specifies the types of service
732  * @param[in] response_data  Received response
733  * @param[in] mac_address    The MAC address of the connection peer
734  * @param[in] user_data      User can transfer the user specific data in callback
735  * @pre Either wifi_direct_start_service_discovery() or
736  *      wifi_direct_cancel_service_discovery() will invoke this callback in the
737  *      thread-default main context of the thread from which you registered this
738  *      callback using wifi_direct_set_service_state_changed_cb().
739  * @see wifi_direct_start_discovery()
740  * @see wifi_direct_cancel_discovery()
741  * @see wifi_direct_set_discovery_state_changed_cb()
742  * @see wifi_direct_unset_discovery_state_changed_cb()
743  */
744 typedef void (*wifi_direct_service_state_changed_cb) (int error_code,
745                                                       wifi_direct_service_discovery_state_e service_state,
746                                                       wifi_direct_service_type_e service_type,
747                                                       void *response_data,
748                                                       const char *mac_address,
749                                                       void *user_data);
750
751
752 /**
753  * @brief Called when the state of Wi-FI Direct is changed.
754  * @since_tizen 3.0
755  * @param[in] state      The Wi-Fi Direct state
756  * @param[in] user_data  The user data passed from the callback registration function
757  * @pre Changes in Wi-Fi Direct state will invoke this callback
758  *      if you register this callback using wifi_direct_set_state_changed_cb().
759  * @see wifi_direct_set_state_changed_cb()
760  * @see wifi_direct_unset_state_changed_cb()
761  */
762 typedef void (*wifi_direct_state_changed_cb) (wifi_direct_state_e state,
763                                               void *user_data);
764
765
766 /**
767  * @brief Initializes Wi-Fi Direct service.
768  * @since_tizen 2.3
769  * @privlevel public
770  * @privilege %http://tizen.org/privilege/wifidirect
771  * @return @c 0 on success,
772  *         otherwise a negative error value
773  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
774  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
775  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
776  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
777  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
778  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
779  * @see wifi_direct_deinitialize()
780  *
781  *
782  * Here is an example of the usage:
783  * @code
784  * #include <stdio.h>
785  * #include <wifi_direct.h>
786  *
787  * void function(void)
788  * {
789  *      int ret;
790  *
791  *      ret = wifi_direct_initialize();
792  *
793  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
794  *              printf("Failed to initialize\n");
795  *              return;
796  *      }
797  *
798  *      printf("Initialized Successfully\n");
799  * }
800  *
801  * int main()
802  * {
803  *      function(); // initialize Wi-Fi Direct
804  *      wifi_direct_deinitialize(); // deinitialize Wi-Fi Direct
805  *      return 0;
806  * }
807  * @endcode
808  */
809 int wifi_direct_initialize(void);
810
811 /**
812  * @brief Deinitializes Wi-Fi Direct service.
813  * @since_tizen 2.3
814  * @return @c 0 on success,
815  *         otherwise a negative error value
816  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
817  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
818  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
819  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
820  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
821  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
822  * @see wifi_direct_initialize()
823  *
824  *
825  * Here is an example of the usage:
826  * @code
827  * #include <stdio.h>
828  * #include <wifi_direct.h>
829  *
830  * void function(void)
831  * {
832  *      int ret;
833  *
834  *      ret = wifi_direct_deinitialize();
835  *
836  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
837  *              printf("Failed to deinitialize\n");
838  *              return;
839  *      }
840  *
841  *      printf("Deinitialized Successfully\n");
842  * }
843  *
844  * int main()
845  * {
846  *      wifi_direct_initialize(); // initialize Wi-Fi Direct
847  *      function(); // deinitialize Wi-Fi Direct
848  *      return 0;
849  * }
850  * @endcode
851  */
852 int wifi_direct_deinitialize(void);
853
854
855 /**
856  * @brief Sets the callback called when the state of device is changed.
857  * @since_tizen 2.3
858  * @param[in] cb         The callback function to invoke
859  * @param[in] user_data  The user data to be passed to the callback function
860  * @return @c 0 on success,
861  *         otherwise a negative error value
862  * @retval #WIFI_DIRECT_ERROR_NONE               Successful
863  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
864  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED    Not initialized
865  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED      Not supported
866  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
867  * @see wifi_direct_initialize()
868  * @see wifi_direct_unset_device_state_changed_cb()
869  * @see wifi_direct_device_state_changed_cb()
870  *
871  *
872  * Here is an example of the usage:
873  * @code
874  * #include <stdio.h>
875  * #include <wifi_direct.h>
876  *
877  * void callback(int error_code,
878  *               Wifi_direct_device_state_e device_state,
879  *               void *user_data)
880  * {
881  *      switch (device_state) {
882  *      case WIFI_DIRECT_DEVICE_STATE_ACTIVATED:
883  *              printf("device activated\n");
884  *
885  *              //Do stuff here when Wi-Fi Direct is activated
886  *
887  *              break;
888  *
889  *      case WIFI_DIRECT_DEVICE_STATE_DEACTIVATED:
890  *              printf("device deactivated\n");
891  *
892  *              //Do stuff here when Wi-Fi Direct is deactivated
893  *
894  *              break;
895  *
896  *      default:
897  *              break;
898  *      }
899  * }
900  *
901  * void function(void)
902  * {
903  *      int ret;
904  *
905  *      ret = wifi_direct_set_device_state_changed_cb(callback, NULL);
906  *
907  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
908  *              printf("Failed to register callback\n");
909  *              return;
910  *      }
911  *
912  *      printf("callback registered Successfully\n");
913  * }
914  *
915  * int main()
916  * {
917  *      wifi_direct_initialize(); // initialize Wi-Fi Direct
918  *      wifi_direct_activate(); // Activate Wi-Fi Direct
919  *      function();
920  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
921  *      wifi_direct_deinitialize(); // deinitialize Wi-Fi Direct
922  *      return 0;
923  * }
924  * @endcode
925  */
926 int wifi_direct_set_device_state_changed_cb(wifi_direct_device_state_changed_cb cb, void *user_data);
927
928
929 /**
930  * @brief Unsets the callback called when the state of device is changed.
931  * @since_tizen 2.3
932  * @return @c 0 on success,
933  *         otherwise a negative error value
934  * @retval #WIFI_DIRECT_ERROR_NONE             Successful
935  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
936  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED    Not supported
937  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
938  * @see wifi_direct_initialize()
939  * @see wifi_direct_set_device_state_changed_cb()
940  *
941  *
942  * Here is an example of the usage:
943  * @code
944  * #include <stdio.h>
945  * #include <wifi_direct.h>
946  *
947  * void function(void)
948  * {
949  *      int ret;
950  *
951  *      ret = wifi_direct_unset_device_state_changed_cb();
952  *
953  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
954  *              printf("Failed to deregister callback\n");
955  *              return;
956  *      }
957  *
958  *      printf("callback deregistered Successfully\n");
959  * }
960  *
961  * int main()
962  * {
963  *      wifi_direct_initialize(); // initialize Wi-Fi Direct
964  *      function();
965  *      wifi_direct_deinitialize(); // deinitialize Wi-Fi Direct
966  *      return 0;
967  * }
968  * @endcode
969  */
970 int wifi_direct_unset_device_state_changed_cb(void);
971
972
973 /**
974  * @brief Sets the callback called when the state of discovery is changed.
975  * @since_tizen 2.3
976  * @param[in] cb         The callback function to invoke
977  * @param[in] user_data  The user data to be passed to the callback function
978  * @return @c 0 on success,
979  *         otherwise a negative error value
980  * @retval #WIFI_DIRECT_ERROR_NONE               Successful
981  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
982  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED    Not initialized
983  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED      Not supported
984  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
985  * @see wifi_direct_initialize()
986  * @see wifi_direct_unset_discovery_state_changed_cb()
987  * @see wifi_direct_discovery_state_chagned_cb()
988  *
989  *
990  * Here is an example of the usage:
991  * @code
992  * #include <stdio.h>
993  * #include <wifi_direct.h>
994  *
995  * void callback(int error_code,
996  *               wifi_direct_discovery_state_e discovery_state,
997  *               void *user_data)
998  * {
999  *      switch(discovery_state) {
1000  *      case WIFI_DIRECT_DISCOVERY_STARTED:
1001  *              printf("Discovery started\n");
1002  *              break;
1003  *
1004  *      case WIFI_DIRECT_ONLY_LISTEN_STARTED:
1005  *              printf("listen started\n");
1006  *              break;
1007  *
1008  *      case WIFI_DIRECT_DISCOVERY_FINISHED:
1009  *              printf("Discovery finished\n");
1010  *              break;
1011  *
1012  *      case WIFI_DIRECT_DISCOVERY_FOUND:
1013  *              printf("peer devices found\n");
1014  *              break;
1015  *
1016  *      case WIFI_DIRECT_DISCOVERY_LOST:
1017  *              printf("Discovery lost\n");
1018  *              break;
1019  *
1020  *      default:
1021  *      break;
1022  *      }
1023  *
1024  * }
1025  *
1026  * void function(void)
1027  * {
1028  *      int ret;
1029  *
1030  *      ret = wifi_direct_set_discovery_state_changed_cb(callback, NULL);
1031  *
1032  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
1033  *              printf("Failed to register callback\n");
1034  *              return;
1035  *      }
1036  *
1037  *      printf("callback registered Successfully\n");
1038  * }
1039  *
1040  * int main()
1041  * {
1042  *      wifi_direct_initialize(); // initialize Wi-Fi Direct
1043  *      wifi_direct_activate(); // Activate Wi-Fi Direct
1044  *      function();
1045  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
1046  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
1047  *      return 0;
1048  * }
1049  * @endcode
1050  */
1051 int wifi_direct_set_discovery_state_changed_cb(wifi_direct_discovery_state_chagned_cb cb, void* user_data);
1052
1053
1054 /**
1055  * @brief Unsets the callback called when the state of discovery is changed.
1056  * @since_tizen 2.3
1057  * @return @c 0 on success,
1058  *         otherwise a negative error value
1059  * @retval #WIFI_DIRECT_ERROR_NONE             Successful
1060  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
1061  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED    Not supported
1062  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
1063  * @see wifi_direct_initialize()
1064  * @see wifi_direct_set_discovery_state_changed_cb()
1065  *
1066  *
1067  * Here is an example of the usage:
1068  * @code
1069  * #include <stdio.h>
1070  * #include <wifi_direct.h>
1071  *
1072  * void function(void)
1073  * {
1074  *      int ret;
1075  *
1076  *      ret = wifi_direct_unset_discovery_state_changed_cb();
1077  *
1078  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
1079  *              printf("Failed to deregister callback\n");
1080  *              return;
1081  *      }
1082  *
1083  *      printf("callback deregistered Successfully\n");
1084  * }
1085  *
1086  * int main()
1087  * {
1088  *      wifi_direct_initialize(); // initialize Wi-Fi Direct
1089  *      wifi_direct_activate(); // Activate Wi-FI Direct
1090  *      function();
1091  *      wifi_direct_deactivate(); // Deactivate Wi-FI Direct
1092  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
1093  *      return 0;
1094  * }
1095  * @endcode
1096  */
1097 int wifi_direct_unset_discovery_state_changed_cb(void);
1098
1099
1100 /**
1101  * @brief Sets the callback called when the peer is found.
1102  * @since_tizen 2.3
1103  * @param[in] cb         The callback function to invoke
1104  * @param[in] user_data  The user data to be passed to the callback function
1105  * @return @c 0 on success,
1106  *         otherwise a negative error value
1107  * @retval #WIFI_DIRECT_ERROR_NONE               Successful
1108  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
1109  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED    Not initialized
1110  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED      Not supported
1111  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
1112  * @see wifi_direct_initialize()
1113  * @see wifi_direct_unset_peer_found_cb()
1114  * @see wifi_direct_peer_found_cb()
1115  *
1116  *
1117  * Here is an example of the usage:
1118  * @code
1119  * #include <stdio.h>
1120  * #include <wifi_direct.h>
1121  *
1122  * void callback(int error_code,
1123  *               wifi_direct_discovery_state_e discovery_state,
1124  *               const char *mac_address,
1125  *               void *user_data)
1126  *{
1127  *      switch (discovery_state) {
1128  *      case WIFI_DIRECT_DISCOVERY_FOUND:
1129  *              printf("Peer found\n");
1130  *              printf("MAC Address=%s\n", mac_address);
1131  *
1132  *              // Do stuff here for discovered devices
1133  *
1134  *      break;
1135  *
1136  *      default:
1137  *              break;
1138  *      }
1139  *}
1140  *
1141  * void function(void)
1142  * {
1143  *      int ret;
1144  *
1145  *      ret = wifi_direct_set_peer_found_cb(callback, NULL);
1146  *
1147  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
1148  *              printf("Failed to register callback\n");
1149  *              return;
1150  *      }
1151  *
1152  *      printf("callback registered Successfully\n");
1153  * }
1154  *
1155  * int main()
1156  * {
1157  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
1158  *      wifi_direct_activate(); // Activate Wi-Fi Direct
1159  *      function();
1160  *      wifi_direct_deactivate(); // Deactivate Wi-FI Direct
1161  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
1162  *      return 0;
1163  * }
1164  * @endcode
1165  */
1166 int wifi_direct_set_peer_found_cb(wifi_direct_peer_found_cb cb, void* user_data);
1167
1168
1169 /**
1170  * @brief Unsets the callback called when the peer is found.
1171  * @since_tizen 2.3
1172  * @return @c 0 on success,
1173  *         otherwise a negative error value
1174  * @retval #WIFI_DIRECT_ERROR_NONE             Successful
1175  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
1176  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED    Not supported
1177  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
1178  * @see wifi_direct_initialize()
1179  * @see wifi_direct_set_peer_found_cb()
1180  *
1181  *
1182  * Here is an example of the usage:
1183  * @code
1184  * #include <stdio.h>
1185  * #include <wifi_direct.h>
1186  *
1187  * void function(void)
1188  * {
1189  *      int ret;
1190  *
1191  *      ret = wifi_direct_unset_peer_found_cb();
1192  *
1193  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
1194  *              printf("Failed to deregister callback\n");
1195  *              return;
1196  *      }
1197  *
1198  *      printf("callback deregistered Successfully\n");
1199  * }
1200  *
1201  * int main()
1202  * {
1203  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
1204  *      function();
1205  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
1206  *      return 0;
1207  * }
1208  * @endcode
1209  */
1210 int wifi_direct_unset_peer_found_cb(void);
1211
1212
1213 /**
1214  * @brief Sets the callback called when the state of connection is changed.
1215  * @since_tizen 2.3
1216  * @param[in] cb         The callback function to invoke
1217  * @param[in] user_data  The user data to be passed to the callback function
1218  * @return @c 0 on success,
1219  *         otherwise a negative error value
1220  * @retval #WIFI_DIRECT_ERROR_NONE               Successful
1221  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
1222  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED    Not initialized
1223  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED      Not supported
1224  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
1225  * @see wifi_direct_initialize()
1226  * @see wifi_direct_unset_connection_state_changed_cb()
1227  * @see wifi_direct_connection_state_changed_cb()
1228  *
1229  *
1230  * Here is an example of the usage:
1231  * @code
1232  * #include <stdio.h>
1233  * #include <wifi_direct.h>
1234  *
1235  * void callback(int error_code,
1236  *               wifi_direct_connection_state_e connection_state,
1237  *               const char *mac_address,
1238  *               void *user_data)
1239  *{
1240  *      char *ip;
1241  *      bool owner;
1242  *      int wps_mode;
1243  *
1244  *      switch (connection_state) {
1245  *
1246  *      case WIFI_DIRECT_CONNECTION_IN_PROGRESS:
1247  *              printf("Connection in progress\n");
1248  *      break;
1249  *
1250  *      case WIFI_DIRECT_CONNECTION_RSP:
1251  *              if (error_code == WIFI_DIRECT_ERROR_NONE) {
1252  *                      printf("Peer Device Connected\n"); // device is connected
1253  *
1254  *                      printf("MAC=%s\n", mac_address); // device's MAC address
1255  *
1256  *                      wifi_direct_get_ip_address(&ip);
1257  *                      printf("IP=%s\n", ip); //device's IP address
1258  *
1259  *                      wifi_direct_is_group_owner(&owner);
1260  *                      printf("Ownership=%s\n", (owner)? "GO":"STA"); // (GO or client role)
1261  *
1262  *              } else if (error_code == WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT) {
1263  *                      printf("Connection timeout occurred\n");
1264  *              } else if (error_code == WIFI_DIRECT_ERROR_AUTH_FAILED) {
1265  *                      printf("Connection authorization Failed\n");
1266  *              } else
1267  *                      printf("Connection failed\n");
1268  *      break;
1269  *
1270  *      case WIFI_DIRECT_CONNECTION_WPS_REQ:
1271  *
1272  *              wifi_direct_get_local_wps_type(&wps_mode);
1273  *
1274  *              if (wps_mode == WIFI_DIRECT_WPS_TYPE_PBC) {
1275  *                      printf("Connection type WPS PBC\n");
1276  *                      // Handle WPS PBC case here
1277  *              }
1278  *
1279  *              if (wps_mode == WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY) {
1280  *                      printf("Connection type WPS PIN DISPLAY\n");
1281  *                      // Handle WPS PIN Display case here
1282  *              }
1283  *
1284  *              if (wps_mode == WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD) {
1285  *                      printf("Connection type WPS PIN KEYPAD\n");
1286  *                      // Handle WPS PIN Keypad case here
1287  *              }
1288  *      break;
1289  *
1290  *      case WIFI_DIRECT_CONNECTION_REQ:
1291  *              printf("Connection request from MAC %s\n", mac_address);
1292  *
1293  *              // Handle the connection request from peer device here
1294  *              // 1. WPS PBC
1295  *              // 2. WPS PIN Display
1296  *              // 3. WPS PIN Keypad
1297  *
1298  *              wifi_direct_accept_connection(mac_address);
1299  *      break;
1300  *
1301  *      case WIFI_DIRECT_DISCONNECTION_IND:
1302  *              if (error_code == WIFI_DIRECT_ERROR_NONE)
1303  *                      printf("peer device disconnected MAC %s\n", mac_address);
1304  *      break;
1305  *
1306  *      case WIFI_DIRECT_DISCONNECTION_RSP:
1307  *              if (error_code == WIFI_DIRECT_ERROR_NONE)
1308  *                      printf("peer device disconnection response MAC %s\n", mac_address);
1309  *      break;
1310  *
1311  *      case WIFI_DIRECT_DISASSOCIATION_IND:
1312  *              if (error_code == WIFI_DIRECT_ERROR_NONE)
1313  *                      printf("peer device disassociation MAC %s\n", mac_address);
1314  *      break;
1315  *
1316  *      case WIFI_DIRECT_GROUP_CREATED:
1317  *              printf("Group Created\n");
1318  *      break;
1319  *
1320  *      case WIFI_DIRECT_GROUP_DESTROYED:
1321  *              printf("Group Destroyed\n");
1322  *      break;
1323  *
1324  *      default:
1325  *      break;
1326  *      }
1327  *}
1328  *
1329  * void function(void)
1330  * {
1331  *      int ret;
1332  *
1333  *      ret = wifi_direct_set_connection_state_changed_cb(callback,
1334  *                                                    NULL);
1335  *
1336  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
1337  *              printf("Failed to register callback\n");
1338  *              return;
1339  *      }
1340  *
1341  *      printf("callback registered Successfully\n");
1342  * }
1343  *
1344  * int main()
1345  * {
1346  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
1347  *      wifi_direct_activate(); // Activate Wi-Fi Direct
1348  *      function();
1349  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
1350  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
1351  *      return 0;
1352  * }
1353  * @endcode
1354  */
1355 int wifi_direct_set_connection_state_changed_cb(wifi_direct_connection_state_changed_cb cb, void *user_data);
1356
1357
1358 /**
1359  * @brief Unsets the callback called when the state of connection is changed.
1360  * @since_tizen 2.3
1361  * @return @c 0 on success,
1362  *         otherwise a negative error value
1363  * @retval #WIFI_DIRECT_ERROR_NONE             Successful
1364  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
1365  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED    Not supported
1366  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
1367  * @see wifi_direct_initialize()
1368  * @see wifi_direct_set_connection_state_changed_cb()
1369  *
1370  *
1371  * Here is an example of the usage:
1372  * @code
1373  * #include <stdio.h>
1374  * #include <wifi_direct.h>
1375  *
1376  * void function(void)
1377  * {
1378  *      int ret;
1379  *
1380  *      ret = wifi_direct_unset_connection_state_changed_cb();
1381  *
1382  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
1383  *              printf("Failed to deregister callback\n");
1384  *              return;
1385  *      }
1386  *
1387  *      printf("callback deregistered Successfully\n");
1388  * }
1389  *
1390  * int main()
1391  * {
1392  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
1393  *      function();
1394  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
1395  *      return 0;
1396  * }
1397  * @endcode
1398  */
1399 int wifi_direct_unset_connection_state_changed_cb(void);
1400
1401 /**
1402  * @brief Sets the callback called when the state of connection is changed.
1403  * @since_tizen 5.0
1404  * @param[in] cb  The callback function to invoke
1405  * @param[in] user_data  The user data to be passed to the callback function
1406  * @return @c 0 on success,
1407  *         otherwise a negative error value
1408  * @retval #WIFI_DIRECT_ERROR_NONE  Successful
1409  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
1410  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
1411  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED    Not supported
1412  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
1413  * @see wifi_direct_initialize()
1414  * @see wifi_direct_unset_peer_info_connection_state_changed_cb()
1415  * @see wifi_direct_peer_info_connection_state_changed_cb()
1416  */
1417 int wifi_direct_set_peer_info_connection_state_changed_cb(wifi_direct_peer_info_connection_state_changed_cb cb, void *user_data);
1418
1419 /**
1420  * @brief Unsets the callback called when the state of connection is changed.
1421  * @since_tizen 5.0
1422  * @return @c 0 on success,
1423  *         otherwise a negative error value
1424  * @retval #WIFI_DIRECT_ERROR_NONE  Successful
1425  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
1426  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED    Not supported
1427  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
1428  * @see wifi_direct_initialize()
1429  * @see wifi_direct_set_peer_info_connection_state_changed_cb()
1430  */
1431 int wifi_direct_unset_peer_info_connection_state_changed_cb(void);
1432
1433
1434 /**
1435  * @brief Sets the callback called when the IP address of the client is assigned
1436  *        if your device is the group owner.
1437  * @since_tizen 2.3
1438  * @param[in] cb         The callback function to invoke
1439  * @param[in] user_data  The user data to be passed to the callback function
1440  * @return @c 0 on success,
1441  *         otherwise a negative error value
1442  * @retval #WIFI_DIRECT_ERROR_NONE               Successful
1443  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
1444  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED    Not initialized
1445  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED      Not supported
1446  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
1447  * @see wifi_direct_initialize()
1448  * @see wifi_direct_unset_client_ip_address_assigned_cb()
1449  * @see wifi_direct_client_ip_address_assigned_cb()
1450  *
1451  *
1452  * Here is an example of the usage:
1453  * @code
1454  * #include <stdio.h>
1455  * #include <wifi_direct.h>
1456  *
1457  *
1458  * void callback(const char *mac_address,
1459  *               const char *ip_address,
1460  *               const char *interface_address,
1461  *               void *user_data);
1462  *{
1463  *      printf("IP Assigned to the client device\n");
1464  *
1465  *      printf("mac=%s\n", mac_address);
1466  *      printf("ip=%s\n", ip_address);
1467  *      printf("iface=%s\n", interface_address);
1468  *}
1469  *
1470  * void function(void)
1471  * {
1472  *      int ret;
1473  *
1474  *      ret = wifi_direct_set_client_ip_address_assigned_cb(callback,
1475  *                                                      NULL);
1476  *
1477  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
1478  *              printf("Failed to register callback\n");
1479  *              return;
1480  *      }
1481  *
1482  *      printf("callback registered Successfully\n");
1483  * }
1484  *
1485  * int main()
1486  * {
1487  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
1488  *      wifi_direct_activate(); // Activate Wi-Fi Direct
1489  *      function();
1490  *      wifi_direct_deactivate(); // deactivate Wi-Fi Direct
1491  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
1492  *      return 0;
1493  * }
1494  * @endcode
1495  */
1496 int wifi_direct_set_client_ip_address_assigned_cb(wifi_direct_client_ip_address_assigned_cb cb, void *user_data);
1497
1498
1499 /**
1500  * @brief Unsets the callback called when the IP address of the client is assigned
1501  *        if your device is the group owner.
1502  * @since_tizen 2.3
1503  * @return @c 0 on success,
1504  *         otherwise a negative error value
1505  * @retval #WIFI_DIRECT_ERROR_NONE             Successful
1506  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
1507  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED    Not supported
1508  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
1509  * @see wifi_direct_initialize()
1510  * @see wifi_direct_set_connection_state_changed_cb()
1511  *
1512  *
1513  * Here is an example of the usage:
1514  * @code
1515  * #include <stdio.h>
1516  * #include <wifi_direct.h>
1517  *
1518  * void function(void)
1519  * {
1520  *      int ret;
1521  *
1522  *      ret = wifi_direct_unset_client_ip_address_assigned_cb();
1523  *
1524  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
1525  *              printf("Failed to deregister callback\n");
1526  *              return;
1527  *      }
1528  *
1529  *      printf("callback deregistered Successfully\n");
1530  * }
1531  *
1532  * int main()
1533  * {
1534  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
1535  *      function();
1536  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
1537  *      return 0;
1538  * }
1539  * @endcode
1540  */
1541 int wifi_direct_unset_client_ip_address_assigned_cb(void);
1542
1543
1544 /**
1545  * @brief Sets the callback called when the state of the service discovery is changed.
1546  * @since_tizen 2.3
1547  * @param[in] cb         The callback function to invoke
1548  * @param[in] user_data  The user data to be passed to the callback function
1549  * @return @c 0 on success,
1550  *         otherwise a negative error value
1551  * @retval #WIFI_DIRECT_ERROR_NONE               Successful
1552  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
1553  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED    Not initialized
1554  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED      Not supported
1555  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
1556  * @see wifi_direct_initialize()
1557  * @see wifi_direct_unset_service_state_changed_cb()
1558  * @see wifi_direct_service_state_changed_cb()
1559  *
1560  *
1561  * Here is an example of the usage:
1562  * @code
1563  * #include <stdio.h>
1564  * #include <wifi_direct.h>
1565  *
1566  *
1567  * void callback(int error_code,
1568  *               wifi_direct_service_discovery_state_e discovery_state,
1569  *               wifi_direct_service_type_e service_type,
1570  *               void *response_data,
1571  *               const char *mac_address,
1572  *               void *user_data);
1573  *{
1574  *      switch (discovery_state) {
1575  *      case WIFI_DIRECT_SERVICE_DISCOVERY_STARTED:
1576  *              printf("Discovery Started\n");
1577  *      break;
1578  *
1579  *      case WIFI_DIRECT_SERVICE_DISCOVERY_FINISHED:
1580  *              printf("Discovery finished\n");
1581  *      break;
1582  *
1583  *      case WIFI_DIRECT_SERVICE_DISCOVERY_FOUND:
1584  *              printf("Discovery found\n");
1585  *              if (mac_address != NULL)
1586  *                      printf("Peer MAC=%s\n", mac_address);
1587  *
1588  *              if (response_data != NULL)
1589  *                      printf("Peer response=%s\n", (char *)response_data);
1590  *
1591  *              if (service_type == WIFI_DIRECT_SERVICE_TYPE_ALL)
1592  *                      printf("service type all\n");
1593  *              if (service_type == WIFI_DIRECT_SERVICE_TYPE_BONJOUR)
1594  *                      printf("service type bonjour\n");
1595  *              if (service_type == WIFI_DIRECT_SERVICE_TYPE_UPNP)
1596  *                      printf("service type UPNP\n");
1597  *              if (service_type == WIFI_DIRECT_SERVICE_TYPE_BT_ADDR)
1598  *                      printf("service type BT_ADDR\n");
1599  *              if (service_type == WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO)\
1600  *                      printf("service type contact info\n");
1601  *      break;
1602  *
1603  *      default:
1604  *      break;
1605  *      }
1606  *}
1607  *
1608  * void function(void)
1609  * {
1610  *      int ret;
1611  *
1612  *      ret = wifi_direct_set_service_state_changed_cb(callback,
1613  *                                                 NULL);
1614  *
1615  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
1616  *              printf("Failed to register callback\n");
1617  *              return;
1618  *      }
1619  *
1620  *      printf("callback registered Successfully\n");
1621  * }
1622  *
1623  * int main()
1624  * {
1625  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
1626  *      wifi_direct_activate(); // Activate Wi-Fi Direct
1627  *      function();
1628  *      wifi_direct_deactivate(); // deactivate Wi-Fi Direct
1629  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
1630  *      return 0;
1631  * }
1632  * @endcode
1633  */
1634 int wifi_direct_set_service_state_changed_cb(wifi_direct_service_state_changed_cb cb, void *user_data);
1635
1636
1637 /**
1638  * @brief Unsets the callback called when the state of the service discovery is changed.
1639  * @since_tizen 2.3
1640  * @return @c 0 on success,
1641  *         otherwise a negative error value
1642  * @retval #WIFI_DIRECT_ERROR_NONE             Successful
1643  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
1644  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED    Not supported
1645  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
1646  * @see wifi_direct_initialize()
1647  * @see wifi_direct_set_service_state_changed_cb()
1648  *
1649  *
1650  * Here is an example of the usage:
1651  * @code
1652  * #include <stdio.h>
1653  * #include <wifi_direct.h>
1654  *
1655  * void function(void)
1656  * {
1657  *      int ret;
1658  *
1659  *      ret = wifi_direct_unset_service_state_changed_cb();
1660  *
1661  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
1662  *              printf("Failed to deregister callback\n");
1663  *              return;
1664  *      }
1665  *
1666  *      printf("callback deregistered Successfully\n");
1667  * }
1668  *
1669  * int main()
1670  * {
1671  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
1672  *      function();
1673  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
1674  *      return 0;
1675  * }
1676  * @endcode
1677  */
1678 int wifi_direct_unset_service_state_changed_cb(void);
1679
1680
1681 /**
1682  * @brief Sets the callback called when the state of Wi-Fi Direct is changed.
1683  * @since_tizen 3.0
1684  * @param[in] cb         The callback function to invoke
1685  * @param[in] user_data  The user data to be passed to the callback function
1686  * @return @c 0 on success,
1687  *         otherwise a negative error value
1688  * @retval #WIFI_DIRECT_ERROR_NONE               Successful
1689  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
1690  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED   Operation Failed
1691  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED      Not supported
1692  * @see wifi_direct_unset_state_changed_cb()
1693  *
1694  *
1695  * Here is an example of the usage:
1696  * @code
1697  * #include <stdio.h>
1698  * #include <wifi_direct.h>
1699  *
1700  *
1701  * char* print_link_state(wifi_direct_state_e state)
1702  * {
1703  *      if (state == WIFI_DIRECT_STATE_DEACTIVATED)
1704  *              return "DEACTIVATED";
1705  *      if (state == WIFI_DIRECT_STATE_ACTIVATING)
1706  *              return "ACTIVATING";
1707  *      if (state == WIFI_DIRECT_STATE_ACTIVATED)
1708  *              return "ACTIVATED";
1709  *      if (state == WIFI_DIRECT_STATE_DISCOVERING)
1710  *              return "DISCOVERING";
1711  *      if (state == WIFI_DIRECT_STATE_CONNECTING)
1712  *              return "CONNECTING";
1713  *      if (state == WIFI_DIRECT_STATE_DISCONNECTING)
1714  *              return "DISCONNECTING";
1715  *      if (state == WIFI_DIRECT_STATE_CONNECTED)
1716  *              return "CONNECTED";
1717  *      if (state == WIFI_DIRECT_STATE_GROUP_OWNER)
1718  *              return "GROUP OWNER";
1719  *      return "Unknown state";
1720  * }
1721  *
1722  * void callback(wifi_direct_state_e state,
1723  *               void *user_data);
1724  * {
1725  *      printf("State changed [%s]\n", print_link_state(state));
1726  * }
1727  *
1728  * void function(void)
1729  * {
1730  *      int ret;
1731  *
1732  *      ret = wifi_direct_set_state_changed_cb(callback,
1733  *                                          NULL);
1734  *
1735  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
1736  *              printf("Failed to register callback\n");
1737  *              return;
1738  *      }
1739  *
1740  *      printf("callback registered Successfully\n");
1741  * }
1742  *
1743  * int main()
1744  * {
1745  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
1746  *      wifi_direct_activate(); // Activate Wi-Fi Direct
1747  *      function();
1748  *      wifi_direct_deactivate(); // deactivate Wi-Fi Direct
1749  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
1750  *      return 0;
1751  * }
1752  * @endcode
1753  */
1754 int wifi_direct_set_state_changed_cb(wifi_direct_state_changed_cb cb, void *user_data);
1755
1756
1757 /**
1758  * @brief Unsets the callback called when the state of Wi-Fi Direct is changed.
1759  * @since_tizen 3.0
1760  * @return @c 0 on success,
1761  *         otherwise a negative error value
1762  * @retval #WIFI_DIRECT_ERROR_NONE              Successful
1763  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation Failed
1764  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED     Not supported
1765  * @see wifi_direct_initialize()
1766  * @see wifi_direct_set_state_changed_cb()
1767  *
1768  *
1769  * Here is an example of the usage:
1770  * @code
1771  * #include <stdio.h>
1772  * #include <wifi_direct.h>
1773  *
1774  * void function(void)
1775  * {
1776  *      int ret;
1777  *
1778  *      ret = wifi_direct_unset_state_changed_cb();
1779  *
1780  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
1781  *              printf("Failed to deregister callback\n");
1782  *              return;
1783  *      }
1784  *
1785  *      printf("callback deregistered Successfully\n");
1786  * }
1787  *
1788  * int main()
1789  * {
1790  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
1791  *      function();
1792  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
1793  *      return 0;
1794  * }
1795  * @endcode
1796  */
1797 int wifi_direct_unset_state_changed_cb(void);
1798
1799
1800 /**
1801  * @brief Activates the Wi-Fi Direct service, asynchronously.
1802  * @since_tizen 2.3
1803  * @privlevel public
1804  * @privilege %http://tizen.org/privilege/wifidirect
1805  * @return @c 0 on success,
1806  *         otherwise a negative error value
1807  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
1808  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
1809  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
1810  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
1811  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
1812  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
1813  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
1814  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
1815  * @retval #WIFI_DIRECT_ERROR_WIFI_USED             Wi-Fi is being used
1816  * @retval #WIFI_DIRECT_ERROR_MOBILE_AP_USED        Mobile AP is being used
1817  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
1818  * @post wifi_direct_device_state_changed_cb() will be invoked.
1819  * @see wifi_direct_initialize()
1820  * @see wifi_direct_deactivate()
1821  * @see wifi_direct_device_state_changed_cb()
1822  *
1823  *
1824  * Here is an example of the usage:
1825  * @code
1826  * #include <stdio.h>
1827  * #include <wifi_direct.h>
1828  *
1829  *
1830  * int function(void)
1831  * {
1832  *      int ret;
1833  *
1834  *      ret = wifi_direct_activate(); // Activate Wi-Fi Direct
1835  *
1836  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
1837  *              printf("Failed to activate Wi-Fi Direct\n");
1838  *              return -1;
1839  *      }
1840  *
1841  *      printf("Wi-Fi Direct Activated\n");
1842  *      return 0;
1843  * }
1844  *
1845  * int main()
1846  * {
1847  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
1848  *      function();
1849  *      wifi_direct_deactivate(); // deactivate Wi-Fi Direct
1850  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
1851  *      return 0;
1852  * }
1853  * @endcode
1854  */
1855 int wifi_direct_activate(void);
1856
1857
1858 /**
1859  * @brief Deactivates the Wi-Fi Direct service, asynchronously.
1860  * @since_tizen 2.3
1861  * @privlevel public
1862  * @privilege %http://tizen.org/privilege/wifidirect
1863  * @return @c 0 on success,
1864  *         otherwise a negative error value
1865  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
1866  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
1867  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
1868  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
1869  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
1870  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
1871  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
1872  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
1873  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
1874  * @post wifi_direct_device_state_changed_cb() will be invoked.
1875  * @see wifi_direct_activate()
1876  * @see wifi_direct_device_state_changed_cb()
1877  *
1878  *
1879  * Here is an example of the usage:
1880  * @code
1881  * #include <stdio.h>
1882  * #include <wifi_direct.h>
1883  *
1884  *
1885  * int function(void)
1886  * {
1887  *      int ret;
1888  *
1889  *      ret = wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
1890  *
1891  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
1892  *              printf("Failed to deactivate Wi-Fi Direct\n");
1893  *              return -1;
1894  *      }
1895  *
1896  *      printf("Wi-Fi Direct Deactivated\n");
1897  *      return 0;
1898  * }
1899  *
1900  * int main()
1901  * {
1902  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
1903  *      wifi_direct_activate(); // Activated Wi-Fi Direct
1904  *      function();
1905  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
1906  *      return 0;
1907  * }
1908  * @endcode
1909  */
1910 int wifi_direct_deactivate(void);
1911
1912
1913 /**
1914  * @brief Starts discovery to find all P2P capable devices, asynchronously.
1915  * @details If application developers call wifi_direct_start_discovery() with @a listen_only as @c true,
1916  *          then skip the initial 802.11 Scan and then enter Listen state instead of
1917  *          cycling between Scan and Listen.
1918  * @since_tizen 2.3
1919  * @privlevel public
1920  * @privilege %http://tizen.org/privilege/wifidirect
1921  * @remarks The function can be called if the Wi-Fi Direct state is one of:\n
1922  *          #WIFI_DIRECT_STATE_ACTIVATED\n
1923  *          #WIFI_DIRECT_STATE_DISCOVERING\n
1924  *          #WIFI_DIRECT_STATE_GROUP_OWNER\n
1925  *          The function can be called even if there is another discovery in progress.
1926  *          All started processes will run simultaneously. Each process will receive
1927  *          #WIFI_DIRECT_DISCOVERY_FINISHED
1928  *          event in wifi_direct_discovery_state_chagned_cb().
1929  * @param[in] listen_only  The status of listen only: (@c true = listen only,
1930  *                         @c false = cycling between Scan and Listen)
1931  * @param[in] timeout      Specifies the duration of discovery period, in seconds.
1932  *                         If @c 0, then there is no limit on how long the discovery takes.
1933  *                         The actual limit (and time after which discovery stops) depends on
1934  *                         the vendor's hardware and firmware
1935  * @return @c 0 on success,
1936  *         otherwise a negative error value
1937  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
1938  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
1939  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
1940  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
1941  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
1942  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
1943  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
1944  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
1945  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
1946  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
1947  * @post wifi_direct_discovery_state_chagned_cb() will be invoked.
1948  * @see wifi_direct_activate()
1949  * @see wifi_direct_cancel_discovery()
1950  * @see wifi_direct_discovery_state_chagned_cb()
1951  *
1952  *
1953  * Here is an example of the usage:
1954  * @code
1955  * #include <stdio.h>
1956  * #include <wifi_direct.h>
1957  *
1958  *
1959  * void callback(int error_code,
1960  *               wifi_direct_discovery_state_e discovery_state,
1961  *               void *user_data)
1962  * {
1963  *      switch(discovery_state) {
1964  *      case WIFI_DIRECT_DISCOVERY_STARTED:
1965  *              printf("Discovery started\n");
1966  *              break;
1967  *
1968  *      case WIFI_DIRECT_ONLY_LISTEN_STARTED:
1969  *              printf("listen started\n");
1970  *              break;
1971  *
1972  *      case WIFI_DIRECT_DISCOVERY_FINISHED:
1973  *              printf("Discovery finished\n");
1974  *              break;
1975  *
1976  *      case WIFI_DIRECT_DISCOVERY_FOUND:
1977  *              printf("peer devices found\n");
1978  *              break;
1979  *
1980  *      case WIFI_DIRECT_DISCOVERY_LOST:
1981  *              printf("Discovery lost\n");
1982  *              break;
1983  *
1984  *      default:
1985  *      break;
1986  *      }
1987  * }
1988  *
1989  * int function(void)
1990  * {
1991  *      int ret;
1992  *
1993  *      ret = wifi_direct_start_discovery(TRUE, 15); // Start discovery with listen only
1994  *
1995  * if (ret != WIFI_DIRECT_ERROR_NONE) {
1996  *              printf("Failed to start scan\n");
1997  *              return -1;
1998  *      }
1999  *
2000  *      return 0;
2001  * }
2002  *
2003  * int main()
2004  * {
2005  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
2006  *      wifi_direct_set_discovery_state_changed_cb(callback,
2007  *                                              NULL); // Register callback
2008  *      wifi_direct_activate(); // Activated Wi-Fi Direct
2009  *
2010  *      function();
2011  *
2012  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
2013  *      wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback
2014  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
2015  *      return 0;
2016  * }
2017  * @endcode
2018  */
2019 int wifi_direct_start_discovery(bool listen_only, int timeout);
2020
2021
2022 /**
2023  * @brief Starts discovery to find all P2P capable devices with specified channel, asynchronously.
2024  * @details If you call this function with @a channel as @c #WIFI_DIRECT_DISCOVERY_FULL_SCAN
2025  *          it works same as wifi_direct_start_discovery() API.
2026  *          If application developers call this function with @a channel as @c #WIFI_DIRECT_DISCOVERY_SOCIAL_CHANNEL,
2027  *          then will search only the devices on the social channels(channel 1 or 6 or 11).
2028  *          If application developers call this function with @a channel as @c #WIFI_DIRECT_DISCOVERY_CHANNEL1,
2029  *          then will search only the devices on the channel 1.
2030  *          If application developers call this function with @a channel as @c #WIFI_DIRECT_DISCOVERY_CHANNEL6,
2031  *          then will search only the devices on the channel 6.
2032  *          If application developers call this function with @a channel as @c #WIFI_DIRECT_DISCOVERY_CHANNEL11,
2033  *          then will search only the devices on the channel 11.
2034  * @since_tizen 2.3
2035  * @privlevel public
2036  * @privilege %http://tizen.org/privilege/wifidirect
2037  * @remarks The function can be called if the Wi-Fi Direct state is one of:\n
2038  *          #WIFI_DIRECT_STATE_ACTIVATED\n
2039  *          #WIFI_DIRECT_STATE_DISCOVERING\n
2040  *          #WIFI_DIRECT_STATE_GROUP_OWNER\n
2041  *          The function can be called even if there is another discovery in progress.
2042  *          All started processes will run simultaneously. Each process will receive
2043  *          #WIFI_DIRECT_DISCOVERY_FINISHED
2044  *          event in wifi_direct_discovery_state_chagned_cb().
2045  * @param[in] listen_only  The status of listen only: (@c true = listen only,
2046  *                         @c false = cycling between Scan and Listen)
2047  * @param[in] timeout      Specifies the duration of discovery period, in seconds.
2048  *                         If @c 0, then there is no limit on how long the discovery takes.
2049  *                         The actual limit (and time after which discovery stops) depends on
2050  *                         the vendor's hardware and firmware
2051  * @param[in] channel      Specifies the discovery channel. (Full scan, social channels, channel 1, 6, 11)
2052  * @return @c 0 on success,
2053  *         otherwise a negative error value
2054  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
2055  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
2056  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
2057  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
2058  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
2059  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
2060  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
2061  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
2062  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
2063  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
2064  * @post wifi_direct_discovery_state_chagned_cb() will be invoked.
2065  * @see wifi_direct_activate()
2066  * @see wifi_direct_cancel_discovery()
2067  * @see wifi_direct_discovery_state_chagned_cb()
2068  *
2069  *
2070  * Here is an example of the usage:
2071  * @code
2072  * #include <stdio.h>
2073  * #include <wifi_direct.h>
2074  *
2075  *
2076  * void callback(int error_code,
2077  *               wifi_direct_discovery_state_e discovery_state,
2078  *               void *user_data)
2079  * {
2080  *      switch(discovery_state) {
2081  *      case WIFI_DIRECT_DISCOVERY_STARTED:
2082  *              printf("Discovery started\n");
2083  *              break;
2084  *
2085  *      case WIFI_DIRECT_ONLY_LISTEN_STARTED:
2086  *              printf("listen started\n");
2087  *              break;
2088  *
2089  *      case WIFI_DIRECT_DISCOVERY_FINISHED:
2090  *              printf("Discovery finished\n");
2091  *              break;
2092  *
2093  *      case WIFI_DIRECT_DISCOVERY_FOUND:
2094  *              printf("peer devices found\n");
2095  *              break;
2096  *
2097  *      case WIFI_DIRECT_DISCOVERY_LOST:
2098  *              printf("Discovery lost\n");
2099  *              break;
2100  *
2101  *      default:
2102  *      break;
2103  *      }
2104  * }
2105  *
2106  * int function(void)
2107  * {
2108  *      int ret;
2109  *
2110  *      ret = wifi_direct_start_discovery_specific_channel(TRUE, 15, // start discovery with 15sec timeout
2111  *           WIFI_DIRECT_DISCOVERY_FULL_SCAN); // scan all channels
2112  *
2113  * if (ret != WIFI_DIRECT_ERROR_NONE) {
2114  *              printf("Failed to start scan\n");
2115  *              return -1;
2116  *      }
2117  *
2118  *      return 0;
2119  * }
2120  *
2121  * int main()
2122  * {
2123  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
2124  *      wifi_direct_set_discovery_state_changed_cb(callback,
2125  *                                              NULL); // Register callback
2126  *      wifi_direct_activate(); // Activated Wi-Fi Direct
2127  *
2128  *      function();
2129  *
2130  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
2131  *      wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback
2132  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
2133  *      return 0;
2134  * }
2135  * @endcode
2136  */
2137 int wifi_direct_start_discovery_specific_channel(bool listen_only, int timeout, wifi_direct_discovery_channel_e channel);
2138
2139
2140 /**
2141  * @brief Starts discovery to find all P2P capable devices with specified frequency, asynchronously.
2142  * @since_tizen 4.0
2143  * @privlevel public
2144  * @privilege %http://tizen.org/privilege/wifidirect
2145  * @remarks The function can be called if the Wi-Fi Direct state is one of:\n
2146  *          #WIFI_DIRECT_STATE_ACTIVATED\n
2147  *          #WIFI_DIRECT_STATE_DISCOVERING\n
2148  *          #WIFI_DIRECT_STATE_GROUP_OWNER\n
2149  *          The function can be called even if there is another discovery in progress.
2150  *          All started processes will run simultaneously. Each process will receive
2151  *          #WIFI_DIRECT_DISCOVERY_FINISHED
2152  *          event in wifi_direct_discovery_state_chagned_cb().
2153  * @param[in] listen_only  Indicates mode in which the discovery service will work.
2154  *                         If @c true, the service will only listen, otherwise
2155  *                         it will cycle between scanning and listening
2156  * @param[in] timeout      Specifies the duration of discovery period, in seconds.
2157  *                         If @c 0, then there is no limit on how long the discovery takes.
2158  *                         The actual limit (and time after which discovery stops) depends on
2159  *                         the vendor's hardware and firmware
2160  * @param[in] frequency    Specifies the discovery frequency in MHz
2161  * @return @c 0 on success,
2162  *         otherwise a negative error value
2163  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
2164  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
2165  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
2166  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
2167  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
2168  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
2169  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
2170  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
2171  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
2172  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
2173  * @post wifi_direct_discovery_state_chagned_cb() will be invoked.
2174  * @see wifi_direct_activate()
2175  * @see wifi_direct_cancel_discovery()
2176  * @see wifi_direct_discovery_state_chagned_cb()
2177  * @see wifi_direct_discovered_peer_cb()
2178  *
2179  *
2180  * Here is an example of the usage:
2181  * @code
2182  * #include <stdio.h>
2183  * #include <wifi_direct.h>
2184  *
2185  *
2186  * void callback(int error_code,
2187  *               wifi_direct_discovery_state_e discovery_state,
2188  *               void *user_data)
2189  * {
2190  *      switch(discovery_state) {
2191  *      case WIFI_DIRECT_DISCOVERY_STARTED:
2192  *              printf("Discovery started\n");
2193  *              break;
2194  *
2195  *      case WIFI_DIRECT_ONLY_LISTEN_STARTED:
2196  *              printf("listen started\n");
2197  *              break;
2198  *
2199  *      case WIFI_DIRECT_DISCOVERY_FINISHED:
2200  *              printf("Discovery finished\n");
2201  *              break;
2202  *
2203  *      case WIFI_DIRECT_DISCOVERY_FOUND:
2204  *              printf("peer devices found\n");
2205  *              break;
2206  *
2207  *      case WIFI_DIRECT_DISCOVERY_LOST:
2208  *              printf("Discovery lost\n");
2209  *              break;
2210  *
2211  *      default:
2212  *      break;
2213  *      }
2214  * }
2215  *
2216  * int function(void)
2217  * {
2218  *      int ret;
2219  *
2220  *      ret = wifi_direct_start_discovery_specific_freq(TRUE, 15, // start discovery with 15sec timeout
2221  *                                                  2437); // scan for 2437 MHz frequency (Channel 6)
2222  *
2223  * if (ret != WIFI_DIRECT_ERROR_NONE) {
2224  *              printf("Failed to start scan\n");
2225  *              return -1;
2226  *      }
2227  *
2228  *      return 0;
2229  * }
2230  *
2231  * int main()
2232  * {
2233  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
2234  *      wifi_direct_set_discovery_state_changed_cb(callback,
2235  *                                              NULL); // Register callback
2236  *      wifi_direct_activate(); // Activated Wi-Fi Direct
2237  *
2238  *      function();
2239  *
2240  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
2241  *      wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback
2242  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
2243  *      return 0;
2244  * }
2245  * @endcode
2246  */
2247 int wifi_direct_start_discovery_specific_freq(bool listen_only, int timeout, int frequency);
2248
2249
2250 /**
2251  * @brief Cancels discovery process, asynchronously.
2252  * @details This function stops all discovery processes started with
2253  *          wifi_direct_start_discovery() functions.
2254  * @since_tizen 2.3
2255  * @privlevel public
2256  * @privilege %http://tizen.org/privilege/wifidirect
2257  * @return @c 0 on success,
2258  *         otherwise a negative error value
2259  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
2260  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
2261  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
2262  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
2263  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
2264  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
2265  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
2266  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
2267  * @pre Discovery must be started by wifi_direct_start_discovery().
2268  * @post wifi_direct_discovery_state_chagned_cb() will be invoked.
2269  * @see wifi_direct_start_discovery()
2270  * @see wifi_direct_start_discovery_specific_channel()
2271  * @see wifi_direct_start_discovery_specific_freq()
2272  * @see wifi_direct_discovery_state_chagned_cb()
2273  *
2274  *
2275  * Here is an example of the usage:
2276  * @code
2277  * #include <stdio.h>
2278  * #include <wifi_direct.h>
2279  *
2280  *
2281  * void callback(int error_code,
2282  *               wifi_direct_discovery_state_e discovery_state,
2283  *               void *user_data)
2284  * {
2285  *      switch(discovery_state) {
2286  *      case WIFI_DIRECT_DISCOVERY_STARTED:
2287  *              printf("Discovery started\n");
2288  *              break;
2289  *
2290  *      case WIFI_DIRECT_ONLY_LISTEN_STARTED:
2291  *              printf("listen started\n");
2292  *              break;
2293  *
2294  *      case WIFI_DIRECT_DISCOVERY_FINISHED:
2295  *              printf("Discovery finished\n");
2296  *              break;
2297  *
2298  *      case WIFI_DIRECT_DISCOVERY_FOUND:
2299  *              printf("peer devices found\n");
2300  *              break;
2301  *
2302  *      case WIFI_DIRECT_DISCOVERY_LOST:
2303  *              printf("Discovery lost\n");
2304  *              break;
2305  *
2306  *      default:
2307  *      break;
2308  *      }
2309  * }
2310  *
2311  * int function(void)
2312  * {
2313  *      int ret;
2314  *
2315  *      ret = wifi_direct_cancel_discovery(); // Cancel ongoing discovery
2316  *
2317  * if (ret != WIFI_DIRECT_ERROR_NONE) {
2318  *              printf("Failed to cancel discovery\n");
2319  *              return -1;
2320  *      }
2321  *
2322  *      return 0;
2323  * }
2324  *
2325  * int main()
2326  * {
2327  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
2328  *      wifi_direct_set_discovery_state_changed_cb(callback, NULL); // Register callback
2329  *      wifi_direct_activate(); // Activate Wi-Fi Direct
2330  *      wifi_direct_start_discovery(TRUE, 15); // Start discovery
2331  *
2332  *      function();
2333  *
2334  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
2335  *      wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback
2336  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
2337  *      return 0;
2338  * }
2339  * @endcode
2340  */
2341 int wifi_direct_cancel_discovery(void);
2342
2343
2344 /**
2345  * @brief Called repeatedly when you get the information of discovered peers.
2346  * @since_tizen 2.3
2347  * @remarks @a peer is valid only in this function.
2348  * @param[in] peer       The information of the discovered peer
2349  * @param[in] user_data  The user data passed from foreach function
2350  * @return @c true to continue with the next iteration of the loop,
2351  *         @c false to break out of the loop
2352  * @see wifi_direct_foreach_discovered_peers()
2353  */
2354 typedef bool (*wifi_direct_discovered_peer_cb) (wifi_direct_discovered_peer_info_s *peer, void *user_data);
2355
2356
2357 /**
2358  * @brief Gets the information of discovered peers.
2359  * @since_tizen 2.3
2360  * @privlevel public
2361  * @privilege %http://tizen.org/privilege/wifidirect
2362  * @param[in] callback   The callback function to invoke
2363  * @param[in] user_data  The user data to be passed to the callback function
2364  * @return @c 0 on success,
2365  *         otherwise a negative error value
2366  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
2367  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
2368  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
2369  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
2370  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
2371  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
2372  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
2373  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
2374  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
2375  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
2376  * @see wifi_direct_activate()
2377  * @see wifi_direct_discovered_peer_cb()
2378  *
2379  *
2380  * Here is an example of the usage:
2381  * @code
2382  * #include <stdio.h>
2383  * #include <wifi_direct.h>
2384  *
2385  *
2386  * void function_cb(wifi_direct_discovered_peer_info_s* peer,
2387  *                                           void *user_data)
2388  * {
2389  *      if (peer)
2390  *              printf("peer device=%s MAC=%s\n", peer->device_name, peer->mac_address);
2391  * }
2392  *
2393  * int function(void)
2394  * {
2395  *      int ret;
2396  *
2397  *      ret = wifi_direct_foreach_discovered_peers(function_cb, NULL); // get discovered peer devices info
2398  *
2399  * if (ret != WIFI_DIRECT_ERROR_NONE) {
2400  *              printf("Failed to get discovered peers\n");
2401  *              return -1;
2402  *      }
2403  *
2404  *      return 0;
2405  * }
2406  *
2407  * void callback(int error_code,
2408  *               wifi_direct_discovery_state_e discovery_state,
2409  *               void *user_data)
2410  * {
2411  *      switch(discovery_state) {
2412  *      case WIFI_DIRECT_DISCOVERY_STARTED:
2413  *              printf("Discovery started\n");
2414  *              break;
2415  *
2416  *      case WIFI_DIRECT_ONLY_LISTEN_STARTED:
2417  *              printf("listen started\n");
2418  *              break;
2419  *
2420  *      case WIFI_DIRECT_DISCOVERY_FINISHED:
2421  *              printf("Discovery finished\n");
2422  *
2423  *              function();
2424  *
2425  *              break;
2426  *
2427  *      case WIFI_DIRECT_DISCOVERY_FOUND:
2428  *              printf("peer devices found\n");
2429  *              break;
2430  *
2431  *      case WIFI_DIRECT_DISCOVERY_LOST:
2432  *              printf("Discovery lost\n");
2433  *              break;
2434  *
2435  *      default:
2436  *      break;
2437  *      }
2438  * }
2439  *
2440  * int main()
2441  * {
2442  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
2443  *      wifi_direct_set_discovery_state_changed_cb(callback, NULL); // Register callback
2444  *      wifi_direct_activate(); // Activate Wi-Fi Direct
2445  *      wifi_direct_start_discovery(TRUE, 15); // Start discovery
2446  *
2447  *      //       APP CODE HERE
2448  *
2449  *      // App must clean up Wi-Fi Direct before exiting
2450  *
2451  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
2452  *      wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback
2453  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
2454  *      return 0;
2455  * }
2456  * @endcode
2457  */
2458 int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_cb callback, void *user_data);
2459
2460
2461 /**
2462  * @brief Connects to a specified peer, asynchronously.
2463  * @details This function connects to specified peer by automatically determining
2464  *          whether to perform group formation, join an existing group, invite, re-invoke a group.
2465  *          The decision is based on the current state of the peers (i.e. GO, STA, not connected)
2466  *          and the availability of persistent data.
2467  * @since_tizen 2.3
2468  * @privlevel public
2469  * @privilege %http://tizen.org/privilege/wifidirect
2470  * @param[in] mac_address  The MAC address of remote device
2471  * @return @c 0 on success,
2472  *         otherwise a negative error value
2473  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
2474  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
2475  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
2476  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
2477  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
2478  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
2479  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
2480  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
2481  * @retval #WIFI_DIRECT_ERROR_TOO_MANY_CLIENT       Too many client
2482  * @retval #WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT   Connection timed out
2483  * @retval #WIFI_DIRECT_ERROR_CONNECTION_FAILED     Connection failed
2484  * @retval #WIFI_DIRECT_ERROR_AUTH_FAILED           Authentication failed
2485  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
2486  * @post wifi_direct_connection_state_changed_cb() will be invoked.
2487  * @see wifi_direct_activate()
2488  * @see wifi_direct_disconnect()
2489  * @see wifi_direct_disconnect_all()
2490  * @see wifi_direct_connection_state_changed_cb()
2491  *
2492  *
2493  * Here is an example of the usage:
2494  * @code
2495  * #include <stdio.h>
2496  * #include <wifi_direct.h>
2497  *
2498  *
2499  * bool device_selected = false;
2500  *
2501  * void peers_cb(wifi_direct_discovered_peer_info_s* peer,
2502  *                                           void *user_data)
2503  * {
2504  *      if (peer && !device_selected) {
2505  *              printf("peer device=%s MAC=%s\n", peer->device_name, peer->mac_address);
2506  *
2507  *              device_selected = true;
2508  *
2509  *              function(peer->mac_address); // Connect to the first discovered peer
2510  *      }
2511  * }
2512  *
2513  * int function(const char *mac)
2514  * {
2515  *      int ret;
2516  *
2517  *      ret = wifi_direct_connect(mac); // connect to the peer device
2518  *
2519  * if (ret != WIFI_DIRECT_ERROR_NONE) {
2520  *              printf("Failed to connect the peer\n");
2521  *              return -1;
2522  *      }
2523  *
2524  *      return 0;
2525  * }
2526  *
2527  * void callback_2(int error_code,
2528  *                 wifi_direct_connection_state_e state,
2529  *                 const char *mac, void *user_data)
2530  *{
2531  *      switch (state) {
2532  *      case WIFI_DIRECT_CONNECTION_IN_PROGRESS:
2533  *              printf("Connection in progress\n");
2534  *      break;
2535  *
2536  *      case WIFI_DIRECT_CONNECTION_RSP:
2537  *              printf("Connected\n");
2538  *      break;
2539  *
2540  *      case WIFI_DIRECT_DISCONNECTION_IND:
2541  *              printf("Disconnection IND\n");
2542  *      break;
2543  *
2544  *      case WIFI_DIRECT_DISCONNECTION_RSP;
2545  *              printf("Disconnected\n");
2546  *      break;
2547  *      }
2548  * }
2549  *
2550  * void callback_1(int error_code,
2551  *               wifi_direct_discovery_state_e discovery_state,
2552  *               void *user_data)
2553  * {
2554  *      switch(discovery_state) {
2555  *      case WIFI_DIRECT_DISCOVERY_STARTED:
2556  *              printf("Discovery started\n");
2557  *      break;
2558  *
2559  *      case WIFI_DIRECT_ONLY_LISTEN_STARTED:
2560  *              printf("listen started\n");
2561  *      break;
2562  *
2563  *      case WIFI_DIRECT_DISCOVERY_FINISHED:
2564  *              printf("Discovery finished\n");
2565  *
2566  *      wifi_direct_foreach_discovered_peers(peers_cb,
2567  *                                        NULL); // Get discovered peer
2568  *      break;
2569  *
2570  *      case WIFI_DIRECT_DISCOVERY_FOUND:
2571  *              printf("peer devices found\n");
2572  *              break;
2573  *
2574  *      case WIFI_DIRECT_DISCOVERY_LOST:
2575  *              printf("Discovery lost\n");
2576  *      break;
2577  *
2578  *      default:
2579  *      break;
2580  *      }
2581  * }
2582  *
2583  * int main()
2584  * {
2585  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
2586  *      wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1
2587  *      wifi_direct_set_connection_state_changed_cb(callback_2, NULL); // Register callback 2
2588  *
2589  *      wifi_direct_activate(); // Activate Wi-Fi Direct
2590  *      wifi_direct_start_discovery(TRUE, 15); // Start discovery
2591  *
2592  *      //       APP CODE HERE
2593  *
2594  *      // App must clean up Wi-Fi Direct before exiting
2595  *
2596  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
2597  *      wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback
2598  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
2599  *      return 0;
2600  * }
2601  * @endcode
2602  */
2603 int wifi_direct_connect(char *mac_address);
2604
2605
2606 /**
2607  * @brief Cancels the connection now in progress.
2608  * @since_tizen 2.3
2609  * @privlevel public
2610  * @privilege %http://tizen.org/privilege/wifidirect
2611  * @param[in] mac_address  The MAC address of rejected device
2612  * @return @c 0 on success,
2613  *         otherwise a negative error value
2614  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
2615  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
2616  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
2617  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
2618  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
2619  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
2620  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
2621  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
2622  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
2623  *
2624  *
2625  * Here is an example of the usage:
2626  * @code
2627  * #include <stdio.h>
2628  * #include <wifi_direct.h>
2629  *
2630  * bool peer_selected = false;
2631  * int connection_timeout = 0;
2632  * int count = 0; // counter to wait for connection
2633  *
2634  * int function(char *mac);
2635  *
2636  * gboolean connection_timeout_cb(gpointer data)
2637  * {
2638  *      char *mac = (char *)data;
2639  *
2640  *      if (count < 3) {
2641  *              count++;
2642  *              return TRUE;
2643  *      }
2644  *
2645  *      function(mac); // cancel ongoing connection
2646  *      g_free(mac);
2647  *      return FALSE;
2648  * }
2649  *
2650  * void peers_cb(wifi_direct_discovered_peer_info_s* peer,
2651  *                                           void *user_data)
2652  * {
2653  *      char *mac;
2654  *
2655  *      if (peer && !peer_selected) {
2656  *              printf("peer device=%s MAC=%s\n", peer->device_name, peer->mac_address);
2657  *
2658  *              mac = g_strdup(peer->mac_address);
2659  *              peer_selected = true;
2660  *
2661  *              wifi_direct_connect(mac); // Connect to the selected peer
2662  *              connection_timeout = g_timeout_add(1000,
2663  *                                         connection_timeout_cb,
2664  *                                         mac); // Add 3secs timeout
2665  *      }
2666  * }
2667  *
2668  * int function(char *mac)
2669  * {
2670  *      int ret;
2671  *
2672  *      ret = wifi_direct_cancel_connection(mac); // cancel connection
2673  *
2674  * if (ret != WIFI_DIRECT_ERROR_NONE) {
2675  *              printf("Failed to cancel the ongoing connection\n");
2676  *              return -1;
2677  *      }
2678  *
2679  *      return 0;
2680  * }
2681  *
2682  * void callback_2(int error_code,
2683  *                 wifi_direct_connection_state_e state,
2684  *                 const char *mac, void *user_data)
2685  *{
2686  *      switch (state) {
2687  *      case WIFI_DIRECT_CONNECTION_IN_PROGRESS:
2688  *              printf("Connection in progress\n");
2689  *      break;
2690  *
2691  *      case WIFI_DIRECT_CONNECTON_RSP:
2692  *              printf("Connected\n");
2693  *              g_source_remove(connection_timeout);
2694  *      break;
2695  *
2696  *      case WIFI_DIRECT_DISCONNECTION_IND:
2697  *              printf("Disconnection IND\n");
2698  *      break;
2699  *
2700  *      case WIFI_DIRECT_DISCONNECTION_RSP;
2701  *              printf("Disconnected\n");
2702  *      break;
2703  * }
2704  *}
2705  *
2706  * void callback_1(int error_code,
2707  *               wifi_direct_discovery_state_e discovery_state,
2708  *               void *user_data)
2709  * {
2710  *      switch(discovery_state) {
2711  *      case WIFI_DIRECT_DISCOVERY_STARTED:
2712  *              printf("Discovery started\n");
2713  *      break;
2714  *
2715  *      case WIFI_DIRECT_ONLY_LISTEN_STARTED:
2716  *              printf("listen started\n");
2717  *      break;
2718  *
2719  *      case WIFI_DIRECT_DISCOVERY_FINISHED:
2720  *              printf("Discovery finished\n");
2721  *
2722  *      wifi_direct_foreach_discovered_peers(peers_cb,
2723  *                                        NULL); // Get discovered peer
2724  *      break;
2725  *
2726  *      case WIFI_DIRECT_DISCOVERY_FOUND:
2727  *              printf("peer devices found\n");
2728  *      break;
2729  *
2730  *      case WIFI_DIRECT_DISCOVERY_LOST:
2731  *              printf("Discovery lost\n");
2732  *      break;
2733  *
2734  *      default:
2735  *      break;
2736  *      }
2737  * }
2738  *
2739  * int main()
2740  * {
2741  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
2742  *      wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1
2743  *      wifi_direct_set_connection_state_changed_cb(callback_2, NULL); // Register callback 2
2744  *
2745  *      wifi_direct_activate(); // Activate Wi-Fi Direct
2746  *      wifi_direct_start_discovery(TRUE, 15); // Start discovery
2747  *
2748  *      // App must clean up Wi-Fi Direct before exiting
2749  *
2750  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
2751  *      wifi_direct_unset_connection_state_changed_cb(); // Deregister callback 2
2752  *      wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback 1
2753  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
2754  *      return 0;
2755  * }
2756  * @endcode
2757  */
2758 int wifi_direct_cancel_connection(char *mac_address);
2759
2760
2761 /**
2762  * @brief Disconnects all connected links to peers, asynchronously.
2763  * @since_tizen 2.3
2764  * @privlevel public
2765  * @privilege %http://tizen.org/privilege/wifidirect
2766  * @return @c 0 on success,
2767  *         otherwise a negative error value
2768  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
2769  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
2770  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
2771  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
2772  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
2773  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
2774  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
2775  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
2776  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
2777  * @post wifi_direct_connection_state_changed_cb() will be invoked.
2778  * @see wifi_direct_activate()
2779  * @see wifi_direct_disconnect()
2780  * @see wifi_direct_connection_state_changed_cb()
2781  *
2782  *
2783  * Here is an example of the usage:
2784  * @code
2785  * #include <stdio.h>
2786  * #include <wifi_direct.h>
2787  *
2788  * void callback(int error_code,
2789  *               wifi_direct_connection_state_e state,
2790  *               const char *mac, void *user_data)
2791  *{
2792  *      switch (state) {
2793  *      case WIFI_DIRECT_CONNECTION_IN_PROGRESS:
2794  *              printf("Connection in progress\n");
2795  *      break;
2796  *
2797  *      case WIFI_DIRECT_CONNECTON_RSP:
2798  *              printf("Connected\n");
2799  * break;
2800  *
2801  *      case WIFI_DIRECT_DISCONNECTION_IND:
2802  *              printf("Disconnection IND\n");
2803  *      break;
2804  *
2805  *      case WIFI_DIRECT_DISCONNECTION_RSP;
2806  *              printf("Disconnected\n"); // disconnect notification
2807  *      break;
2808  * }
2809  *}
2810  *
2811  * int function(void)
2812  * {
2813  *      int res;
2814  *
2815  *      res = wifi_direct_disconnect_all(); // disconnect all the connected peers
2816  *
2817  * if (res != WIFI_DIRECT_ERROR_NONE) {
2818  *              printf("Failed to disconnect all clients\n");
2819  *              return -1;
2820  * }
2821  *
2822  *      return 0;
2823  * }
2824  *
2825  * int main()
2826  * {
2827  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
2828  *      wifi_direct_set_connection_state_changed_cb(callback, NULL); // Register callback
2829  *      wifi_direct_activate(); // Activate Wi-Fi Direct *
2830  *
2831  * function();
2832  *
2833  *      //       APP CODE HERE
2834  *
2835  *      // App must clean up Wi-Fi Direct before exiting
2836  *
2837  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
2838  *      wifi_direct_unset_connection_state_changed_cb(); // Deregister callback
2839  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
2840  *      return 0;
2841  * }
2842  * @endcode
2843  */
2844 int wifi_direct_disconnect_all(void);
2845
2846
2847 /**
2848  * @brief Disconnects the specified peer, asynchronously.
2849  * @since_tizen 2.3
2850  * @privlevel public
2851  * @privilege %http://tizen.org/privilege/wifidirect
2852  * @param[in] mac_address  The MAC address of remote device
2853  * @return @c 0 on success,
2854  *         otherwise a negative error value
2855  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
2856  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
2857  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
2858  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
2859  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
2860  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
2861  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
2862  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
2863  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
2864  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
2865  * @post wifi_direct_connection_state_changed_cb() will be invoked.
2866  * @see wifi_direct_activate()
2867  * @see wifi_direct_connect()
2868  * @see wifi_direct_connection_state_changed_cb()
2869  *
2870  *
2871  * Here is an example of the usage:
2872  * @code
2873  * #include <stdio.h>
2874  * #include <wifi_direct.h>
2875  *
2876  * bool callback_2(wifi_direct_connected_peer_info_s* peer,
2877  *                 void* user_data)
2878  * {
2879  *      if (peer) {
2880  *              printf("connected device=%s mac=%s\n",
2881  *                    peer->device_name, peer->mac_address);
2882  *      }
2883  * }
2884  *
2885  * void callback_1(int error_code,
2886  *               wifi_direct_connection_state_e state,
2887  *               const char *mac, void *user_data)
2888  *{
2889  *      switch (state) {
2890  *      case WIFI_DIRECT_CONNECTION_IN_PROGRESS:
2891  *              printf("Connection in progress\n");
2892  *      break;
2893  *
2894  *      case WIFI_DIRECT_CONNECTON_RSP:
2895  *              printf("Connected\n");
2896  * break;
2897  *
2898  *      case WIFI_DIRECT_DISCONNECTION_IND:
2899  *              printf("Disconnection IND\n");
2900  *      break;
2901  *
2902  *      case WIFI_DIRECT_DISCONNECTION_RSP;
2903  *              printf("Disconnected mac=%s\n", mac_address); // disconnect notification
2904  *      break;
2905  * }
2906  *}
2907  *
2908  * int function(char *mac)
2909  * {
2910  *      int res;
2911  *
2912  *      res = wifi_direct_disconnect(mac); // disconnect the connected peer with input mac
2913  *
2914  * if (res != WIFI_DIRECT_ERROR_NONE) {
2915  *              printf("Failed to disconnect all clients\n");
2916  *              return -1;
2917  * }
2918  *
2919  *      return 0;
2920  * }
2921  *
2922  * int main()
2923  * {
2924  *      char mac[16] = {0,};
2925  *
2926  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
2927  *      wifi_direct_set_connection_state_changed_cb(callback_1, NULL); // Register callback_1
2928  *      wifi_direct_activate(); // Activate Wi-Fi Direct *
2929  *
2930  *      wifi_direct_foreach_connected_peers(callback_2, NULL); // Register callback_2
2931  *
2932  *      printf("Enter the connected peer mac address\n");
2933  *      read(stdin, mac, 15);
2934  *
2935  *      function(mac);
2936  *
2937  *      //       APP CODE HERE
2938  *
2939  *      // App must clean up Wi-Fi Direct before exiting
2940  *
2941  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
2942  *      wifi_direct_unset_connection_state_changed_cb(); // Deregister callback
2943  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
2944  *      return 0;
2945  * }
2946  * @endcode
2947  */
2948 int wifi_direct_disconnect(char *mac_address);
2949
2950
2951 /**
2952  * @brief Called repeatedly when you get the information of connected peers.
2953  * @since_tizen 2.3
2954  * @remarks @a peer is valid only in this function.
2955  * @param[in] peer       The information of discovered peer
2956  * @param[in] user_data  The user data passed from foreach function
2957  * @return @c true to continue with the next iteration of the loop,
2958  *         @c false to break out of the loop
2959  * @see wifi_direct_foreach_connected_peers()
2960  */
2961 typedef bool (*wifi_direct_connected_peer_cb) (wifi_direct_connected_peer_info_s *peer, void *user_data);
2962
2963
2964 /**
2965  * @brief Gets the information of connected peers.
2966  * @since_tizen 2.3
2967  * @privlevel public
2968  * @privilege %http://tizen.org/privilege/wifidirect
2969  * @param[in] callback   The callback function to invoke
2970  * @param[in] user_data  The user data to be passed to the callback function
2971  * @return @c 0 on success,
2972  *         otherwise a negative error value
2973  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
2974  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
2975  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
2976  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
2977  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
2978  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
2979  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
2980  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
2981  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
2982  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
2983  * @see wifi_direct_activate()
2984  * @see wifi_direct_discovered_peer_cb()
2985  *
2986  *
2987  * Here is an example of the usage:
2988  * @code
2989  * #include <stdio.h>
2990  * #include <wifi_direct.h>
2991  *
2992  * bool callback_1(wifi_direct_connected_peer_info_s* peer,
2993  *                 void* user_data)
2994  * {
2995  *      if (peer) {
2996  *              printf("connected device=%s mac=%s\n",
2997  *                    peer->device_name, peer->mac_address);
2998  *      }
2999  * }
3000  *
3001  * int function(char *mac)
3002  * {
3003  *      int res;
3004  *
3005  *      res = wifi_direct_foreach_connected_peers(callback_1, NULL) // Get connected peers
3006  *
3007  * if (res != WIFI_DIRECT_ERROR_NONE) {
3008  *              printf("Failed to get connected peers\n");
3009  *              return -1;
3010  * }
3011  *
3012  *      return 0;
3013  * }
3014  *
3015  * int main()
3016  * {
3017  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
3018  *      wifi_direct_activate(); // Activate Wi-Fi Direct
3019  *
3020  *      function();
3021  *
3022  *      //       APP CODE HERE
3023  *
3024  *      // App must clean up Wi-Fi Direct before exiting
3025  *
3026  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
3027  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
3028  *      return 0;
3029  * }
3030  * @endcode
3031  */
3032 int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb callback, void *user_data);
3033
3034
3035 /**
3036  * @brief Creates a Wi-Fi Direct Group, asynchronously.
3037  * @details This function sets up device as the Group Owner and waits for clients to connect.
3038  *          In addition, a soft AP will be created, the WPS registrar and the DHCP server will be started.
3039  * @since_tizen 2.3
3040  * @privlevel public
3041  * @privilege %http://tizen.org/privilege/wifidirect
3042  * @return @c 0 on success,
3043  *         otherwise a negative error value
3044  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
3045  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
3046  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
3047  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
3048  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
3049  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
3050  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
3051  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
3052  * @retval #WIFI_DIRECT_ERROR_AUTH_FAILED           Authentication failed
3053  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
3054  * @post wifi_direct_connection_state_changed_cb() will be invoked with #WIFI_DIRECT_GROUP_CREATED.
3055  * @see wifi_direct_activate()
3056  * @see wifi_direct_destroy_group()
3057  * @see wifi_direct_connection_state_changed_cb()
3058  *
3059  *
3060  * Here is an example of the usage:
3061  * @code
3062  * #include <stdio.h>
3063  * #include <wifi_direct.h>
3064  *
3065  * void callback_1(int error_code,
3066  *               wifi_direct_connection_state_e state,
3067  *               const char *mac, void *user_data)
3068  * {
3069  *      if (state == WIFI_DIRECT_GROUP_CREATED) {
3070  *              printf("Group created\n");
3071  *      }
3072  * }
3073  *
3074  * int function(void)
3075  * {
3076  *      int res;
3077  *
3078  *      res = wifi_direct_create_group() // create autonomous group
3079  *
3080  * if (res != WIFI_DIRECT_ERROR_NONE) {
3081  *              printf("Failed to create group\n");
3082  *              return -1;
3083  * }
3084  *
3085  *      return 0;
3086  * }
3087  *
3088  * int main()
3089  * {
3090  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
3091  *      wifi_direct_set_connection_state_changed_cb(callback_1, NULL); // Register callback_1
3092  *      wifi_direct_activate(); // Activate Wi-Fi Direct
3093  *
3094  *      function();
3095  *
3096  *      //       APP CODE HERE
3097  *
3098  *      // App must clean up Wi-Fi Direct before exiting
3099  *
3100  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
3101  *      wifi_direct_unset_connection_state_changed_cb(); // Deregister callback_1
3102  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
3103  *      return 0;
3104  * }
3105  * @endcode
3106  */
3107 int wifi_direct_create_group(void);
3108
3109 /**
3110  * @brief Creates a Wi-Fi Direct Group, asynchronously with given SSID name.
3111  * @details This function sets up device as the Group Owner and waits for clients to connect.
3112  * In addition, a soft AP will be created, the WPS registrar and the DHCP server will be started.
3113  * @since_tizen 5.0
3114  * @privlevel public
3115  * @privilege %http://tizen.org/privilege/wifidirect
3116  * @param[in] ssid  Referred to as a network name, it is a name that identifies a wireless network
3117  * @return 0 on success, otherwise a negative error value
3118  * @retval #WIFI_DIRECT_ERROR_NONE  Successful
3119  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
3120  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
3121  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
3122  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameters
3123  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
3124  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
3125  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
3126  * @retval #WIFI_DIRECT_ERROR_AUTH_FAILED           Authentication failed
3127  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
3128  * @post wifi_direct_connection_state_changed_cb() will be invoked with #WIFI_DIRECT_GROUP_CREATED.
3129  * @see wifi_direct_activate()
3130  * @see wifi_direct_destroy_group()
3131  * @see wifi_direct_connection_state_changed_cb()
3132  */
3133 int wifi_direct_create_group_with_ssid(const char *ssid);
3134
3135 /**
3136  * @brief Destroys the Wi-Fi Direct Group, asynchronously.
3137  * @details This function destroys the Wi-Fi Direct Group owned by a local device.
3138  *          If creating a Group is in progress, this function cancels that creating.
3139  * @since_tizen 2.3
3140  * @privlevel public
3141  * @privilege %http://tizen.org/privilege/wifidirect
3142  * @return @c 0 on success,
3143  *         otherwise a negative error value
3144  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
3145  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
3146  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
3147  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
3148  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
3149  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
3150  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
3151  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
3152  * @retval #WIFI_DIRECT_ERROR_AUTH_FAILED           Authentication failed
3153  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
3154  * @post wifi_direct_connection_state_changed_cb() will be invoked with #WIFI_DIRECT_GROUP_DESTROYED.
3155  * @see wifi_direct_activate()
3156  * @see wifi_direct_create_group()
3157  * @see wifi_direct_connection_state_changed_cb()
3158  *
3159  *
3160  * Here is an example of the usage:
3161  * @code
3162  * #include <stdio.h>
3163  * #include <wifi_direct.h>
3164  *
3165  * void callback_1(int error_code,
3166  *               wifi_direct_connection_state_e state,
3167  *               const char *mac, void *user_data)
3168  * {
3169  *      if (state == WIFI_DIRECT_GROUP_DESTROYED) {
3170  *              printf("Group destroyed\n");
3171  *      }
3172  * }
3173  *
3174  * int function(void)
3175  * {
3176  *      int res;
3177  *
3178  *      res = wifi_direct_destroy_group() // destroy autonomous group
3179  *
3180  * if (res != WIFI_DIRECT_ERROR_NONE) {
3181  *              printf("Failed to destroy group\n");
3182  *              return -1;
3183  * }
3184  *
3185  *      return 0;
3186  * }
3187  *
3188  * int main()
3189  * {
3190  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
3191  *      wifi_direct_set_connection_state_changed_cb(callback_1, NULL); // Register callback_1
3192  *      wifi_direct_activate(); // Activate Wi-Fi Direct
3193  *
3194  *      function();
3195  *
3196  *      //       APP CODE HERE
3197  *
3198  *      // App must clean up Wi-Fi Direct before exiting
3199  *
3200  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
3201  *      wifi_direct_unset_connection_state_changed_cb(); // Deregister callback_1
3202  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
3203  *      return 0;
3204  * }
3205  * @endcode
3206  */
3207 int wifi_direct_destroy_group(void);
3208
3209
3210 /**
3211  * @brief Checks whether this device is the group owner or not.
3212  * @since_tizen 2.3
3213  * @privlevel public
3214  * @privilege %http://tizen.org/privilege/wifidirect
3215  * @param[out] is_group_owner Indicates whether this device is the group owner or not
3216  * @return @c 0 on success,
3217  *         otherwise a negative error value
3218  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
3219  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
3220  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
3221  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
3222  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
3223  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
3224  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
3225  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
3226  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
3227  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
3228  * @see wifi_direct_activate()
3229  *
3230  *
3231  * Here is an example of the usage:
3232  * @code
3233  * #include <stdio.h>
3234  * #include <wifi_direct.h>
3235  *
3236  * int function(void)
3237  * {
3238  *      int res;
3239  *      bool owner;
3240  *
3241  *      res = wifi_direct_is_group_owner(&owner); // destroy autonomous group
3242  *
3243  * if (res != WIFI_DIRECT_ERROR_NONE) {
3244  *              printf("Failed to get ownership role\n");
3245  *              return -1;
3246  * }
3247  *
3248  *      printf("role = %s\n", (owner)?"GO":"STA");
3249  *      return 0;
3250  * }
3251  *
3252  * void callback_1(int error_code,
3253  *               wifi_direct_connection_state_e state,
3254  *               const char *mac, void *user_data)
3255  * {
3256  *      if (state == WIFI_DIRECT_GROUP_DESTROYED) {
3257  *              printf("Group destroyed\n");
3258  *
3259  *              function();
3260  *      }
3261  *
3262  *      if (state == WIFI_DIRECT_GROUP_CREATED) {
3263  *              printf("Group created\n");
3264  *
3265  *              function();
3266  *      }
3267  * }
3268  *
3269  * int main()
3270  * {
3271  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
3272  *      wifi_direct_set_connection_state_changed_cb(callback_1, NULL); // Register callback_1
3273  *      wifi_direct_activate(); // Activate Wi-Fi Direct
3274  *
3275  *      wifi_direct_create_group();
3276  *
3277  *      wifi_direct_destroy_group();
3278  *
3279  *      //       APP CODE HERE
3280  *
3281  *      // App must clean up Wi-Fi Direct before exiting
3282  *
3283  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
3284  *      wifi_direct_unset_connection_state_changed_cb(); // Deregister callback_1
3285  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
3286  *      return 0;
3287  * }
3288  * @endcode
3289  */
3290 int wifi_direct_is_group_owner(bool *is_group_owner);
3291
3292
3293 /**
3294  * @brief Checks whether the current group is the autonomous group or not.
3295  * @details If you create a group by wifi_direct_create_group(),
3296  *          then the current group is the autonomous group.
3297  * @since_tizen 2.3
3298  * @privlevel public
3299  * @privilege %http://tizen.org/privilege/wifidirect
3300  * @param[out] is_autonomous_group  Indicates whether the current group is the autonomous group or not
3301  * @return @c 0 on success,
3302  *         otherwise a negative error value
3303  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
3304  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
3305  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
3306  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
3307  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
3308  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
3309  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
3310  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
3311  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
3312  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
3313  * @see wifi_direct_activate()
3314  * @see wifi_direct_create_group()
3315  * @see wifi_direct_destroy_group()
3316  *
3317  *
3318  * Here is an example of the usage:
3319  * @code
3320  * #include <stdio.h>
3321  * #include <wifi_direct.h>
3322  *
3323  * int function(void)
3324  * {
3325  *      int res;
3326  *      bool owner;
3327  *
3328  *      res = wifi_direct_is_autonomous_group(&owner); // autonomous group
3329  *
3330  * if (res != WIFI_DIRECT_ERROR_NONE) {
3331  *              printf("Failed to get ownership role\n");
3332  *              return -1;
3333  * }
3334  *
3335  *      printf("Group = %s\n", (owner)?"Auto":"Non-Auto");
3336  *      return 0;
3337  * }
3338  *
3339  * void callback_1(int error_code,
3340  *               wifi_direct_connection_state_e state,
3341  *               const char *mac, void *user_data)
3342  * {
3343  *      if (state == WIFI_DIRECT_GROUP_DESTROYED) {
3344  *              printf("Group destroyed\n");
3345  *      }
3346  *
3347  *      if (state == WIFI_DIRECT_GROUP_CREATED) {
3348  *              printf("Group created\n");
3349  *
3350  *              function();
3351  *      }
3352  * }
3353  *
3354  * int main()
3355  * {
3356  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
3357  *      wifi_direct_set_connection_state_changed_cb(callback_1, NULL); // Register callback_1
3358  *      wifi_direct_activate(); // Activate Wi-Fi Direct
3359  *
3360  *      wifi_direct_create_group();
3361  *
3362  *      //       APP CODE HERE
3363  *
3364  *      // App must clean up Wi-Fi Direct before exiting
3365  *
3366  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
3367  *      wifi_direct_unset_connection_state_changed_cb(); // Deregister callback_1
3368  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
3369  *      return 0;
3370  * }
3371  * @endcode
3372  */
3373 int wifi_direct_is_autonomous_group(bool *is_autonomous_group);
3374
3375
3376 /**
3377  * @brief Sets the friendly name of a local device.
3378  * @details This device name is shown to other devices during device discovery.
3379  * @since_tizen 2.3
3380  * @privlevel public
3381  * @privilege %http://tizen.org/privilege/wifidirect
3382  * @remarks The name set is only valid during activated state.
3383  *          After Wi-Fi Direct is deactivated, this name will be same as the phone name.
3384  * @param[in] device_name  The name of a local device
3385  * @return @c 0 on success,
3386  *         otherwise a negative error value
3387  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
3388  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
3389  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
3390  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
3391  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
3392  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
3393  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
3394  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
3395  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
3396  * @pre Wi-Fi Direct must be activated by wifi_direct_activate().
3397  * @see wifi_direct_activate()
3398  * @see wifi_direct_get_device_name()
3399  *
3400  *
3401  * Here is an example of the usage:
3402  * @code
3403  * #include <stdio.h>
3404  * #include <wifi_direct.h>
3405  *
3406  * int function(char *name)
3407  * {
3408  *      int res;
3409  *
3410  *      res = wifi_direct_set_device_name(&name); // set device name
3411  *
3412  *      if (res != WIFI_DIRECT_ERROR_NONE) {
3413  *              printf("Failed to set device name\n");
3414  *              return -1;
3415  * }
3416  *
3417  *      return 0;
3418  * }
3419  *
3420  * int main()
3421  * {
3422  *      char name[256] = {0, };
3423  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
3424  *      wifi_direct_activate(); // Activate Wi-Fi Direct
3425  *
3426  *      printf("Enter the device name\n");
3427  *      read(stdin, name, 255);
3428  *
3429  *      function(name);
3430  *
3431  *      //       APP CODE HERE
3432  *
3433  *      // App must clean up Wi-Fi Direct before exiting
3434  *
3435  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
3436  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
3437  *      return 0;
3438  * }
3439  * @endcode
3440  */
3441 int wifi_direct_set_device_name(const char *device_name);
3442
3443
3444 /**
3445  * @brief Gets the name of a local device.
3446  * @since_tizen 2.3
3447  * @privlevel public
3448  * @privilege %http://tizen.org/privilege/wifidirect
3449  * @remarks @a device_name must be released with free().
3450  * @param[out] device_name  The name of a local device
3451  * @return @c 0 on success,
3452  *         otherwise a negative error value
3453  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
3454  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
3455  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
3456  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
3457  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
3458  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
3459  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
3460  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
3461  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
3462  * @see wifi_direct_initialize()
3463  * @see wifi_direct_set_device_name()
3464  *
3465  *
3466  * Here is an example of the usage:
3467  * @code
3468  * #include <stdio.h>
3469  * #include <wifi_direct.h>
3470  *
3471  * int function(void)
3472  * {
3473  *      int res;
3474  *      char *name;
3475  *
3476  *      res = wifi_direct_get_device_name(&name); // get device name
3477  *
3478  *      if (res != WIFI_DIRECT_ERROR_NONE) {
3479  *              printf("Failed to get device name\n");
3480  *              return -1;
3481  * }
3482  *
3483  *      printf("device name = %s\n", name);
3484  *      g_free(name);
3485  *      return 0;
3486  * }
3487  *
3488  * int main()
3489  * {
3490  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
3491  *      wifi_direct_activate(); // Activate Wi-Fi Direct
3492  *
3493  *      function();
3494  *
3495  *      //       APP CODE HERE
3496  *
3497  *      // App must clean up Wi-Fi Direct before exiting
3498  *
3499  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
3500  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
3501  *      return 0;
3502  * }
3503  * @endcode
3504  */
3505 int wifi_direct_get_device_name(char** device_name);
3506
3507
3508 /**
3509  * @brief Gets SSID (Service Set Identifier) of a local device.
3510  * @since_tizen 2.3
3511  * @privlevel public
3512  * @privilege %http://tizen.org/privilege/wifidirect
3513  * @remarks @a ssid must be released using free().
3514  * @param[out] ssid  The SSID
3515  * @return @c 0 on success,
3516  *         otherwise a negative error value
3517  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
3518  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
3519  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
3520  * @retval #WIFI_DIRECT_ERROR_OUT_OF_MEMORY         Out of memory
3521  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
3522  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
3523  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
3524  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
3525  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
3526  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
3527  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
3528  * @see wifi_direct_initialize()
3529  *
3530  *
3531  * Here is an example of the usage:
3532  * @code
3533  * #include <stdio.h>
3534  * #include <wifi_direct.h>
3535  *
3536  * int function(void)
3537  * {
3538  *      int res;
3539  *      char *ssid;
3540  *
3541  *      res = wifi_direct_get_ssid(&ssid); // get SSID
3542  *
3543  *      if (res != WIFI_DIRECT_ERROR_NONE) {
3544  *              printf("Failed to get ssid name\n");
3545  *              return -1;
3546  * }
3547  *
3548  *      printf("SSID name = %s\n", ssid);
3549  *      g_free(ssid);
3550  *      return 0;
3551  * }
3552  *
3553  * int main()
3554  * {
3555  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
3556  *      wifi_direct_activate(); // Activate Wi-Fi Direct
3557  *
3558  *      function();
3559  *
3560  *      //       APP CODE HERE
3561  *
3562  *      // App must clean up Wi-Fi Direct before exiting
3563  *
3564  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
3565  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
3566  *      return 0;
3567  * }
3568  * @endcode
3569  */
3570 int wifi_direct_get_ssid(char **ssid);
3571
3572
3573 /**
3574  * @brief Gets the name of network interface (for example: eth0, pdp0).
3575  * @since_tizen 2.3
3576  * @privlevel public
3577  * @privilege %http://tizen.org/privilege/wifidirect
3578  * @remarks @a name must be released using free().
3579  * @param[out] name  The name of the network interface
3580  * @return @c 0 on success,
3581  *         otherwise negative error value
3582  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
3583  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
3584  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
3585  * @retval #WIFI_DIRECT_ERROR_OUT_OF_MEMORY         Out of memory
3586  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
3587  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
3588  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
3589  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
3590  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
3591  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
3592  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
3593  * @see wifi_direct_activate()
3594  *
3595  *
3596  * Here is an example of the usage:
3597  * @code
3598  * #include <stdio.h>
3599  * #include <wifi_direct.h>
3600  *
3601  * int function(void)
3602  * {
3603  *      int res;
3604  *      char *iface_name;
3605  *
3606  *      res = wifi_direct_get_network_interface_name(&iface_name); // get interface name
3607  *
3608  *      if (res != WIFI_DIRECT_ERROR_NONE) {
3609  *              printf("Failed to get interface name\n");
3610  *              return -1;
3611  * }
3612  *
3613  *      printf("interface = %s\n", iface_name);
3614  *      g_free(iface_name);
3615  *      return 0;
3616  * }
3617  *
3618  * int main()
3619  * {
3620  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
3621  *      wifi_direct_activate(); // Activate Wi-Fi Direct
3622  *
3623  *      function();
3624  *
3625  *      //       APP CODE HERE
3626  *
3627  *      // App must clean up Wi-Fi Direct before exiting
3628  *
3629  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
3630  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
3631  *      return 0;
3632  * }
3633  * @endcode
3634  */
3635 int wifi_direct_get_network_interface_name(char **name);
3636
3637
3638 /**
3639  * @brief Gets IP address of a local device.
3640  * @since_tizen 2.3
3641  * @privlevel public
3642  * @privilege %http://tizen.org/privilege/wifidirect
3643  * @remarks @a ip_address must be released using free().
3644  * @param[out] ip_address  The IP address
3645  * @return @c 0 on success,
3646  *         otherwise a negative error value
3647  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
3648  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
3649  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
3650  * @retval #WIFI_DIRECT_ERROR_OUT_OF_MEMORY         Out of memory
3651  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
3652  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
3653  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
3654  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
3655  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
3656  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
3657  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
3658  * @see wifi_direct_activate()
3659  *
3660  *
3661  *
3662  * Here is an example of the usage:
3663  * @code
3664  * #include <stdio.h>
3665  * #include <wifi_direct.h>
3666  *
3667  * int function(void);
3668  *
3669  * bool device_selected = false;
3670  *
3671  * void peers_cb(wifi_direct_discovered_peer_info_s* peer,
3672  *                                           void *user_data)
3673  * {
3674  *      if (peer && !device_selected) {
3675  *              printf("peer device=%s MAC=%s\n", peer->device_name, peer->mac_address);
3676  *
3677  *              device_selected = true;
3678  *
3679  *              wifi_direct_connect(peer->mac_address); // Connect to the first discovered peer
3680  *      }
3681  * }
3682  *
3683  * int function(void)
3684  * {
3685  *      int ret;
3686  *      char *ip;
3687  *
3688  *      ret = wifi_direct_get_ip_address(&ip); // get ip address
3689  *
3690  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
3691  *              printf("Failed to connect the peer\n");
3692  *              return -1;
3693  *      }
3694  *
3695  *      printf("IP address=%s\n", ip);
3696  *      g_free(ip);
3697  *      return 0;
3698  * }
3699  *
3700  * void callback_2(int error_code,
3701  *                 wifi_direct_connection_state_e state,
3702  *                 const char *mac, void *user_data)
3703  *{
3704  *      switch (state) {
3705  *      case WIFI_DIRECT_CONNECTION_IN_PROGRESS:
3706  *              printf("Connection in progress\n");
3707  *      break;
3708  *
3709  *      case WIFI_DIRECT_CONNECTON_RSP:
3710  *              printf("Connected\n");
3711  *
3712  *              function();
3713  * break;
3714  *
3715  *      case WIFI_DIRECT_DISCONNECTION_IND:
3716  *              printf("Disconnection IND\n");
3717  *      break;
3718  *
3719  *      case WIFI_DIRECT_DISCONNECTION_RSP;
3720  *              printf("Disconnected\n");
3721  *      break;
3722  * }
3723  *}
3724  *
3725  * void callback_1(int error_code,
3726  *               wifi_direct_discovery_state_e discovery_state,
3727  *               void *user_data)
3728  * {
3729  *      switch(discovery_state) {
3730  *      case WIFI_DIRECT_DISCOVERY_STARTED:
3731  *              printf("Discovery started\n");
3732  *              break;
3733  *
3734  *      case WIFI_DIRECT_ONLY_LISTEN_STARTED:
3735  *              printf("listen started\n");
3736  *              break;
3737  *
3738  *      case WIFI_DIRECT_DISCOVERY_FINISHED:
3739  *              printf("Discovery finished\n");
3740  *
3741  *              wifi_direct_foreach_discovered_peers(peers_cb,
3742  *                                        NULL);
3743  *              break;
3744  *
3745  *      case WIFI_DIRECT_DISCOVERY_FOUND:
3746  *              printf("peer devices found\n");
3747  *              break;
3748  *
3749  *      case WIFI_DIRECT_DISCOVERY_LOST:
3750  *              printf("Discovery lost\n");
3751  *              break;
3752  *
3753  *      default:
3754  *      break;
3755  *      }
3756  * }
3757  *
3758  * int main()
3759  * {
3760  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
3761  *      wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1
3762  *      wifi_direct_set_connection_state_changed_cb(callback_2, NULL); // Register callback 2
3763  *
3764  *      wifi_direct_activate(); // Activate Wi-Fi Direct
3765  *      wifi_direct_start_discovery(TRUE, 15); // Start discovery
3766  *
3767  *      //       APP CODE HERE
3768  *
3769  *      // App must clean up Wi-Fi Direct before exiting
3770  *
3771  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
3772  *      wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback
3773  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
3774  *      return 0;
3775  * }
3776  * @endcode
3777  */
3778 int wifi_direct_get_ip_address(char **ip_address);
3779
3780
3781 /**
3782  * @brief Gets the Subnet Mask.
3783  * @since_tizen 2.3
3784  * @privlevel public
3785  * @privilege %http://tizen.org/privilege/wifidirect
3786  * @remarks @a subnet_mask must be released using free().
3787  * @param[out] subnet_mask  The subnet mask
3788  * @return @c 0 on success,
3789  *         otherwise a negative error value
3790  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
3791  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
3792  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
3793  * @retval #WIFI_DIRECT_ERROR_OUT_OF_MEMORY         Out of memory
3794  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
3795  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
3796  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
3797  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
3798  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
3799  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
3800  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
3801  * @see wifi_direct_activate()
3802  *
3803  *
3804  * Here is an example of the usage:
3805  * @code
3806  * #include <stdio.h>
3807  * #include <wifi_direct.h>
3808  *
3809  * int function(void);
3810  *
3811  * bool device_selected = false;
3812  *
3813  * void peers_cb(wifi_direct_discovered_peer_info_s* peer,
3814  *                                           void *user_data)
3815  * {
3816  *      if (peer && !device_selected) {
3817  *              printf("peer device=%s MAC=%s\n", peer->device_name, peer->mac_address);
3818  *
3819  *              device_selected = true;
3820  *
3821  *              wifi_direct_connect(peer->mac_address); // Connect to the first discovered peer
3822  *      }
3823  * }
3824  *
3825  * int function(void)
3826  * {
3827  *      int ret;
3828  *      char *subnet;
3829  *      char *ip;
3830  *
3831  *      wifi_direct_get_ip_address(&ip); // get ip address
3832  *
3833  *      ret = wifi_direct_get_subnet_mask(&subnet); // get subnet mask
3834  *
3835  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
3836  *              printf("Failed to get subnet mask\n");
3837  *              return -1;
3838  *      }
3839  *
3840  *      printf("subnet address=%s\n", subnet);
3841  *      g_free(ip);
3842  *      g_free(subnet);
3843  *      return 0;
3844  * }
3845  *
3846  * void callback_2(int error_code,
3847  *                 wifi_direct_connection_state_e state,
3848  *                 const char *mac, void *user_data)
3849  *{
3850  *      switch (state) {
3851  *      case WIFI_DIRECT_CONNECTION_IN_PROGRESS:
3852  *              printf("Connection in progress\n");
3853  *      break;
3854  *
3855  *      case WIFI_DIRECT_CONNECTON_RSP:
3856  *              printf("Connected\n");
3857  *
3858  *              function();
3859  * break;
3860  *
3861  *      case WIFI_DIRECT_DISCONNECTION_IND:
3862  *              printf("Disconnection IND\n");
3863  *      break;
3864  *
3865  *      case WIFI_DIRECT_DISCONNECTION_RSP;
3866  *              printf("Disconnected\n");
3867  *      break;
3868  * }
3869  *}
3870  *
3871  * void callback_1(int error_code,
3872  *               wifi_direct_discovery_state_e discovery_state,
3873  *               void *user_data)
3874  * {
3875  *      switch(discovery_state) {
3876  *      case WIFI_DIRECT_DISCOVERY_STARTED:
3877  *              printf("Discovery started\n");
3878  *              break;
3879  *
3880  *      case WIFI_DIRECT_ONLY_LISTEN_STARTED:
3881  *              printf("listen started\n");
3882  *              break;
3883  *
3884  *      case WIFI_DIRECT_DISCOVERY_FINISHED:
3885  *              printf("Discovery finished\n");
3886  *
3887  *              wifi_direct_foreach_discovered_peers(peers_cb,
3888  *                                        NULL);
3889  *              break;
3890  *
3891  *      case WIFI_DIRECT_DISCOVERY_FOUND:
3892  *              printf("peer devices found\n");
3893  *              break;
3894  *
3895  *      case WIFI_DIRECT_DISCOVERY_LOST:
3896  *              printf("Discovery lost\n");
3897  *              break;
3898  *
3899  *      default:
3900  *      break;
3901  *      }
3902  * }
3903  *
3904  * int main()
3905  * {
3906  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
3907  *      wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1
3908  *      wifi_direct_set_connection_state_changed_cb(callback_2, NULL); // Register callback 2
3909  *
3910  *      wifi_direct_activate(); // Activate Wi-Fi Direct
3911  *      wifi_direct_start_discovery(TRUE, 15); // Start discovery
3912  *
3913  *      //       APP CODE HERE
3914  *
3915  *      // App must clean up Wi-Fi Direct before exiting
3916  *
3917  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
3918  *      wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback
3919  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
3920  *      return 0;
3921  * }
3922  * @endcode
3923  */
3924 int wifi_direct_get_subnet_mask(char **subnet_mask);
3925
3926
3927 /**
3928  * @brief Gets the Gateway address.
3929  * @since_tizen 2.3
3930  * @privlevel public
3931  * @privilege %http://tizen.org/privilege/wifidirect
3932  * @remarks @a gateway_address must be released using free().
3933  * @param[out] gateway_address  The gateway address
3934  * @return @c 0 on success,
3935  *         otherwise a negative error value
3936  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
3937  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
3938  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
3939  * @retval #WIFI_DIRECT_ERROR_OUT_OF_MEMORY         Out of memory
3940  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
3941  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
3942  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
3943  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
3944  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
3945  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
3946  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
3947  * @see wifi_direct_activate()
3948  *
3949  *
3950  * Here is an example of the usage:
3951  * @code
3952  * #include <stdio.h>
3953  * #include <wifi_direct.h>
3954  *
3955  * int function(void);
3956  *
3957  * bool device_selected = false;
3958  *
3959  * void peers_cb(wifi_direct_discovered_peer_info_s* peer,
3960  *                                           void *user_data)
3961  * {
3962  *      if (peer && !device_selected) {
3963  *              printf("peer device=%s MAC=%s\n", peer->device_name, peer->mac_address);
3964  *
3965  *              device_selected = true;
3966  *
3967  *              wifi_direct_connect(peer->mac_address); // Connect to the first discovered peer
3968  *      }
3969  * }
3970  *
3971  * int function(void)
3972  * {
3973  *      int ret;
3974  *      char *gateway;
3975  *      char *ip;
3976  *
3977  *      wifi_direct_get_ip_address(&ip); // get ip address
3978  *
3979  *      ret = wifi_direct_get_gateway_address(&gateway); // get gateway address
3980  *
3981  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
3982  *              printf("Failed to get gateway address\n");
3983  *              return -1;
3984  *      }
3985  *
3986  *      printf("gateway address=%s\n", gateway);
3987  *      g_free(ip);
3988  *      g_free(gateway);
3989  *      return 0;
3990  * }
3991  *
3992  * void callback_2(int error_code,
3993  *                 wifi_direct_connection_state_e state,
3994  *                 const char *mac, void *user_data)
3995  *{
3996  *      switch (state) {
3997  *      case WIFI_DIRECT_CONNECTION_IN_PROGRESS:
3998  *              printf("Connection in progress\n");
3999  *      break;
4000  *
4001  *      case WIFI_DIRECT_CONNECTON_RSP:
4002  *              printf("Connected\n");
4003  *
4004  *              function();
4005  * break;
4006  *
4007  *      case WIFI_DIRECT_DISCONNECTION_IND:
4008  *              printf("Disconnection IND\n");
4009  *      break;
4010  *
4011  *      case WIFI_DIRECT_DISCONNECTION_RSP;
4012  *              printf("Disconnected\n");
4013  *      break;
4014  * }
4015  *}
4016  *
4017  * void callback_1(int error_code,
4018  *               wifi_direct_discovery_state_e discovery_state,
4019  *               void *user_data)
4020  * {
4021  *      switch(discovery_state) {
4022  *      case WIFI_DIRECT_DISCOVERY_STARTED:
4023  *              printf("Discovery started\n");
4024  *              break;
4025  *
4026  *      case WIFI_DIRECT_ONLY_LISTEN_STARTED:
4027  *              printf("listen started\n");
4028  *              break;
4029  *
4030  *      case WIFI_DIRECT_DISCOVERY_FINISHED:
4031  *              printf("Discovery finished\n");
4032  *
4033  *              wifi_direct_foreach_discovered_peers(peers_cb,
4034  *                                        NULL);
4035  *              break;
4036  *
4037  *      case WIFI_DIRECT_DISCOVERY_FOUND:
4038  *              printf("peer devices found\n");
4039  *              break;
4040  *
4041  *      case WIFI_DIRECT_DISCOVERY_LOST:
4042  *              printf("Discovery lost\n");
4043  *              break;
4044  *
4045  *      default:
4046  *      break;
4047  *      }
4048  * }
4049  *
4050  * int main()
4051  * {
4052  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
4053  *      wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1
4054  *      wifi_direct_set_connection_state_changed_cb(callback_2, NULL); // Register callback 2
4055  *
4056  *      wifi_direct_activate(); // Activate Wi-Fi Direct
4057  *      wifi_direct_start_discovery(TRUE, 15); // Start discovery
4058  *
4059  *      //       APP CODE HERE
4060  *
4061  *      // App must clean up Wi-Fi Direct before exiting
4062  *
4063  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
4064  *      wifi_direct_unset_connection_state_changed_cb(); // Deregister callback
4065  *      wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback
4066  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
4067  *      return 0;
4068  * }
4069  * @endcode
4070  */
4071 int wifi_direct_get_gateway_address(char **gateway_address);
4072
4073
4074 /**
4075  * @brief Gets MAC address of a local device.
4076  * @since_tizen 2.3
4077  * @privlevel public
4078  * @privilege %http://tizen.org/privilege/wifidirect
4079  * @remarks @a mac_address must be released using free().
4080  * @param[out] mac_address  The MAC address
4081  * @return @c 0 on success,
4082  *         otherwise a negative error value
4083  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
4084  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
4085  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
4086  * @retval #WIFI_DIRECT_ERROR_OUT_OF_MEMORY         Out of memory
4087  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
4088  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
4089  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
4090  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
4091  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
4092  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
4093  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
4094  * @see wifi_direct_initialize()
4095  *
4096  *
4097  * Here is an example of the usage:
4098  * @code
4099  * #include <stdio.h>
4100  * #include <wifi_direct.h>
4101  *
4102  * int function(void);
4103  *
4104  * bool device_selected = false;
4105  *
4106  * void peers_cb(wifi_direct_discovered_peer_info_s* peer,
4107  *                                           void *user_data)
4108  * {
4109  *      if (peer && !device_selected) {
4110  *              printf("peer device=%s MAC=%s\n", peer->device_name, peer->mac_address);
4111  *
4112  *              device_selected = true;
4113  *
4114  *              wifi_direct_connect(peer->mac_address); // Connect to the first discovered peer
4115  *      }
4116  * }
4117  *
4118  * int function(void)
4119  * {
4120  *      int ret;
4121  *      char *mac;
4122  *      char *ip;
4123  *
4124  *      wifi_direct_get_ip_address(&ip); // get ip address
4125  *
4126  *      ret = wifi_direct_get_mac_address(&mac); // get MAC address
4127  *
4128  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
4129  *              printf("Failed to get mac address\n");
4130  *              return -1;
4131  *      }
4132  *
4133  *      printf("MAC address=%s\n", mac);
4134  *      g_free(ip);
4135  *      g_free(mac);
4136  *      return 0;
4137  * }
4138  *
4139  * void callback_2(int error_code,
4140  *                 wifi_direct_connection_state_e state,
4141  *                 const char *mac, void *user_data)
4142  *{
4143  *      switch (state) {
4144  *      case WIFI_DIRECT_CONNECTION_IN_PROGRESS:
4145  *              printf("Connection in progress\n");
4146  *      break;
4147  *
4148  *      case WIFI_DIRECT_CONNECTON_RSP:
4149  *              printf("Connected\n");
4150  *
4151  *              function();
4152  * break;
4153  *
4154  *      case WIFI_DIRECT_DISCONNECTION_IND:
4155  *              printf("Disconnection IND\n");
4156  *      break;
4157  *
4158  *      case WIFI_DIRECT_DISCONNECTION_RSP;
4159  *              printf("Disconnected\n");
4160  *      break;
4161  * }
4162  *}
4163  *
4164  * void callback_1(int error_code,
4165  *               wifi_direct_discovery_state_e discovery_state,
4166  *               void *user_data)
4167  * {
4168  *      switch(discovery_state) {
4169  *      case WIFI_DIRECT_DISCOVERY_STARTED:
4170  *              printf("Discovery started\n");
4171  *              break;
4172  *
4173  *      case WIFI_DIRECT_ONLY_LISTEN_STARTED:
4174  *              printf("listen started\n");
4175  *              break;
4176  *
4177  *      case WIFI_DIRECT_DISCOVERY_FINISHED:
4178  *              printf("Discovery finished\n");
4179  *
4180  *              wifi_direct_foreach_discovered_peers(peers_cb,
4181  *                                        NULL);
4182  *              break;
4183  *
4184  *      case WIFI_DIRECT_DISCOVERY_FOUND:
4185  *              printf("peer devices found\n");
4186  *              break;
4187  *
4188  *      case WIFI_DIRECT_DISCOVERY_LOST:
4189  *              printf("Discovery lost\n");
4190  *              break;
4191  *
4192  *      default:
4193  *      break;
4194  *      }
4195  * }
4196  *
4197  * int main()
4198  * {
4199  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
4200  *      wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1
4201  *      wifi_direct_set_connection_state_changed_cb(callback_2, NULL); // Register callback 2
4202  *
4203  *      wifi_direct_activate(); // Activate Wi-Fi Direct
4204  *      wifi_direct_start_discovery(TRUE, 15); // Start discovery
4205  *
4206  *      //       APP CODE HERE
4207  *
4208  *      // App must clean up Wi-Fi Direct before exiting
4209  *
4210  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
4211  *      wifi_direct_unset_connection_state_changed_cb(); // Deregister callback
4212  *      wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback
4213  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
4214  *      return 0;
4215  * }
4216  * @endcode
4217  */
4218 int wifi_direct_get_mac_address(char **mac_address);
4219
4220
4221 /**
4222  * @brief Gets the state of Wi-Fi Direct service.
4223  * @since_tizen 2.3
4224  * @param[out] state  The state of Wi-Fi Direct service
4225  * @return @c 0 on success,
4226  *         otherwise a negative error value
4227  * @retval #WIFI_DIRECT_ERROR_NONE               Successful
4228  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
4229  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED   Operation failed
4230  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED      Operation not permitted
4231  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED      Not supported
4232  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY      Device or resource busy
4233  *
4234  *
4235  * Here is an example of the usage:
4236  * @code
4237  * #include <stdio.h>
4238  * #include <wifi_direct.h>
4239  *
4240  * char* print_state(wifi_direct_state_e state)
4241  * {
4242  *      if (state == WIFI_DIRECT_STATE_DEACTIVATED)
4243  *              return "DEACTIVATED";
4244  *      if (state == WIFI_DIRECT_STATE_ACTIVATING)
4245  *              return "ACTIVATING";
4246  *      if (state == WIFI_DIRECT_STATE_ACTIVATED)
4247  *              return "ACTIVATED";
4248  *      if (state == WIFI_DIRECT_STATE_DISCOVERING)
4249  *              return "DISCOVERING";
4250  *      if (state == WIFI_DIRECT_STATE_CONNECTING)
4251  *              return "CONNECTING";
4252  *      if (state == WIFI_DIRECT_STATE_DISCONNECTING)
4253  *              return "DISCONNECTING";
4254  *      if (state == WIFI_DIRECT_STATE_CONNECTED)
4255  *              return "CONNECTED";
4256  *      if (state == WIFI_DIRECT_STATE_GROUP_OWNER)
4257  *              return "GROUP OWNER";
4258  *
4259  *      return "Unknown state";
4260  * }
4261  *
4262  * int function(void)
4263  * {
4264  *      int ret;
4265  *      int state;
4266  *
4267  *      ret = wifi_direct_get_state(&state); // get Wi-Fi Direct state
4268  *
4269  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
4270  *              printf("Failed to get state\n");
4271  *              return -1;
4272  *      }
4273  *
4274  *      printf(Wi-Fi Direct State = %s\n, print_state(state));
4275  *
4276  *      return 0;
4277  * }
4278  *
4279  * int main()
4280  * {
4281  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
4282  *      wifi_direct_activate(); // Activate Wi-Fi Direct
4283  *
4284  *      function();
4285  *
4286  *      //       APP CODE HERE
4287  *
4288  *      // App must clean up Wi-Fi Direct before exiting
4289  *
4290  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
4291  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
4292  *      return 0;
4293  * }
4294  * @endcode
4295  */
4296 int wifi_direct_get_state(wifi_direct_state_e *state);
4297
4298
4299 /**
4300  * @brief Checks whether this device is discoverable or not by P2P discovery.
4301  * @details If you call wifi_direct_start_discovery(), then your device can be discoverable.
4302  * @since_tizen 2.3
4303  * @privlevel public
4304  * @privilege %http://tizen.org/privilege/wifidirect
4305  * @param[out] discoverable  The status of discoverable:
4306  *                           (@c true = discoverable, @c false = non-discoverable)
4307  * @return @c 0 on success,
4308  *         otherwise a negative error value
4309  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
4310  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
4311  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
4312  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
4313  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
4314  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
4315  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
4316  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
4317  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
4318  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
4319  * @see wifi_direct_initialize()
4320  * @see wifi_direct_start_discovery()
4321  * @see wifi_direct_cancel_discovery()
4322  *
4323  *
4324  * Here is an example of the usage:
4325  * @code
4326  * #include <stdio.h>
4327  * #include <wifi_direct.h>
4328  *
4329  * int function(void)
4330  * {
4331  *      int ret;
4332  *      bool discoverable;
4333  *
4334  *      ret = wifi_direct_is_discoverable(&discoverable); // check if device is discoverable
4335  *
4336  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
4337  *              printf("Failed to get discoverable property\n");
4338  *              return -1;
4339  *      }
4340  *
4341  *      printf("discoverable=%s\n", discoverable?"Yes":"No");
4342  *
4343  *      return 0;
4344  * }
4345  *
4346  * void callback_1(int error_code,
4347  *               wifi_direct_discovery_state_e discovery_state,
4348  *               void *user_data)
4349  * {
4350  *      switch(discovery_state) {
4351  *      case WIFI_DIRECT_DISCOVERY_STARTED:
4352  *              printf("Discovery started\n");
4353  *
4354  *              function();
4355  *              break;
4356  *
4357  *      case WIFI_DIRECT_ONLY_LISTEN_STARTED:
4358  *              printf("listen started\n");
4359  *
4360  *              function();
4361  *              break;
4362  *
4363  *      case WIFI_DIRECT_DISCOVERY_FINISHED:
4364  *              printf("Discovery finished\n");
4365  *
4366  *              function();
4367  *              break;
4368  *
4369  *      case WIFI_DIRECT_DISCOVERY_FOUND:
4370  *              printf("peer devices found\n");
4371  *              break;
4372  *
4373  *      case WIFI_DIRECT_DISCOVERY_LOST:
4374  *              printf("Discovery lost\n");
4375  *              break;
4376  *
4377  *      default:
4378  *      break;
4379  *      }
4380  * }
4381  *
4382  * int main()
4383  * {
4384  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
4385  *      wifi_direct_activate(); // Activate Wi-Fi Direct
4386  *      wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1
4387  *
4388  *      wifi_direct_start_discovery(TRUE, 15); // Start discovery
4389  *
4390  *      function();
4391  *
4392  *      //       APP CODE HERE
4393  *
4394  *      // App must clean up Wi-Fi Direct before exiting
4395  *
4396  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
4397  *      wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback
4398  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
4399  *      return 0;
4400  * }
4401  * @endcode
4402  */
4403 int wifi_direct_is_discoverable(bool *discoverable);
4404
4405
4406 /**
4407  * @brief Checks whether the local device is listening only.
4408  * @details If you call wifi_direct_start_discovery() with @a listen_only as @c true,
4409  *          it does not support specific channel but the initial 802.11.
4410  * @since_tizen 2.3
4411  * @privlevel public
4412  * @privilege %http://tizen.org/privilege/wifidirect
4413  * @param[out] listen_only  The status of listen only:(@c true = listen only, @c false =
4414  *                          cycling between Scan and Listen or not in discovery state)
4415  * @return @c 0 on success,
4416  *         otherwise a negative error value
4417  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
4418  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
4419  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
4420  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
4421  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
4422  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
4423  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
4424  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
4425  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
4426  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
4427  * @see wifi_direct_activate()
4428  * @see wifi_direct_start_discovery()
4429  * @see wifi_direct_cancel_discovery()
4430  * @see wifi_direct_is_discoverable()
4431  *
4432  *
4433  * Here is an example of the usage:
4434  * @code
4435  * #include <stdio.h>
4436  * #include <wifi_direct.h>
4437  *
4438  * int function(void)
4439  * {
4440  *      int ret;
4441  *      bool listen_only;
4442  *
4443  *      ret = wifi_direct_is_listening_only(&listen_only); // check if device is listening
4444  *
4445  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
4446  *              printf("Failed to get discoverable property\n");
4447  *              return -1;
4448  *      }
4449  *
4450  *      printf("listening=%s\n", listen_only?"Yes":"No");
4451  *
4452  *      return 0;
4453  * }
4454  *
4455  * void callback_1(int error_code,
4456  *               wifi_direct_discovery_state_e discovery_state,
4457  *               void *user_data)
4458  * {
4459  *      switch(discovery_state) {
4460  *      case WIFI_DIRECT_DISCOVERY_STARTED:
4461  *              printf("Discovery started\n");
4462  *              break;
4463  *
4464  *      case WIFI_DIRECT_ONLY_LISTEN_STARTED:
4465  *              printf("listen started\n");
4466  *
4467  *              function();
4468  *              break;
4469  *
4470  *      case WIFI_DIRECT_DISCOVERY_FINISHED:
4471  *              printf("Discovery finished\n");
4472  *
4473  *              function();
4474  *              break;
4475  *
4476  *      case WIFI_DIRECT_DISCOVERY_FOUND:
4477  *              printf("peer devices found\n");
4478  *              break;
4479  *
4480  *      case WIFI_DIRECT_DISCOVERY_LOST:
4481  *              printf("Discovery lost\n");
4482  *              break;
4483  *
4484  *      default:
4485  *      break;
4486  *      }
4487  * }
4488  *
4489  * int main()
4490  * {
4491  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
4492  *      wifi_direct_activate(); // Activate Wi-Fi Direct
4493  *      wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1
4494  *
4495  *      wifi_direct_start_discovery(TRUE, 15); // Start discovery
4496  *
4497  *      function();
4498  *
4499  *      //       APP CODE HERE
4500  *
4501  *      // App must clean up Wi-Fi Direct before exiting
4502  *
4503  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
4504  *      wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback
4505  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
4506  *      return 0;
4507  * }
4508  * @endcode
4509  */
4510 int wifi_direct_is_listening_only(bool *listen_only);
4511
4512
4513 /**
4514  * @brief Gets the primary device type of a local device.
4515  * @since_tizen 2.3
4516  * @privlevel public
4517  * @privilege %http://tizen.org/privilege/wifidirect
4518  * @param[out] type  The primary device type
4519  * @return @c 0 on success,
4520  *         otherwise a negative error value
4521  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
4522  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
4523  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
4524  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
4525  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
4526  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
4527  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
4528  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
4529  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
4530  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
4531  * @see wifi_direct_initialize()
4532  *
4533  *
4534  * Here is an example of the usage:
4535  * @code
4536  * #include <stdio.h>
4537  * #include <wifi_direct.h>
4538  *
4539  * char* print_type(wifi_direct_primary_device_type_e type)
4540  * {
4541  *      if (type == WIFI_DIRECT_PRIMARY_DEVICE_TYPE_COMPUTER)
4542  *              return "Computer";
4543  *      if (state == WIFI_DIRECT_PRIMARY_DEVICE_TYPE_CAMERA)
4544  *              return "Camera";
4545  *      if (state == WIFI_DIRECT_PRIMARY_DEVICE_TYPE_STORAGE)
4546  *              return "Storage";
4547  *      if (state == WIFI_DIRECT_PRIMARY_DEVICE_TYPE_DISPLAY)
4548  *              return "Display";
4549  *      if (state == WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE)
4550  *              return "Telephone";
4551  *
4552  *      // Refer wifi_direct_primary_device_type_e enum for all devices
4553  * }
4554  *
4555  * int function(void)
4556  * {
4557  *      int ret;
4558  *      int type;
4559  *
4560  *      ret = wifi_direct_get_primary_device_type(&type); // get primary device type
4561  *
4562  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
4563  *              printf("Failed to get primary device type\n");
4564  *              return -1;
4565  *      }
4566  *
4567  *      printf("primary Device = %s\n", print_type(type));
4568  *
4569  *      return 0;
4570  * }
4571  *
4572  * int main()
4573  * {
4574  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
4575  *      wifi_direct_activate(); // Activate Wi-Fi Direct
4576  *
4577  *      function();
4578  *
4579  *      //       APP CODE HERE
4580  *
4581  *      // App must clean up Wi-Fi Direct before exiting
4582  *
4583  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
4584  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
4585  *      return 0;
4586  * }
4587  * @endcode
4588  */
4589 int wifi_direct_get_primary_device_type(wifi_direct_primary_device_type_e *type);
4590
4591
4592 /**
4593  * @brief Gets the secondary device type of a local device.
4594  * @since_tizen 2.3
4595  * @privlevel public
4596  * @privilege %http://tizen.org/privilege/wifidirect
4597  * @param[out] type  The secondary device type
4598  * @return @c 0 on success,
4599  *         otherwise a negative error value
4600  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
4601  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
4602  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
4603  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
4604  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
4605  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
4606  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
4607  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
4608  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
4609  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
4610  * @see wifi_direct_initialize()
4611  *
4612  *
4613  * Here is an example of the usage:
4614  * @code
4615  * #include <stdio.h>
4616  * #include <wifi_direct.h>
4617  *
4618  * char* print_type(wifi_direct_primary_device_type_e type)
4619  * {
4620  *      if (type == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_PC)
4621  *              return "Computer pc";
4622  *      if (state == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_KEYBOARD)
4623  *              return "input Keyboard";
4624  *      if (state == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_VIDEO)
4625  *              return "Camera Video";
4626  *      if (state == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_STORAGE_NAS)
4627  *              return "Storage NAS";
4628  *      if (state == WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_TV)
4629  *              return "Display TV";
4630  *
4631  *      // Refer wifi_direct_secondary_device_type_e enum for all devices
4632  * }
4633  *
4634  * int function(void)
4635  * {
4636  *      int ret;
4637  *      int type;
4638  *
4639  *      ret = wifi_direct_get_secondary_device_type(&type); // get secondary device type
4640  *
4641  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
4642  *              printf("Failed to get secondary device type\n");
4643  *              return -1;
4644  *      }
4645  *
4646  *      printf("secondary Device = %s\n", print_type(type));
4647  *
4648  *      return 0;
4649  * }
4650  *
4651  * int main()
4652  * {
4653  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
4654  *      wifi_direct_activate(); // Activate Wi-Fi Direct
4655  *
4656  *      function();
4657  *
4658  *      //       APP CODE HERE
4659  *
4660  *      // App must clean up Wi-Fi Direct before exiting
4661  *
4662  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
4663  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
4664  *      return 0;
4665  * }
4666  * @endcode
4667  */
4668 int wifi_direct_get_secondary_device_type(wifi_direct_secondary_device_type_e* type);
4669
4670
4671 /**
4672  * @brief Sets the WPS config PBC as preferred method for connection.
4673  * @since_tizen 2.3
4674  * @privlevel public
4675  * @privilege %http://tizen.org/privilege/wifidirect
4676  * @return @c 0 on success,
4677  *         otherwise a negative error value
4678  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
4679  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
4680  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
4681  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
4682  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
4683  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
4684  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
4685  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
4686  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
4687  * @see wifi_direct_activate()
4688  *
4689  *
4690  * Here is an example of the usage:
4691  * @code
4692  * #include <stdio.h>
4693  * #include <wifi_direct.h>
4694  *
4695  * int function(void)
4696  * {
4697  *      int ret;
4698  *
4699  *      ret = wifi_direct_activate_pushbutton(); // Activate WPS PBC Push Button
4700  *
4701  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
4702  *              printf("Failed to activate push button\n");
4703  *              return -1;
4704  *      }
4705  *
4706  *      printf("Push button Activated successfully\n");
4707  *
4708  *      return 0;
4709  * }
4710  *
4711  * int main()
4712  * {
4713  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
4714  *      wifi_direct_activate(); // Activate Wi-Fi Direct
4715  *
4716  *      function();
4717  *
4718  *      //       APP CODE HERE
4719  *
4720  *      // App must clean up Wi-Fi Direct before exiting
4721  *
4722  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
4723  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
4724  *      return 0;
4725  * }
4726  * @endcode
4727  */
4728 int wifi_direct_activate_pushbutton(void);
4729
4730
4731 /**
4732  * @brief Sets or updates the WPS PIN number user expects.
4733  * @since_tizen 2.3
4734  * @privlevel public
4735  * @privilege %http://tizen.org/privilege/wifidirect
4736  * @param[in] pin  New pin to set. Application must set the new pin number before
4737  * @return @c 0 on success,
4738  *         otherwise a negative error value
4739  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
4740  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
4741  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
4742  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
4743  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
4744  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
4745  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
4746  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
4747  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
4748  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
4749  * @see wifi_direct_activate()
4750  * @see wifi_direct_get_wps_pin()
4751  *
4752  *
4753  * Here is an example of the usage:
4754  * @code
4755  * #include <stdio.h>
4756  * #include <wifi_direct.h>
4757  *
4758  *
4759  * int function(void)
4760  * {
4761  *      int ret;
4762  *      char pin[9] = {0, };
4763  *
4764  *      printf("Input 8 digit PIN to set the WPS PIN mode\n");
4765  *      read(stdin, pin, 8);
4766  *
4767  *      ret = wifi_direct_set_wps_pin(pin); // Set the WPS PIN for connection
4768  *
4769  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
4770  *              printf("Failed to set the WPS PIN\n");
4771  *              return -1;
4772  *      }
4773  *
4774  *      printf("WPS PIN set success\n");
4775  *      return 0;
4776  * }
4777  *
4778  * void callback(int error_code,
4779  *               wifi_direct_connection_state_e connection_state,
4780  *               const char *mac_address,
4781  *               void *user_data)
4782  *{
4783  *      char *ip;
4784  *      bool owner;
4785  *      int wps_mode;
4786  *
4787  *      switch (connection_state) {
4788  *
4789  *      case WIFI_DIRECT_CONNECTION_IN_PROGRESS:
4790  *              printf("Connection in progress\n");
4791  *      break;
4792  *
4793  *      case WIFI_DIRECT_CONNECTION_RSP:
4794  *              if (error_code == WIFI_DIRECT_ERROR_NONE) {
4795  *                      printf("Peer Device Connected\n"); // device is connected
4796  *
4797  *                      printf("MAC=%s\n", mac_address); // device's MAC address
4798  *
4799  *                      wifi_direct_get_ip_address(&ip);
4800  *                      printf("IP=%s\n", ip); //device's IP address
4801  *
4802  *                      wifi_direct_is_group_owner(&owner);
4803  *                      printf("Ownership=%s\n", (owner)? "GO":"STA"); // (GO or client role)
4804  *
4805  *              } else if (error_code == WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT) {
4806  *                      printf("Connection timeout occurred\n");
4807  *              } else if (error_code == WIFI_DIRECT_ERROR_AUTH_FAILED) {
4808  *                      printf("Connection authorization Failed\n");
4809  *              } else
4810  *                      printf("Connection failed\n");
4811  *      break;
4812  *
4813  *      case WIFI_DIRECT_CONNECTION_WPS_REQ:
4814  *
4815  *              wifi_direct_get_local_wps_type(&wps_mode);
4816  *
4817  *              if (wps_mode == WIFI_DIRECT_WPS_TYPE_PBC) {
4818  *                      printf("Connection type WPS PBC\n");
4819  *                      // Handle WPS PBC case here
4820  *              }
4821  *
4822  *              if (wps_mode == WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY) {
4823  *                      printf("Connection type WPS PIN DISPLAY\n");
4824  *                      // Handle WPS PIN Display case here
4825  *              }
4826  *
4827  *              if (wps_mode == WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD) {
4828  *                      printf("Connection type WPS PIN KEYPAD\n");
4829  *
4830  *              // Set 8 digit WPS PIN here
4831  *              // Since the device has received the wps mode as PIN Keypad
4832  *              // User need to set the WPS PIN for peer
4833  *              // device connection using PIN method.
4834  *
4835  *              if (function() == 0)
4836  *                      wifi_direct_accept_connection(mac_address); // Accept the requested connection
4837  *
4838  *              }
4839  *      break;
4840  *
4841  *      case WIFI_DIRECT_CONNECTION_REQ:
4842  *              printf("Connection request from MAC %s\n", mac_address);
4843  *
4844  *              // Handle the connection request from peer device here
4845  *              // 1. WPS PBC
4846  *              // 2. WPS PIN Display
4847  *              // 3. WPS PIN Keypad
4848  *
4849  *              wifi_direct_accept_connection(mac_address);
4850  *      break;
4851  *
4852  *      case WIFI_DIRECT_DISCONNECTION_IND:
4853  *              if (error_code == WIFI_DIRECT_ERROR_NONE)
4854  *                      printf("peer device disconnected MAC %s\n", mac_address);
4855  *      break;
4856  *
4857  *      case WIFI_DIRECT_DISCONNECTION_RSP:
4858  *              if (error_code == WIFI_DIRECT_ERROR_NONE)
4859  *                      printf("peer device disconnection response MAC %s\n", mac_address);
4860  *      break;
4861  *
4862  *      case WIFI_DIRECT_DISASSOCIATION_IND:
4863  *              if (error_code == WIFI_DIRECT_ERROR_NONE)
4864  *                      printf("peer device disassociation MAC %s\n", mac_address);
4865  *      break;
4866  *
4867  *      case WIFI_DIRECT_GROUP_CREATED:
4868  *              printf("Group Created\n");
4869  *      break;
4870  *
4871  *      case WIFI_DIRECT_GROUP_DESTROYED:
4872  *              printf("Group Destroyed\n");
4873  *      break;
4874  *
4875  *      default:
4876  *      break;
4877  *      }
4878  *}
4879  *
4880  * int main()
4881  * {
4882  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
4883  *      wifi_direct_set_connection_state_changed_cb(callback, NULL); // Register callback
4884  *
4885  *      wifi_direct_activate(); // Activate Wi-Fi Direct
4886  *
4887  *      function();
4888  *
4889  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
4890  *
4891  *      wifi_direct_set_connection_state_changed_cb(callback, NULL); // Deregister callback
4892  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
4893  *      return 0;
4894  * }
4895  * @endcode
4896  */
4897 int wifi_direct_set_wps_pin(char *pin);
4898
4899
4900 /**
4901  * @brief Gets the WPS PIN number.
4902  * @since_tizen 2.3
4903  * @privlevel public
4904  * @privilege %http://tizen.org/privilege/wifidirect
4905  * @remarks @a pin must be released with free().
4906  * @param[out] pin  Pointer to store pin number. Application must free this memory
4907  * @return @c 0 on success,
4908  *         otherwise a negative error value
4909  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
4910  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
4911  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
4912  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
4913  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
4914  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
4915  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
4916  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
4917  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
4918  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
4919  * @see wifi_direct_activate()
4920  * @see wifi_direct_set_wps_pin()
4921  *
4922  *
4923  * Here is an example of the usage:
4924  * @code
4925  * #include <stdio.h>
4926  * #include <wifi_direct.h>
4927  *
4928  *
4929  * int function(void)
4930  * {
4931  *      int ret;
4932  *      char *pin;
4933  *
4934  *      ret = wifi_direct_get_wps_pin(&pin); // Get the WPS PIN
4935  *
4936  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
4937  *              printf("Failed to get the WPS PIN\n");
4938  *              return -1;
4939  *      }
4940  *
4941  *      printf("WPS PIN : %s\n", pin);
4942  *      g_free(pin);
4943  *      return 0;
4944  * }
4945  *
4946  * void callback(int error_code,
4947  *               wifi_direct_connection_state_e connection_state,
4948  *               const char *mac_address,
4949  *               void *user_data)
4950  *{
4951  *      char *ip;
4952  *      bool owner;
4953  *      int wps_mode;
4954  *
4955  *      switch (connection_state) {
4956  *
4957  *      case WIFI_DIRECT_CONNECTION_IN_PROGRESS:
4958  *              printf("Connection in progress\n");
4959  *      break;
4960  *
4961  *      case WIFI_DIRECT_CONNECTION_RSP:
4962  *              if (error_code == WIFI_DIRECT_ERROR_NONE) {
4963  *                      printf("Peer Device Connected\n"); // device is connected
4964  *
4965  *                      printf("MAC=%s\n", mac_address); // device's MAC address
4966  *
4967  *                      wifi_direct_get_ip_address(&ip);
4968  *                      printf("IP=%s\n", ip); //device's IP address
4969  *
4970  *                      wifi_direct_is_group_owner(&owner);
4971  *                      printf("Ownership=%s\n", (owner)? "GO":"STA"); // (GO or client role)
4972  *
4973  *              } else if (error_code == WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT) {
4974  *                      printf("Connection timeout occurred\n");
4975  *              } else if (error_code == WIFI_DIRECT_ERROR_AUTH_FAILED) {
4976  *                      printf("Connection authorization Failed\n");
4977  *              } else
4978  *                      printf("Connection failed\n");
4979  *      break;
4980  *
4981  *      case WIFI_DIRECT_CONNECTION_WPS_REQ:
4982  *
4983  *              wifi_direct_get_local_wps_type(&wps_mode);
4984  *
4985  *              if (wps_mode == WIFI_DIRECT_WPS_TYPE_PBC) {
4986  *                      printf("Connection type WPS PBC\n");
4987  *                      // Handle WPS PBC case here
4988  *              }
4989  *
4990  *              if (wps_mode == WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY) {
4991  *                      printf("Connection type WPS PIN DISPLAY\n");
4992  *                      // Handle WPS PIN Display case here
4993  *
4994  *
4995  *                      // Display WPS PIN here
4996  *                      // Since the device received WPS PIN Display connection request
4997  *                      // user need to display the WPS PIN which is shared by peer device
4998  *                      function();
4999  *
5000  *              }
5001  *
5002  *              if (wps_mode == WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD) {
5003  *                      printf("Connection type WPS PIN KEYPAD\n");
5004  *                      // Handle WPS PIN Keypad case here
5005  *              }
5006  *      break;
5007  *
5008  *      case WIFI_DIRECT_CONNECTION_REQ:
5009  *              printf("Connection request from MAC %s\n", mac_address);
5010  *
5011  *              // Handle the connection request from peer device here
5012  *              // 1. WPS PBC
5013  *              // 2. WPS PIN Display
5014  *              // 3. WPS PIN Keypad
5015  *
5016  *              wifi_direct_accept_connection(mac_address);
5017  *      break;
5018  *
5019  *      case WIFI_DIRECT_DISCONNECTION_IND:
5020  *              if (error_code == WIFI_DIRECT_ERROR_NONE)
5021  *                      printf("peer device disconnected MAC %s\n", mac_address);
5022  *      break;
5023  *
5024  *      case WIFI_DIRECT_DISCONNECTION_RSP:
5025  *              if (error_code == WIFI_DIRECT_ERROR_NONE)
5026  *                      printf("peer device disconnection response MAC %s\n", mac_address);
5027  *      break;
5028  *
5029  *      case WIFI_DIRECT_DISASSOCIATION_IND:
5030  *              if (error_code == WIFI_DIRECT_ERROR_NONE)
5031  *                      printf("peer device disassociation MAC %s\n", mac_address);
5032  *      break;
5033  *
5034  *      case WIFI_DIRECT_GROUP_CREATED:
5035  *              printf("Group Created\n");
5036  *      break;
5037  *
5038  *      case WIFI_DIRECT_GROUP_DESTROYED:
5039  *              printf("Group Destroyed\n");
5040  *      break;
5041  *
5042  *      default:
5043  *      break;
5044  *      }
5045  *}
5046  *
5047  * int main()
5048  * {
5049  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
5050  *      wifi_direct_set_connection_state_changed_cb(callback, NULL); // Register callback
5051  *
5052  *      wifi_direct_activate(); // Activate Wi-Fi Direct
5053  *
5054  *      function();
5055  *
5056  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
5057  *
5058  *      wifi_direct_set_connection_state_changed_cb(callback, NULL); // Deregister callback
5059  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
5060  *      return 0;
5061  * }
5062  * @endcode
5063  */
5064 int wifi_direct_get_wps_pin(char **pin);
5065
5066
5067 /**
5068  * @brief Gets all the supported WPS (Wi-Fi Protected Setup) types at local device.
5069  * @since_tizen 2.3
5070  * @privlevel public
5071  * @privilege %http://tizen.org/privilege/wifidirect
5072  * @param[out] wps_mode  Supported WPS mode for local device
5073  * @return @c 0 on success,
5074  *         otherwise a negative error value
5075  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
5076  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
5077  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
5078  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
5079  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
5080  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
5081  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
5082  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
5083  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
5084  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
5085  * @see wifi_direct_initialize()
5086  *
5087  *
5088  * Here is an example of the usage:
5089  * @code
5090  * #include <stdio.h>
5091  * #include <wifi_direct.h>
5092  *
5093  * int function(void)
5094  * {
5095  *      int ret;
5096  *      int wps_mode;
5097  *
5098  *      ret = wifi_direct_get_supported_wps_mode(&wps_mode); // Get supported WPS mode
5099  *
5100  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
5101  *              printf("Failed to get supported wps mode\n");
5102  *              return -1;
5103  *      }
5104  *
5105  *      switch (wps_mode) {
5106  *      case WIFI_DIRECT_WPS_TYPE_PBC:
5107  *              printf("mode is WPS PBC\n");
5108  *      break;
5109  *
5110  *      case WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY:
5111  *              printf("mode is WPS PIN Display\n");
5112  *      break;
5113  *
5114  *      case WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD:
5115  *              printf("mode is WPS PIN Keypad\n");
5116  *      break;
5117  *      }
5118  *
5119  *      return 0;
5120  * }
5121  *
5122  * int main()
5123  * {
5124  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
5125  *      wifi_direct_activate(); // Activate Wi-Fi Direct
5126  *
5127  *      function();
5128  *
5129  *      //       APP CODE HERE
5130  *
5131  *      // App must clean up Wi-Fi Direct before exiting
5132  *
5133  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
5134  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
5135  *      return 0;
5136  * }
5137  * @endcode
5138  */
5139 int wifi_direct_get_supported_wps_mode(int *wps_mode);
5140
5141
5142 /**
5143  * @brief Called when you get the supported WPS (Wi-Fi Protected Setup) type repeatedly.
5144  * @since_tizen 2.3
5145  * @param[in] type       The type of WPS
5146  * @param[in] user_data  The user data passed from the request function
5147  * @return @c true to continue with the next iteration of the loop, \n
5148  *         @c false to break out of the loop
5149  * @pre wifi_direct_foreach_supported_wps_types() will invoke this callback.
5150  * @see wifi_direct_foreach_supported_wps_types()
5151  */
5152 typedef bool(*wifi_direct_supported_wps_type_cb)(wifi_direct_wps_type_e type, void *user_data);
5153
5154
5155 /**
5156  * @brief Gets the supported WPS (Wi-Fi Protected Setup) types.
5157  * @since_tizen 2.3
5158  * @privlevel public
5159  * @privilege %http://tizen.org/privilege/wifidirect
5160  * @param[in] callback   The callback function to invoke
5161  * @param[in] user_data  The user data to be passed to the callback function
5162  * @return @c 0 on success,
5163  *         otherwise a negative error value
5164  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
5165  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
5166  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
5167  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
5168  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
5169  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
5170  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
5171  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
5172  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
5173  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
5174  * @see wifi_direct_initialize()
5175  * @see wifi_direct_supported_wps_type_cb()
5176  *
5177  *
5178  * Here is an example of the usage:
5179  * @code
5180  * #include <stdio.h>
5181  * #include <wifi_direct.h>
5182  *
5183  *
5184  * bool callback(wifi_direct_wps_types_e type, void *user_data)
5185  * {
5186  *      switch (type) {
5187  *      case WIFI_DIRECT_WPS_TYPE_PBC:
5188  *              printf("mode is WPS PBC\n");
5189  *      break;
5190  *
5191  *      case WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY:
5192  *              printf("mode is WPS PIN Display\n");
5193  *      break;
5194  *
5195  *      case WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD:
5196  *              printf("mode is WPS PIN Keypad\n");
5197  *      break;
5198  *      }
5199  * }
5200  *
5201  * int function(void)
5202  * {
5203  *      int ret;
5204  *
5205  *      ret = wifi_direct_foreach_supported_wps_types(callback, NULL);
5206  *
5207  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
5208  *              printf("Failed to get supported wps types\n");
5209  *              return -1;
5210  *      }
5211  *
5212  *      return 0;
5213  * }
5214  *
5215  * int main()
5216  * {
5217  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
5218  *      wifi_direct_activate(); // Activate Wi-Fi Direct
5219  *
5220  *      function();
5221  *
5222  *      //       APP CODE HERE
5223  *
5224  *      // App must clean up Wi-Fi Direct before exiting
5225  *
5226  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
5227  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
5228  *      return 0;
5229  * }
5230  * @endcode
5231  */
5232 int wifi_direct_foreach_supported_wps_types(wifi_direct_supported_wps_type_cb callback, void *user_data);
5233
5234
5235 /**
5236  * @brief Gets the WPS (Wi-Fi Protected Setup) type.
5237  * @since_tizen 2.3
5238  * @privlevel public
5239  * @privilege %http://tizen.org/privilege/wifidirect
5240  * @param[out] type  The type of WPS
5241  * @return @c 0 on success,
5242  *         otherwise a negative error value
5243  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
5244  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
5245  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
5246  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
5247  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
5248  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
5249  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
5250  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
5251  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
5252  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
5253  * @see wifi_direct_initialize()
5254  * @see wifi_direct_foreach_supported_wps_types()
5255  *
5256  *
5257  * Here is an example of the usage:
5258  * @code
5259  * #include <stdio.h>
5260  * #include <wifi_direct.h>
5261  *
5262  *
5263  * int function(void)
5264  * {
5265  *      int ret;
5266  *      int wps_type;
5267  *
5268  *      ret = wifi_direct_get_local_wps_type(&wps_type);
5269  *
5270  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
5271  *              printf("Failed to get supported wps types\n");
5272  *              return -1;
5273  *      }
5274  *
5275  *      switch (wps_type) {
5276  *      case WIFI_DIRECT_WPS_TYPE_PBC:
5277  *              printf("mode is WPS PBC\n");
5278  *      break;
5279  *
5280  *      case WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY:
5281  *              printf("mode is WPS PIN Display\n");
5282  *      break;
5283  *
5284  *      case WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD:
5285  *              printf("mode is WPS PIN Keypad\n");
5286  *      break;
5287  *      }
5288  *      return 0;
5289  * }
5290  *
5291  * int main()
5292  * {
5293  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
5294  *      wifi_direct_activate(); // Activate Wi-Fi Direct
5295  *
5296  *      function();
5297  *
5298  *      //       APP CODE HERE
5299  *
5300  *      // App must clean up Wi-Fi Direct before exiting
5301  *
5302  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
5303  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
5304  *      return 0;
5305  * }
5306  * @endcode
5307  */
5308 int wifi_direct_get_local_wps_type(wifi_direct_wps_type_e *type);
5309
5310
5311 /**
5312  * @brief Sets the requested WPS (Wi-Fi Protected Setup) type.
5313  * @since_tizen 2.3
5314  * @privlevel public
5315  * @privilege %http://tizen.org/privilege/wifidirect
5316  * @param[in] type  The type of WPS
5317  * @return @c 0 on success,
5318  *         otherwise a negative error value
5319  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
5320  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
5321  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
5322  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
5323  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
5324  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
5325  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
5326  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
5327  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
5328  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
5329  * @see wifi_direct_initialize()
5330  * @see wifi_direct_foreach_supported_wps_types()
5331  *
5332  *
5333  * Here is an example of the usage:
5334  * @code
5335  * #include <stdio.h>
5336  * #include <wifi_direct.h>
5337  *
5338  *
5339  * int function(void)
5340  * {
5341  *      int ret;
5342  *      int wps_type;
5343  *      int option;
5344  *
5345  *      printf("Input new WPS mode\n");
5346  *      printf("1. WPS Type PBC\n");
5347  *      printf("2. WPS Type PIN Display\n");
5348  *      printf("3. WPS Type PIN Keypad\n");
5349  *      scanf("%1d", &option);
5350  *
5351  *      switch (input) {
5352  *      case 1:
5353  *              wps_type = WIFI_DIRECT_WPS_TYPE_PBC;
5354  *      break;
5355  *
5356  *      case 2:
5357  *              wps_type = WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY;
5358  *      break;
5359  *
5360  *      case 3:
5361  *              wps_type = WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD;
5362  *      break;
5363  *      }
5364  *
5365  *      ret = wifi_direct_set_req_wps_type(wps_type);
5366  *
5367  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
5368  *              printf("Failed to set requested wps types\n");
5369  *              return -1;
5370  *      }
5371  *
5372  *      return 0;
5373  * }
5374  *
5375  * int main()
5376  * {
5377  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
5378  *      wifi_direct_activate(); // Activate Wi-Fi Direct
5379  *
5380  *      function();
5381  *
5382  *      //       APP CODE HERE
5383  *
5384  *      // App must clean up Wi-Fi Direct before exiting
5385  *
5386  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
5387  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
5388  *      return 0;
5389  * }
5390  * @endcode
5391  */
5392 int wifi_direct_set_req_wps_type(wifi_direct_wps_type_e type);
5393
5394
5395 /**
5396  * @brief Gets the requested WPS (Wi-Fi Protected Setup) type.
5397  * @since_tizen 2.3
5398  * @privlevel public
5399  * @privilege %http://tizen.org/privilege/wifidirect
5400  * @param[out] type  The type of WPS
5401  * @return @c 0 on success,
5402  *         otherwise a negative error value
5403  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
5404  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
5405  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
5406  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
5407  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
5408  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
5409  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
5410  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
5411  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
5412  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
5413  * @see wifi_direct_initialize()
5414  * @see wifi_direct_foreach_supported_wps_types()
5415  *
5416  *
5417  * Here is an example of the usage:
5418  * @code
5419  * #include <stdio.h>
5420  * #include <wifi_direct.h>
5421  *
5422  *
5423  * int function(void)
5424  * {
5425  *      int ret;
5426  *      int wps_type;
5427  *
5428  *      ret = wifi_direct_get_req_wps_type(&wps_type);
5429  *
5430  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
5431  *              printf("Failed to get supported wps types\n");
5432  *              return -1;
5433  *      }
5434  *
5435  *      switch (wps_type) {
5436  *      case WIFI_DIRECT_WPS_TYPE_PBC:
5437  *              printf("mode is WPS PBC\n");
5438  *      break;
5439  *
5440  *      case WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY:
5441  *              printf("mode is WPS PIN Display\n");
5442  *      break;
5443  *
5444  *      case WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD:
5445  *              printf("mode is WPS PIN Keypad\n");
5446  *      break;
5447  *      }
5448  *      return 0;
5449  * }
5450  *
5451  * int main()
5452  * {
5453  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
5454  *      wifi_direct_activate(); // Activate Wi-Fi Direct
5455  *
5456  *      function();
5457  *
5458  *      //       APP CODE HERE
5459  *
5460  *      // App must clean up Wi-Fi Direct before exiting
5461  *
5462  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
5463  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
5464  *      return 0;
5465  * }
5466  * @endcode
5467  */
5468 int wifi_direct_get_req_wps_type(wifi_direct_wps_type_e *type);
5469
5470
5471 /**
5472  * @brief Sets the intent of the group owner.
5473  * @since_tizen 2.3
5474  * @privlevel public
5475  * @privilege %http://tizen.org/privilege/wifidirect
5476  * @remarks The range of intent is 0 - 15. The higher the @a intent is,
5477  *          the higher the probability to be the group owner is.
5478  * @param[in] intent The intent of the group owner
5479  * @return @c 0 on success,
5480  *         otherwise a negative error value
5481  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
5482  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
5483  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
5484  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
5485  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
5486  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
5487  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
5488  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
5489  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
5490  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
5491  * @see wifi_direct_initialize()
5492  * @see wifi_direct_get_group_owner_intent()
5493  *
5494  *
5495  * Here is an example of the usage:
5496  * @code
5497  * #include <stdio.h>
5498  * #include <wifi_direct.h>
5499  *
5500  *
5501  * int function(void)
5502  * {
5503  *      int ret;
5504  *      int go_intent;
5505  *
5506  *      printf("Input the GO Intent range(0~15)\n");
5507  *      scanf("%2d", &go_intent);
5508  *
5509  *      ret = wifi_direct_set_group_owner_intent(go_intent);
5510  *
5511  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
5512  *              printf("Failed to set go intent\n");
5513  *              return -1;
5514  *      }
5515  *
5516  *      return 0;
5517  * }
5518  *
5519  * int main()
5520  * {
5521  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
5522  *      wifi_direct_activate(); // Activate Wi-Fi Direct
5523  *
5524  *      function();
5525  *
5526  *      //       APP CODE HERE
5527  *
5528  *      // App must clean up Wi-Fi Direct before exiting
5529  *
5530  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
5531  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
5532  *      return 0;
5533  * }
5534  * @endcode
5535  */
5536 int wifi_direct_set_group_owner_intent(int intent);
5537
5538 /**
5539  * @brief Sets the intent of the group owner for each connection type.
5540  * @since_tizen 5.0
5541  * @privlevel public
5542  * @privilege %http://tizen.org/privilege/wifidirect
5543  * @remarks The range of intent is 0 - 15. The higher the @a intent is, the higher the probability to be the group owner is.
5544  * @param[in] type  The type of connection for a peer device
5545  * @param[in] intent  The intent of the group owner
5546  * @return 0 on success, otherwise a negative error value
5547  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
5548  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
5549  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
5550  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
5551  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
5552  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
5553  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
5554  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
5555  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
5556  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
5557  * @see wifi_direct_initialize()
5558  * @see wifi_direct_get_go_intent_per_type()
5559  */
5560 int wifi_direct_set_go_intent_per_type(int type, int intent);
5561
5562 /**
5563  * @brief Gets the intent of the group owner.
5564  * @since_tizen 2.3
5565  * @privlevel public
5566  * @privilege %http://tizen.org/privilege/wifidirect
5567  * @param[out] intent  The intent of the group owner
5568  * @return @c 0 on success,
5569  *         otherwise a negative error value
5570  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
5571  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
5572  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
5573  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
5574  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
5575  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
5576  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
5577  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
5578  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
5579  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
5580  * @see wifi_direct_initialize()
5581  * @see wifi_direct_set_group_owner_intent()
5582  *
5583  *
5584  * Here is an example of the usage:
5585  * @code
5586  * #include <stdio.h>
5587  * #include <wifi_direct.h>
5588  *
5589  *
5590  * int function(void)
5591  * {
5592  *      int ret;
5593  *      int go_intent;
5594  *
5595  *      ret = wifi_direct_get_group_owner_intent(&go_intent);
5596  *
5597  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
5598  *              printf("Failed to get go intent\n");
5599  *              return -1;
5600  *      }
5601  *
5602  *      printf("Current GO Intent = %d\n", go_intent);
5603  *      return 0;
5604  * }
5605  *
5606  * int main()
5607  * {
5608  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
5609  *      wifi_direct_activate(); // Activate Wi-Fi Direct
5610  *
5611  *      function();
5612  *
5613  *      //       APP CODE HERE
5614  *
5615  *      // App must clean up Wi-Fi Direct before exiting
5616  *
5617  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
5618  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
5619  *      return 0;
5620  * }
5621  * @endcode
5622  */
5623 int wifi_direct_get_group_owner_intent(int *intent);
5624
5625 /**
5626  * @brief Gets the intent of the group owner for each connection type.
5627  * @since_tizen 5.0
5628  * @privlevel public
5629  * @privilege %http://tizen.org/privilege/wifidirect
5630  * @param[in] type  The type of connection for a peer device
5631  * @param[out] intent  The intent of the group owner
5632  * @return 0 on success, otherwise a negative error value
5633  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
5634  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
5635  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
5636  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
5637  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
5638  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
5639  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
5640  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
5641  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
5642  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
5643  * @see wifi_direct_initialize()
5644  * @see wifi_direct_set_go_intent_per_type()
5645  */
5646 int wifi_direct_get_go_intent_per_type(int type, int *intent);
5647
5648 /**
5649  * @brief Sets the max number of clients.
5650  * @since_tizen 2.3
5651  * @privlevel public
5652  * @privilege %http://tizen.org/privilege/wifidirect
5653  * @param[in] max  The max number of clients
5654  * @return @c 0 on success,
5655  *         otherwise a negative error value
5656  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
5657  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
5658  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
5659  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
5660  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
5661  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
5662  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
5663  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
5664  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
5665  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
5666  * @see wifi_direct_initialize()
5667  * @see wifi_direct_get_max_clients()
5668  *
5669  *
5670  * Here is an example of the usage:
5671  * @code
5672  * #include <stdio.h>
5673  * #include <wifi_direct.h>
5674  *
5675  *
5676  * int function(void)
5677  * {
5678  *      int ret;
5679  *      int max_client;
5680  *
5681  *      printf("Input the maximum clients to be connected\n");
5682  *      scanf("%4d", &max_client);
5683  *
5684  *      ret = wifi_direct_set_max_clients(max_client);
5685  *
5686  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
5687  *              printf("Failed to set max clients\n");
5688  *              return -1;
5689  *      }
5690  *
5691  *      printf("max client set success\n");
5692  *      return 0;
5693  * }
5694  *
5695  * int main()
5696  * {
5697  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
5698  *      wifi_direct_activate(); // Activate Wi-Fi Direct
5699  *
5700  *      function();
5701  *
5702  *      //       APP CODE HERE
5703  *
5704  *      // App must clean up Wi-Fi Direct before exiting
5705  *
5706  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
5707  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
5708  *      return 0;
5709  * }
5710  * @endcode
5711  */
5712 int wifi_direct_set_max_clients(int max);
5713
5714
5715 /**
5716  * @brief Gets the max number of clients.
5717  * @since_tizen 2.3
5718  * @privlevel public
5719  * @privilege %http://tizen.org/privilege/wifidirect
5720  * @param[out] max  The max number of clients
5721  * @return @c 0 on success,
5722  *         otherwise a negative error value
5723  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
5724  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
5725  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
5726  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
5727  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
5728  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
5729  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
5730  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
5731  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
5732  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
5733  * @see wifi_direct_initialize()
5734  * @see wifi_direct_set_max_clients()
5735  *
5736  *
5737  * Here is an example of the usage:
5738  * @code
5739  * #include <stdio.h>
5740  * #include <wifi_direct.h>
5741  *
5742  *
5743  * int function(void)
5744  * {
5745  *      int ret;
5746  *      int max_client;
5747  *
5748  *      ret = wifi_direct_get_max_clients(&max_client);
5749  *
5750  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
5751  *              printf("Failed to get max clients\n");
5752  *              return -1;
5753  *      }
5754  *
5755  *      printf("max client = %d\n", max_client);
5756  *      return 0;
5757  * }
5758  *
5759  * int main()
5760  * {
5761  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
5762  *      wifi_direct_activate(); // Activate Wi-Fi Direct
5763  *
5764  *      function();
5765  *
5766  *      //       APP CODE HERE
5767  *
5768  *      // App must clean up Wi-Fi Direct before exiting
5769  *
5770  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
5771  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
5772  *      return 0;
5773  * }
5774  * @endcode
5775  */
5776 int wifi_direct_get_max_clients(int *max);
5777
5778
5779 /**
5780  * @brief Sets or updates Wi-Fi Protected Access (WPA) password.
5781  *        When creating Wi-Fi Direct Group, this password will be used.
5782  * @since_tizen 2.4
5783  * @privlevel public
5784  * @privilege %http://tizen.org/privilege/wifidirect
5785  * @remarks A peer can connect to this group as Wi-Fi Infrastructured mode with a passphrase.
5786  * @param[in] passphrase new wpa password to set. Application must set the new password before.
5787  * @return @c 0 on success,
5788  *         otherwise a negative error value
5789  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
5790  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
5791  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
5792  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
5793  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
5794  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
5795  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
5796  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
5797  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
5798  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
5799  * @see wifi_direct_activate()
5800  * @see wifi_direct_get_passphrase()
5801  *
5802  *
5803  * Here is an example of the usage:
5804  * @code
5805  * #include <stdio.h>
5806  * #include <wifi_direct.h>
5807  *
5808  *
5809  * int function(void)
5810  * {
5811  *      int ret;
5812  *      char key[65] = {0, };
5813  *
5814  *      printf("Input the passphrase\n");
5815  *      read(stdin, key, 64);
5816  *
5817  *      ret = wifi_direct_set_passphrase(key);
5818  *
5819  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
5820  *              printf("Failed to set passphrase\n");
5821  *              return -1;
5822  *      }
5823  *
5824  *      printf("passphrase set success\n");
5825  *      return 0;
5826  * }
5827  *
5828  * int main()
5829  * {
5830  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
5831  *      wifi_direct_activate(); // Activate Wi-Fi Direct
5832  *
5833  *      function();
5834  *
5835  *      //       APP CODE HERE
5836  *
5837  *      // App must clean up Wi-Fi Direct before exiting
5838  *
5839  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
5840  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
5841  *      return 0;
5842  * }
5843  * @endcode
5844  */
5845 int wifi_direct_set_passphrase(const char *passphrase);
5846
5847
5848 /**
5849  * @brief Gets the Wi-Fi Protected Access (WPA) password when creating Wi-Fi Direct Group.
5850  * @since_tizen 2.4
5851  * @privlevel public
5852  * @privilege %http://tizen.org/privilege/wifidirect
5853  * @remarks @a passphrase must be released with free().
5854  * @param[out] passphrase  Pointer to store wpa password. Application must free this memory
5855  * @return @c 0 on success,
5856  *         otherwise a negative error value
5857  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
5858  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
5859  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
5860  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
5861  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
5862  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
5863  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
5864  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
5865  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
5866  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
5867  * @see wifi_direct_activate()
5868  * @see wifi_direct_set_passphrase()
5869  *
5870  *
5871  * Here is an example of the usage:
5872  * @code
5873  * #include <stdio.h>
5874  * #include <wifi_direct.h>
5875  *
5876  *
5877  * int function(void)
5878  * {
5879  *      int ret;
5880  *      char *key;
5881  *
5882  *      ret = wifi_direct_get_passphrase(&key);
5883  *
5884  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
5885  *              printf("Failed to get passphrase\n");
5886  *              return -1;
5887  *      }
5888  *
5889  *      printf("passphrase = %s\n", key);
5890  *      g_free(key);
5891  *      return 0;
5892  * }
5893  *
5894  * int main()
5895  * {
5896  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
5897  *      wifi_direct_activate(); // Activate Wi-Fi Direct
5898  *
5899  *      function();
5900  *
5901  *      //       APP CODE HERE
5902  *
5903  *      // App must clean up Wi-Fi Direct before exiting
5904  *
5905  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
5906  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
5907  *      return 0;
5908  * }
5909  * @endcode
5910  */
5911 int wifi_direct_get_passphrase(char **passphrase);
5912
5913
5914 /**
5915  * @brief Gets the operating channel.
5916  * @since_tizen 2.3
5917  * @privlevel public
5918  * @privilege %http://tizen.org/privilege/wifidirect
5919  * @param[out] channel  The operating channel
5920  * @return @c 0 on success,
5921  *         otherwise a negative error value
5922  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
5923  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
5924  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
5925  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
5926  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
5927  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
5928  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
5929  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
5930  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
5931  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
5932  * @see wifi_direct_initialize()
5933  *
5934  *
5935  * Here is an example of the usage:
5936  * @code
5937  * #include <stdio.h>
5938  * #include <wifi_direct.h>
5939  *
5940  *
5941  * int function(void)
5942  * {
5943  *      int ret;
5944  *      int channel;
5945  *
5946  *      ret = wifi_direct_get_operating_channel(&channel);
5947  *
5948  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
5949  *              printf("Failed to get operating channel\n");
5950  *              return -1;
5951  *      }
5952  *
5953  *      printf("operating channel = %d\n", channel);
5954  *      return 0;
5955  * }
5956  *
5957  * int main()
5958  * {
5959  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
5960  *      wifi_direct_activate(); // Activate Wi-Fi Direct
5961  *
5962  *      function();
5963  *
5964  *      //       APP CODE HERE
5965  *
5966  *      // App must clean up Wi-Fi Direct before exiting
5967  *
5968  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
5969  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
5970  *      return 0;
5971  * }
5972  * @endcode
5973  */
5974 int wifi_direct_get_operating_channel(int *channel);
5975
5976
5977 /**
5978  * @brief Sets the Autoconnection mode.
5979  * @since_tizen 2.3
5980  * @privlevel public
5981  * @privilege %http://tizen.org/privilege/wifidirect
5982  * @param[in] mode  Describes the mode of connection. In case of TRUE \n
5983  *                      auto-connection will be taken care by framework
5984  * @return @c 0 on success,
5985  *         otherwise a negative error value
5986  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
5987  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
5988  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
5989  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
5990  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
5991  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
5992  * @see wifi_direct_foreach_supported_wps_types()
5993  *
5994  *
5995  * Here is an example of the usage:
5996  * @code
5997  * #include <stdio.h>
5998  * #include <wifi_direct.h>
5999  *
6000  *
6001  * int function(void)
6002  * {
6003  *      int ret;
6004  *      int auto_connect;
6005  *
6006  *      printf("enable auto connect mode (yes[1] or no[2])\n");
6007  *      scanf("%1d", &auto_connect);
6008  *
6009  *      if (auto_connect)
6010  *              ret = wifi_direct_set_autoconnection_mode(true);
6011  *      else
6012  *              ret = wifi_direct_set_autoconnection_mode(false);
6013  *
6014  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
6015  *              printf("Failed to set autoconnection mode\n");
6016  *              return -1;
6017  *      }
6018  *
6019  *      printf("Auto connect mode enabled\n");
6020  *      return 0;
6021  * }
6022  *
6023  * int main()
6024  * {
6025  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
6026  *      wifi_direct_activate(); // Activate Wi-Fi Direct
6027  *
6028  *      function();
6029  *
6030  *      //       APP CODE HERE
6031  *
6032  *      // App must clean up Wi-Fi Direct before exiting
6033  *
6034  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
6035  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
6036  *      return 0;
6037  * }
6038  * @endcode
6039  */
6040 int wifi_direct_set_autoconnection_mode(bool mode);
6041
6042
6043 /**
6044  * @brief Gets the Autoconnection mode status.
6045  * @since_tizen 2.3
6046  * @privlevel public
6047  * @privilege %http://tizen.org/privilege/wifidirect
6048  * @param[out] mode  Describes the auto connection mode of framework has set.
6049  * @return @c 0 on success,
6050  *         otherwise a negative error value
6051  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
6052  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
6053  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
6054  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
6055  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
6056  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
6057  * @see wifi_direct_foreach_supported_wps_types()
6058  * @see wifi_direct_initialize()
6059  *
6060  *
6061  * Here is an example of the usage:
6062  * @code
6063  * #include <stdio.h>
6064  * #include <wifi_direct.h>
6065  *
6066  *
6067  * int function(void)
6068  * {
6069  *      int ret;
6070  *      bool status;
6071  *
6072  *      ret = wifi_direct_is_autoconnection_mode(&status);
6073  *
6074  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
6075  *              printf("Failed to get autoconnection mode\n");
6076  *              return -1;
6077  *      }
6078  *
6079  *      printf("auto connect mode = %s\n", (status)?"Yes":"No");
6080  *      return 0;
6081  * }
6082  *
6083  * int main()
6084  * {
6085  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
6086  *      wifi_direct_activate(); // Activate Wi-Fi Direct
6087  *
6088  *      function();
6089  *
6090  *      //       APP CODE HERE
6091  *
6092  *      // App must clean up Wi-Fi Direct before exiting
6093  *
6094  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
6095  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
6096  *      return 0;
6097  * }
6098  * @endcode
6099  */
6100 int wifi_direct_is_autoconnection_mode(bool *mode);
6101
6102
6103 /**
6104  * @brief Allows a device to connect automatically.
6105  * @since_tizen 2.4
6106  * @privlevel public
6107  * @privilege %http://tizen.org/privilege/wifidirect
6108  * @param[in] mac_address  Device MAC address to allow autoconnection
6109  * @return @c 0 on success,
6110  *         otherwise a negative error value
6111  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
6112  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
6113  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
6114  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
6115  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
6116  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
6117  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
6118  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
6119  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
6120  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
6121  * @see wifi_direct_activate()
6122  *
6123  *
6124  * Here is an example of the usage:
6125  * @code
6126  * #include <stdio.h>
6127  * #include <wifi_direct.h>
6128  *
6129  * bool peer_selected = false;
6130  * int connection_timeout = 0;
6131  * int count = 0; // counter to wait for connection
6132  *
6133  * int function(char *mac);
6134  *
6135  * void peers_cb(wifi_direct_discovered_peer_info_s* peer,
6136  *                                           void *user_data)
6137  * {
6138  *      char *mac;
6139  *
6140  *      if (peer && !peer_selected) {
6141  *              printf("peer device=%s MAC=%s\n", peer->device_name, peer->mac_address);
6142  *
6143  *              peer_selected = true;
6144  *
6145  *              function(peer->mac_address);
6146  *
6147  *              wifi_direct_connect(peer->mac_address); // Connect to the selected peer
6148  *      }
6149  * }
6150  *
6151  * int function(char *mac)
6152  * {
6153  *      int ret;
6154  *
6155  *      ret = wifi_direct_set_autoconnection_peer(mac); // set autoconnection
6156  *
6157  * if (ret != WIFI_DIRECT_ERROR_NONE) {
6158  *              printf("Failed to set autoconnection for peer\n");
6159  *              return -1;
6160  *      }
6161  *
6162  *      printf("set auto-connection success\n");
6163  *      return 0;
6164  * }
6165  *
6166  * void callback_2(int error_code,
6167  *                 wifi_direct_connection_state_e state,
6168  *                 const char *mac, void *user_data)
6169  *{
6170  *      switch (state) {
6171  *      case WIFI_DIRECT_CONNECTION_IN_PROGRESS:
6172  *              printf("Connection in progress\n");
6173  *      break;
6174  *
6175  *      case WIFI_DIRECT_CONNECTON_RSP:
6176  *              printf("Connected\n");
6177  *              g_source_remove(connection_timeout);
6178  * break;
6179  *
6180  *      case WIFI_DIRECT_DISCONNECTION_IND:
6181  *              printf("Disconnection IND\n");
6182  *      break;
6183  *
6184  *      case WIFI_DIRECT_DISCONNECTION_RSP;
6185  *              printf("Disconnected\n");
6186  *      break;
6187  * }
6188  *}
6189  *
6190  * void callback_1(int error_code,
6191  *               wifi_direct_discovery_state_e discovery_state,
6192  *               void *user_data)
6193  * {
6194  *      switch(discovery_state) {
6195  *      case WIFI_DIRECT_DISCOVERY_STARTED:
6196  *              printf("Discovery started\n");
6197  *              break;
6198  *
6199  *      case WIFI_DIRECT_ONLY_LISTEN_STARTED:
6200  *              printf("listen started\n");
6201  *              break;
6202  *
6203  *      case WIFI_DIRECT_DISCOVERY_FINISHED:
6204  *              printf("Discovery finished\n");
6205  *
6206  *      wifi_direct_foreach_discovered_peers(peers_cb,
6207  *                                        NULL); // Get discovered peer
6208  *              break;
6209  *
6210  *      case WIFI_DIRECT_DISCOVERY_FOUND:
6211  *              printf("peer devices found\n");
6212  *              break;
6213  *
6214  *      case WIFI_DIRECT_DISCOVERY_LOST:
6215  *              printf("Discovery lost\n");
6216  *              break;
6217  *
6218  *      default:
6219  *      break;
6220  *      }
6221  * }
6222  *
6223  * int main()
6224  * {
6225  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
6226  *      wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1
6227  *      wifi_direct_set_connection_state_changed_cb(callback_2, NULL); // Register callback 2
6228  *
6229  *      wifi_direct_activate(); // Activate Wi-Fi Direct
6230  *      wifi_direct_start_discovery(TRUE, 15); // Start discovery
6231  *
6232  *      // App must clean up Wi-Fi Direct before exiting
6233  *
6234  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
6235  *      wifi_direct_unset_connection_state_changed_cb(); // Deregister callback 2
6236  *      wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback 1
6237  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
6238  *      return 0;
6239  * }
6240  * @endcode
6241  */
6242 int wifi_direct_set_autoconnection_peer(char *mac_address);
6243
6244
6245 /**
6246  * @brief Enables the persistent group.
6247  * @details If @a enabled is true, then P2P persistent group will be used
6248  *          while creating a group and establishing a connection.
6249  * @since_tizen 2.3
6250  * @privlevel public
6251  * @privilege %http://tizen.org/privilege/wifidirect
6252  * @param[in] enabled  The status of persistent group: (@c true = enabled, @c false = disabled)
6253  * @return @c 0 on success,
6254  *         otherwise a negative error value
6255  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
6256  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
6257  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
6258  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
6259  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
6260  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
6261  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
6262  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
6263  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
6264  * @see wifi_direct_initialize()
6265  * @see wifi_direct_is_persistent_group_enabled()
6266  *
6267  *
6268  * Here is an example of the usage:
6269  * @code
6270  * #include <stdio.h>
6271  * #include <wifi_direct.h>
6272  *
6273  *
6274  * int function(void)
6275  * {
6276  *      int ret;
6277  *
6278  *      ret = wifi_direct_set_persistent_group_enabled(true);
6279  *
6280  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
6281  *              printf("Failed to set persistence group enabled\n");
6282  *              return -1;
6283  *      }
6284  *
6285  *      printf("persistence group enabled success\n");
6286  *      return 0;
6287  * }
6288  *
6289  * int main()
6290  * {
6291  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
6292  *      wifi_direct_activate(); // Activate Wi-Fi Direct
6293  *
6294  *      function();
6295  *
6296  *      //       APP CODE HERE
6297  *
6298  *      // App must clean up Wi-Fi Direct before exiting
6299  *
6300  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
6301  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
6302  *      return 0;
6303  * }
6304  * @endcode
6305  */
6306 int wifi_direct_set_persistent_group_enabled(bool enabled);
6307
6308
6309 /**
6310  * @brief Checks whether the persistent group is enabled or disabled.
6311  * @since_tizen 2.3
6312  * @privlevel public
6313  * @privilege %http://tizen.org/privilege/wifidirect
6314  * @param[out] enabled  The status of the persistent group: (@c true = enabled, @c false = disabled)
6315  * @return @c 0 on success,
6316  *         otherwise a negative error value
6317  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
6318  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
6319  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
6320  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
6321  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
6322  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
6323  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
6324  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
6325  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
6326  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
6327  * @see wifi_direct_initialize()
6328  * @see wifi_direct_set_persistent_group_enabled()
6329  *
6330  *
6331  * Here is an example of the usage:
6332  * @code
6333  * #include <stdio.h>
6334  * #include <wifi_direct.h>
6335  *
6336  *
6337  * int function(void)
6338  * {
6339  *      int ret;
6340  *      bool status;
6341  *
6342  *      ret = wifi_direct_is_persistent_group_enabled(&status);
6343  *
6344  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
6345  *              printf("Failed to get status of persistence group enabled\n");
6346  *              return -1;
6347  *      }
6348  *
6349  *      printf("persistence group status = %s\n", status?"Yes":"No");
6350  *      return 0;
6351  * }
6352  *
6353  * int main()
6354  * {
6355  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
6356  *      wifi_direct_activate(); // Activate Wi-Fi Direct
6357  *
6358  *      function();
6359  *
6360  *      //       APP CODE HERE
6361  *
6362  *      // App must clean up Wi-Fi Direct before exiting
6363  *
6364  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
6365  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
6366  *      return 0;
6367  * }
6368  * @endcode
6369  */
6370 int wifi_direct_is_persistent_group_enabled(bool *enabled);
6371
6372
6373 /**
6374  * @brief Called when you get the persistent groups repeatedly.
6375  * @since_tizen 2.3
6376  * @remarks The @a mac_address can be used only in the callback. To use outside, make a copy.
6377  *          The @a ssid can be used only in the callback. To use outside, make a copy.
6378  * @param[in] mac_address  The MAC address of the persistent group owner
6379  * @param[in] ssid         The SSID (Service Set Identifier) of the persistent group owner
6380  * @param[in] user_data    The user data passed from the request function
6381  * @return @c true to continue with the next iteration of the loop, \n
6382  *         @c false to break out of the loop
6383  * @pre wifi_direct_foreach_persistent_groups() will invoke this callback.
6384  * @see wifi_direct_foreach_persistent_groups()
6385  */
6386 typedef bool(*wifi_direct_persistent_group_cb)(const char *mac_address, const char *ssid, void *user_data);
6387
6388
6389 /**
6390  * @brief Gets the persistent groups.
6391  * @since_tizen 2.3
6392  * @privlevel public
6393  * @privilege %http://tizen.org/privilege/wifidirect
6394  * @param[in] callback   The callback function to invoke
6395  * @param[in] user_data  The user data to be passed to the callback function
6396  * @return @c 0 on success,
6397  *         otherwise a negative error value
6398  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
6399  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
6400  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
6401  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
6402  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
6403  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
6404  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
6405  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
6406  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
6407  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
6408  * @post wifi_direct_persistent_group_cb() will be called.
6409  * @see wifi_direct_initialize()
6410  * @see wifi_direct_persistent_group_cb()
6411  *
6412  *
6413  * Here is an example of the usage:
6414  * @code
6415  * #include <stdio.h>
6416  * #include <wifi_direct.h>
6417  *
6418  *
6419  * bool callback(const char *mac_address,
6420  *               const char *ssid,
6421  *               void *user_data)
6422  * {
6423  *      if (mac_address)
6424  *              printf("mac = %s\n", mac_address);
6425  *
6426  *      if (ssid)
6427  *              printf("ssid = %s\n", ssid);
6428  *
6429  *      return true;
6430  * }
6431  *
6432  * int function(void)
6433  * {
6434  *      int ret;
6435  *
6436  *      ret = wifi_direct_foreach_persistent_groups(callback, NULL);
6437  *
6438  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
6439  *              printf("Failed to set callback to get persistent groups\n");
6440  *              return -1;
6441  *      }
6442  *
6443  *      return 0;
6444  * }
6445  *
6446  * int main()
6447  * {
6448  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
6449  *      wifi_direct_activate(); // Activate Wi-Fi Direct
6450  *
6451  *      function();
6452  *
6453  *      //       APP CODE HERE
6454  *
6455  *      // App must clean up Wi-Fi Direct before exiting
6456  *
6457  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
6458  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
6459  *      return 0;
6460  * }
6461  * @endcode
6462  */
6463 int wifi_direct_foreach_persistent_groups(wifi_direct_persistent_group_cb callback, void *user_data);
6464
6465
6466 /**
6467  * @brief Removes a persistent group.
6468  * @since_tizen 2.3
6469  * @privlevel public
6470  * @privilege %http://tizen.org/privilege/wifidirect
6471  * @param[in] mac_address  The MAC address of the persistent group owner
6472  * @param[in] ssid         The SSID (Service Set Identifier) of the persistent group owner
6473  * @return @c 0 on success,
6474  *         otherwise a negative error value
6475  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
6476  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
6477  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
6478  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
6479  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
6480  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
6481  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
6482  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
6483  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
6484  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
6485  * @see wifi_direct_initialize()
6486  * @see wifi_direct_foreach_persistent_groups()
6487  *
6488  *
6489  * Here is an example of the usage:
6490  * @code
6491  * #include <stdio.h>
6492  * #include <wifi_direct.h>
6493  *
6494  *
6495  * int function(void)
6496  * {
6497  *      int ret;
6498  *      char *mac = NULL;
6499  *      char *ssid = NULL;
6500  *
6501  *      printf("Input MAC\n");
6502  *      scanf("%18ms", &mac);
6503  *
6504  *      printf("Input SSID\n");
6505  *      scanf("%33ms", &ssid);
6506  *
6507  *      ret = wifi_direct_remove_persistent_group(mac, ssid);
6508  *
6509  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
6510  *              printf("Failed to remove persistent group\n");
6511  *              return -1;
6512  *      }
6513  *
6514  *      printf("persistent group with MAC (%s) is removed\n", mac);
6515  *      free(mac);
6516  *      free(ssid);
6517  *      return 0;
6518  * }
6519  *
6520  * int main()
6521  * {
6522  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
6523  *      wifi_direct_activate(); // Activate Wi-Fi Direct
6524  *
6525  *      function();
6526  *
6527  *      //       APP CODE HERE
6528  *
6529  *      // App must clean up Wi-Fi Direct before exiting
6530  *
6531  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
6532  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
6533  *      return 0;
6534  * }
6535  * @endcode
6536  */
6537 int wifi_direct_remove_persistent_group(char *mac_address, const char *ssid);
6538
6539
6540 /**
6541  * @brief Starts wifi direct service discovery.
6542  * @since_tizen 2.3
6543  * @privlevel public
6544  * @privilege %http://tizen.org/privilege/wifidirect
6545  * @param[in] mac_address   The MAC address of servicing device. A broadcast \n
6546  *                               will be sent when MAC is SET to ZERO
6547  * @param[in] service_type  Describes the type of service
6548  * @return @c 0 on success,
6549  *         otherwise a negative error value
6550  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
6551  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
6552  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
6553  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
6554  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
6555  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
6556  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
6557  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
6558  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
6559  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
6560  * @post wifi_direct_set_service_state_changed_cb() will be invoked.
6561  * @see wifi_direct_activate()
6562  * @see wifi_direct_set_service_state_changed_cb()
6563  *
6564  *
6565  * Here is an example of the usage:
6566  * @code
6567  * #include <stdio.h>
6568  * #include <wifi_direct.h>
6569  *
6570  * void callback(int error_code,
6571  *       wifi_direct_service_discovery_state_e discovery_state,
6572  *       wifi_direct_service_type_e service_type,
6573  *       void *response_data, const char * mac_address,
6574  *       void *user_data)
6575  * {
6576  *      switch (discovery_state) {
6577  *      case WIFI_DIRECT_SERVICE_DISCOVERY_STARTED:
6578  *              printf("Service discovery started\n");
6579  *      break;
6580  *
6581  *      case WIFI_DIRECT_SERVICE_DISCOVERY_FINISHED:
6582  *              printf("Service discovery finished\n");
6583  *      break;
6584  *
6585  *      case WIFI_DIRECT_SERVICE_DISCOVERY_FOUND:
6586  *              printf("Service discovery found\n");
6587  *      break;
6588  *      }
6589  * }
6590  *
6591  * int function(void)
6592  * {
6593  *      int ret;
6594  *      int option;
6595  *      wifi_direct_service_type_e type = WIFI_DIRECT_SERVICE_TYPE_ALL;
6596  *
6597  *      printf("Input service type\n");
6598  *      scanf("%1d", &option);
6599  *
6600  *      printf("1.  WIFI_DIRECT_SERVICE_TYPE_ALL\n");
6601  *      printf("2.  WIFI_DIRECT_SERVICE_TYPE_BONJOUR\n");
6602  *      printf("3.  WIFI_DIRECT_SERVICE_TYPE_UPNP\n");
6603  *      printf("4.  WIFI_DIRECT_SERVICE_TYPE_BT_ADDR\n");
6604  *      printf("5.  WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO\n");
6605  *
6606  *      switch (option) {
6607  *      case 1:
6608  *              type = WIFI_DIRECT_SERVICE_TYPE_ALL;
6609  *      break;
6610  *
6611  *      case 2:
6612  *              type = WIFI_DIRECT_SERVICE_TYPE_BONJOUR;
6613  *      break;
6614  *
6615  *      case 3:
6616  *              type = WIFI_DIRECT_SERVICE_TYPE_UPNP;
6617  *      break;
6618  *
6619  *      case 4:
6620  *              type = WIFI_DIRECT_SERVICE_TYPE_BT_ADDR;
6621  *      break;
6622  *
6623  *      case 5:
6624  *              type = WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO;
6625  *      break;
6626  *      }
6627  *
6628  *      ret = wifi_direct_start_service_discovery(NULL, type); // start broadcast service discovery
6629  *
6630  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
6631  *              printf("Failed to start service discovery\n");
6632  *              return -1;
6633  *      }
6634  *
6635  *      return 0;
6636  * }
6637  *
6638  * int main()
6639  * {
6640  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
6641  *      wifi_direct_set_service_state_changed_cb(callback, NULL);
6642  *      wifi_direct_activate(); // Activate Wi-Fi Direct
6643  *
6644  *      function();
6645  *
6646  *      //       APP CODE HERE
6647  *
6648  *      // App must clean up Wi-Fi Direct before exiting
6649  *
6650  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
6651  *      wifi_direct_unset_service_state_changed_cb();
6652  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
6653  *      return 0;
6654  * }
6655  * @endcode
6656  */
6657 int wifi_direct_start_service_discovery(char *mac_address, wifi_direct_service_type_e service_type);
6658
6659
6660 /**
6661  * @brief Cancels an ongoing wifi direct service discovery.
6662  * @since_tizen 2.3
6663  * @privlevel public
6664  * @privilege %http://tizen.org/privilege/wifidirect
6665  * @param[in] mac_address  The MAC address of servicing device. A broadcast \n
6666  *                             will be sent when MAC is SET to ZERO
6667  * @param[in] service_type Describes the type of service
6668  * @return @c 0 on success,
6669  *         otherwise a negative error value
6670  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
6671  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
6672  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
6673  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
6674  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
6675  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
6676  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
6677  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
6678  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
6679  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
6680  * @see wifi_direct_activate()
6681  *
6682  *
6683  * Here is an example of the usage:
6684  * @code
6685  * #include <stdio.h>
6686  * #include <wifi_direct.h>
6687  *
6688  * void callback(int error_code,
6689  *       wifi_direct_service_discovery_state_e discovery_state,
6690  *       wifi_direct_service_type_e service_type,
6691  *       void *response_data, const char * mac_address,
6692  *       void *user_data)
6693  * {
6694  *      switch (discovery_state) {
6695  *      case WIFI_DIRECT_SERVICE_DISCOVERY_STARTED:
6696  *              printf("Service discovery started\n");
6697  *      break;
6698  *
6699  *      case WIFI_DIRECT_SERVICE_DISCOVERY_FINISHED:
6700  *              printf("Service discovery finished\n");
6701  *      break;
6702  *
6703  *      case WIFI_DIRECT_SERVICE_DISCOVERY_FOUND:
6704  *              printf("Service discovery found\n");
6705  *      break;
6706  *      }
6707  * }
6708  *
6709  * int function(void)
6710  * {
6711  *      int ret;
6712  *
6713  *      ret = wifi_direct_cancel_service_discovery(NULL,
6714  *                             WIFI_DIRECT_SERVICE_TYPE_ALL); // cancel the ongoing service discovery
6715  *
6716  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
6717  *              printf("Failed to cancel service discovery\n");
6718  *              return -1;
6719  *      }
6720  *
6721  *      return 0;
6722  * }
6723  *
6724  * int main()
6725  * {
6726  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
6727  *      wifi_direct_set_service_state_changed_cb(callback, NULL);
6728  *      wifi_direct_activate(); // Activate Wi-Fi Direct
6729  *
6730  *      wifi_direct_start_service_discovery(NULL,
6731  *                       WIFI_DIRECT_SERVICE_TYPE_ALL); // start broadcast service discovery
6732  *
6733  *      function();
6734  *
6735  *      //       APP CODE HERE
6736  *
6737  *      // App must clean up Wi-Fi Direct before exiting
6738  *
6739  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
6740  *      wifi_direct_unset_service_state_changed_cb();
6741  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
6742  *      return 0;
6743  * }
6744  * @endcode
6745  */
6746 int wifi_direct_cancel_service_discovery(char *mac_address, wifi_direct_service_type_e service_type);
6747
6748
6749 /**
6750  * @brief Registers for a service using Wi-Fi Direct Service Discovery.
6751  * @since_tizen 2.3
6752  * @privlevel public
6753  * @privilege %http://tizen.org/privilege/wifidirect
6754  * @param[in] service_type  Describes the type of service.
6755  * @param[in] info1         Describes the information of service. It is service-specific
6756  * @param[in] info2         Describes the information of service. It is service-specific
6757  * @param[out] service_id   A Service ID will be assigned to service getting registered
6758  * @return @c 0 on success,
6759  *         otherwise a negative error value
6760  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
6761  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
6762  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
6763  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
6764  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
6765  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
6766  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
6767  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
6768  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
6769  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
6770  * @see wifi_direct_activate()
6771  *
6772  *
6773  * Here is an example of the usage:
6774  * @code
6775  * #include <stdio.h>
6776  * #include <wifi_direct.h>
6777  *
6778  * void callback(int error_code,
6779  *       wifi_direct_service_discovery_state_e discovery_state,
6780  *       wifi_direct_service_type_e service_type,
6781  *       void *response_data, const char * mac_address,
6782  *       void *user_data)
6783  * {
6784  *      switch (discovery_state) {
6785  *      case WIFI_DIRECT_SERVICE_DISCOVERY_STARTED:
6786  *              printf("Service discovery started\n");
6787  *      break;
6788  *
6789  *      case WIFI_DIRECT_SERVICE_DISCOVERY_FINISHED:
6790  *              printf("Service discovery finished\n");
6791  *      break;
6792  *
6793  *      case WIFI_DIRECT_SERVICE_DISCOVERY_FOUND:
6794  *              printf("Service discovery found\n");
6795  *      break;
6796  *      }
6797  * }
6798  *
6799  * int function(void)
6800  * {
6801  *      int ret;
6802  *      int option;
6803  *      char *info1;
6804  *      char *info2;
6805  *      wifi_direct_service_type_e type = WIFI_DIRECT_SERVICE_TYPE_ALL;
6806  *
6807  *      printf("Input service type\n");
6808  *      scanf("%1d", &option);
6809  *
6810  *      printf("1.  WIFI_DIRECT_SERVICE_TYPE_ALL\n");
6811  *      printf("2.  WIFI_DIRECT_SERVICE_TYPE_BONJOUR\n");
6812  *      printf("3.  WIFI_DIRECT_SERVICE_TYPE_UPNP\n");
6813  *      printf("4.  WIFI_DIRECT_SERVICE_TYPE_BT_ADDR\n");
6814  *      printf("5.  WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO\n");
6815  *
6816  *      switch (option) {
6817  *      case 1:
6818  *              type = WIFI_DIRECT_SERVICE_TYPE_ALL;
6819  *      break;
6820  *
6821  *      case 2:
6822  *              type = WIFI_DIRECT_SERVICE_TYPE_BONJOUR;
6823  *
6824  *              printf("Enter the info 1\n");
6825  *              scanf("%50ms", &info1);
6826  *
6827  *              printf("Enter the info 2\n");
6828  *              scanf("%50ms", &info2);
6829  *      break;
6830  *
6831  *      case 3:
6832  *              type = WIFI_DIRECT_SERVICE_TYPE_UPNP;
6833  *
6834  *              printf("Enter the info 1\n");
6835  *              scanf("%50ms", &info1);
6836  *
6837  *              printf("Enter the info 2\n");
6838  *              scanf("%50ms", &info2);
6839  *      break;
6840  *
6841  *      case 4:
6842  *              type = WIFI_DIRECT_SERVICE_TYPE_BT_ADDR;
6843  *      break;
6844  *
6845  *      case 5:
6846  *              type = WIFI_DIRECT_SERVICE_TYPE_CONTACT_INFO;
6847  *
6848  *              printf("Enter the info 1\n");
6849  *              scanf("%50ms", &info1);
6850  *      break;
6851  *      }
6852  *
6853  * ret = wifi_direct_register_service(type, info1, info2, &option);
6854  *
6855  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
6856  *              printf("Failed to start service discovery\n");
6857  *              return -1;
6858  *      }
6859  *
6860  *      wifi_direct_start_service_discovery(NULL, type);
6861  *
6862  *      free(info1);
6863  *      free(info2);
6864  *      return 0;
6865  * }
6866  *
6867  * int main()
6868  * {
6869  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
6870  *      wifi_direct_set_service_state_changed_cb(callback, NULL);
6871  *      wifi_direct_activate(); // Activate Wi-Fi Direct
6872  *
6873  *      function();
6874  *
6875  *      //       APP CODE HERE
6876  *
6877  *      // App must clean up Wi-Fi Direct before exiting
6878  *
6879  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
6880  *      wifi_direct_unset_service_state_changed_cb();
6881  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
6882  *      return 0;
6883  * }
6884  * @endcode
6885  */
6886 int wifi_direct_register_service(wifi_direct_service_type_e service_type, char *info1, char *info2, unsigned int *service_id);
6887
6888
6889 /**
6890  * @brief Deregisters for a service used for Wi-Fi Direct Service Discovery.
6891  * @since_tizen 2.3
6892  * @privlevel public
6893  * @privilege %http://tizen.org/privilege/wifidirect
6894  * @param[in] service_id  A Service ID for which service has to be deregistered
6895  * @return @c 0 on success,
6896  *         otherwise a negative error value
6897  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
6898  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
6899  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
6900  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
6901  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
6902  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
6903  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
6904  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
6905  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
6906  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
6907  * @see wifi_direct_activate()
6908  *
6909  *
6910  * Here is an example of the usage:
6911  * @code
6912  * #include <stdio.h>
6913  * #include <wifi_direct.h>
6914  *
6915  *
6916  * int function(void)
6917  * {
6918  *      int ret;
6919  *      int input;
6920  *
6921  *      printf("Enter the service id\n");
6922  *      scanf("%5d", &input);
6923  *
6924  *      ret = wifi_direct_deregister_service(input);
6925  *
6926  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
6927  *              printf("Failed to deregister service\n");
6928  *              return -1;
6929  *      }
6930  *
6931  *      return 0;
6932  * }
6933  *
6934  * int main()
6935  * {
6936  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
6937  *      wifi_direct_activate(); // Activate Wi-Fi Direct
6938  *
6939  *      function();
6940  *
6941  *      //       APP CODE HERE
6942  *
6943  *      // App must clean up Wi-Fi Direct before exiting
6944  *
6945  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
6946  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
6947  *      return 0;
6948  * }
6949  * @endcode
6950  */
6951 int wifi_direct_deregister_service(unsigned int service_id);
6952
6953
6954 /**
6955  * @brief Initializes OR Deintializes the WiFi Direct Display (MIRACAST) service.
6956  * @since_tizen 2.3
6957  * @privlevel public
6958  * @privilege %http://tizen.org/privilege/wifidirect
6959  * @param[in] enable  Enables/Disables Service based on the value TRUE/FALSE
6960  * @return @c 0 on success,
6961  *         otherwise a negative error value
6962  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
6963  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
6964  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
6965  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
6966  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
6967  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
6968  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
6969  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
6970  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
6971  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
6972  * @see wifi_direct_activate()
6973  *
6974  *
6975  * Here is an example of the usage:
6976  * @code
6977  * #include <stdio.h>
6978  * #include <wifi_direct.h>
6979  *
6980  *
6981  * int function(void)
6982  * {
6983  *      int ret;
6984  *
6985  *      ret = wifi_direct_init_miracast(true);
6986  *
6987  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
6988  *              printf("Failed to init miracast\n");
6989  *              return -1;
6990  *      }
6991  *
6992  *      printf("init miracast success\n");
6993  *      return 0;
6994  * }
6995  *
6996  * int main()
6997  * {
6998  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
6999  *      wifi_direct_activate(); // Activate Wi-Fi Direct
7000  *
7001  *      function();
7002  *
7003  *      //       APP CODE HERE
7004  *
7005  *      // App must clean up Wi-Fi Direct before exiting
7006  *
7007  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
7008  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
7009  *      return 0;
7010  * }
7011  * @endcode
7012  */
7013 int wifi_direct_init_miracast(bool enable);
7014
7015
7016 /**
7017  * @brief Gets the information of a discovered peer.
7018  * @since_tizen 2.3
7019  * @privlevel public
7020  * @privilege %http://tizen.org/privilege/wifidirect
7021  * @param[in] mac_address  The MAC address of peer to get
7022  * @param[out] peer_info   The peer information to be passed
7023  * @return @c 0 on success,
7024  *         otherwise a negative error value
7025  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
7026  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
7027  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
7028  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
7029  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
7030  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
7031  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
7032  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
7033  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
7034  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
7035  * @see wifi_direct_activate()
7036  * @see wifi_direct_foreach_discovered_peers()
7037  *
7038  *
7039  * Here is an example of the usage:
7040  * @code
7041  * #include <stdio.h>
7042  * #include <wifi_direct.h>
7043  *
7044  *
7045  * int function(void)
7046  * {
7047  *      int ret;
7048  *      char mac[19] = {0, };
7049  *      wifi_direct_discovered_peer_info_s *peer_info;
7050  *
7051  *      printf("Input peer MAC address\n");
7052  *      read(stdin, mac, 18);
7053  *
7054  *      ret = wifi_direct_get_peer_info(mac, &peer_info);
7055  *
7056  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
7057  *              printf("Failed to get peer info\n");
7058  *              return -1;
7059  *      }
7060  *
7061  *      printf("get peer info success\n");
7062  *      return 0;
7063  * }
7064  *
7065  * int main()
7066  * {
7067  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
7068  *      wifi_direct_activate(); // Activate Wi-Fi Direct
7069  *
7070  *      function();
7071  *
7072  *      //       APP CODE HERE
7073  *
7074  *      // App must clean up Wi-Fi Direct before exiting
7075  *
7076  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
7077  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
7078  *      return 0;
7079  * }
7080  * @endcode
7081  */
7082 int wifi_direct_get_peer_info(char *mac_address, wifi_direct_discovered_peer_info_s **peer_info);
7083
7084
7085 /**
7086  * @brief Enables Wi-Fi Display (WFD) functionality and initialize the various variables required for WFD.
7087  * @details Starts listening in only assigned channel. Device will be discoverable
7088  *          only in assigned listen channel.
7089  * @since_tizen 2.4
7090  * @privlevel public
7091  * @privilege %http://tizen.org/privilege/wifidirect
7092  * @return @c 0 on success,
7093  *         otherwise a negative error value
7094  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
7095  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
7096  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
7097  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
7098  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
7099  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
7100  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
7101  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
7102  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate()
7103  * @see wifi_direct_activate()
7104  * @see wifi_direct_deinit_display()
7105  * @see wifi_direct_set_display()
7106  *
7107  *
7108  * Here is an example of the usage:
7109  * @code
7110  * #include <stdio.h>
7111  * #include <wifi_direct.h>
7112  *
7113  *
7114  * int function(void)
7115  * {
7116  *      int ret;
7117  *
7118  *      ret = wifi_direct_init_display();
7119  *
7120  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
7121  *              printf("Failed to init display\n");
7122  *              return -1;
7123  *      }
7124  *
7125  *      printf("init display success\n");
7126  *      return 0;
7127  * }
7128  *
7129  * int main()
7130  * {
7131  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
7132  *      wifi_direct_activate(); // Activate Wi-Fi Direct
7133  *
7134  *      function();
7135  *
7136  *      //       APP CODE HERE
7137  *
7138  *      // App must clean up Wi-Fi Direct before exiting
7139  *
7140  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
7141  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
7142  *      return 0;
7143  * }
7144  * @endcode
7145  */
7146 int wifi_direct_init_display(void);
7147
7148
7149 /**
7150  * @brief Disables Wi-Fi Display functionality & disables the support of WFD Information Element (IE).
7151  * @since_tizen 2.4
7152  * @privlevel public
7153  * @privilege %http://tizen.org/privilege/wifidirect
7154  * @return @c 0 on success,
7155  *         otherwise a negative error value
7156  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
7157  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
7158  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
7159  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
7160  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
7161  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
7162  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
7163  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
7164  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate()
7165  *      and Wi-Fi Display must be enabled by wifi_direct_init_display().
7166  * @see wifi_direct_activate()
7167  * @see wifi_direct_init_display()
7168  * @see wifi_direct_set_display()
7169  *
7170  *
7171  * Here is an example of the usage:
7172  * @code
7173  * #include <stdio.h>
7174  * #include <wifi_direct.h>
7175  *
7176  *
7177  * int function(void)
7178  * {
7179  *      int ret;
7180  *
7181  *      wifi_direct_init_display();
7182  *
7183  *      ret = wifi_direct_deinit_display();
7184  *
7185  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
7186  *              printf("Failed to deinit display\n");
7187  *              return -1;
7188  *      }
7189  *
7190  *      printf("deinit display success\n");
7191  *      return 0;
7192  * }
7193  *
7194  * int main()
7195  * {
7196  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
7197  *      wifi_direct_activate(); // Activate Wi-Fi Direct
7198  *
7199  *      function();
7200  *
7201  *      //       APP CODE HERE
7202  *
7203  *      // App must clean up Wi-Fi Direct before exiting
7204  *
7205  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
7206  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
7207  *      return 0;
7208  * }
7209  * @endcode
7210  */
7211 int wifi_direct_deinit_display(void);
7212
7213
7214 /**
7215  * @brief Sets the Wi-Fi Display parameters for the WFD IE of local device.
7216  * @since_tizen 2.4
7217  * @privlevel public
7218  * @privilege %http://tizen.org/privilege/wifidirect
7219  * @param[in] type  WFD Device Type: define the Role of WFD device like source or sink
7220  * @param[in] port  Specifies Session Management Control Port number. It should be 2 bytes (0~65535)
7221  * @param[in] hdcp  CP support bit: (@c 1 = enable the hdcp support, @c 0 = disable the hdcp support)
7222  * @return @c 0 on success,
7223  *         otherwise a negative error value
7224  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
7225  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
7226  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
7227  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
7228  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
7229  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
7230  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
7231  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
7232  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
7233  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate()
7234  *      and Wi-Fi Display must be enabled by wifi_direct_init_display().
7235  * @see wifi_direct_activate()
7236  * @see wifi_direct_init_display()
7237  * @see wifi_direct_deinit_display()
7238  *
7239  *
7240  * Here is an example of the usage:
7241  * @code
7242  * #include <stdio.h>
7243  * #include <wifi_direct.h>
7244  *
7245  *
7246  * int function(void)
7247  * {
7248  *      int ret;
7249  *
7250  *      ret = wifi_direct_set_display(WIFI_DIRECT_DISPLAY_SOURCE, 7236, 1);
7251  *
7252  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
7253  *              printf("Failed to set display property\n");
7254  *              return -1;
7255  *      }
7256  *
7257  *      printf("set display param success\n");
7258  *      return 0;
7259  * }
7260  *
7261  * int main()
7262  * {
7263  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
7264  *      wifi_direct_activate(); // Activate Wi-Fi Direct
7265  *
7266  *      function();
7267  *
7268  *      //       APP CODE HERE
7269  *
7270  *      // App must clean up Wi-Fi Direct before exiting
7271  *
7272  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
7273  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
7274  *      return 0;
7275  * }
7276  * @endcode
7277  */
7278 int wifi_direct_set_display(wifi_direct_display_type_e type, int port, int hdcp);
7279
7280
7281 /**
7282  * @brief Sets the Wi-Fi Display Session Availability.
7283  * @since_tizen 2.4
7284  * @privlevel public
7285  * @privilege %http://tizen.org/privilege/wifidirect
7286  * @param[in] availability  Wi-Fi Display Session Availability
7287  * @return @c 0 on success,
7288  *         otherwise a negative error value
7289  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
7290  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
7291  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
7292  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
7293  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
7294  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
7295  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
7296  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
7297  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
7298  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate()
7299  *      and enable Wi-Fi Display by wifi_direct_init_display().
7300  * @see wifi_direct_activate()
7301  * @see wifi_direct_init_display()
7302  * @see wifi_direct_deinit_display()
7303  *
7304  *
7305  * Here is an example of the usage:
7306  * @code
7307  * #include <stdio.h>
7308  * #include <wifi_direct.h>
7309  *
7310  *
7311  * int function(void)
7312  * {
7313  *      int ret;
7314  *      int availability;
7315  *
7316  *      printf("Input the Wi-FI Display availability\n");
7317  *      scanf("%1d", &availability);
7318  *
7319  *      ret = wifi_direct_set_display_availability(availability);
7320  *
7321  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
7322  *              printf("Failed to set display availability\n");
7323  *              return -1;
7324  *      }
7325  *
7326  *      printf("set display availability success\n");
7327  *      return 0;
7328  * }
7329  *
7330  * int main()
7331  * {
7332  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
7333  *      wifi_direct_activate(); // Activate Wi-Fi Direct
7334  *
7335  *      function();
7336  *
7337  *      //       APP CODE HERE
7338  *
7339  *      // App must clean up Wi-Fi Direct before exiting
7340  *
7341  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
7342  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
7343  *      return 0;
7344  * }
7345  * @endcode
7346  */
7347 int wifi_direct_set_display_availability(bool availability);
7348
7349
7350 /**
7351  * @brief Gets the Wi-Fi Display parameters for the WFD IE of local device.
7352  * @since_tizen 5.0
7353  * @privlevel public
7354  * @privilege %http://tizen.org/privilege/wifidirect
7355  * @param[out] type  WFD device type: role of WFD device like source or sink
7356  * @param[out] port  Session management control port number, it will be of 2 bytes (0~65535)
7357  * @param[out] hdcp  CP support bit: (@c 1 = hdcp support is enabled, @c 0 = hdcp support is disabled)
7358  * @return @c 0 on success,
7359  *         otherwise a negative error value
7360  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
7361  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
7362  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
7363  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
7364  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
7365  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
7366  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
7367  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
7368  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
7369  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate()
7370  *      and enable Wi-Fi Display by wifi_direct_init_display().
7371  * @see wifi_direct_activate()
7372  * @see wifi_direct_init_display()
7373  * @see wifi_direct_deinit_display()
7374  *
7375  *
7376  * Here is an example of the usage:
7377  * @code
7378  * #include <stdio.h>
7379  * #include <wifi_direct.h>
7380  *
7381  *
7382  * int function(void)
7383  * {
7384  *      int ret;
7385  *      wifi_direct_display_type_e type;
7386  *      int port;
7387  *      int hdcp;
7388  *
7389  *      ret = wifi_direct_get_display(&type, &port, &hdcp);
7390  *
7391  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
7392  *              printf("Failed to get display property\n");
7393  *              return -1;
7394  *      }
7395  *
7396  *      printf("get display param success [type:%d], [port:%d], [hdcp:%d]\n", type, port, hdcp);
7397  *      return 0;
7398  * }
7399  *
7400  * int main()
7401  * {
7402  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
7403  *      wifi_direct_activate(); // Activate Wi-Fi Direct
7404  *
7405  *      function();
7406  *
7407  *      //       APP CODE HERE
7408  *
7409  *      // App must clean up Wi-Fi Direct before exiting
7410  *
7411  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
7412  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
7413  *      return 0;
7414  * }
7415  * @endcode
7416  */
7417 int wifi_direct_get_display(wifi_direct_display_type_e *type, int *port, int *hdcp);
7418
7419
7420 /**
7421  * @brief Gets the Wi-Fi Display Session Availability.
7422  * @since_tizen 5.0
7423  * @privlevel public
7424  * @privilege %http://tizen.org/privilege/wifidirect
7425  * @param[out] availability  Wi-Fi display session availability
7426  * @return @c 0 on success,
7427  *         otherwise a negative error value
7428  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
7429  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
7430  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
7431  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
7432  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
7433  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
7434  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
7435  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
7436  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
7437  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate()
7438  *      and enable Wi-Fi Display by wifi_direct_init_display().
7439  * @see wifi_direct_activate()
7440  * @see wifi_direct_init_display()
7441  * @see wifi_direct_deinit_display()
7442  *
7443  *
7444  * Here is an example of the usage:
7445  * @code
7446  * #include <stdio.h>
7447  * #include <wifi_direct.h>
7448  *
7449  *
7450  * int function(void)
7451  * {
7452  *      int ret;
7453  *      int availability;
7454  *
7455  *      ret = wifi_direct_get_display_availability(&availability);
7456  *
7457  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
7458  *              printf("Failed to get display availability\n");
7459  *              return -1;
7460  *      }
7461  *
7462  *      printf("get display availability success [%d]\n", availability);
7463  *      return 0;
7464  * }
7465  *
7466  * int main()
7467  * {
7468  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
7469  *      wifi_direct_activate(); // Activate Wi-Fi Direct
7470  *
7471  *      function();
7472  *
7473  *      //       APP CODE HERE
7474  *
7475  *      // App must clean up Wi-Fi Direct before exiting
7476  *
7477  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
7478  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
7479  *      return 0;
7480  * }
7481  * @endcode
7482  */
7483 int wifi_direct_get_display_availability(bool *availability);
7484
7485
7486 /**
7487  * @brief Gets the information of a peer's Wi-Fi Display device type.
7488  * @since_tizen 2.4
7489  * @privlevel public
7490  * @privilege %http://tizen.org/privilege/wifidirect
7491  * @param[in] mac_address MAC Address of the PEER
7492  * @param[out] type  The information of a peer's Wi-Fi Display device type
7493  *                   if there's Wi-Fi Direct information, this will be NULL
7494  * @return @c 0 on success,
7495  *         otherwise a negative error value
7496  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
7497  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
7498  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
7499  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
7500  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
7501  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
7502  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
7503  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
7504  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
7505  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
7506  * @see wifi_direct_activate()
7507  * @see wifi_direct_foreach_discovered_peers()
7508  *
7509  *
7510  * Here is an example of the usage:
7511  * @code
7512  * #include <stdio.h>
7513  * #include <wifi_direct.h>
7514  *
7515  *
7516  * int function(void)
7517  * {
7518  *      int ret;
7519  *      char *mac = NULL;
7520  *      wifi_direct_display_type_e type;
7521  *
7522  *      printf("Input the peer mac\n");
7523  *      scanf("%18ms", &mac);
7524  *
7525  *      ret = wifi_direct_get_peer_display_type(mac, &type);
7526  *
7527  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
7528  *              printf("Failed to get peer display type\n");
7529  *              return -1;
7530  *      }
7531  *
7532  *      printf("peer display type = %d\n", type);
7533  *      free(mac);
7534  *      return 0;
7535  * }
7536  *
7537  * int main()
7538  * {
7539  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
7540  *      wifi_direct_activate(); // Activate Wi-Fi Direct
7541  *
7542  *      function();
7543  *
7544  *      //       APP CODE HERE
7545  *
7546  *      // App must clean up Wi-Fi Direct before exiting
7547  *
7548  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
7549  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
7550  *      return 0;
7551  * }
7552  * @endcode
7553  */
7554 int wifi_direct_get_peer_display_type(char *mac_address, wifi_direct_display_type_e *type);
7555
7556
7557 /**
7558  * @brief Gets the information of a peer's Wi-Fi Display session availability.
7559  * @since_tizen 2.4
7560  * @privlevel public
7561  * @privilege %http://tizen.org/privilege/wifidirect
7562  * @param[in] mac_address MAC Address of the PEER
7563  * @param[out] availability  The information of a peer's Wi-Fi Display session availability
7564  *                           if there's Wi-Fi Direct information, this will be NULL
7565  * @return @c 0 on success,
7566  *         otherwise a negative error value
7567  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
7568  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
7569  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
7570  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
7571  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
7572  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
7573  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
7574  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
7575  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
7576  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
7577  * @see wifi_direct_activate()
7578  * @see wifi_direct_foreach_discovered_peers()
7579  *
7580  *
7581  * Here is an example of the usage:
7582  * @code
7583  * #include <stdio.h>
7584  * #include <wifi_direct.h>
7585  *
7586  *
7587  * int function(void)
7588  * {
7589  *      int ret;
7590  *      bool availability;
7591  *      char *mac = NULL;
7592  *
7593  *      printf("Input the peer mac\n");
7594  *      scanf("%18ms", &mac);
7595  *
7596  *      ret = wifi_direct_get_peer_display_availability(mac, &availability);
7597  *
7598  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
7599  *              printf("Failed to get peer display availability\n");
7600  *              return -1;
7601  *      }
7602  *
7603  *      printf("peer display availability = %s\n", availability?"yes":"no");
7604  *      free(mac);
7605  *      return 0;
7606  * }
7607  *
7608  * int main()
7609  * {
7610  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
7611  *      wifi_direct_activate(); // Activate Wi-Fi Direct
7612  *
7613  *      function();
7614  *
7615  *      //       APP CODE HERE
7616  *
7617  *      // App must clean up Wi-Fi Direct before exiting
7618  *
7619  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
7620  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
7621  *      return 0;
7622  * }
7623  * @endcode
7624  */
7625 int wifi_direct_get_peer_display_availability(char *mac_address, bool *availability);
7626
7627
7628 /**
7629  * @brief Gets the information of a peer's Wi-Fi Display HDCP support.
7630  * @since_tizen 2.4
7631  * @privlevel public
7632  * @privilege %http://tizen.org/privilege/wifidirect
7633  * @param[in] mac_address MAC Address of the PEER
7634  * @param[out] hdcp  The information of a peer's Wi-Fi Display HDCP support
7635  *                   if there's Wi-Fi Direct information, this will be NULL
7636  * @return @c 0 on success,
7637  *         otherwise a negative error value
7638  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
7639  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
7640  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
7641  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
7642  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
7643  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
7644  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
7645  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
7646  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
7647  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
7648  * @see wifi_direct_activate()
7649  * @see wifi_direct_foreach_discovered_peers()
7650  *
7651  *
7652  * Here is an example of the usage:
7653  * @code
7654  * #include <stdio.h>
7655  * #include <wifi_direct.h>
7656  *
7657  *
7658  * int function(void)
7659  * {
7660  *      int ret;
7661  *      int hdcp;
7662  *      char *mac = NULL;
7663  *
7664  *      printf("Input the peer mac\n");
7665  *      scanf("%18ms", &mac);
7666  *
7667  *      ret = wifi_direct_get_peer_display_hdcp(mac, &hdcp);
7668  *
7669  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
7670  *              printf("Failed to get peer display hdcp\n");
7671  *              return -1;
7672  *      }
7673  *
7674  *      printf("peer display hdcp = %d\n", hdcp);
7675  *      free(mac);
7676  *      return 0;
7677  * }
7678  *
7679  * int main()
7680  * {
7681  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
7682  *      wifi_direct_activate(); // Activate Wi-Fi Direct
7683  *
7684  *      function();
7685  *
7686  *      //       APP CODE HERE
7687  *
7688  *      // App must clean up Wi-Fi Direct before exiting
7689  *
7690  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
7691  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
7692  *      return 0;
7693  * }
7694  * @endcode
7695  */
7696 int wifi_direct_get_peer_display_hdcp(char *mac_address, int *hdcp);
7697
7698
7699 /**
7700  * @brief Gets the information of a peer's Wi-Fi Display RTSP control port.
7701  * @since_tizen 2.4
7702  * @privlevel public
7703  * @privilege %http://tizen.org/privilege/wifidirect
7704  * @param[in] mac_address MAC Address of the PEER
7705  * @param[out] port  The information of a peer's Wi-Fi Display RTSP control port
7706  *                   if there's Wi-Fi Direct information, this will be NULL
7707  * @return @c 0 on success,
7708  *         otherwise a negative error value
7709  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
7710  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
7711  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
7712  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
7713  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
7714  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
7715  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
7716  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
7717  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
7718  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
7719  * @see wifi_direct_activate()
7720  * @see wifi_direct_foreach_discovered_peers()
7721  *
7722  *
7723  * Here is an example of the usage:
7724  * @code
7725  * #include <stdio.h>
7726  * #include <wifi_direct.h>
7727  *
7728  *
7729  * int function(void)
7730  * {
7731  *      int ret;
7732  *      int port;
7733  *      char *mac = NULL;
7734  *
7735  *      printf("Input the peer mac\n");
7736  *      scanf("%18ms", &mac);
7737  *
7738  *      ret = wifi_direct_get_peer_display_port(mac, &port);
7739  *
7740  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
7741  *              printf("Failed to get peer display port\n");
7742  *              return -1;
7743  *      }
7744  *
7745  *      printf("peer display port = %d\n", port);
7746  *      free(mac);
7747  *      return 0;
7748  * }
7749  *
7750  * int main()
7751  * {
7752  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
7753  *      wifi_direct_activate(); // Activate Wi-Fi Direct
7754  *
7755  *      function();
7756  *
7757  *      //       APP CODE HERE
7758  *
7759  *      // App must clean up Wi-Fi Direct before exiting
7760  *
7761  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
7762  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
7763  *      return 0;
7764  * }
7765  * @endcode
7766  */
7767 int wifi_direct_get_peer_display_port(char *mac_address, int *port);
7768
7769
7770 /**
7771  * @brief Gets the information of a peer's Wi-Fi Display max throughput.
7772  * @since_tizen 2.4
7773  * @privlevel public
7774  * @privilege %http://tizen.org/privilege/wifidirect
7775  * @param[in] mac_address MAC Address of the PEER
7776  * @param[out] throughput  The information of a peer's Wi-Fi Display max throughput (Mbps)
7777  *                         if there's Wi-Fi Direct information, this will be NULL
7778  * @return @c 0 on success,
7779  *         otherwise a negative error value
7780  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
7781  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
7782  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
7783  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
7784  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
7785  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
7786  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
7787  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
7788  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
7789  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
7790  * @see wifi_direct_activate()
7791  * @see wifi_direct_foreach_discovered_peers()
7792  *
7793  *
7794  * Here is an example of the usage:
7795  * @code
7796  * #include <stdio.h>
7797  * #include <wifi_direct.h>
7798  *
7799  *
7800  * int function(void)
7801  * {
7802  *      int ret;
7803  *      int tput;
7804  *      char *mac = NULL;
7805  *
7806  *      printf("Input the peer mac\n");
7807  *      scanf("%18ms", &mac);
7808  *
7809  *      ret = wifi_direct_get_peer_display_throughput(mac, &tput);
7810  *
7811  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
7812  *              printf("Failed to get peer display throughput\n");
7813  *              return -1;
7814  *      }
7815  *
7816  *      printf("peer display throughput = %d\n", tput);
7817  *      free(mac);
7818  *      return 0;
7819  * }
7820  *
7821  * int main()
7822  * {
7823  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
7824  *      wifi_direct_activate(); // Activate Wi-Fi Direct
7825  *
7826  *      function();
7827  *
7828  *      //       APP CODE HERE
7829  *
7830  *      // App must clean up Wi-Fi Direct before exiting
7831  *
7832  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
7833  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
7834  *      return 0;
7835  * }
7836  * @endcode
7837  */
7838 int wifi_direct_get_peer_display_throughput(char *mac_address, int *throughput);
7839
7840
7841 /**
7842  * @brief Enables / Disables automatic group removal feature when all peers are disconnected.
7843  * @since_tizen 3.0
7844  * @privlevel public
7845  * @privilege %http://tizen.org/privilege/wifidirect
7846  * @param[in] enable  Enables/Disables Group Removal feature based on the value TRUE/FALSE
7847  * @return @c 0 on success,
7848  *         otherwise a negative error value
7849  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
7850  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
7851  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
7852  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
7853  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
7854  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
7855  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
7856  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
7857  * @post wifi_direct_connection_state_changed_cb() will be invoked with
7858  *       #WIFI_DIRECT_GROUP_DESTROYED when there's no connected Group Client
7859  *       if device is Group Owner and this feature is enabled.
7860  * @see wifi_direct_activate()
7861  * @see wifi_direct_create_group()
7862  * @see wifi_direct_connection_state_changed_cb()
7863  *
7864  *
7865  * Here is an example of the usage:
7866  * @code
7867  * #include <stdio.h>
7868  * #include <wifi_direct.h>
7869  *
7870  *
7871  * int function(void)
7872  * {
7873  *      int ret;
7874  *
7875  *      ret = wifi_direct_set_auto_group_removal(true); // Enable auto group removal
7876  *
7877  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
7878  *              printf("Failed to set auto group removal\n");
7879  *              return -1;
7880  *      }
7881  *
7882  *      printf("set auto group removal success\n");
7883  *      return 0;
7884  * }
7885  *
7886  * int main()
7887  * {
7888  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
7889  *      wifi_direct_activate(); // Activate Wi-Fi Direct
7890  *
7891  *      function();
7892  *
7893  *      //       APP CODE HERE
7894  *
7895  *      // App must clean up Wi-Fi Direct before exiting
7896  *
7897  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
7898  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
7899  *      return 0;
7900  * }
7901  * @endcode
7902  */
7903 int wifi_direct_set_auto_group_removal(bool enable);
7904
7905
7906 /**
7907  * @brief Sets the timer which is used to expire the connection session.
7908  * @since_tizen 3.0
7909  * @privlevel public
7910  * @privilege %http://tizen.org/privilege/wifidirect
7911  * @param[in] seconds  Set the connection session timer value in seconds
7912  * @return @c 0 on success,
7913  *         otherwise a negative error value
7914  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
7915  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
7916  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
7917  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
7918  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
7919  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
7920  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
7921  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
7922  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
7923  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
7924  * @see wifi_direct_activate()
7925  *
7926  *
7927  * Here is an example of the usage:
7928  * @code
7929  * #include <stdio.h>
7930  * #include <wifi_direct.h>
7931  *
7932  *
7933  * int function(void)
7934  * {
7935  *      int ret;
7936  *      int session_timeout;
7937  *
7938  *      printf("Input the time for session timer\n");
7939  *      scanf("%2d", &session_timeout);
7940  *
7941  *      ret = wifi_direct_set_session_timer(session_timeout); // set session timer
7942  *
7943  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
7944  *              printf("Failed to set session timer\n");
7945  *              return -1;
7946  *      }
7947  *
7948  *      printf("set session timer success\n");
7949  *      return 0;
7950  * }
7951  *
7952  * int main()
7953  * {
7954  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
7955  *      wifi_direct_activate(); // Activate Wi-Fi Direct
7956  *
7957  *      function();
7958  *
7959  *      //       APP CODE HERE
7960  *
7961  *      // App must clean up Wi-Fi Direct before exiting
7962  *
7963  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
7964  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
7965  *      return 0;
7966  * }
7967  * @endcode
7968  */
7969 int wifi_direct_set_session_timer(int seconds);
7970
7971
7972 /**
7973  * @brief Gets the timer which is used to expire the connection session.
7974  * @since_tizen 3.0
7975  * @privlevel public
7976  * @privilege %http://tizen.org/privilege/wifidirect
7977  * @param[out] seconds  Connection session timer value
7978  * @return @c 0 on success,
7979  *         otherwise a negative error value
7980  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
7981  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
7982  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
7983  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
7984  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
7985  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
7986  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
7987  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
7988  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
7989  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
7990  * @see wifi_direct_activate()
7991  *
7992  *
7993  * Here is an example of the usage:
7994  * @code
7995  * #include <stdio.h>
7996  * #include <wifi_direct.h>
7997  *
7998  *
7999  * int function(void)
8000  * {
8001  *      int ret;
8002  *      int session_timeout;
8003  *
8004  *      ret = wifi_direct_get_session_timer(&session_timeout); // get session timer
8005  *
8006  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
8007  *              printf("Failed to get session timer\n");
8008  *              return -1;
8009  *      }
8010  *
8011  *      printf("session timer = %d\n", session_timeout);
8012  *      return 0;
8013  * }
8014  *
8015  * int main()
8016  * {
8017  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
8018  *      wifi_direct_activate(); // Activate Wi-Fi Direct
8019  *
8020  *      function();
8021  *
8022  *      //       APP CODE HERE
8023  *
8024  *      // App must clean up Wi-Fi Direct before exiting
8025  *
8026  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
8027  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
8028  *      return 0;
8029  * }
8030  * @endcode
8031  */
8032 int wifi_direct_get_session_timer(int *seconds);
8033
8034
8035 /**
8036  * @brief Gets the information of a peer's RSSI value.
8037  * @since_tizen 3.0
8038  * @privlevel public
8039  * @privilege %http://tizen.org/privilege/wifidirect
8040  * @param[in] mac_address  MAC Address of the peer device
8041  * @param[out] rssi        RSSI value of the peer device
8042  * @return @c 0 on success,
8043  *         otherwise a negative error value
8044  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
8045  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
8046  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
8047  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
8048  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
8049  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
8050  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
8051  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
8052  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
8053  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
8054  * @see wifi_direct_activate()
8055  *
8056  *
8057  * Here is an example of the usage:
8058  * @code
8059  * #include <stdio.h>
8060  * #include <wifi_direct.h>
8061  *
8062  *
8063  * int function(void)
8064  * {
8065  *      int ret;
8066  *      int rssi;
8067  *      char *mac = NULL;
8068  *
8069  *      printf("Input the peer mac\n");
8070  *      scanf("%18ms", &mac);
8071  *
8072  *      ret = wifi_direct_get_peer_rssi(mac, &rssi); // get peer rssi
8073  *
8074  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
8075  *              printf("Failed to get peer rssi\n");
8076  *              return -1;
8077  *      }
8078  *
8079  *      printf("peer rssi = %d\n", rssi);
8080  *      free(mac);
8081  *      return 0;
8082  * }
8083  *
8084  * int main()
8085  * {
8086  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
8087  *      wifi_direct_activate(); // Activate Wi-Fi Direct
8088  *
8089  *      function();
8090  *
8091  *      //       APP CODE HERE
8092  *
8093  *      // App must clean up Wi-Fi Direct before exiting
8094  *
8095  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
8096  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
8097  *      return 0;
8098  * }
8099  * @endcode
8100  */
8101 int wifi_direct_get_peer_rssi(char *mac_address, int *rssi);
8102
8103
8104 /**
8105  * @brief Adds the Wi-Fi Vendor Specific Information Element (VSIE) to specific frame type.
8106  * @since_tizen 4.0
8107  * @privlevel public
8108  * @privilege %http://tizen.org/privilege/wifidirect
8109  * @remarks @a vsie_str for @a frame_id will be in effect until Wi-Fi Direct is deactivated.
8110  * @param[in] frame_id frame ID for setting VSIE
8111  * @param[in] vsie_str VSIE data
8112  * @return @c 0 on success,
8113  *         otherwise a negative error value
8114  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
8115  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
8116  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
8117  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
8118  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
8119  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
8120  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
8121  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
8122  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
8123  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
8124  * @see wifi_direct_activate()
8125  * @see wifi_direct_remove_vsie()
8126  * @see wifi_direct_get_vsie()
8127  *
8128  *
8129  * Here is an example of the usage:
8130  * @code
8131  * #include <stdio.h>
8132  * #include <wifi_direct.h>
8133  *
8134  *
8135  * int function(void)
8136  * {
8137  *      int ret;
8138  *      char *vsie = NULL;
8139  *      unsigned int frame_id;
8140  *
8141  *      printf("Input the frame id\n");
8142  *      scanf("%2u", &frame_id);
8143  *
8144  *      printf("Input the vsie\n");
8145  *      scanf("%100ms", &vsie);
8146  *
8147  *      ret = wifi_direct_add_vsie(frame_id, vsie); // add vsie
8148  *
8149  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
8150  *              printf("Failed to add vsie\n");
8151  *              return -1;
8152  *      }
8153  *
8154  *      printf("vsie added success");
8155  *      free(vsie);
8156  *      return 0;
8157  * }
8158  *
8159  * int main()
8160  * {
8161  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
8162  *      wifi_direct_activate(); // Activate Wi-Fi Direct
8163  *
8164  *      function();
8165  *
8166  *      //       APP CODE HERE
8167  *
8168  *      // App must clean up Wi-Fi Direct before exiting
8169  *
8170  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
8171  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
8172  *      return 0;
8173  * }
8174  * @endcode
8175  */
8176 int wifi_direct_add_vsie(wifi_direct_vsie_frames_e frame_id, const char *vsie_str);
8177
8178
8179 /**
8180  * @brief Gets the Wi-Fi Vendor Specific Information Elements (VSIE) from specific frame.
8181  * @since_tizen 4.0
8182  * @privlevel public
8183  * @privilege %http://tizen.org/privilege/wifidirect
8184  * @remarks @a vsie_str must be released with free().
8185  * @param[in] frame_id  frame ID for setting VSIE
8186  * @param[out] vsie_str VSIE data
8187  * @return @c 0 on success,
8188  *         otherwise a negative error value
8189  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
8190  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
8191  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
8192  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
8193  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
8194  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
8195  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
8196  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
8197  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
8198  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate()
8199  *      and set VSIE for specific frame by wifi_direct_add_vsie().
8200  * @see wifi_direct_activate()
8201  * @see wifi_direct_add_vsie()
8202  * @see wifi_direct_remove_vsie()
8203  *
8204  *
8205  * Here is an example of the usage:
8206  * @code
8207  * #include <stdio.h>
8208  * #include <wifi_direct.h>
8209  *
8210  *
8211  * int function(void)
8212  * {
8213  *      int ret;
8214  *      char *vsie = NULL;
8215  *      unsigned int frame_id;
8216  *
8217  *      printf("Input the frame id\n");
8218  *      scanf("%2u", &frame_id);
8219  *
8220  *      ret = wifi_direct_get_vsie(frame_id, &vsie); // get vsie
8221  *
8222  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
8223  *              printf("Failed to get vsie\n");
8224  *              return -1;
8225  *      }
8226  *
8227  *      printf("vsie = %s\n", vsie);
8228  *      free(vsie);
8229  *      return 0;
8230  * }
8231  *
8232  * int main()
8233  * {
8234  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
8235  *      wifi_direct_activate(); // Activate Wi-Fi Direct
8236  *
8237  *      function();
8238  *
8239  *      //       APP CODE HERE
8240  *
8241  *      // App must clean up Wi-Fi Direct before exiting
8242  *
8243  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
8244  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
8245  *      return 0;
8246  * }
8247  * @endcode
8248  */
8249 int wifi_direct_get_vsie(wifi_direct_vsie_frames_e frame_id, char **vsie_str);
8250
8251
8252 /**
8253  * @brief Removes the Wi-Fi Vendor Specific Information Element (VSIE) from specific frame.
8254  * @since_tizen 4.0
8255  * @privlevel public
8256  * @privilege %http://tizen.org/privilege/wifidirect
8257  * @remarks @a vsie_str for @a frame_id will be in effect until Wi-Fi Direct is deactivated.
8258  * @param[in] frame_id frame ID for removing VSIE
8259  * @param[in] vsie_str VSIE data
8260  * @return @c 0 on success,
8261  *         otherwise a negative error value
8262  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
8263  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
8264  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
8265  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
8266  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
8267  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
8268  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
8269  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
8270  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
8271  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate()
8272  *      and set VSIE for specific frame by wifi_direct_add_vsie().
8273  * @see wifi_direct_activate()
8274  * @see wifi_direct_add_vsie()
8275  * @see wifi_direct_get_vsie()
8276  *
8277  *
8278  * Here is an example of the usage:
8279  * @code
8280  * #include <stdio.h>
8281  * #include <wifi_direct.h>
8282  *
8283  *
8284  * int function(void)
8285  * {
8286  *      int ret;
8287  *      char *vsie = NULL;
8288  *      unsigned int frame_id;
8289  *
8290  *      printf("Input the frame id\n");
8291  *      scanf("%2u", &frame_id);
8292  *
8293  *      printf("Input the vsie\n");
8294  *      scanf("%100ms", &vsie);
8295  *
8296  *      ret = wifi_direct_remove_vsie(frame_id, vsie); // remove vsie
8297  *
8298  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
8299  *              printf("Failed to remove vsie\n");
8300  *              return -1;
8301  *      }
8302  *
8303  *      printf("vsie removed success\n");
8304  *      free(vsie);
8305  *      return 0;
8306  * }
8307  *
8308  * int main()
8309  * {
8310  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
8311  *      wifi_direct_activate(); // Activate Wi-Fi Direct
8312  *
8313  *      function();
8314  *
8315  *      //       APP CODE HERE
8316  *
8317  *      // App must clean up Wi-Fi Direct before exiting
8318  *
8319  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
8320  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
8321  *      return 0;
8322  * }
8323  * @endcode
8324  */
8325 int wifi_direct_remove_vsie(wifi_direct_vsie_frames_e frame_id, const char *vsie_str);
8326
8327
8328 /**
8329  * @brief Gets the information of peer devices which is in the connecting state.
8330  * @since_tizen 4.0
8331  * @privlevel public
8332  * @privilege %http://tizen.org/privilege/wifidirect
8333  * @remarks @a peer_info must be released with free().
8334  * @param[out] peer_info connecting peer device data
8335  * @return @c 0 on success,
8336  *         otherwise a negative error value
8337  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
8338  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
8339  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
8340  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
8341  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
8342  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
8343  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
8344  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
8345  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
8346  * @pre Wi-Fi Direct service must be connecting state by wifi_direct_connect()
8347  *      or by receiving connection request from p2p peer device.
8348  * @see wifi_direct_activate()
8349  * @see wifi_direct_connect()
8350  *
8351  *
8352  * Here is an example of the usage:
8353  * @code
8354  * #include <stdio.h>
8355  * #include <wifi_direct.h>
8356  *
8357  *
8358  * bool device_selected = false;
8359  *
8360  * void peers_cb(wifi_direct_discovered_peer_info_s* peer,
8361  *                                           void *user_data)
8362  * {
8363  *      if (peer && !device_selected) {
8364  *              printf("peer device=%s MAC=%s\n", peer->device_name, peer->mac_address);
8365  *
8366  *              device_selected = true;
8367  *
8368  *              wifi_direct_connect(peer->mac_address); // Connect to the first discovered peer
8369  *      }
8370  * }
8371  *
8372  * int function(void)
8373  * {
8374  *      int ret;
8375  *      wifi_direct_discovered_peer_info_s *peer = NULL;
8376  *
8377  *      ret = wifi_direct_get_connecting_peer_info(&peer);
8378  *
8379  *      if (ret != WIFI_DIRECT_ERROR_NONE) {
8380  *              printf("Failed to get connecting peer info\n");
8381  *              return -1;
8382  *      }
8383  *
8384  *      printf("peer device name (%s) mac (%s)\n", peer->device_name,
8385  *                                                 peer->mac_address);
8386  *      return 0;
8387  * }
8388  *
8389  * void callback_2(int error_code,
8390  *                 wifi_direct_connection_state_e state,
8391  *                 const char *mac, void *user_data)
8392  *{
8393  *      switch (state) {
8394  *      case WIFI_DIRECT_CONNECTION_IN_PROGRESS:
8395  *              printf("Connection in progress\n");
8396  *
8397  *              function(); // get the connecting peer info
8398  *
8399  *      break;
8400  *
8401  *      case WIFI_DIRECT_CONNECTION_RSP:
8402  *              printf("Connected\n");
8403  * break;
8404  *
8405  *      case WIFI_DIRECT_DISCONNECTION_IND:
8406  *              printf("Disconnection IND\n");
8407  *      break;
8408  *
8409  *      case WIFI_DIRECT_DISCONNECTION_RSP;
8410  *              printf("Disconnected\n");
8411  *      break;
8412  * }
8413  *}
8414  *
8415  * void callback_1(int error_code,
8416  *               wifi_direct_discovery_state_e discovery_state,
8417  *               void *user_data)
8418  * {
8419  *      switch(discovery_state) {
8420  *      case WIFI_DIRECT_DISCOVERY_STARTED:
8421  *              printf("Discovery started\n");
8422  *              break;
8423  *
8424  *      case WIFI_DIRECT_ONLY_LISTEN_STARTED:
8425  *              printf("listen started\n");
8426  *              break;
8427  *
8428  *      case WIFI_DIRECT_DISCOVERY_FINISHED:
8429  *              printf("Discovery finished\n");
8430  *
8431  *      wifi_direct_foreach_discovered_peers(peers_cb,
8432  *                                        NULL); // Get discovered peer
8433  *              break;
8434  *
8435  *      case WIFI_DIRECT_DISCOVERY_FOUND:
8436  *              printf("peer devices found\n");
8437  *              break;
8438  *
8439  *      case WIFI_DIRECT_DISCOVERY_LOST:
8440  *              printf("Discovery lost\n");
8441  *              break;
8442  *
8443  *      default:
8444  *      break;
8445  *      }
8446  * }
8447  *
8448  * int main()
8449  * {
8450  *      wifi_direct_initialize(); // Initialize Wi-Fi Direct
8451  *      wifi_direct_set_discovery_state_changed_cb(callback_1, NULL); // Register callback 1
8452  *      wifi_direct_set_connection_state_changed_cb(callback_2, NULL); // Register callback 2
8453  *
8454  *      wifi_direct_activate(); // Activate Wi-Fi Direct
8455  *      wifi_direct_start_discovery(TRUE, 15); // Start discovery
8456  *
8457  *      //       APP CODE HERE
8458  *
8459  *      // App must clean up Wi-Fi Direct before exiting
8460  *
8461  *      wifi_direct_deactivate(); // Deactivate Wi-Fi Direct
8462  *      wifi_direct_unset_discovery_state_changed_cb(); // Deregister callback
8463  *      wifi_direct_deinitialize(); // Deinitialize Wi-Fi Direct
8464  *      return 0;
8465  * }
8466  * @endcode
8467  */
8468 int wifi_direct_get_connecting_peer_info(wifi_direct_discovered_peer_info_s **peer_info);
8469
8470 /**
8471  * @brief Gets the vendor specific information element (VSIE) of a peer.
8472  * @since_tizen 5.0
8473  * @privlevel public
8474  * @privilege %http://tizen.org/privilege/wifidirect
8475  * @remarks @a vsie must be released with free().
8476  * @param[in] mac_address MAC Address of the PEER
8477  * @param[out] vsie  The vendor specific information element (VSIE) of peer
8478  *                   if Wi-Fi Direct information is available, else it will be NULL.
8479  * @return @c 0 on success,
8480  *         otherwise a negative error value
8481  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
8482  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
8483  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
8484  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
8485  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
8486  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
8487  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
8488  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
8489  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
8490  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
8491  * @see wifi_direct_activate()
8492  * @see wifi_direct_foreach_discovered_peers()
8493  */
8494 int wifi_direct_get_peer_vsie(char *mac_address, char **vsie);
8495
8496 /**
8497  * @brief Sets the advertizing WPS (Wi-Fi Protected Setup) type.
8498  * @since_tizen 5.0
8499  * @privlevel public
8500  * @privilege %http://tizen.org/privilege/wifidirect
8501  * @param[in] type  The type of WPS. composition of #wifi_direct_config_method_type_e
8502  *            for example #WIFI_DIRECT_CONFIG_METHOD_PBC|#WIFI_DIRECT_CONFIG_METHOD_PIN_DISPLAY
8503  *            Use #WIFI_DIRECT_CONFIG_METHOD_DEFAULT to reset to default value
8504  * @return 0 on success, otherwise a negative error value
8505  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
8506  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
8507  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
8508  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
8509  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
8510  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
8511  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
8512  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
8513  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
8514  * @pre Wi-Fi Direct service must be initialized by wifi_direct_activate().
8515  * @see wifi_direct_initialize()
8516  */
8517 int wifi_direct_set_wps_config_method(int type);
8518
8519 /**
8520  * @brief Gets the advertizing WPS (Wi-Fi Protected Setup) type.
8521  * @since_tizen 5.0
8522  * @privlevel public
8523  * @privilege %http://tizen.org/privilege/wifidirect
8524  * @param[out] type  The type of WPS. composition of #wifi_direct_config_method_type_e
8525  * @return 0 on success, otherwise a negative error value
8526  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
8527  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
8528  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
8529  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
8530  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
8531  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
8532  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
8533  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
8534  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
8535  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
8536  * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
8537  * @see wifi_direct_initialize()
8538  */
8539 int wifi_direct_get_wps_config_method(int *type);
8540
8541 /**
8542  * @brief Removes a persistent device.
8543  * @since_tizen 5.0
8544  * @privlevel public
8545  * @privilege %http://tizen.org/privilege/wifidirect
8546  * @param[in] mac_address  The MAC address of the persistent group owner
8547  * @return 0 on success, otherwise a negative error value
8548  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
8549  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER     Invalid parameter
8550  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
8551  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
8552  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
8553  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
8554  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
8555  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
8556  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
8557  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
8558  * @see wifi_direct_initialize()
8559 */
8560 int wifi_direct_remove_persistent_device(char *mac_address);
8561
8562 /**
8563  * @brief Removes all persistent devices.
8564  * @since_tizen 5.0
8565  * @privlevel public
8566  * @privilege %http://tizen.org/privilege/wifidirect
8567  * @return 0 on success, otherwise a negative error value
8568  * @retval #WIFI_DIRECT_ERROR_NONE                  Successful
8569  * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED      Operation failed
8570  * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
8571  * @retval #WIFI_DIRECT_ERROR_PERMISSION_DENIED     Permission denied
8572  * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED         Operation not permitted
8573  * @retval #WIFI_DIRECT_ERROR_NOT_SUPPORTED         Not supported
8574  * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED       Not initialized
8575  * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY         Device or resource busy
8576  * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
8577  * @see wifi_direct_initialize()
8578 */
8579 int wifi_direct_remove_all_persistent_devices(void);
8580
8581 /**
8582  * @}
8583  */
8584
8585 #ifdef __cplusplus
8586 }
8587 #endif
8588 #endif /* __TIZEN_NET_WIFI_DIRECT_H__ */