tizen 2.0beta
[framework/connectivity/libwifi-direct.git] / include / wifi-direct.h
1 /*
2  * libwifi-direct
3  *
4  * Copyright (c) 2000 - 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
22 #ifndef __WIFI_DIRECT_INTERFACE_H_
23 #define __WIFI_DIRECT_INTERFACE_H_
24
25 #include <errno.h>
26 #include <stdbool.h>
27
28 #ifdef __cplusplus
29 extern "C"
30 {
31 #endif
32
33
34 /**
35  * @addtogroup CAPI_NET_WIFI_DIRECT_MODULE
36  * @{
37  */
38
39 /**
40  * @brief Enumeration for Wi-Fi Direct error code
41  */
42 typedef enum
43 {
44         WIFI_DIRECT_ERROR_NONE = 0,  /**< Successful */
45         WIFI_DIRECT_ERROR_OUT_OF_MEMORY = -ENOMEM,  /**< Out of memory */
46         WIFI_DIRECT_ERROR_NOT_PERMITTED = -EPERM,  /**< Operation not permitted */
47         WIFI_DIRECT_ERROR_INVALID_PARAMETER = -EINVAL,  /**< Invalid function parameter */
48         WIFI_DIRECT_ERROR_RESOURCE_BUSY = -EBUSY,  /**< Device or resource busy */
49         WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT = -ETIMEDOUT,  /**< Connection timed out */
50         WIFI_DIRECT_ERROR_NOT_INITIALIZED = -0x00008000|0x0201,  /**< Not initialized */
51         WIFI_DIRECT_ERROR_COMMUNICATION_FAILED = -0x00008000|0x0202,  /**< I/O error */
52         WIFI_DIRECT_ERROR_WIFI_USED = -0x00008000|0x0203,  /**< WiFi is being used */
53         WIFI_DIRECT_ERROR_MOBILE_AP_USED = -0x00008000|0x0204,  /**< Mobile AP is being used */
54         WIFI_DIRECT_ERROR_CONNECTION_FAILED = -0x00008000|0x0205,  /**< Connection failed */
55         WIFI_DIRECT_ERROR_AUTH_FAILED = -0x00008000|0x0206,  /**< Authentication failed */
56         WIFI_DIRECT_ERROR_OPERATION_FAILED = -0x00008000|0x0207,  /**< Operation failed */
57         WIFI_DIRECT_ERROR_TOO_MANY_CLIENT = -0x00008000|0x0208,  /**< Too many client */
58 } wifi_direct_error_e;
59
60 /**
61  * @brief Enumeration for Wi-Fi Direct link status
62  */
63 typedef enum
64 {
65         WIFI_DIRECT_STATE_DEACTIVATED = 0,
66                                                                         /**< */
67         WIFI_DIRECT_STATE_DEACTIVATING, /**< */
68         WIFI_DIRECT_STATE_ACTIVATING,           /**< */
69         WIFI_DIRECT_STATE_ACTIVATED,            /**< */
70         WIFI_DIRECT_STATE_DISCOVERING,  /**< */
71         WIFI_DIRECT_STATE_CONNECTING,   /**< */
72         WIFI_DIRECT_STATE_DISCONNECTING,        /**< */
73         WIFI_DIRECT_STATE_CONNECTED,            /**< */
74         WIFI_DIRECT_STATE_GROUP_OWNER   /**< */
75 } wifi_direct_state_e;
76
77 /**
78  * @brief Enumeration for Wi-Fi Direct device state
79  */
80 typedef enum
81 {
82         WIFI_DIRECT_DEVICE_STATE_ACTIVATED,
83         WIFI_DIRECT_DEVICE_STATE_DEACTIVATED,
84 } wifi_direct_device_state_e;
85
86 /**
87  * @brief Enumeration for Wi-Fi Direct discovery state
88  */
89 typedef enum
90 {
91         WIFI_DIRECT_ONLY_LISTEN_STARTED,
92         WIFI_DIRECT_DISCOVERY_STARTED,
93         WIFI_DIRECT_DISCOVERY_FOUND,
94         WIFI_DIRECT_DISCOVERY_FINISHED,
95 } wifi_direct_discovery_state_e;
96
97 /**
98  * @brief Enumeration for Wi-Fi Direct connection state
99  */
100 typedef enum
101 {
102         WIFI_DIRECT_CONNECTION_REQ,                     /**< */
103         WIFI_DIRECT_CONNECTION_WPS_REQ,         /**< */
104         WIFI_DIRECT_CONNECTION_IN_PROGRESS,                     /**< */
105         WIFI_DIRECT_CONNECTION_RSP,                     /**< */
106         WIFI_DIRECT_DISASSOCIATION_IND,                 /**< */
107         WIFI_DIRECT_DISCONNECTION_RSP,                  /**< */
108         WIFI_DIRECT_DISCONNECTION_IND,                  /**< */
109         WIFI_DIRECT_GROUP_CREATED,                      /**< */
110         WIFI_DIRECT_GROUP_DESTROYED,                    /**< */
111 } wifi_direct_connection_state_e;
112
113 /**
114  * @brief Enumeration for Wi-Fi Direct secondary device type
115  */
116 typedef enum
117 {
118         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_PC = 1,                              /**< */
119         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_SERVER = 2,          /**< */
120         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_MEDIA_CTR = 3,       /**< */
121         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_UMPC = 4,            /**< */
122         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_NOTEBOOK = 5,        /**< */
123         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_DESKTOP = 6,         /**< */
124         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_MID = 7,                     /**< */
125         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_COMPUTER_NETBOOK = 8,         /**< */
126         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_KEYBOARD = 1,                           /**< */
127         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_MOUSE = 2,                      /**< */
128         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_JOYSTICK = 3,           /**< */
129         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_TRACKBALL = 4,          /**< */
130         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_CONTROLLER = 5,         /**< */
131         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_REMOTE = 6,                     /**< */
132         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_TOUCHSCREEN = 7,/**< */
133         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_BIO_READER = 8,         /**< */
134         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_INPUT_BAR_READER = 9,         /**< */
135         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_PRINTER = 1,          /**< */
136         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_SCANNER = 2,          /**< */
137         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_FAX = 3,                              /**< */
138         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_COPIER = 4,           /**< */
139         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PRINTER_ALLINONE = 5,         /**< */
140         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_DIGITAL_STILL = 1,             /**< */
141         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_VIDEO = 2,                     /**< */
142         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_WEBCAM = 3,            /**< */
143         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_CAMERA_SECONDARYURITY = 4,    /**< */
144         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_STORAGE_NAS = 1,                      /**< */
145         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_NETWORK_INFRA_AP = 1,                                 /**< */
146         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_NETWORK_INFRA_ROUTER = 2,                     /**< */
147         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_NETWORK_INFRA_SWITCH = 3,                     /**< */
148         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_NETWORK_INFRA_GATEWAY = 4,            /**< */
149         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_TV = 1,                               /**< */
150         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_PIC_FRAME = 2,        /**< */
151         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_PROJECTOR = 3,        /**< */
152         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_MONITOR = 4,          /**< */
153         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_DAR = 1,                           /**< */
154         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVR = 2,                           /**< */
155         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MCX = 3,                           /**< */
156         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_STB = 4,                           /**< */
157         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_MSMAME = 5,                /**< */
158         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_MULTIMEDIA_PVP = 6,                           /**< */
159         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_XBOX = 1,                /**< */
160         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_XBOX_360 = 2,    /**< */
161         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_PS = 3,                          /**< */
162         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_CONSOLE = 4,             /**< */
163         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_GAME_PORTABLE = 5,    /**< */
164         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PHONE_WM = 1,                 /**< */
165         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PHONE_SINGLE = 2,             /**< */
166         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PHONE_DUAL = 3,               /**< */
167         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PHONE_SM_SINGLE = 4,
168                                                                                                                 /**< */
169         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_PHONE_SM_DUAL = 5,    /**< */
170         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_TUNER = 1,              /**< */
171         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_SPEAKER = 2,    /**< */
172         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_PMP = 3,                /**< */
173         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_HEADSET = 4,    /**< */
174         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_HEADPHONE = 5,
175                                                                                                                 /**< */
176         WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_MIC = 6,                /**< */
177 } wifi_direct_secondary_device_type_e;
178
179 /**
180  * @brief Enumeration for Wi-Fi Direct primary device type
181  */
182 typedef enum
183 {
184         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_COMPUTER = 1,           /**< */
185         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_INPUT_DEVICE = 2,       /**< */
186         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_PRINTER = 3,            /**< */
187         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_CAMERA = 4,             /**< */
188         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_STORAGE = 5,            /**< */
189         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_NETWORK_INFRA = 6,              /**< */
190         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_DISPLAY = 7,            /**< */
191         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_MULTIMEDIA_DEVICE = 8,          /**< */
192         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_GAME_DEVICE = 9,        /**< */
193         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE = 10, /**< */
194         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_AUDIO = 11,             /**< */
195         WIFI_DIRECT_PRIMARY_DEVICE_TYPE_OTHER = 255                     /**< */
196 } wifi_direct_primary_device_type_e;
197
198
199 /**
200 * @brief Enumeration for Wi-Fi WPS type
201 */
202 typedef enum {
203         WIFI_DIRECT_WPS_TYPE_NONE = 0x00,  /**< No WPS type */
204         WIFI_DIRECT_WPS_TYPE_PBC = 0x01,  /**< Push Button Configuration */
205         WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY = 0x02,  /**< Display PIN code */
206         WIFI_DIRECT_WPS_TYPE_PIN_KEYPAD = 0x04,  /**< Provide the keypad to input the PIN */
207 } wifi_direct_wps_type_e;
208
209 /**
210 * @struct wifi_direct_config_data_s
211 * Wi-Fi Direct configuration data structure
212 */
213 typedef struct
214 {
215         /** ssid */
216         char *ssid;
217
218         /** Specifies the operating channel. If zero, auto channel selection
219         *  will be used to find a quiet channel.
220         */
221         int channel;
222
223         /** WPS configuration parameters. */
224         wifi_direct_wps_type_e wps_config;
225
226         /** Max number of STAs allowed associations */
227         int max_clients;
228
229         /** TRUE to hide SSID in beacons and probe responses, FALSE otherwise. */
230         bool hide_SSID;
231
232         /** P2P Group owner intent value. */
233         int group_owner_intent;
234
235         bool want_persistent_group;
236
237         /** Auto connection mode */
238         bool auto_connection;
239
240         wifi_direct_primary_device_type_e primary_dev_type;
241         wifi_direct_secondary_device_type_e secondary_dev_type;
242 } wifi_direct_config_data_s;
243
244
245 /**
246  * @struct wifi_direct_discovered_peer_info_s
247  * Wi-Fi Direct buffer structure to store result of peer discovery
248  */
249 typedef struct
250 {
251         char* ssid;  /** Null-terminated device friendly name. */
252         char *mac_address;  /** Device's P2P Device Address */
253         char* interface_address;  /** Device's P2P Interface Address.  Valid only if device is a P2P GO. */    
254         int channel;  /** Channel the device is listening on. */
255         bool is_connected;  /** Is peer connected*/
256         bool is_group_owner;  /** Is an active P2P Group Owner */    
257         bool is_persistent_group_owner;  /** Is a stored Persistent GO */
258         wifi_direct_primary_device_type_e primary_device_type;  /** Primary category of device */
259         wifi_direct_secondary_device_type_e secondary_device_type;  /** Sub category of device */
260         int supported_wps_types;  /** The list of supported WPS type. \n
261         The OR operation on #wifi_direct_wps_type_e can be used like #WIFI_DIRECT_WPS_TYPE_PBC | #WIFI_DIRECT_WPS_TYPE_PIN_DISPLAY */
262 } wifi_direct_discovered_peer_info_s;
263
264
265 /**
266  * @struct wifi_direct_connected_peer_info_s
267  * Wi-Fi Direct buffer structure to store information of connected peer
268  */
269 typedef struct
270 {
271         char* ssid;  /** Device friendly name. */
272         char* ip_address;  /**< The IP address */
273         char* mac_address;  /** Device's P2P Device Address */
274         char* interface_address;  /** Device's P2P Interface Address */
275         bool p2p_supported;  /* whether peer is a P2P device */
276         wifi_direct_primary_device_type_e       primary_device_type;  /* primary category of device */
277         int channel;  /* Operating channel */
278 } wifi_direct_connected_peer_info_s;
279
280 /**
281  * Notification callback function type. \n
282  *
283  * Discover notifications can occur at the peers or P2P groups are found.
284  *
285  * @param event             Specifies the types of notifications.
286  *                          - WIFI_DIRECT_DISCOVERY_STARTED
287  *                          - WIFI_DIRECT_ONLY_LISTEN_STARTED
288  *                          - WIFI_DIRECT_DISCOVERY_FOUND
289  *                          - WIFI_DIRECT_DISCOVERY_FINISHED
290  * @param error_code        In failure case.
291  * @param user_data         User can transfer the user specific data in callback.
292  *
293  */
294 typedef void (*wifi_direct_discovery_state_chagned_cb) (int error_code,
295                                                                                                                 wifi_direct_discovery_state_e
296                                                                                                                 discovery_state,
297                                                                                                                 void *user_data);
298
299 /**
300  * Notification callback function type. \n
301  *
302  * Activation notifications callback function type.
303  *
304  * @param event             Specifies the types of notifications.
305  *                          - WIFI_DIRECT_DEVICE_STATE_ACTIVATED
306  *                          - WIFI_DIRECT_DEVICE_STATE_DEACTIVATED
307  * @param error_code        In failure case.
308  * @param user_data         User can transfer the user specific data in callback.
309  *
310  */
311 typedef void (*wifi_direct_device_state_changed_cb) (int error_code,
312                                                                                                          wifi_direct_device_state_e
313                                                                                                          device_state,
314                                                                                                          void *user_data);
315
316 /**
317  * connection notification callback function type. \n
318  *
319  * @param event             Specifies the types of notifications.
320  *                          - WIFI_DIRECT_CONNECTION_REQ
321  *                          - WIFI_DIRECT_CONNECTION_WPS_REQ
322  *                          - WIFI_DIRECT_CONNECTION_IN_PROGRESS
323  *                          - WIFI_DIRECT_CONNECTION_RSP
324  *                          - WIFI_DIRECT_DISASSOCIATION_IND
325  *                          - WIFI_DIRECT_DISCONNECTION_RSP
326  *                          - WIFI_DIRECT_DISCONNECTION_IND
327  *                          - WIFI_DIRECT_GROUP_CREATED
328  *                          - WIFI_DIRECT_GROUP_DESTROYED
329  *
330  * @param error_code        In failure case.
331  *
332  * @param param1        additional data for connection. ex) MAC
333  * @param param2        additional data for connection. ex) SSID
334  *
335  * @param user_data         User can transfer the user specific data in callback.
336  *
337  */
338 typedef void (*wifi_direct_connection_state_changed_cb) (int error_code,
339                                                                                                                  wifi_direct_connection_state_e
340                                                                                                                  connection_state,
341                                                                                                                  const char
342                                                                                                                  *mac_address,
343                                                                                                                  void *user_data);
344
345
346
347 /**
348 * @brief Called when IP address of client is assigned when your device is group owner.
349 * @param[in] mac_address  The MAC address of connection peer
350 * @param[in] ip_address  The IP address of connection peer
351 * @param[in] interface_address  The interface address of connection peer
352 * @param[in] user_data  The user data passed from the callback registration function
353 * @see wifi_direct_set_client_ip_address_assigned_cb()
354 * @see wifi_direct_unset_client_ip_address_assigned_cb()
355 */
356 typedef void (*wifi_direct_client_ip_address_assigned_cb) (const char* mac_address,
357                                                                                                                  const char* ip_address,
358                                                                                                                  const char* interface_address,
359                                                                                                                  void *user_data);
360
361
362
363 /*=============================================================================
364                                          Wifi Direct Client APIs
365 =============================================================================*/
366
367 /*****************************************************************************/
368 /* wifi_direct_initialize API function prototype
369  * int wifi_direct_initialize (void);
370  */
371 /**
372  * \brief       This API shall register the client application with the Wi-Fi Direct server and  initialize the various variables. \n
373  *
374  * \pre None.
375  *
376  * \post Application is registered.
377  *
378  * \see wifi_direct_device_state_changed_cb
379  * \see wifi_direct_discovery_state_chagned_cb
380  * \see wifi_direct_connection_state_changed_cb
381  *
382  * \par Sync (or) Async:
383  * This is a Synchronous API.
384  *
385  * \warning
386  *  None
387  *
388  * \return Return Type (int) \n
389  *
390  * - WIFI_DIRECT_ERROR_NONE on success \n
391  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
392  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
393  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
394  * - WIFI_DIRECT_ERROR_TOO_MANY_CLIENT for "Too many users" \n
395  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
396  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
397  *
398  * \par Prospective Clients:
399  * External Apps.
400  *
401  * \remarks None.
402  * \code
403  *
404  * #include <wifi-direct.h>
405  *
406  * void foo(void)
407  * {
408  *
409  * int result;
410  * 
411  * result = wifi_direct_initialize();
412  *
413  * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully connected to the wifi direct server
414  *
415  * \endcode
416  ******************************************************************************/
417 int wifi_direct_initialize(void);
418
419
420 /*****************************************************************************************/
421 /* wifi_direct_deinitialize API function prototype
422  * int wifi_direct_deinitialize(void);
423  */
424
425 /**
426  * \brief This API shall deregister the client application with the Wi-Fi Direct server and releases all resources.
427  *
428  * \pre Application must be already registered to the Wi-Fi Direct server.
429  *
430  * \post Application is de-registered.
431  *
432  * \see wifi_direct_initialize
433  *
434  * \par Sync (or) Async:
435  * This is a Synchronous API.
436  *
437  * \warning
438  *  None
439  *
440  *
441  * \par Async Response Message:
442  *        None
443  *
444  *
445  * \return Return Type (int) \n
446  * - WIFI_DIRECT_ERROR_NONE on success \n
447  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
448  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
449  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
450  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
451  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
452  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
453  *
454  * \par Prospective Clients:
455  * External Apps.
456  *
457  * \code
458  *
459  * #include <wifi-direct.h>
460  *
461  * void foo(void)
462  * {
463
464  * int result;
465  *
466  * result = wifi_direct_deinitialize();
467  *
468  * if(result == WIFI_DIRECT_ERROR_NONE)......... // Deregister is successful
469  *
470  *\endcode
471  *
472  *\remarks None.
473  *
474  ******************************************************************************/
475 int wifi_direct_deinitialize(void);
476
477
478 /*****************************************************************************/
479 /* wifi_direct_set_connection_state_changed_cb API function prototype
480  * int wifi_direct_set_connection_state_changed_cb(wifi_direct_device_state_changed_cb cb, void* user_data)
481  */
482 /**
483  * \brief       This API shall register the activation callback function and user data from client. \n
484  *
485  * \pre The Client should be initialized.
486  *
487  * \see wifi_direct_initialize
488  * \see wifi_direct_device_state_changed_cb
489  *
490  * \par Sync (or) Async:
491  * This is a Synchronous API.
492  *
493  * \warning
494  *  None
495  *
496  * \param[in] cb    Application Callback function pointer to receive Wi-Fi Direct events
497  * \param[in] user_data    user data
498  * 
499  * \return Return Type (int) \n
500  *
501  * - WIFI_DIRECT_ERROR_NONE on success \n
502  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
503  *
504  * \par Prospective Clients:
505  * External Apps.
506  *
507  * \remarks None.
508  * \code
509  *
510  * #include <wifi-direct.h>
511  *
512  * void foo(void)
513  * {
514  *
515  * int result;
516  * 
517  * result = wifi_direct_set_connection_state_changed_cb(_cb_activation, void* user_data);
518  *
519  * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully registered the callback function
520  *
521  * \endcode
522  ******************************************************************************/
523 int wifi_direct_set_device_state_changed_cb(wifi_direct_device_state_changed_cb cb, void *user_data);
524
525
526 /*****************************************************************************/
527 /* wifi_direct_unset_connection_state_changed_cb API function prototype
528  * int wifi_direct_unset_connection_state_changed_cb(void)
529  */
530 /**
531  * \brief       This API shall deregister the activation callback function and user data from client. \n
532  *
533  * \pre The Client should be initialized.
534  *
535  * \see wifi_direct_initialize
536  * \see wifi_direct_set_connection_state_changed_cb
537  *
538  * \par Sync (or) Async:
539  * This is a Synchronous API.
540  *
541  * \warning
542  *  None
543  *
544  * \return Return Type (int) \n
545  *
546  * - WIFI_DIRECT_ERROR_NONE on success \n
547  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
548  *
549  * \par Prospective Clients:
550  * External Apps.
551  *
552  * \remarks None.
553  * \code
554  *
555  * #include <wifi-direct.h>
556  *
557  * void foo(void)
558  * {
559  *
560  * int result;
561  * 
562  * result = wifi_direct_unset_connection_state_changed_cb();
563  *
564  * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully deregistered the callback function
565  *
566  * \endcode
567  ******************************************************************************/
568 int wifi_direct_unset_device_state_changed_cb(void);
569
570
571
572 /*****************************************************************************/
573 /* wifi_direct_set_discovery_state_changed_cb API function prototype
574  * int wifi_direct_set_discover_state_changed_cb(wifi_direct_discovery_state_chagned_cb cb, void* user_data)
575  */
576 /**
577  * \brief       This API shall register the discover callback function and user data from client. \n
578  *
579  * \pre The Client should be initialized.
580  *
581  * \see wifi_direct_initialize
582  * \see wifi_direct_discovery_state_chagned_cb
583  *
584  * \par Sync (or) Async:
585  * This is a Synchronous API.
586  *
587  * \warning
588  *  None
589  *
590  * \param[in] cb    Application Callback function pointer to receive Wi-Fi Direct events
591  * \param[in] user_data    user data
592  * 
593  * \return Return Type (int) \n
594  *
595  * - WIFI_DIRECT_ERROR_NONE on success \n
596  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
597  *
598  * \par Prospective Clients:
599  * External Apps.
600  *
601  * \remarks None.
602  * \code
603  *
604  * #include <wifi-direct.h>
605  *
606  * void foo(void)
607  * {
608  *
609  * int result;
610  * 
611  * result = wifi_direct_set_discovery_state_changed_cb(_cb_discover, void* user_data);
612  *
613  * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully registered the callback function
614  *
615  * \endcode
616  ******************************************************************************/
617 int wifi_direct_set_discovery_state_changed_cb(wifi_direct_discovery_state_chagned_cb cb, void *user_data);
618
619
620 /*****************************************************************************/
621 /* wifi_direct_unset_discovery_state_changed_cb API function prototype
622  * int wifi_direct_unset_discovery_state_changed_cb(void)
623  */
624 /**
625  * \brief       This API shall deregister the discover callback function and user data from client. \n
626  *
627  * \pre The Client should be initialized.
628  *
629  * \see wifi_direct_initialize
630  * \see wifi_direct_set_discovery_state_changed_cb
631  *
632  * \par Sync (or) Async:
633  * This is a Synchronous API.
634  *
635  * \warning
636  *  None
637  *
638  * \return Return Type (int) \n
639  *
640  * - WIFI_DIRECT_ERROR_NONE on success \n
641  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
642  *
643  * \par Prospective Clients:
644  * External Apps.
645  *
646  * \remarks None.
647  * \code
648  *
649  * #include <wifi-direct.h>
650  *
651  * void foo(void)
652  * {
653  *
654  * int result;
655  * 
656  * result = wifi_direct_unset_discovery_state_changed_cb();
657  *
658  * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully deregistered the callback function
659  *
660  * \endcode
661  ******************************************************************************/
662 int wifi_direct_unset_discovery_state_changed_cb(void);
663
664
665
666 /*****************************************************************************/
667 /* wifi_direct_set_connection_state_changed_cb API function prototype
668  * int wifi_direct_set_connection_state_changed_cb(wifi_direct_connection_state_changed_cb cb, void* user_data)
669  */
670 /**
671  * \brief       This API shall register the connection callback function and user data from client. \n
672  *
673  * \pre The Client should be initialized.
674  *
675  * \see wifi_direct_initialize
676  * \see wifi_direct_connection_state_changed_cb
677  *
678  * \par Sync (or) Async:
679  * This is a Synchronous API.
680  *
681  * \warning
682  *  None
683  *
684  * \param[in] cb    Application Callback function pointer to receive Wi-Fi Direct events
685  * \param[in] user_data    user data
686  * 
687  * \return Return Type (int) \n
688  *
689  * - WIFI_DIRECT_ERROR_NONE on success \n
690  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
691  *
692  * \par Prospective Clients:
693  * External Apps.
694  *
695  * \remarks None.
696  * \code
697  *
698  * #include <wifi-direct.h>
699  *
700  * void foo(void)
701  * {
702  *
703  * int result;
704  * 
705  * result = wifi_direct_set_connection_state_changed_cb(_cb_connection, void* user_data);
706  *
707  * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully registered the callback function
708  *
709  * \endcode
710  ******************************************************************************/
711 int wifi_direct_set_connection_state_changed_cb(wifi_direct_connection_state_changed_cb cb, void *user_data);
712
713
714 /*****************************************************************************/
715 /* wifi_direct_unset_connection_state_changed_cb API function prototype
716  * int wifi_direct_unset_connection_state_changed_cb(void)
717  */
718 /**
719  * \brief       This API shall deregister the connection callback function and user data from client. \n
720  *
721  * \pre The Client should be initialized.
722  *
723  * \see wifi_direct_initialize
724  * \see wifi_direct_set_connection_state_changed_cb
725  *
726  * \par Sync (or) Async:
727  * This is a Synchronous API.
728  *
729  * \warning
730  *  None
731  *
732  * \return Return Type (int) \n
733  *
734  * - WIFI_DIRECT_ERROR_NONE on success \n
735  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
736  *
737  * \par Prospective Clients:
738  * External Apps.
739  *
740  * \remarks None.
741  * \code
742  *
743  * #include <wifi-direct.h>
744  *
745  * void foo(void)
746  * {
747  *
748  * int result;
749  * 
750  * result = wifi_direct_unset_connection_state_changed_cb();
751  *
752  * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully deregistered the callback function
753  *
754  * \endcode
755  ******************************************************************************/
756 int wifi_direct_unset_connection_state_changed_cb(void);
757
758
759 /**
760 * @brief Registers the callback called when IP address of client is assigned when your device is group owner.
761 * @param[in] cb  The callback function to invoke
762 * @param[in] user_data  The user data to be passed to the callback function
763 * @return 0 on success, otherwise a negative error value.
764 * @retval #WIFI_DIRECT_ERROR_NONE  Successful
765 * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
766 * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
767 * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
768 * @see wifi_direct_initialize()
769 * @see wifi_direct_unset_client_ip_address_assigned_cb()
770 * @see wifi_direct_client_ip_address_assigned_cb()
771 */
772 int wifi_direct_set_client_ip_address_assigned_cb(wifi_direct_client_ip_address_assigned_cb cb, void* user_data);
773
774
775 /**
776 * @brief Unregisters the callback called when IP address of client is assigned when your device is group owner.
777 * @return 0 on success, otherwise a negative error value.
778 * @retval #WIFI_DIRECT_ERROR_NONE  Successful
779 * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
780 * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
781 * @see wifi_direct_initialize()
782 * @see wifi_direct_set_connection_state_changed_cb()
783 */
784 int wifi_direct_unset_client_ip_address_assigned_cb(void);
785
786
787
788
789 /*****************************************************************************************/
790 /* wifi_direct_activate API function prototype
791  * int wifi_direct_activate(void);
792  */
793
794 /**
795  * \brief This API shall open a wireless adapter device for P2P use.
796
797  * \pre Application must be already registered to the Wi-Fi Direct server.
798  *
799  * \post wireless adapter device will be ready to use.
800  *
801  * \see wifi_direct_initialize
802  *
803  * \par Sync (or) Async:
804  * This is a Asynchronous API.
805  *
806  * \warning
807  *  None
808  *
809  *
810  * \par Async Response Message:
811  *  - WIFI_DIRECT_DEVICE_STATE_ACTIVATED : Application will receive this event via wifi_direct_device_state_changed_cb, when activation  process is completed. \n
812  *
813  *
814  * \return Return Type (int*) \n
815  * - WIFI_DIRECT_ERROR_NONE on success \n
816  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
817  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
818  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
819  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
820  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
821  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
822  * - WIFI_DIRECT_ERROR_WIFI_USED for "WiFi is being used" \n
823  * - WIFI_DIRECT_ERROR_MOBILE_AP_USED for "Mobile AP is being used" \n
824  *
825  *
826  * \par Prospective Clients:
827  * External Apps.
828  *
829  * \code
830  *
831  * #include <wifi-direct.h>
832  *
833  * void foo(void)
834  * {
835
836  * int result;
837  *
838  * result = wifi_direct_activate();
839  *
840  * if(result == WIFI_DIRECT_ERROR_NONE)......... // activation is successful
841  *
842  *\endcode
843  *
844  *\remarks None.
845  *
846  ******************************************************************************/
847 int wifi_direct_activate(void);
848
849
850 /*****************************************************************************************/
851 /* wifi_direct_deactivate API function prototype
852  * int wifi_direct_deactivate(void);
853  */
854
855 /**
856  * \brief This API shall close a wireless adapter device for P2P use
857
858  * \pre Wireless adapter device must be already opened.
859  *
860  * \post wireless adapter device will be closed.
861  *
862  * \see wifi_direct_activate
863  *
864  * \par Sync (or) Async:
865  * This is a Asynchronous API.
866  *
867  * \warning
868  *  None
869  *
870  *
871  * \par Async Response Message:
872  *  - WIFI_DIRECT_DEVICE_STATE_DEACTIVATED : Application will receive this event via wifi_direct_device_state_changed_cb, when deactivation  process is completed. \n
873
874  * \return Return Type (int) \n
875  * - WIFI_DIRECT_ERROR_NONE on success \n
876  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
877  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
878  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
879  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
880  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
881  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
882  *
883  *
884  * \par Prospective Clients:
885  * External Apps.
886  *
887  * \code
888  *
889  * #include <wifi-direct.h>
890  *
891  * void foo(void)
892  * {
893  * int result;
894  *
895  * result = wifi_direct_deactivate();
896  *
897  * if(result == WIFI_DIRECT_ERROR_NONE)......... // Deactivation is successful
898  *
899  *\endcode
900  *
901  *\remarks None.
902  *
903  ******************************************************************************/
904 int wifi_direct_deactivate(void);
905
906
907 /*****************************************************************************************/
908 /* wifi_direct_start_discovery API function prototype
909  * int wifi_direct_start_discovery(bool listen_only, int timeout);
910  */
911 /**
912  * \brief This API shall Start a discovery to find all P2P capable devices. \n
913  *        Applications will be notified event via wifi_direct_discovery_state_chagned_cb(). \n
914  *
915  * @param listen_only    if true, skip the initial 802.11 scan and then enter
916  *                       Listen state instead of cycling between Search and Listen.
917  * @param timeout        Specifies the duration of discovery period, in seconds.
918  *                       APs. If 0, a default value will be used, which depends on UX guideline.
919  *
920  * \pre Wireless adapter device must be already opened.
921  *
922  *
923  * \see wifi_direct_get_discovery_result
924  *
925  * \par Sync (or) Async:
926  * This is a Asynchronous API.
927  *
928  * \warning
929  *  None
930  *
931  *
932  * \par Async Response Message:
933  *  - WIFI_DIRECT_DISCOVERY_STARTED : Application will receive this event via wifi_direct_discovery_state_chagned_cb (), when discover process (80211 Scan) started. \n
934  *  - WIFI_DIRECT_ONLY_LISTEN_STARTED : Application will receive this event via wifi_direct_discovery_state_chagned_cb (), when discover process (listen only mode) started. \n
935  *  - WIFI_DIRECT_DISCOVERY_FOUND : Application will receive this event via wifi_direct_discovery_state_chagned_cb (), when peer or group is found. \n
936  *  - WIFI_DIRECT_DISCOVERY_FINISHED : Once the whole discovery process is completed, applications will receive it via wifi_direct_discovery_state_chagned_cb (). \n
937  *                                 Applications may then call wifi_direct_foreach_discovered_peers() to get the final result.  \n
938  *                                 With the intermediate or final list of P2P capable devices, applications can update their UI if needed. \n
939  *                                 It is up to the applications to control how often to update their UI display. \n
940  *
941  *
942  * \return Return Type (int) \n
943  * - WIFI_DIRECT_ERROR_NONE on success \n
944  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
945  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
946  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
947  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
948  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
949  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
950  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
951  *
952  *
953  * \par Prospective Clients:
954  * External Apps.
955  *
956  * \code
957  *
958  * #include <wifi-direct.h>
959  *
960  * void foo(void)
961  * {
962
963  * int result;
964  *
965  * result = wifi_direct_start_discovery(TRUE, 0);
966  *
967  * if(result == WIFI_DIRECT_ERROR_NONE)......... // discovery request is successful
968  *
969  *\endcode
970  *
971  *\remarks If discover is over, peer can not find the device and the device can not find peer, too. 
972  * 
973  ******************************************************************************/
974 int wifi_direct_start_discovery(bool listen_only, int timeout);
975
976
977 /*****************************************************************************************/
978 /* wifi_direct_cancel_discovery API function prototype
979  * int wifi_direct_cancel_discovery(void);
980  */
981 /**
982  * \brief This API shall cancel the discovery process started from wifi_direct_start_discovery. \n
983  *
984  * \pre discovery process must be started.
985  *
986  * \post discovery process stopped.
987  *
988  * \see wifi_direct_client_start_discovery
989  *
990  * \par Sync (or) Async:
991  * This is a Asynchronous API.
992  *
993  * \warning
994  *  None
995  *
996  *
997  * \par Async Response Message:
998  *    - WIFI_DIRECT_DISCOVERY_FINISHED :  Applications will receive a this event
999  *                                   via callback when the discovery process is cancelled or completed.
1000  *
1001  *
1002  * \return Return Type (int) \n
1003  * - WIFI_DIRECT_ERROR_NONE on success \n
1004  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1005  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1006  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1007  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1008  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1009  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1010  *
1011  * \par Prospective Clients:
1012  * External Apps.
1013  *
1014  * \code
1015  *
1016  * #include <wifi-direct.h>
1017  *
1018  * void foo(void)
1019  * {
1020
1021  * int result;
1022  *
1023  * result = wifi_direct_cancel_discovery();
1024  *
1025  * if(result == WIFI_DIRECT_ERROR_NONE)......... // discovery cancel request is successful
1026  *
1027  *\endcode
1028  *
1029  *\remarks None.
1030  *
1031  ******************************************************************************/
1032 int wifi_direct_cancel_discovery(void);
1033
1034
1035 /**
1036  * discorverd peers notification callback function type. \n
1037  *
1038  * @param peer The discovered peer information.
1039  * @param user_data The user data passed from the foreach function.
1040  * @return @c true to continue with the next iteration of the loop,
1041  * \n @c false to break out of the loop.
1042  *
1043  * @pre wifi_direct_foreach_discovered_peers() will invoke this function.
1044  *
1045  * @see wifi_direct_foreach_discovered_peers()
1046  *
1047  */
1048 typedef bool(*wifi_direct_discovered_peer_cb)   (wifi_direct_discovered_peer_info_s * peer, void *user_data);
1049
1050
1051 /*****************************************************************************************/
1052 /* wifi_direct_foreach_discovered_peers API function prototype
1053  * int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_cb, void* user_data)
1054  */
1055 /**
1056  * \brief This API shall get the information of all discovered peers. \n
1057  *
1058  * @param callback The callback function to invoke.
1059  * @param user_data The user data passed from the foreach function.
1060  *
1061  * \see wifi_direct_discovered_peer_cb
1062  *
1063  * \par Sync (or) Async:
1064  * This is a Synchronous API.
1065  *
1066  * \warning
1067  *  None
1068  *
1069  * \return Return Type (int) \n
1070  * - WIFI_DIRECT_ERROR_NONE on success \n
1071  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1072  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1073  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1074  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1075  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1076  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1077  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1078  *
1079  *
1080  * \par Prospective Clients:
1081  * External Apps.
1082  *
1083  * \code
1084  *
1085  * #include <wifi-direct.h>
1086  *
1087  * bool _cb_discovered_peers_impl(wifi_direct_discovered_peer_info_s* peer, void* user_data)
1088  * {
1089  *      struct appdata* ad = (struct appdata*) user_data;
1090  *      
1091  *      if(NULL != peer)
1092  *      {
1093  *              if ( ad->peer_count >= MAX_PEER_NUM )
1094  *                      return false;   // break out of the loop
1095  *
1096  *              memcpy(&ad->peer_list[ad->peer_count], peer, sizeof(wifi_direct_discovered_peer_info_s));
1097  *              ad->peer_count++;
1098  *      }
1099  *
1100  *      return true;    // continue with the next iteration of the loop
1101  * }
1102  *
1103  *
1104  * void foo()
1105  * {
1106  *      int result;
1107  *
1108  *      ad->peer_list = NULL;
1109  *      ad->peer_count = 0;
1110  *      ad ->selected_peer_index = 0;
1111  *      result = wifi_direct_foreach_discovered_peers(_cb_discovered_peers_impl, (void*)ad);
1112  *
1113  *      if(result == WIFI_DIRECT_ERROR_NONE)......... // get discovery result is successful
1114  *
1115  *\endcode
1116  *
1117  *\remarks None.
1118  *
1119  ******************************************************************************/
1120 int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_cb
1121                                                                                  callback, void *user_data);
1122
1123
1124 /*****************************************************************************************/
1125 /* wifi_direct_connect API function prototype
1126  * int wifi_direct_connect(const char* mac_address);
1127  */
1128 /**
1129  * \brief This API shall connect to specified peer by automatically determining whether to perform group \n
1130  * formation, join an existing group, invite, re-invoke a group. The decision is \n
1131  * based on the current state of the peers (i.e. GO, STA, not connected) and the \n
1132  * availability of persistent data. \n
1133  *
1134  * @param mac_addr Device address of target peer.
1135  *
1136  * \par Sync (or) Async:
1137  * This is a Asynchronous API.
1138  *
1139  * \warning
1140  *  None
1141  *
1142  *
1143  * \par Async Response Message:
1144  *    - WIFI_DIRECT_CONNECTION_IN_PROGRESS :  Applications will receive this event
1145  *                                   via callback when the connection process is started.
1146  *    - WIFI_DIRECT_CONNECTION_RSP :  Applications will receive this event
1147  *                                   via callback when the connection process is completed or failed.
1148  *
1149  * \return Return Type (int) \n
1150  * - WIFI_DIRECT_ERROR_NONE on success \n
1151  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1152  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1153  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1154  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1155  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1156  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1157  * - WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT for "Connection timed out" \n
1158  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1159  * - WIFI_DIRECT_ERROR_CONNECTION_FAILED for "Create Link fail" \n
1160  * - WIFI_DIRECT_ERROR_AUTH_FAILED for "Create Link Auth fail" \n
1161  *
1162  *
1163  * \par Prospective Clients:
1164  * External Apps.
1165  *
1166  * \code
1167  *
1168  * #include <wifi-direct.h>
1169  *
1170  * void foo(unsigned char* mac_addr)
1171  * {
1172
1173  * int result;
1174  *
1175  * result = wifi_direct_connect(mac_addr);
1176  *
1177  * if(result == WIFI_DIRECT_ERROR_NONE)......... // connect request is successful
1178  *
1179  *\endcode
1180  *
1181  *\remarks This API will try to send provisioning request befre connecting.
1182  *
1183  ******************************************************************************/
1184 int wifi_direct_connect(const char *mac_address);
1185
1186
1187 /*****************************************************************************************/
1188 /* wifi_direct_disconnect_all API function prototype
1189  * int wifi_direct_disconnect_all(void);
1190  */
1191 /**
1192  * \brief This API shall tear down all connected links to peers (stop soft AP, and close interface).  \n
1193  *
1194  * \see wifi_direct_connect
1195  *
1196  * \par Sync (or) Async:
1197  * This is a Asynchronous API.
1198  *
1199  * \warning
1200  *  None
1201  *
1202  *
1203  * \par Async Response Message:
1204  *    - WIFI_DIRECT_DISCONNECTION_RSP :  Applications will receive this event
1205  *                                   via callback when the disconnection process is completed.
1206  *                          
1207  *
1208  * \return Return Type (int) \n
1209  * - WIFI_DIRECT_ERROR_NONE on success \n
1210  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1211  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1212  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1213  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1214  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1215  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1216  *
1217  *
1218  * \par Prospective Clients:
1219  * External Apps.
1220  *
1221  * \code
1222  *
1223  * #include <wifi-direct.h>
1224  *
1225  * void foo(void)
1226  * {
1227
1228  * int result;
1229  *
1230  * result = wifi_direct_disconnect_all();
1231  *
1232  * if(result == WIFI_DIRECT_ERROR_NONE)......... // disconnect request is successful
1233  *
1234  *\endcode
1235  *
1236  *\remarks None.
1237  *
1238  ******************************************************************************/
1239 int wifi_direct_disconnect_all(void);
1240
1241
1242
1243 /*****************************************************************************************/
1244 /* wifi_direct_disconnect API function prototype
1245  * int wifi_direct_disconnect(const char* mac_address);
1246  */
1247 /**
1248  * \brief This API shall disconnect the specified peer by mac address. 
1249  *
1250  * @param mac_addr Device address of target peer.
1251  *
1252  * \see
1253  *
1254  * \par Sync (or) Async:
1255  * This is a Asynchronous API.
1256  *
1257  * \warning
1258  *  None
1259  *
1260  *
1261  * \par Async Response Message:
1262  *    - WIFI_DIRECT_DISCONNECTION_RSP :  Applications will receive a this event
1263  *                                   via callback when a peer is disconnected.
1264  *
1265  * \return Return Type (int) \n
1266  * - WIFI_DIRECT_ERROR_NONE on success \n
1267  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1268  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1269  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1270  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1271  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1272  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1273  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1274  *
1275  *
1276  * \par Prospective Clients:
1277  * External Apps.
1278  *
1279  * \code
1280  *
1281  * #include <wifi-direct.h>
1282  *
1283  * void foo(unsigned char* mac_addr)
1284  * {
1285
1286  * int result;
1287  *
1288  * result = wifi_direct_disconnect(mac_addr);
1289  *
1290  * if(result == WIFI_DIRECT_ERROR_NONE)......... // disconnect request is successful
1291  *
1292  *\endcode
1293  *
1294  *\remarks None.
1295  *
1296  ******************************************************************************/
1297 int wifi_direct_disconnect(const char *mac_address);
1298
1299
1300
1301 /**
1302  * connected peers notification callback function type. \n
1303  *
1304  * @param peer The connected peer information.
1305  * @param user_data The user data passed from the foreach function.
1306  * @return @c true to continue with the next iteration of the loop,
1307  * \n @c false to break out of the loop.
1308  *
1309  * @pre wifi_direct_foreach_connected_peers() will invoke this function.
1310  *
1311  * @see wifi_direct_foreach_connected_peers()
1312  *
1313  */
1314 typedef bool(*wifi_direct_connected_peer_cb) (wifi_direct_connected_peer_info_s
1315                                                                                   * peer, void *user_data);
1316
1317
1318 /*****************************************************************************************/
1319 /* wifi_direct_foreach_connected_peers API function prototype
1320  * int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb, void* user_data)
1321  */
1322 /**
1323  * \brief This API shall get the information of all connected peers. \n
1324  *
1325  * @param callback The callback function to invoke.
1326  * @param user_data The user data passed from the foreach function.
1327  *
1328  * \see wifi_direct_connected_peer_cb
1329  *
1330  * \par Sync (or) Async:
1331  * This is a Synchronous API.
1332  *
1333  * \warning
1334  *  None
1335  *
1336  * \return Return Type (int) \n
1337  * - WIFI_DIRECT_ERROR_NONE on success \n
1338  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1339  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1340  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1341  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1342  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1343  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1344  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1345  *
1346  * \par Prospective Clients:
1347  * External Apps.
1348  *
1349  * \code
1350  *
1351  * #include <wifi-direct.h>
1352  *
1353  * bool _cb_connected_peers_impl(wifi_direct_connected_peer_info_s* peer, void* user_data)
1354  *{
1355  *      
1356  *      struct appdata* ad = (struct appdata*) user_data;
1357  *
1358  *      if(NULL != peer)
1359  *      {
1360  *              if ( ad->connected_peer_count >= MAX_PEER_NUM )
1361  *                      return false;   // break out of the loop
1362  *              
1363  *              memcpy(&ad->connected_peer_list[ad->connected_peer_count], peer, sizeof(wifi_direct_connected_peer_info_s));
1364  *              ad->connected_peer_count++;
1365  *              
1366  *      }
1367  *
1368  *      return true;    // continue with the next iteration of the loop
1369  *}
1370  *
1371  * void foo()
1372  * {
1373  *      int result;
1374  *
1375  *      ad->connected_peer_list = NULL;
1376  *      ad->connected_peer_count = 0;
1377  *
1378  *      result = wifi_direct_foreach_connected_peers(_cb_connected_peers_impl, (void*)ad);
1379  *
1380  * if(result == WIFI_DIRECT_ERROR_NONE)......... // get discovery result is successful
1381  *
1382  *\endcode
1383  *
1384  *\remarks None.
1385  *
1386  ******************************************************************************/
1387 int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb
1388                                                                                 callback, void *user_data);
1389
1390
1391
1392 /*****************************************************************************************/
1393 /* wifi_direct_create_group API function prototype
1394  * int wifi_direct_create_group();
1395  */
1396 /**
1397  * \brief This API shall set up device as a Group Owner and wait for clients to connect. \n
1398  * Create a soft AP, start the WPS registrar, start the DHCP server. \n
1399  *
1400  * \see wifi_direct_destroy_group
1401  *
1402  * \par Sync (or) Async:
1403  * This is a Asynchronous API.
1404  *
1405  * \warning
1406  *  None
1407  *
1408  *
1409  * \par Async Response Message:
1410  *    - WIFI_DIRECT_GROUP_CREATED :  Applications will receive this event
1411  *                                   via callback when the group creating request is successful. \n
1412  *                                Errorcode will be set to the WFD_ERROR_CREATE_LINK_FAIL value. \n
1413  *
1414  * \return Return Type (int) \n
1415  * - WIFI_DIRECT_ERROR_NONE on success \n
1416  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1417  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1418  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1419  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1420  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1421  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1422  * - WIFI_DIRECT_ERROR_CONNECTION_FAILED for "Create Link fail" \n
1423  * - WIFI_DIRECT_ERROR_AUTH_FAILED for "Create Link Auth fail" \n
1424  *
1425  *
1426  * \par Prospective Clients:
1427  * External Apps.
1428  *
1429  * \code
1430  *
1431  * #include <wifi-direct.h>
1432  *
1433  * void foo()
1434  * {
1435
1436  * int result;
1437  *
1438  * result = wifi_direct_create_group();
1439  *
1440  * if(result == WIFI_DIRECT_ERROR_NONE)......... // create group request is successful
1441  *
1442  *\endcode
1443  *
1444  *\remarks None.
1445  *
1446  ******************************************************************************/
1447 int wifi_direct_create_group(void);
1448
1449
1450
1451 /*****************************************************************************************/
1452 /* wifi_direct_destroy_group API function prototype
1453  * int wifi_direct_destroy_group();
1454  */
1455 /**
1456  * \brief This API shall cancel P2P Group create or tear down a P2P Group that we own. \n
1457  *
1458  * \see wifi_direct_create_group
1459  *
1460  * \par Sync (or) Async:
1461  * This is a Asynchronous API.
1462  *
1463  * \warning
1464  *  None
1465  *
1466  *
1467  * \par Async Response Message:
1468  *    - WIFI_DIRECT_GROUP_DESTROYED :  Applications will receive this event via callback when the group is cancelled. \n
1469  *
1470  * \return Return Type (int) \n
1471  * - WIFI_DIRECT_ERROR_NONE on success \n
1472  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1473  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1474  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1475  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1476  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1477  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1478  * - WIFI_DIRECT_ERROR_CONNECTION_FAILED for "Create Link fail" \n
1479  * - WIFI_DIRECT_ERROR_AUTH_FAILED for "Create Link Auth fail" \n
1480  *
1481  *
1482  * \par Prospective Clients:
1483  * External Apps.
1484  *
1485  * \code
1486  *
1487  * #include <wifi-direct.h>
1488  *
1489  * void foo()
1490  * {
1491
1492  * int result;
1493  *
1494  * result = wifi_direct_destroy_group();
1495  *
1496  * if(result == WIFI_DIRECT_ERROR_NONE)......... // cancel group request is successful
1497  *
1498  *\endcode
1499  *
1500  *\remarks None.
1501  *
1502  ******************************************************************************/
1503 int wifi_direct_destroy_group(void);
1504
1505
1506 /*****************************************************************************************/
1507 /* wifi_direct_is_group_owner API function prototype
1508  * int wifi_direct_is_group_owner(bool *owner);
1509  */
1510 /**
1511  * \brief This API shall check whether the currunt client is group owner or not.
1512  * @param owner              Memory to store the value of TURE or FALSE. Application must allocate memory.
1513  *
1514  * \see wifi_direct_create_group
1515  *
1516  * \par Sync (or) Async:
1517  * This is a Synchronous API.
1518  *
1519  * \warning
1520  *  None
1521  *
1522  * \return Return Type (int) \n
1523  * - WIFI_DIRECT_ERROR_NONE on success \n
1524  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1525  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1526  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1527  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1528  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1529  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1530  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1531  *
1532  * \par Prospective Clients:
1533  * External Apps.
1534  *
1535  * \code
1536  *
1537  * #include <wifi-direct.h>
1538  *
1539  * void foo(void)
1540  * {
1541
1542  * int result;
1543  * bool owner;
1544  *
1545  * result = wifi_direct_is_group_owner(&owner);
1546  *
1547  *
1548  * if(result == WIFI_DIRECT_ERROR_NONE)......... // checking the value is successful
1549  *
1550  *\endcode
1551  *
1552  *\remarks None.
1553  *
1554  ******************************************************************************/
1555 int wifi_direct_is_group_owner(bool * is_group_owner);
1556
1557
1558
1559 /*****************************************************************************************/
1560 /* wifi_direct_is_autonomous_group API function prototype
1561  * int wifi_direct_is_autonomous_group(bool *autonomous_group);
1562  */
1563 /**
1564  * \brief This API shall check whether the currunt group is autonomous group or not.
1565  * @param autonomous_group              Memory to store the value of TURE or FALSE. Application must allocate memory.
1566  *
1567  * \see wifi_direct_create_group
1568  *
1569  * \par Sync (or) Async:
1570  * This is a Synchronous API.
1571  *
1572  * \warning
1573  *  None
1574  *
1575  * \return Return Type (int) \n
1576  * - WIFI_DIRECT_ERROR_NONE on success \n
1577  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1578  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1579  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1580  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1581  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1582  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1583  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1584  *
1585  * \par Prospective Clients:
1586  * External Apps.
1587  *
1588  * \code
1589  *
1590  * #include <wifi-direct.h>
1591  *
1592  * void foo(void)
1593  * {
1594
1595  * int result;
1596  * bool autonomous_group;
1597  *
1598  * result = wifi_direct_is_autonomous_group(&autonomous_group);
1599  *
1600  *
1601  * if(result == WIFI_DIRECT_ERROR_NONE)......... // checking the value is successful
1602  *
1603  *\endcode
1604  *
1605  *\remarks None.
1606  *
1607  ******************************************************************************/
1608 int wifi_direct_is_autonomous_group(bool * is_autonomous_group);
1609
1610
1611
1612
1613 /*****************************************************************************************/
1614 /* wifi_direct_set_ssid API function prototype
1615  * int wifi_direct_set_ssid(const char* ssid);
1616  */
1617 /**
1618  * \brief This API shall set or update ssid of local device. \n 
1619  * @param ssid              new ssid to set. Application must set the new ssid before.
1620  *
1621  * \see wifi_direct_get_ssid
1622  *
1623  * \par Sync (or) Async:
1624  * This is a Synchronous API.
1625  *
1626  * \warning
1627  *  None
1628  *
1629  *
1630  * \return Return Type (int) \n
1631  * - WIFI_DIRECT_ERROR_NONE on success \n
1632  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1633  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1634  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1635  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1636  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1637  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1638  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1639  *
1640  *
1641  * \par Prospective Clients:
1642  * External Apps.
1643  *
1644  * \code
1645  *
1646  * #include <wifi-direct.h>
1647  *
1648  * void foo()
1649  * {
1650  * int  result;
1651  * char ssid[11] = {0,};
1652  *
1653  * memset(pin, 0x00, sizeof(pin));
1654  * printf("Input 8 digit PIN number :\n");
1655  * scanf("%s", pin);
1656  *
1657  *if( strlen(ssid) > 0 )
1658  *      result = wifi_direct_set_ssid(ssid);
1659  * 
1660  * if(result == WIFI_DIRECT_ERROR_NONE)......... // setting ssid is successful
1661  *
1662  *\endcode
1663  *
1664  *\remarks When the wifi direct is re-activated, ssid will be reset to the device name. \n
1665  *             
1666  *
1667  ******************************************************************************/
1668 int wifi_direct_set_ssid(const char *ssid);
1669
1670
1671 /*****************************************************************************************/
1672 /* wifi_direct_get_ssid API function prototype
1673  * int wifi_direct_get_ssid(char** ssid)
1674  */
1675 /**
1676  * \brief This API shall get ssid of local device. \n
1677  * @param ssid              Pointer to store ssid. Application must free this memory.
1678  *
1679  * \par Sync (or) Async:
1680  * This is a Synchronous API.
1681  *
1682  * \warning
1683  *  None
1684  *
1685  *
1686  * \return Return Type (int) \n
1687  * - WIFI_DIRECT_ERROR_NONE on success \n
1688  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1689  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1690  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1691  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1692  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1693  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1694  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1695  *
1696  *
1697  * \par Prospective Clients:
1698  * External Apps.
1699  *
1700  * \code
1701  *
1702  * #include <wifi-direct.h>
1703  *
1704  * void foo()
1705  * {
1706  * int  result;
1707  * char* ssid = NULL;
1708  *
1709  * result = wifi_direct_get_ssid(&ssid);
1710  *
1711  * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting ssid is successful
1712  *
1713  * free(ssid); // Application should free the memory.
1714  *
1715  *
1716  *\endcode
1717  *
1718  *\remarks None.
1719  *
1720  ******************************************************************************/
1721 int wifi_direct_get_ssid(char **ssid);
1722
1723
1724 /**
1725 * @brief Gets the name of network interface. For example, eth0 and pdp0.
1726 * @remarks @a name must be released with free() by you.
1727 * @param[out] name  The name of network interface
1728 * @return 0 on success, otherwise negative error value.
1729 * @retval #WIFI_DIRECT_ERROR_NONE  Successful
1730 * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
1731 * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
1732 * @retval #WIFI_DIRECT_ERROR_OUT_OF_MEMORY  Out of memory
1733 * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
1734 * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
1735 * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
1736 * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
1737 * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
1738 * @see wifi_direct_activate()
1739 */
1740 int wifi_direct_get_network_interface_name(char** name);
1741
1742
1743 /*****************************************************************************************/
1744 /* wifi_direct_get_ip_address API function prototype
1745  * int wifi_direct_get_ip_address(char** ip_address)
1746  */
1747 /**
1748  * \brief This API shall get IP address of local device interface. \n
1749  * @param ip_addr              Pointer to store ip address. Application must free this memory.
1750  *
1751  * \par Sync (or) Async:
1752  * This is a Synchronous API.
1753  *
1754  * \warning
1755  *  None
1756  *
1757  *
1758  * \return Return Type (int) \n
1759  * - WIFI_DIRECT_ERROR_NONE on success \n
1760  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1761  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1762  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1763  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1764  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1765  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1766  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1767  *
1768  *
1769  * \par Prospective Clients:
1770  * External Apps.
1771  *
1772  * \code
1773  *
1774  * #include <wifi-direct.h>
1775  *
1776  * void foo()
1777  * {
1778  * int  result;
1779  * char* ip = NULL;
1780  *
1781  * result = wifi_direct_get_ip_address(&ip);
1782  *
1783  * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting IP is successful
1784  *
1785  * free(ip); // Application should free the memory.
1786  *
1787  *\endcode
1788  *
1789  *\remarks None.
1790  *
1791  ******************************************************************************/
1792 int wifi_direct_get_ip_address(char **ip_address);
1793
1794 /**
1795 * @brief Gets the Subnet Mask.
1796 * @remarks @a subnet_mask must be released with free() by you.
1797 * @param[out] subnet_mask  The subnet mask
1798 * @return 0 on success, otherwise negative error value.
1799 * @retval #WIFI_DIRECT_ERROR_NONE  Successful
1800 * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
1801 * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
1802 * @retval #WIFI_DIRECT_ERROR_OUT_OF_MEMORY  Out of memory
1803 * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
1804 * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
1805 * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
1806 * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
1807 * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
1808 * @see wifi_direct_activate()
1809 */
1810 int wifi_direct_get_subnet_mask(char** subnet_mask);
1811
1812
1813 /**
1814 * @brief Gets the Gateway address.
1815 * @remarks @a gateway_address must be released with free() by you.
1816 * @param[out] gateway_address  The gateway address
1817 * @return 0 on success, otherwise negative error value.
1818 * @retval #WIFI_DIRECT_ERROR_NONE  Successful
1819 * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
1820 * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
1821 * @retval #WIFI_DIRECT_ERROR_OUT_OF_MEMORY  Out of memory
1822 * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
1823 * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
1824 * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
1825 * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
1826 * @pre Wi-Fi Direct service must be activated by wifi_direct_activate().
1827 * @see wifi_direct_activate()
1828 */
1829 int wifi_direct_get_gateway_address(char** gateway_address);
1830
1831
1832
1833 /*****************************************************************************************/
1834 /* wifi_direct_get_mac_addr API function prototype
1835  * int wifi_direct_get_mac_address(char **mac_address)
1836  */
1837 /**
1838  * \brief This API shall get device MAC address of local device.\n
1839  * @param mac_addr              Pointer to store MAC address. Application must free this memory.
1840  *
1841  * \par Sync (or) Async:
1842  * This is a Synchronous API.
1843  *
1844  * \warning
1845  *  None
1846  *
1847  *
1848  * \return Return Type (int) \n
1849  * - WIFI_DIRECT_ERROR_NONE on success \n
1850  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1851  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1852  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1853  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1854  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1855  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1856  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1857  *
1858  *
1859  * \par Prospective Clients:
1860  * External Apps.
1861  *
1862  * \code
1863  *
1864  * #include <wifi-direct.h>
1865  *
1866  * void foo()
1867  * {
1868  * int  result;
1869  * char* mac_addr =NULL;
1870  *
1871  * result = wifi_direct_get_mac_addr(&mac_addr);
1872  *
1873  * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting device MAC is successful
1874  *
1875  *\endcode
1876  *
1877  *\remarks None.
1878  *
1879  ******************************************************************************/
1880 int wifi_direct_get_mac_address(char **mac_address);
1881
1882
1883 /*****************************************************************************************/
1884 /* wifi_direct_get_state API function prototype
1885  * int wifi_direct_get_state(wifi_direct_state_e * status);
1886  */
1887 /**
1888  * \brief This API shall get current Wi-Fi direct link status. \n
1889  * @param status Memory to store link status information. Application must allocate memory.
1890  *
1891  * \see wifi_direct_state_e
1892  *
1893  * \par Sync (or) Async:
1894  * This is a Synchronous API.
1895  *
1896  * \warning
1897  *  None
1898  *
1899  *
1900  * \return Return Type (int) \n
1901  * - WIFI_DIRECT_ERROR_NONE on success \n
1902  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1903  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1904  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1905  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1906  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1907  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1908  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1909  *
1910  *
1911  * \par Prospective Clients:
1912  * External Apps.
1913  *
1914  * \code
1915  *
1916  * #include <wifi-direct.h>
1917  *
1918  * void foo()
1919  * {
1920  * int result;
1921  * wifi_direct_state_e status;
1922  *
1923  * result = wifi_direct_get_state(&status);
1924  *
1925  * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting link status is successful
1926  *
1927  *\endcode
1928  *
1929  *\remarks None.
1930  *
1931  ******************************************************************************/
1932 int wifi_direct_get_state(wifi_direct_state_e * state);
1933
1934
1935
1936 /**
1937 * @brief Checks whether this device is discoverable or not.
1938 * @param[out] discoverable  Indicats whether this device is discoverable or not
1939 * @return 0 on success, otherwise a negative error value.
1940 * @retval #WIFI_DIRECT_ERROR_NONE  Successful
1941 * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
1942 * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
1943 * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
1944 * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
1945 * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
1946 * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
1947 * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
1948 * @see wifi_direct_initialize()
1949 */
1950 int wifi_direct_is_discoverable(bool* discoverable);
1951
1952
1953 /**
1954 * @brief Gets the primary device type of local device.
1955 * @param[out] type  The primary device type
1956 * @return 0 on success, otherwise a negative error value.
1957 * @retval #WIFI_DIRECT_ERROR_NONE  Successful
1958 * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
1959 * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
1960 * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
1961 * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
1962 * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
1963 * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
1964 * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
1965 * @see wifi_direct_initialize()
1966 */
1967 int wifi_direct_get_primary_device_type(wifi_direct_primary_device_type_e* type);
1968
1969
1970
1971 /*****************************************************************************************/
1972 /* wifi_direct_accept_connection API function prototype
1973  * int wifi_direct_accept_connection(char* mac_address);
1974  */
1975 /**
1976  * \brief This API shall accept connection request from specified peer. \n
1977  * This API shall be used to respond the connection request event, WIFI_DIRECT_CONNECTION_REQ.
1978  *
1979  * @param mac_addr Device address of target peer.
1980  *
1981  * \see wifi_direct_connect
1982  *
1983  * \par Sync (or) Async:
1984  * This is a Asynchronous API.
1985  *
1986  * \warning
1987  *  None
1988  *
1989  * \par Async Response Message:
1990  *    - WIFI_DIRECT_CONNECTION_IN_PROGRESS :  Applications will receive this event
1991  *                                   via callback when the connection process is started.
1992  *    - WIFI_DIRECT_CONNECTION_RSP :  Applications will receive this event
1993  *                                   via callback when the connection process is completed or failed.
1994  *
1995  * \return Return Type (int) \n
1996  * - WIFI_DIRECT_ERROR_NONE on success \n
1997  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1998  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1999  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
2000  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
2001  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
2002  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
2003  * - WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT for "Connection timed out" \n
2004  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
2005  * - WIFI_DIRECT_ERROR_CONNECTION_FAILED for "Create Link fail" \n
2006  * - WIFI_DIRECT_ERROR_AUTH_FAILED for "Create Link Auth fail" \n
2007  *
2008  *
2009  * \par Prospective Clients:
2010  * External Apps.
2011  *
2012  * \code
2013  *
2014  * #include <wifi-direct.h>
2015  *
2016  * void foo(unsigned char* mac_addr)
2017  * {
2018  * int result;
2019  *
2020  * result = wifi_direct_accept_connection(mac_addr);
2021  *
2022  * if(result == WIFI_DIRECT_ERROR_NONE)......... // connect request is successful
2023  *
2024  *\endcode
2025  *
2026  *\remarks This API will not try to send provisioning request.
2027  *
2028  ******************************************************************************/
2029 int wifi_direct_accept_connection(char *mac_address);
2030
2031
2032
2033 /*****************************************************************************************/
2034 /* wifi_direct_set_wpa_passphrase API function prototype
2035  * int wifi_direct_set_wpa_passphrase(char* passphrase)
2036  */
2037 /**
2038  * \brief This API shall set or update wpa password. If a client create Group (Soft AP), this password will be used. \n
2039  * @param passphrase              new wpa password to set. Application must set the new password before.
2040  *
2041  *
2042  * \par Sync (or) Async:
2043  * This is a Synchronous API.
2044  *
2045  * \warning
2046  *  None
2047  *
2048  *
2049  * \return Return Type (int) \n
2050  * - WIFI_DIRECT_ERROR_NONE on success \n
2051  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
2052  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
2053  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
2054  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
2055  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
2056  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
2057  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
2058  *
2059  * \par Prospective Clients:
2060  * External Apps.
2061  *
2062  * \code
2063  *
2064  * #include <wifi-direct.h>
2065  *
2066  * void foo()
2067  * {
2068  * int  result;
2069  * char new_wpa[64+1] = {0,};
2070  *
2071  * printf("Input new WPA:\n");
2072  * scanf("%s",new_wpa);
2073  *
2074  *if( strlen(new_wpa) > 0 )
2075  *      result = wifi_direct_set_wpa_passphrase(new_wpa);
2076  * 
2077  * if(result == WIFI_DIRECT_ERROR_NONE)......... // setting password is successful
2078  *
2079  *\endcode
2080  *
2081  *\remarks None.
2082  *
2083  ******************************************************************************/
2084 int wifi_direct_set_wpa_passphrase(char *passphrase);
2085
2086
2087 /*****************************************************************************************/
2088 /* wifi_direct_activate_pushbutton API function prototype
2089  * int wifi_direct_activate_pushbutton(void);
2090  */
2091 /**
2092  * \brief This API shall start wps PBC.
2093
2094  * \pre Device must support the pbc button mode.
2095  *
2096  * \see wifi_direct_foreach_supported_wps_types
2097  *
2098  * \par Sync (or) Async:
2099  * This is a Synchronous API.
2100  *
2101  * \warning
2102  *  None
2103  *
2104  * \return Return Type (int) \n
2105  * - WIFI_DIRECT_ERROR_NONE on success \n
2106  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
2107  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
2108  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
2109  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
2110  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
2111  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
2112  *
2113  * \par Prospective Clients:
2114  * External Apps.
2115  *
2116  * \code
2117  *
2118  * #include <wifi-direct.h>
2119  *
2120  * void foo(void)
2121  * {
2122
2123  * int result;
2124  *
2125  * result = wifi_direct_activate_pushbutton();
2126  *
2127  * if(result == WIFI_DIRECT_ERROR_NONE)......... // activating push button is successful
2128  *
2129  *\endcode
2130  *
2131  *\remarks None.
2132  *
2133  ******************************************************************************/
2134 int wifi_direct_activate_pushbutton(void);
2135
2136
2137 /*****************************************************************************************/
2138 /* wifi_direct_set_wps_pin API function prototype
2139  * int wifi_direct_set_wps_pin(char* pin)
2140  */
2141 /**
2142  * \brief This API shall set or update the WPS PIN number user expects. \n
2143  * @param pin              new pin to set. Application must set the new pin number before.
2144  *
2145  * \see wifi_direct_generate_wps_pin.
2146  * \see wifi_direct_get_wps_pin
2147  *
2148  * \par Sync (or) Async:
2149  * This is a Synchronous API.
2150  *
2151  * \warning
2152  *  None
2153  *
2154  *
2155  * \return Return Type (int) \n
2156  * - WIFI_DIRECT_ERROR_NONE on success \n
2157  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
2158  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
2159  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
2160  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
2161  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
2162  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
2163  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
2164  *
2165  *
2166  * \par Prospective Clients:
2167  * External Apps.
2168  *
2169  * \code
2170  *
2171  * #include <wifi-direct.h>
2172  *
2173  * void foo()
2174  * {
2175  * int  result;
2176  * char pin[WIFI_DIRECT_WPS_PIN_LEN+1]= { 0, };
2177  *
2178  * memset(pin, 0x00, sizeof(pin));
2179  * printf("Input 8 digit PIN number :\n");
2180  * scanf("%s", pin);
2181  *
2182  *if( strlen(pin) > 0 )
2183  *      result = wifi_direct_set_wps_pin(pin);
2184  * 
2185  * if(result == WIFI_DIRECT_ERROR_NONE)......... // setting wps pin number is successful
2186  *
2187  *\endcode
2188  *
2189  *\remarks None.
2190  *
2191  ******************************************************************************/
2192 int wifi_direct_set_wps_pin(char *pin);
2193
2194
2195 /*****************************************************************************************/
2196 /* wifi_direct_get_wps_pin API function prototype
2197  * int wifi_direct_get_wps_pin(char** pin)
2198  */
2199 /**
2200  * \brief This API shall get the WPS PIN number. \n
2201  * @param pin              Pointer to store pin number. Application must free this memory.
2202  *
2203  * \see wifi_direct_set_wps_pin
2204  *
2205  * \par Sync (or) Async:
2206  * This is a Synchronous API.
2207  *
2208  * \warning
2209  *  None
2210  *
2211  *
2212  * \return Return Type (int) \n
2213  * - WIFI_DIRECT_ERROR_NONE on success \n
2214  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
2215  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
2216  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
2217  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
2218  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
2219  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
2220  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
2221  *
2222  *
2223  * \par Prospective Clients:
2224  * External Apps.
2225  *
2226  * \code
2227  *
2228  * #include <wifi-direct.h>
2229  *
2230  * void foo()
2231  * {
2232  * int  result;
2233  * char* pin = NULL;
2234  *
2235  * result = wifi_direct_get_wps_pin(&pin);
2236  * 
2237  * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting wps pin number is successful
2238  *
2239  * free(pin); // Application should free the memory.
2240  *
2241  *\endcode
2242  *
2243  *\remarks None.
2244  *
2245  ******************************************************************************/
2246 int wifi_direct_get_wps_pin(char **pin);
2247
2248
2249 /*****************************************************************************************/
2250 /* wifi_direct_generate_wps_pin API function prototype
2251  * wifi_direct_generate_wps_pin(void);
2252  */
2253 /**
2254  * \brief This API shall generate the random WPS PIN number.\n
2255  *              To get the generated PIN number, use wifi_direct_get_wps_pin() API.
2256  *
2257  * \see wifi_direct_set_wps_pin
2258  * \see wifi_direct_get_wps_pin
2259  *
2260  * \par Sync (or) Async:
2261  * This is a Synchronous API.
2262  *
2263  * \warning
2264  *  None
2265  *
2266  *
2267  * \return Return Type (int) \n
2268  * - WIFI_DIRECT_ERROR_NONE on success \n
2269  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
2270  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
2271  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
2272  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
2273  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
2274  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
2275  *
2276  *
2277  * \par Prospective Clients:
2278  * External Apps.
2279  *
2280  * \code
2281  *
2282  * #include <wifi-direct.h>
2283  *
2284  * void foo()
2285  * {
2286  * int  result;
2287  *
2288  * result = wifi_direct_generate_wps_pin();
2289  * 
2290  * if(result == WIFI_DIRECT_ERROR_NONE)......... // generating wps pin number is successful
2291  *
2292  *\endcode
2293  *
2294  *\remarks None.
2295  *
2296  ******************************************************************************/
2297 int wifi_direct_generate_wps_pin(void);
2298
2299
2300 /*****************************************************************************************/
2301 /* wifi_direct_get_supported_wps_mode API function prototype
2302  * int wifi_direct_get_supported_wps_mode(int *wps_mode);
2303  */
2304 /**
2305  * \brief This API shall get the supported wps mode. \n
2306  *              The result is bit flag.
2307  *
2308  * @param wps_mode              Memory to store supported wps mode. Application must allocate memory.
2309  *
2310  * \see wifi_direct_wps_type_e
2311  *
2312  * \par Sync (or) Async:
2313  * This is a Synchronous API.
2314  *
2315  * \warning
2316  *  None
2317  *
2318  *
2319  * \return Return Type (int) \n
2320  * - WIFI_DIRECT_ERROR_NONE on success \n
2321  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
2322  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
2323  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
2324  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
2325  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
2326  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
2327  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
2328  *
2329  *
2330  * \par Prospective Clients:
2331  * External Apps.
2332  *
2333  * \code
2334  *
2335  * #include <wifi-direct.h>
2336  *
2337  * void foo()
2338  * {
2339  * int  result;
2340  * int supported_wps_mode = 0;
2341  *
2342  * result = wifi_direct_get_supported_wps_mode(&supported_wps_mode);
2343  * 
2344  * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting supported wps mode is successful
2345  *
2346  *\endcode
2347  *
2348  *\remarks None.
2349  *
2350  ******************************************************************************/
2351 int wifi_direct_get_supported_wps_mode(int *wps_mode);
2352
2353
2354 /**
2355 * @brief Called when you get the supported WPS(Wi-Fi Protected Setup) type repeatedly.
2356 * @param[in] type  The type of WPS
2357 * @param[in] user_data  The user data passed from the request function
2358 * @return  @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
2359 * @pre  wifi_direct_foreach_supported_wps_types() will invoke this callback.
2360 * @see  wifi_direct_foreach_supported_wps_types()
2361 */
2362 typedef bool(*wifi_direct_supported_wps_type_cb)(wifi_direct_wps_type_e type, void* user_data);
2363
2364 /**
2365 * @brief Gets the supported WPS(Wi-Fi Protected Setup) types.
2366 * @param[in] callback  The callback function to invoke
2367 * @param[in] user_data  The user data to be passed to the callback function
2368 * @retval #WIFI_DIRECT_ERROR_NONE  Successful
2369 * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
2370 * @see wifi_direct_supported_wps_type_cb()
2371 */
2372 int wifi_direct_foreach_supported_wps_types(wifi_direct_supported_wps_type_cb callback, void* user_data);
2373
2374 /**
2375  * @brief Sets the WPS(Wi-Fi Protected Setup) type.
2376  * @param[in] type  The type of WPS
2377  * @retval #WIFI_DIRECT_ERROR_NONE  Successful
2378  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
2379  * @see wifi_direct_foreach_supported_wps_types()
2380  */
2381 int wifi_direct_set_wps_type(wifi_direct_wps_type_e type);
2382 /**
2383  * @brief Gets the WPS(Wi-Fi Protected Setup) type.
2384  * @param[out] type  The type of WPS
2385  * @retval #WIFI_DIRECT_ERROR_NONE  Successful
2386  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
2387  * @see wifi_direct_foreach_supported_wps_types()
2388  */
2389 int wifi_direct_get_wps_type(wifi_direct_wps_type_e* type);
2390
2391 /**
2392 * @brief Sets the intent of a group owner.
2393 * @remakrs The range of intent is 0 ~ 15.
2394 * @param[in] intent  The intent of a group owner
2395 * @retval #WIFI_DIRECT_ERROR_NONE  Successful
2396 * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
2397 * @see wifi_direct_get_group_owner_intent()
2398 */
2399 int wifi_direct_set_group_owner_intent(int intent);
2400
2401 /**
2402 * @brief Gets the intent of a group owner.
2403 * @param[out] intent  The intent of a group owner
2404 * @retval #WIFI_DIRECT_ERROR_NONE  Successful
2405 * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
2406 * @see wifi_direct_set_group_owner_intent()
2407 */
2408 int wifi_direct_get_group_owner_intent(int* intent);
2409         
2410 /**
2411 * @brief Sets the max number of clients.
2412 * @param[in] max  The max number of clients
2413 * @retval #WIFI_DIRECT_ERROR_NONE  Successful
2414 * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
2415 * @see wifi_direct_get_max_clients()
2416 */
2417 int wifi_direct_set_max_clients(int max);
2418         
2419 /**
2420 * @brief Gets the max number of clients.
2421 * @param[in] max  The max number of clients
2422 * @retval #WIFI_DIRECT_ERROR_NONE  Successful
2423 * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
2424 * @see wifi_direct_set_max_clients()
2425 */
2426 int wifi_direct_get_max_clients(int* max);
2427
2428
2429 /**
2430 * @brief Gets the channel of own group.
2431 * @param[out] channel  The channel of own group
2432 * @return 0 on success, otherwise a negative error value.
2433 * @retval #WIFI_DIRECT_ERROR_NONE  Successful
2434 * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
2435 * @retval #WIFI_DIRECT_ERROR_OPERATION_FAILED  Operation failed
2436 * @retval #WIFI_DIRECT_ERROR_COMMUNICATION_FAILED  Communication failed
2437 * @retval #WIFI_DIRECT_ERROR_NOT_PERMITTED  Operation not permitted
2438 * @retval #WIFI_DIRECT_ERROR_NOT_INITIALIZED  Not initialized
2439 * @retval #WIFI_DIRECT_ERROR_RESOURCE_BUSY  Device or resource busy
2440 * @pre Wi-Fi Direct service must be initialized by wifi_direct_initialize().
2441 * @see wifi_direct_initialize()
2442 */
2443 int wifi_direct_get_own_group_channel(int* channel);
2444
2445
2446 /*****************************************************************************************/
2447 /* wifi_direct_get_config_data API function prototype
2448 * int wifi_direct_get_config_data(wifi_direct_config_data_s** config)
2449 */
2450 /**
2451 * \brief This API shall get Wi-Fi direct configuration data. \n
2452 * @param config Pointer to store configuration information. Application must free this memory.
2453 *
2454 * \see wifi_direct_set_config_data
2455 *
2456 * \par Sync (or) Async:
2457 * This is a Synchronous API.
2458 *
2459 * \warning
2460 *  None
2461 *
2462 *
2463 * \return Return Type (int) \n
2464 * - WIFI_DIRECT_ERROR_NONE on success \n
2465 * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
2466 * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
2467 * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
2468 * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
2469 * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
2470 * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
2471 * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
2472 *
2473 *
2474 * \par Prospective Clients:
2475 * External Apps.
2476 *
2477 * \code
2478 *
2479 * #include <wifi-direct.h>
2480 *
2481 * void foo()
2482 * {
2483 * int result;
2484 * wifi_direct_config_data_s* config;
2485 *
2486 * result = wifi_direct_get_config_data(&config);
2487 *
2488 * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting config data is successful
2489 *
2490 *\endcode
2491 *
2492 *\remarks None.
2493 *
2494 ******************************************************************************/
2495 int wifi_direct_get_config_data(wifi_direct_config_data_s ** config);
2496
2497
2498 /*****************************************************************************************/
2499 /* wifi_direct_set_config_data API function prototype
2500 * int wifi_direct_set_config_data(wifi_direct_config_data_s* config);
2501 */
2502 /**
2503 * \brief This API shall set or update Wi-Fi direct configuration data. \n
2504 * @param config Wi-Fi configuration data to be set
2505 *
2506 * \see wifi_direct_get_config_data
2507 *
2508 * \par Sync (or) Async:
2509 * This is a Synchronous API.
2510 *
2511 * \warning
2512 *  None
2513 *
2514 * \return Return Type (int) \n
2515 * - WIFI_DIRECT_ERROR_NONE on success \n
2516 * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
2517 * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
2518 * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
2519 * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
2520 * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
2521 * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
2522 * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
2523 *
2524 *
2525 * \par Prospective Clients:
2526 * External Apps.
2527 *
2528 * \code
2529 *
2530 * #include <wifi-direct.h>
2531 *
2532 * void foo()
2533 * {
2534 * int result;
2535 * wifi_direct_config_data_s* config;
2536 *
2537 * result = wifi_direct_get_config_data(&config);
2538 *
2539 * if(result != WIFI_DIRECT_ERROR_NONE)......... // Getting configuration data is not successful
2540 * {
2541 *        return;
2542 * }
2543 *
2544 * // Change params
2545 * config->group_owner_intent = 8;
2546 * config->wps_config = WIFI_DIRECT_WPS_TYPE_PBC;
2547 * config->want_persistent_group = false;
2548 * config->hide_SSID = false;
2549 * strncpy(config->ssid, "My WiFi Direct", WIFI_DIRECT_MAX_SSID_LEN);
2550 *
2551 * result = wifi_direct_set_config_data(config);
2552 * if(result == WIFI_DIRECT_ERROR_NONE)......... // Setting configuration data is successful
2553 * {
2554 *
2555 *
2556 *
2557 *\endcode
2558 *
2559 *\remarks None.
2560 *
2561 ******************************************************************************/
2562 int wifi_direct_set_config_data(wifi_direct_config_data_s * config);
2563
2564
2565 /**
2566  * @brief Sets the Autoconnection mode.
2567  * @param[in]
2568  * @retval #WIFI_DIRECT_ERROR_NONE  Successful
2569  * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER  Invalid parameter
2570  * @see wifi_direct_foreach_supported_wps_types()
2571  */
2572 int wifi_direct_set_autoconnection_mode(bool mode);
2573
2574
2575 /**
2576  * @}
2577  */
2578
2579 #ifdef __cplusplus
2580 }
2581 #endif
2582
2583 #endif                                                  //__WIFI_DIRECT_INTERFACE_H_