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