869472c9061ff922a9fadca6f3d988b31dcc34dd
[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_STRANGE_CLIENT = -0x00008000|0x0201,  /**< Invalid Client */
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  * Wi-Fi Direct WPS config methods
201  */
202 typedef enum
203 {
204         WIFI_DIRECT_WPS_PUSHBUTTON = 0x0001,            /**< Push Button mode*/
205         WIFI_DIRECT_WPS_DISPLAY = 0x0002,                       /**< Display mode */
206         WIFI_DIRECT_WPS_KEYPAD = 0x0004,                        /**< Keypad mode */
207 } wifi_direct_wps_cfg_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_cfg_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 } wifi_direct_discovered_peer_info_s;
261
262
263 /**
264  * @struct wifi_direct_connected_peer_info_s
265  * Wi-Fi Direct buffer structure to store information of connected peer
266  */
267 typedef struct
268 {
269         char* ssid;  /** Null-terminated device friendly name. */
270         char* mac_address;  /** Device's P2P Device Address */
271         char* interface_address;  /** Device's P2P Interface Address */
272         bool p2p_supported;  /* whether peer is a P2P device */
273         wifi_direct_primary_device_type_e       primary_device_type;  /* primary category of device */
274 } wifi_direct_connected_peer_info_s;
275
276 /**
277  * Notification callback function type. \n
278  *
279  * Discover notifications can occur at the peers or P2P groups are found.
280  *
281  * @param event             Specifies the types of notifications.
282  *                          - WIFI_DIRECT_DISCOVERY_STARTED
283  *                          - WIFI_DIRECT_ONLY_LISTEN_STARTED
284  *                          - WIFI_DIRECT_DISCOVERY_FOUND
285  *                          - WIFI_DIRECT_DISCOVERY_FINISHED
286  * @param error_code        In failure case.
287  * @param user_data         User can transfer the user specific data in callback.
288  *
289  */
290 typedef void (*wifi_direct_discovery_state_chagned_cb) (int error_code,
291                                                                                                                 wifi_direct_discovery_state_e
292                                                                                                                 discovery_state,
293                                                                                                                 void *user_data);
294
295 /**
296  * Notification callback function type. \n
297  *
298  * Activation notifications callback function type.
299  *
300  * @param event             Specifies the types of notifications.
301  *                          - WIFI_DIRECT_DEVICE_STATE_ACTIVATED
302  *                          - WIFI_DIRECT_DEVICE_STATE_DEACTIVATED
303  * @param error_code        In failure case.
304  * @param user_data         User can transfer the user specific data in callback.
305  *
306  */
307 typedef void (*wifi_direct_device_state_changed_cb) (int error_code,
308                                                                                                          wifi_direct_device_state_e
309                                                                                                          device_state,
310                                                                                                          void *user_data);
311
312 /**
313  * connection notification callback function type. \n
314  *
315  * @param event             Specifies the types of notifications.
316  *                          - WIFI_DIRECT_CONNECTION_REQ
317  *                          - WIFI_DIRECT_CONNECTION_WPS_REQ
318  *                          - WIFI_DIRECT_CONNECTION_IN_PROGRESS
319  *                          - WIFI_DIRECT_CONNECTION_RSP
320  *                          - WIFI_DIRECT_DISASSOCIATION_IND
321  *                          - WIFI_DIRECT_DISCONNECTION_RSP
322  *                          - WIFI_DIRECT_DISCONNECTION_IND
323  *                          - WIFI_DIRECT_GROUP_CREATED
324  *                          - WIFI_DIRECT_GROUP_DESTROYED
325  *
326  * @param error_code        In failure case.
327  *
328  * @param param1        additional data for connection. ex) MAC
329  * @param param2        additional data for connection. ex) SSID
330  *
331  * @param user_data         User can transfer the user specific data in callback.
332  *
333  */
334 typedef void (*wifi_direct_connection_state_changed_cb) (int error_code,
335                                                                                                                  wifi_direct_connection_state_e
336                                                                                                                  connection_state,
337                                                                                                                  const char
338                                                                                                                  *mac_address,
339                                                                                                                  void *user_data);
340
341
342 /*=============================================================================
343                                          Wifi Direct Client APIs
344 =============================================================================*/
345
346 /*****************************************************************************/
347 /* wifi_direct_initialize API function prototype
348  * int wifi_direct_initialize (void);
349  */
350 /**
351  * \brief       This API shall register the client application with the Wi-Fi Direct server and  initialize the various variables. \n
352  *
353  * \pre None.
354  *
355  * \post Application is registered.
356  *
357  * \see wifi_direct_device_state_changed_cb
358  * \see wifi_direct_discovery_state_chagned_cb
359  * \see wifi_direct_connection_state_changed_cb
360  *
361  * \par Sync (or) Async:
362  * This is a Synchronous API.
363  *
364  * \warning
365  *  None
366  *
367  * \return Return Type (int) \n
368  *
369  * - WIFI_DIRECT_ERROR_NONE on success \n
370  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
371  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
372  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
373  * - WIFI_DIRECT_ERROR_TOO_MANY_CLIENT for "Too many users" \n
374  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
375  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
376  *
377  * \par Prospective Clients:
378  * External Apps.
379  *
380  * \remarks None.
381  * \code
382  *
383  * #include <wifi-direct.h>
384  *
385  * void foo(void)
386  * {
387  *
388  * int result;
389  * 
390  * result = wifi_direct_initialize();
391  *
392  * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully connected to the wifi direct server
393  *
394  * \endcode
395  ******************************************************************************/
396 int wifi_direct_initialize(void);
397
398
399 /*****************************************************************************************/
400 /* wifi_direct_deinitialize API function prototype
401  * int wifi_direct_deinitialize(void);
402  */
403
404 /**
405  * \brief This API shall deregister the client application with the Wi-Fi Direct server and releases all resources.
406  *
407  * \pre Application must be already registered to the Wi-Fi Direct server.
408  *
409  * \post Application is de-registered.
410  *
411  * \see wifi_direct_initialize
412  *
413  * \par Sync (or) Async:
414  * This is a Synchronous API.
415  *
416  * \warning
417  *  None
418  *
419  *
420  * \par Async Response Message:
421  *        None
422  *
423  *
424  * \return Return Type (int) \n
425  * - WIFI_DIRECT_ERROR_NONE on success \n
426  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
427  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
428  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
429  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
430  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
431  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
432  *
433  * \par Prospective Clients:
434  * External Apps.
435  *
436  * \code
437  *
438  * #include <wifi-direct.h>
439  *
440  * void foo(void)
441  * {
442
443  * int result;
444  *
445  * result = wifi_direct_deinitialize();
446  *
447  * if(result == WIFI_DIRECT_ERROR_NONE)......... // Deregister is successful
448  *
449  *\endcode
450  *
451  *\remarks None.
452  *
453  ******************************************************************************/
454 int wifi_direct_deinitialize(void);
455
456
457 /*****************************************************************************/
458 /* wifi_direct_set_connection_state_changed_cb API function prototype
459  * int wifi_direct_set_connection_state_changed_cb(wifi_direct_device_state_changed_cb cb, void* user_data)
460  */
461 /**
462  * \brief       This API shall register the activation callback function and user data from client. \n
463  *
464  * \pre The Client should be initialized.
465  *
466  * \see wifi_direct_initialize
467  * \see wifi_direct_device_state_changed_cb
468  *
469  * \par Sync (or) Async:
470  * This is a Synchronous API.
471  *
472  * \warning
473  *  None
474  *
475  * \param[in] cb    Application Callback function pointer to receive Wi-Fi Direct events
476  * \param[in] user_data    user data
477  * 
478  * \return Return Type (int) \n
479  *
480  * - WIFI_DIRECT_ERROR_NONE on success \n
481  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
482  *
483  * \par Prospective Clients:
484  * External Apps.
485  *
486  * \remarks None.
487  * \code
488  *
489  * #include <wifi-direct.h>
490  *
491  * void foo(void)
492  * {
493  *
494  * int result;
495  * 
496  * result = wifi_direct_set_connection_state_changed_cb(_cb_activation, void* user_data);
497  *
498  * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully registered the callback function
499  *
500  * \endcode
501  ******************************************************************************/
502 int wifi_direct_set_device_state_changed_cb(wifi_direct_device_state_changed_cb cb, void *user_data);
503
504
505 /*****************************************************************************/
506 /* wifi_direct_unset_connection_state_changed_cb API function prototype
507  * int wifi_direct_unset_connection_state_changed_cb(void)
508  */
509 /**
510  * \brief       This API shall deregister the activation callback function and user data from client. \n
511  *
512  * \pre The Client should be initialized.
513  *
514  * \see wifi_direct_initialize
515  * \see wifi_direct_set_connection_state_changed_cb
516  *
517  * \par Sync (or) Async:
518  * This is a Synchronous API.
519  *
520  * \warning
521  *  None
522  *
523  * \return Return Type (int) \n
524  *
525  * - WIFI_DIRECT_ERROR_NONE on success \n
526  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
527  *
528  * \par Prospective Clients:
529  * External Apps.
530  *
531  * \remarks None.
532  * \code
533  *
534  * #include <wifi-direct.h>
535  *
536  * void foo(void)
537  * {
538  *
539  * int result;
540  * 
541  * result = wifi_direct_unset_connection_state_changed_cb();
542  *
543  * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully deregistered the callback function
544  *
545  * \endcode
546  ******************************************************************************/
547 int wifi_direct_unset_device_state_changed_cb(void);
548
549
550
551 /*****************************************************************************/
552 /* wifi_direct_set_discovery_state_changed_cb API function prototype
553  * int wifi_direct_set_discover_state_changed_cb(wifi_direct_discovery_state_chagned_cb cb, void* user_data)
554  */
555 /**
556  * \brief       This API shall register the discover callback function and user data from client. \n
557  *
558  * \pre The Client should be initialized.
559  *
560  * \see wifi_direct_initialize
561  * \see wifi_direct_discovery_state_chagned_cb
562  *
563  * \par Sync (or) Async:
564  * This is a Synchronous API.
565  *
566  * \warning
567  *  None
568  *
569  * \param[in] cb    Application Callback function pointer to receive Wi-Fi Direct events
570  * \param[in] user_data    user data
571  * 
572  * \return Return Type (int) \n
573  *
574  * - WIFI_DIRECT_ERROR_NONE on success \n
575  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
576  *
577  * \par Prospective Clients:
578  * External Apps.
579  *
580  * \remarks None.
581  * \code
582  *
583  * #include <wifi-direct.h>
584  *
585  * void foo(void)
586  * {
587  *
588  * int result;
589  * 
590  * result = wifi_direct_set_discovery_state_changed_cb(_cb_discover, void* user_data);
591  *
592  * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully registered the callback function
593  *
594  * \endcode
595  ******************************************************************************/
596 int wifi_direct_set_discovery_state_changed_cb(wifi_direct_discovery_state_chagned_cb cb, void *user_data);
597
598
599 /*****************************************************************************/
600 /* wifi_direct_unset_discovery_state_changed_cb API function prototype
601  * int wifi_direct_unset_discovery_state_changed_cb(void)
602  */
603 /**
604  * \brief       This API shall deregister the discover callback function and user data from client. \n
605  *
606  * \pre The Client should be initialized.
607  *
608  * \see wifi_direct_initialize
609  * \see wifi_direct_set_discovery_state_changed_cb
610  *
611  * \par Sync (or) Async:
612  * This is a Synchronous API.
613  *
614  * \warning
615  *  None
616  *
617  * \return Return Type (int) \n
618  *
619  * - WIFI_DIRECT_ERROR_NONE on success \n
620  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
621  *
622  * \par Prospective Clients:
623  * External Apps.
624  *
625  * \remarks None.
626  * \code
627  *
628  * #include <wifi-direct.h>
629  *
630  * void foo(void)
631  * {
632  *
633  * int result;
634  * 
635  * result = wifi_direct_unset_discovery_state_changed_cb();
636  *
637  * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully deregistered the callback function
638  *
639  * \endcode
640  ******************************************************************************/
641 int wifi_direct_unset_discovery_state_changed_cb(void);
642
643
644
645 /*****************************************************************************/
646 /* wifi_direct_set_connection_state_changed_cb API function prototype
647  * int wifi_direct_set_connection_state_changed_cb(wifi_direct_connection_state_changed_cb cb, void* user_data)
648  */
649 /**
650  * \brief       This API shall register the connection callback function and user data from client. \n
651  *
652  * \pre The Client should be initialized.
653  *
654  * \see wifi_direct_initialize
655  * \see wifi_direct_connection_state_changed_cb
656  *
657  * \par Sync (or) Async:
658  * This is a Synchronous API.
659  *
660  * \warning
661  *  None
662  *
663  * \param[in] cb    Application Callback function pointer to receive Wi-Fi Direct events
664  * \param[in] user_data    user data
665  * 
666  * \return Return Type (int) \n
667  *
668  * - WIFI_DIRECT_ERROR_NONE on success \n
669  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
670  *
671  * \par Prospective Clients:
672  * External Apps.
673  *
674  * \remarks None.
675  * \code
676  *
677  * #include <wifi-direct.h>
678  *
679  * void foo(void)
680  * {
681  *
682  * int result;
683  * 
684  * result = wifi_direct_set_connection_state_changed_cb(_cb_connection, void* user_data);
685  *
686  * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully registered the callback function
687  *
688  * \endcode
689  ******************************************************************************/
690 int wifi_direct_set_connection_state_changed_cb(wifi_direct_connection_state_changed_cb cb, void *user_data);
691
692
693 /*****************************************************************************/
694 /* wifi_direct_unset_connection_state_changed_cb API function prototype
695  * int wifi_direct_unset_connection_state_changed_cb(void)
696  */
697 /**
698  * \brief       This API shall deregister the connection callback function and user data from client. \n
699  *
700  * \pre The Client should be initialized.
701  *
702  * \see wifi_direct_initialize
703  * \see wifi_direct_set_connection_state_changed_cb
704  *
705  * \par Sync (or) Async:
706  * This is a Synchronous API.
707  *
708  * \warning
709  *  None
710  *
711  * \return Return Type (int) \n
712  *
713  * - WIFI_DIRECT_ERROR_NONE on success \n
714  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
715  *
716  * \par Prospective Clients:
717  * External Apps.
718  *
719  * \remarks None.
720  * \code
721  *
722  * #include <wifi-direct.h>
723  *
724  * void foo(void)
725  * {
726  *
727  * int result;
728  * 
729  * result = wifi_direct_unset_connection_state_changed_cb();
730  *
731  * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully deregistered the callback function
732  *
733  * \endcode
734  ******************************************************************************/
735 int wifi_direct_unset_connection_state_changed_cb(void);
736
737
738 /*****************************************************************************************/
739 /* wifi_direct_activate API function prototype
740  * int wifi_direct_activate(void);
741  */
742
743 /**
744  * \brief This API shall open a wireless adapter device for P2P use.
745
746  * \pre Application must be already registered to the Wi-Fi Direct server.
747  *
748  * \post wireless adapter device will be ready to use.
749  *
750  * \see wifi_direct_initialize
751  *
752  * \par Sync (or) Async:
753  * This is a Asynchronous API.
754  *
755  * \warning
756  *  None
757  *
758  *
759  * \par Async Response Message:
760  *  - WIFI_DIRECT_DEVICE_STATE_ACTIVATED : Application will receive this event via wifi_direct_device_state_changed_cb, when activation  process is completed. \n
761  *
762  *
763  * \return Return Type (int*) \n
764  * - WIFI_DIRECT_ERROR_NONE on success \n
765  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
766  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
767  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
768  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
769  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
770  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
771  * - WIFI_DIRECT_ERROR_WIFI_USED for "WiFi is being used" \n
772  * - WIFI_DIRECT_ERROR_MOBILE_AP_USED for "Mobile AP is being used" \n
773  *
774  *
775  * \par Prospective Clients:
776  * External Apps.
777  *
778  * \code
779  *
780  * #include <wifi-direct.h>
781  *
782  * void foo(void)
783  * {
784
785  * int result;
786  *
787  * result = wifi_direct_activate();
788  *
789  * if(result == WIFI_DIRECT_ERROR_NONE)......... // activation is successful
790  *
791  *\endcode
792  *
793  *\remarks None.
794  *
795  ******************************************************************************/
796 int wifi_direct_activate(void);
797
798
799 /*****************************************************************************************/
800 /* wifi_direct_deactivate API function prototype
801  * int wifi_direct_deactivate(void);
802  */
803
804 /**
805  * \brief This API shall close a wireless adapter device for P2P use
806
807  * \pre Wireless adapter device must be already opened.
808  *
809  * \post wireless adapter device will be closed.
810  *
811  * \see wifi_direct_activate
812  *
813  * \par Sync (or) Async:
814  * This is a Asynchronous API.
815  *
816  * \warning
817  *  None
818  *
819  *
820  * \par Async Response Message:
821  *  - WIFI_DIRECT_DEVICE_STATE_DEACTIVATED : Application will receive this event via wifi_direct_device_state_changed_cb, when deactivation  process is completed. \n
822
823  * \return Return Type (int) \n
824  * - WIFI_DIRECT_ERROR_NONE on success \n
825  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
826  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
827  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
828  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
829  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
830  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
831  *
832  *
833  * \par Prospective Clients:
834  * External Apps.
835  *
836  * \code
837  *
838  * #include <wifi-direct.h>
839  *
840  * void foo(void)
841  * {
842  * int result;
843  *
844  * result = wifi_direct_deactivate();
845  *
846  * if(result == WIFI_DIRECT_ERROR_NONE)......... // Deactivation is successful
847  *
848  *\endcode
849  *
850  *\remarks None.
851  *
852  ******************************************************************************/
853 int wifi_direct_deactivate(void);
854
855
856 /*****************************************************************************************/
857 /* wifi_direct_start_discovery API function prototype
858  * int wifi_direct_start_discovery(bool listen_only, int timeout);
859  */
860 /**
861  * \brief This API shall Start a discovery to find all P2P capable devices. \n
862  *        Applications will be notified event via wifi_direct_discovery_state_chagned_cb(). \n
863  *
864  * @param listen_only    if true, skip the initial 802.11 scan and then enter
865  *                       Listen state instead of cycling between Search and Listen.
866  * @param timeout        Specifies the duration of discovery period, in seconds.
867  *                       APs. If 0, a default value will be used, which depends on UX guideline.
868  *
869  * \pre Wireless adapter device must be already opened.
870  *
871  *
872  * \see wifi_direct_get_discovery_result
873  *
874  * \par Sync (or) Async:
875  * This is a Asynchronous API.
876  *
877  * \warning
878  *  None
879  *
880  *
881  * \par Async Response Message:
882  *  - WIFI_DIRECT_DISCOVERY_STARTED : Application will receive this event via wifi_direct_discovery_state_chagned_cb (), when discover process (80211 Scan) started. \n
883  *  - 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
884  *  - WIFI_DIRECT_DISCOVERY_FOUND : Application will receive this event via wifi_direct_discovery_state_chagned_cb (), when peer or group is found. \n
885  *  - WIFI_DIRECT_DISCOVERY_FINISHED : Once the whole discovery process is completed, applications will receive it via wifi_direct_discovery_state_chagned_cb (). \n
886  *                                 Applications may then call wifi_direct_foreach_discovered_peers() to get the final result.  \n
887  *                                 With the intermediate or final list of P2P capable devices, applications can update their UI if needed. \n
888  *                                 It is up to the applications to control how often to update their UI display. \n
889  *
890  *
891  * \return Return Type (int) \n
892  * - WIFI_DIRECT_ERROR_NONE on success \n
893  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
894  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
895  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
896  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
897  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
898  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
899  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
900  *
901  *
902  * \par Prospective Clients:
903  * External Apps.
904  *
905  * \code
906  *
907  * #include <wifi-direct.h>
908  *
909  * void foo(void)
910  * {
911
912  * int result;
913  *
914  * result = wifi_direct_start_discovery(TRUE, 0);
915  *
916  * if(result == WIFI_DIRECT_ERROR_NONE)......... // discovery request is successful
917  *
918  *\endcode
919  *
920  *\remarks If discover is over, peer can not find the device and the device can not find peer, too. 
921  * 
922  ******************************************************************************/
923 int wifi_direct_start_discovery(bool listen_only, int timeout);
924
925
926 /*****************************************************************************************/
927 /* wifi_direct_cancel_discovery API function prototype
928  * int wifi_direct_cancel_discovery(void);
929  */
930 /**
931  * \brief This API shall cancel the discovery process started from wifi_direct_start_discovery. \n
932  *
933  * \pre discovery process must be started.
934  *
935  * \post discovery process stopped.
936  *
937  * \see wifi_direct_client_start_discovery
938  *
939  * \par Sync (or) Async:
940  * This is a Asynchronous API.
941  *
942  * \warning
943  *  None
944  *
945  *
946  * \par Async Response Message:
947  *    - WIFI_DIRECT_DISCOVERY_FINISHED :  Applications will receive a this event
948  *                                   via callback when the discovery process is cancelled or completed.
949  *
950  *
951  * \return Return Type (int) \n
952  * - WIFI_DIRECT_ERROR_NONE on success \n
953  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
954  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
955  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
956  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
957  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
958  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
959  *
960  * \par Prospective Clients:
961  * External Apps.
962  *
963  * \code
964  *
965  * #include <wifi-direct.h>
966  *
967  * void foo(void)
968  * {
969
970  * int result;
971  *
972  * result = wifi_direct_cancel_discovery();
973  *
974  * if(result == WIFI_DIRECT_ERROR_NONE)......... // discovery cancel request is successful
975  *
976  *\endcode
977  *
978  *\remarks None.
979  *
980  ******************************************************************************/
981 int wifi_direct_cancel_discovery(void);
982
983
984 /**
985  * discorverd peers notification callback function type. \n
986  *
987  * @param peer The discovered peer information.
988  * @param user_data The user data passed from the foreach function.
989  * @return @c true to continue with the next iteration of the loop,
990  * \n @c false to break out of the loop.
991  *
992  * @pre wifi_direct_foreach_discovered_peers() will invoke this function.
993  *
994  * @see wifi_direct_foreach_discovered_peers()
995  *
996  */
997 typedef bool(*wifi_direct_discovered_peer_cb)   (wifi_direct_discovered_peer_info_s * peer, void *user_data);
998
999
1000 /*****************************************************************************************/
1001 /* wifi_direct_foreach_discovered_peers API function prototype
1002  * int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_cb, void* user_data)
1003  */
1004 /**
1005  * \brief This API shall get the information of all discovered peers. \n
1006  *
1007  * @param callback The callback function to invoke.
1008  * @param user_data The user data passed from the foreach function.
1009  *
1010  * \see wifi_direct_discovered_peer_cb
1011  *
1012  * \par Sync (or) Async:
1013  * This is a Synchronous API.
1014  *
1015  * \warning
1016  *  None
1017  *
1018  * \return Return Type (int) \n
1019  * - WIFI_DIRECT_ERROR_NONE on success \n
1020  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1021  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1022  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1023  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1024  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1025  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1026  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1027  *
1028  *
1029  * \par Prospective Clients:
1030  * External Apps.
1031  *
1032  * \code
1033  *
1034  * #include <wifi-direct.h>
1035  *
1036  * bool _cb_discovered_peers_impl(wifi_direct_discovered_peer_info_s* peer, void* user_data)
1037  * {
1038  *      struct appdata* ad = (struct appdata*) user_data;
1039  *      
1040  *      if(NULL != peer)
1041  *      {
1042  *              if ( ad->peer_count >= MAX_PEER_NUM )
1043  *                      return false;   // break out of the loop
1044  *
1045  *              memcpy(&ad->peer_list[ad->peer_count], peer, sizeof(wifi_direct_discovered_peer_info_s));
1046  *              ad->peer_count++;
1047  *      }
1048  *
1049  *      return true;    // continue with the next iteration of the loop
1050  * }
1051  *
1052  *
1053  * void foo()
1054  * {
1055  *      int result;
1056  *
1057  *      ad->peer_list = NULL;
1058  *      ad->peer_count = 0;
1059  *      ad ->selected_peer_index = 0;
1060  *      result = wifi_direct_foreach_discovered_peers(_cb_discovered_peers_impl, (void*)ad);
1061  *
1062  *      if(result == WIFI_DIRECT_ERROR_NONE)......... // get discovery result is successful
1063  *
1064  *\endcode
1065  *
1066  *\remarks None.
1067  *
1068  ******************************************************************************/
1069 int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_cb
1070                                                                                  callback, void *user_data);
1071
1072
1073 /*****************************************************************************************/
1074 /* wifi_direct_connect API function prototype
1075  * int wifi_direct_connect(const char* mac_address);
1076  */
1077 /**
1078  * \brief This API shall connect to specified peer by automatically determining whether to perform group \n
1079  * formation, join an existing group, invite, re-invoke a group. The decision is \n
1080  * based on the current state of the peers (i.e. GO, STA, not connected) and the \n
1081  * availability of persistent data. \n
1082  *
1083  * @param mac_addr Device address of target peer.
1084  *
1085  * \par Sync (or) Async:
1086  * This is a Asynchronous API.
1087  *
1088  * \warning
1089  *  None
1090  *
1091  *
1092  * \par Async Response Message:
1093  *    - WIFI_DIRECT_CONNECTION_IN_PROGRESS :  Applications will receive this event
1094  *                                   via callback when the connection process is started.
1095  *    - WIFI_DIRECT_CONNECTION_RSP :  Applications will receive this event
1096  *                                   via callback when the connection process is completed or failed.
1097  *
1098  * \return Return Type (int) \n
1099  * - WIFI_DIRECT_ERROR_NONE on success \n
1100  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1101  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1102  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1103  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1104  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1105  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1106  * - WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT for "Connection timed out" \n
1107  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1108  * - WIFI_DIRECT_ERROR_CONNECTION_FAILED for "Create Link fail" \n
1109  * - WIFI_DIRECT_ERROR_AUTH_FAILED for "Create Link Auth fail" \n
1110  *
1111  *
1112  * \par Prospective Clients:
1113  * External Apps.
1114  *
1115  * \code
1116  *
1117  * #include <wifi-direct.h>
1118  *
1119  * void foo(unsigned char* mac_addr)
1120  * {
1121
1122  * int result;
1123  *
1124  * result = wifi_direct_connect(mac_addr);
1125  *
1126  * if(result == WIFI_DIRECT_ERROR_NONE)......... // connect request is successful
1127  *
1128  *\endcode
1129  *
1130  *\remarks This API will try to send provisioning request befre connecting.
1131  *
1132  ******************************************************************************/
1133 int wifi_direct_connect(const char *mac_address);
1134
1135
1136 /*****************************************************************************************/
1137 /* wifi_direct_disconnect_all API function prototype
1138  * int wifi_direct_disconnect_all(void);
1139  */
1140 /**
1141  * \brief This API shall tear down all connected links to peers (stop soft AP, and close interface).  \n
1142  *
1143  * \see wifi_direct_connect
1144  *
1145  * \par Sync (or) Async:
1146  * This is a Asynchronous API.
1147  *
1148  * \warning
1149  *  None
1150  *
1151  *
1152  * \par Async Response Message:
1153  *    - WIFI_DIRECT_DISCONNECTION_RSP :  Applications will receive this event
1154  *                                   via callback when the disconnection process is completed.
1155  *                          
1156  *
1157  * \return Return Type (int) \n
1158  * - WIFI_DIRECT_ERROR_NONE on success \n
1159  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1160  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1161  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1162  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1163  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1164  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1165  *
1166  *
1167  * \par Prospective Clients:
1168  * External Apps.
1169  *
1170  * \code
1171  *
1172  * #include <wifi-direct.h>
1173  *
1174  * void foo(void)
1175  * {
1176
1177  * int result;
1178  *
1179  * result = wifi_direct_disconnect_all();
1180  *
1181  * if(result == WIFI_DIRECT_ERROR_NONE)......... // disconnect request is successful
1182  *
1183  *\endcode
1184  *
1185  *\remarks None.
1186  *
1187  ******************************************************************************/
1188 int wifi_direct_disconnect_all(void);
1189
1190
1191
1192 /*****************************************************************************************/
1193 /* wifi_direct_disconnect API function prototype
1194  * int wifi_direct_disconnect(const char* mac_address);
1195  */
1196 /**
1197  * \brief This API shall disconnect the specified peer by mac address. 
1198  *
1199  * @param mac_addr Device address of target peer.
1200  *
1201  * \see
1202  *
1203  * \par Sync (or) Async:
1204  * This is a Asynchronous API.
1205  *
1206  * \warning
1207  *  None
1208  *
1209  *
1210  * \par Async Response Message:
1211  *    - WIFI_DIRECT_DISCONNECTION_RSP :  Applications will receive a this event
1212  *                                   via callback when a peer is disconnected.
1213  *
1214  * \return Return Type (int) \n
1215  * - WIFI_DIRECT_ERROR_NONE on success \n
1216  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1217  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1218  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1219  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1220  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1221  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1222  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1223  *
1224  *
1225  * \par Prospective Clients:
1226  * External Apps.
1227  *
1228  * \code
1229  *
1230  * #include <wifi-direct.h>
1231  *
1232  * void foo(unsigned char* mac_addr)
1233  * {
1234
1235  * int result;
1236  *
1237  * result = wifi_direct_disconnect(mac_addr);
1238  *
1239  * if(result == WIFI_DIRECT_ERROR_NONE)......... // disconnect request is successful
1240  *
1241  *\endcode
1242  *
1243  *\remarks None.
1244  *
1245  ******************************************************************************/
1246 int wifi_direct_disconnect(const char *mac_address);
1247
1248
1249
1250 /**
1251  * connected peers notification callback function type. \n
1252  *
1253  * @param peer The connected peer information.
1254  * @param user_data The user data passed from the foreach function.
1255  * @return @c true to continue with the next iteration of the loop,
1256  * \n @c false to break out of the loop.
1257  *
1258  * @pre wifi_direct_foreach_connected_peers() will invoke this function.
1259  *
1260  * @see wifi_direct_foreach_connected_peers()
1261  *
1262  */
1263 typedef bool(*wifi_direct_connected_peer_cb) (wifi_direct_connected_peer_info_s
1264                                                                                   * peer, void *user_data);
1265
1266
1267 /*****************************************************************************************/
1268 /* wifi_direct_foreach_connected_peers API function prototype
1269  * int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb, void* user_data)
1270  */
1271 /**
1272  * \brief This API shall get the information of all connected peers. \n
1273  *
1274  * @param callback The callback function to invoke.
1275  * @param user_data The user data passed from the foreach function.
1276  *
1277  * \see wifi_direct_connected_peer_cb
1278  *
1279  * \par Sync (or) Async:
1280  * This is a Synchronous API.
1281  *
1282  * \warning
1283  *  None
1284  *
1285  * \return Return Type (int) \n
1286  * - WIFI_DIRECT_ERROR_NONE on success \n
1287  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1288  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1289  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1290  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1291  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1292  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1293  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1294  *
1295  * \par Prospective Clients:
1296  * External Apps.
1297  *
1298  * \code
1299  *
1300  * #include <wifi-direct.h>
1301  *
1302  * bool _cb_connected_peers_impl(wifi_direct_connected_peer_info_s* peer, void* user_data)
1303  *{
1304  *      
1305  *      struct appdata* ad = (struct appdata*) user_data;
1306  *
1307  *      if(NULL != peer)
1308  *      {
1309  *              if ( ad->connected_peer_count >= MAX_PEER_NUM )
1310  *                      return false;   // break out of the loop
1311  *              
1312  *              memcpy(&ad->connected_peer_list[ad->connected_peer_count], peer, sizeof(wifi_direct_connected_peer_info_s));
1313  *              ad->connected_peer_count++;
1314  *              
1315  *      }
1316  *
1317  *      return true;    // continue with the next iteration of the loop
1318  *}
1319  *
1320  * void foo()
1321  * {
1322  *      int result;
1323  *
1324  *      ad->connected_peer_list = NULL;
1325  *      ad->connected_peer_count = 0;
1326  *
1327  *      result = wifi_direct_foreach_connected_peers(_cb_connected_peers_impl, (void*)ad);
1328  *
1329  * if(result == WIFI_DIRECT_ERROR_NONE)......... // get discovery result is successful
1330  *
1331  *\endcode
1332  *
1333  *\remarks None.
1334  *
1335  ******************************************************************************/
1336 int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb
1337                                                                                 callback, void *user_data);
1338
1339
1340
1341 /*****************************************************************************************/
1342 /* wifi_direct_create_group API function prototype
1343  * int wifi_direct_create_group();
1344  */
1345 /**
1346  * \brief This API shall set up device as a Group Owner and wait for clients to connect. \n
1347  * Create a soft AP, start the WPS registrar, start the DHCP server. \n
1348  *
1349  * \see wifi_direct_destroy_group
1350  *
1351  * \par Sync (or) Async:
1352  * This is a Asynchronous API.
1353  *
1354  * \warning
1355  *  None
1356  *
1357  *
1358  * \par Async Response Message:
1359  *    - WIFI_DIRECT_GROUP_CREATED :  Applications will receive this event
1360  *                                   via callback when the group creating request is successful. \n
1361  *                                Errorcode will be set to the WFD_ERROR_CREATE_LINK_FAIL value. \n
1362  *
1363  * \return Return Type (int) \n
1364  * - WIFI_DIRECT_ERROR_NONE on success \n
1365  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1366  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1367  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1368  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1369  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1370  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1371  * - WIFI_DIRECT_ERROR_CONNECTION_FAILED for "Create Link fail" \n
1372  * - WIFI_DIRECT_ERROR_AUTH_FAILED for "Create Link Auth fail" \n
1373  *
1374  *
1375  * \par Prospective Clients:
1376  * External Apps.
1377  *
1378  * \code
1379  *
1380  * #include <wifi-direct.h>
1381  *
1382  * void foo()
1383  * {
1384
1385  * int result;
1386  *
1387  * result = wifi_direct_create_group();
1388  *
1389  * if(result == WIFI_DIRECT_ERROR_NONE)......... // create group request is successful
1390  *
1391  *\endcode
1392  *
1393  *\remarks None.
1394  *
1395  ******************************************************************************/
1396 int wifi_direct_create_group(void);
1397
1398
1399
1400 /*****************************************************************************************/
1401 /* wifi_direct_destroy_group API function prototype
1402  * int wifi_direct_destroy_group();
1403  */
1404 /**
1405  * \brief This API shall cancel P2P Group create or tear down a P2P Group that we own. \n
1406  *
1407  * \see wifi_direct_create_group
1408  *
1409  * \par Sync (or) Async:
1410  * This is a Asynchronous API.
1411  *
1412  * \warning
1413  *  None
1414  *
1415  *
1416  * \par Async Response Message:
1417  *    - WIFI_DIRECT_GROUP_DESTROYED :  Applications will receive this event via callback when the group is cancelled. \n
1418  *
1419  * \return Return Type (int) \n
1420  * - WIFI_DIRECT_ERROR_NONE on success \n
1421  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1422  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1423  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1424  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1425  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1426  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1427  * - WIFI_DIRECT_ERROR_CONNECTION_FAILED for "Create Link fail" \n
1428  * - WIFI_DIRECT_ERROR_AUTH_FAILED for "Create Link Auth fail" \n
1429  *
1430  *
1431  * \par Prospective Clients:
1432  * External Apps.
1433  *
1434  * \code
1435  *
1436  * #include <wifi-direct.h>
1437  *
1438  * void foo()
1439  * {
1440
1441  * int result;
1442  *
1443  * result = wifi_direct_destroy_group();
1444  *
1445  * if(result == WIFI_DIRECT_ERROR_NONE)......... // cancel group request is successful
1446  *
1447  *\endcode
1448  *
1449  *\remarks None.
1450  *
1451  ******************************************************************************/
1452 int wifi_direct_destroy_group(void);
1453
1454
1455 /*****************************************************************************************/
1456 /* wifi_direct_is_group_owner API function prototype
1457  * int wifi_direct_is_group_owner(bool *owner);
1458  */
1459 /**
1460  * \brief This API shall check whether the currunt client is group owner or not.
1461  * @param owner              Memory to store the value of TURE or FALSE. Application must allocate memory.
1462  *
1463  * \see wifi_direct_create_group
1464  *
1465  * \par Sync (or) Async:
1466  * This is a Synchronous API.
1467  *
1468  * \warning
1469  *  None
1470  *
1471  * \return Return Type (int) \n
1472  * - WIFI_DIRECT_ERROR_NONE on success \n
1473  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1474  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1475  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1476  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1477  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1478  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1479  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1480  *
1481  * \par Prospective Clients:
1482  * External Apps.
1483  *
1484  * \code
1485  *
1486  * #include <wifi-direct.h>
1487  *
1488  * void foo(void)
1489  * {
1490
1491  * int result;
1492  * bool owner;
1493  *
1494  * result = wifi_direct_is_group_owner(&owner);
1495  *
1496  *
1497  * if(result == WIFI_DIRECT_ERROR_NONE)......... // checking the value is successful
1498  *
1499  *\endcode
1500  *
1501  *\remarks None.
1502  *
1503  ******************************************************************************/
1504 int wifi_direct_is_group_owner(bool * is_group_owner);
1505
1506
1507
1508 /*****************************************************************************************/
1509 /* wifi_direct_is_autonomous_group API function prototype
1510  * int wifi_direct_is_autonomous_group(bool *autonomous_group);
1511  */
1512 /**
1513  * \brief This API shall check whether the currunt group is autonomous group or not.
1514  * @param autonomous_group              Memory to store the value of TURE or FALSE. Application must allocate memory.
1515  *
1516  * \see wifi_direct_create_group
1517  *
1518  * \par Sync (or) Async:
1519  * This is a Synchronous API.
1520  *
1521  * \warning
1522  *  None
1523  *
1524  * \return Return Type (int) \n
1525  * - WIFI_DIRECT_ERROR_NONE on success \n
1526  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1527  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1528  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1529  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1530  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1531  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1532  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1533  *
1534  * \par Prospective Clients:
1535  * External Apps.
1536  *
1537  * \code
1538  *
1539  * #include <wifi-direct.h>
1540  *
1541  * void foo(void)
1542  * {
1543
1544  * int result;
1545  * bool autonomous_group;
1546  *
1547  * result = wifi_direct_is_autonomous_group(&autonomous_group);
1548  *
1549  *
1550  * if(result == WIFI_DIRECT_ERROR_NONE)......... // checking the value is successful
1551  *
1552  *\endcode
1553  *
1554  *\remarks None.
1555  *
1556  ******************************************************************************/
1557 int wifi_direct_is_autonomous_group(bool * is_autonomous_group);
1558
1559
1560
1561
1562 /*****************************************************************************************/
1563 /* wifi_direct_set_ssid API function prototype
1564  * int wifi_direct_set_ssid(const char* ssid);
1565  */
1566 /**
1567  * \brief This API shall set or update ssid of local device. \n 
1568  * @param ssid              new ssid to set. Application must set the new ssid before.
1569  *
1570  * \see wifi_direct_get_ssid
1571  *
1572  * \par Sync (or) Async:
1573  * This is a Synchronous API.
1574  *
1575  * \warning
1576  *  None
1577  *
1578  *
1579  * \return Return Type (int) \n
1580  * - WIFI_DIRECT_ERROR_NONE on success \n
1581  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1582  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1583  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1584  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1585  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1586  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1587  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1588  *
1589  *
1590  * \par Prospective Clients:
1591  * External Apps.
1592  *
1593  * \code
1594  *
1595  * #include <wifi-direct.h>
1596  *
1597  * void foo()
1598  * {
1599  * int  result;
1600  * char ssid[11] = {0,};
1601  *
1602  * memset(pin, 0x00, sizeof(pin));
1603  * printf("Input 8 digit PIN number :\n");
1604  * scanf("%s", pin);
1605  *
1606  *if( strlen(ssid) > 0 )
1607  *      result = wifi_direct_set_ssid(ssid);
1608  * 
1609  * if(result == WIFI_DIRECT_ERROR_NONE)......... // setting ssid is successful
1610  *
1611  *\endcode
1612  *
1613  *\remarks When the wifi direct is re-activated, ssid will be reset to the device name. \n
1614  *             
1615  *
1616  ******************************************************************************/
1617 int wifi_direct_set_ssid(const char *ssid);
1618
1619
1620 /*****************************************************************************************/
1621 /* wifi_direct_get_ssid API function prototype
1622  * int wifi_direct_get_ssid(char** ssid)
1623  */
1624 /**
1625  * \brief This API shall get ssid of local device. \n
1626  * @param ssid              Pointer to store ssid. Application must free this memory.
1627  *
1628  * \par Sync (or) Async:
1629  * This is a Synchronous API.
1630  *
1631  * \warning
1632  *  None
1633  *
1634  *
1635  * \return Return Type (int) \n
1636  * - WIFI_DIRECT_ERROR_NONE on success \n
1637  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1638  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1639  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1640  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1641  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1642  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1643  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1644  *
1645  *
1646  * \par Prospective Clients:
1647  * External Apps.
1648  *
1649  * \code
1650  *
1651  * #include <wifi-direct.h>
1652  *
1653  * void foo()
1654  * {
1655  * int  result;
1656  * char* ssid = NULL;
1657  *
1658  * result = wifi_direct_get_ssid(&ssid);
1659  *
1660  * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting ssid is successful
1661  *
1662  * free(ssid); // Application should free the memory.
1663  *
1664  *
1665  *\endcode
1666  *
1667  *\remarks None.
1668  *
1669  ******************************************************************************/
1670 int wifi_direct_get_ssid(char **ssid);
1671
1672
1673 /*****************************************************************************************/
1674 /* wifi_direct_get_ip_address API function prototype
1675  * int wifi_direct_get_ip_address(char** ip_address)
1676  */
1677 /**
1678  * \brief This API shall get IP address of local device interface. \n
1679  * @param ip_addr              Pointer to store ip address. Application must free this memory.
1680  *
1681  * \par Sync (or) Async:
1682  * This is a Synchronous API.
1683  *
1684  * \warning
1685  *  None
1686  *
1687  *
1688  * \return Return Type (int) \n
1689  * - WIFI_DIRECT_ERROR_NONE on success \n
1690  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1691  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1692  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1693  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1694  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1695  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1696  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1697  *
1698  *
1699  * \par Prospective Clients:
1700  * External Apps.
1701  *
1702  * \code
1703  *
1704  * #include <wifi-direct.h>
1705  *
1706  * void foo()
1707  * {
1708  * int  result;
1709  * char* ip = NULL;
1710  *
1711  * result = wifi_direct_get_ip_address(&ip);
1712  *
1713  * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting IP is successful
1714  *
1715  * free(ip); // Application should free the memory.
1716  *
1717  *\endcode
1718  *
1719  *\remarks None.
1720  *
1721  ******************************************************************************/
1722 int wifi_direct_get_ip_address(char **ip_address);
1723
1724
1725 /*****************************************************************************************/
1726 /* wifi_direct_get_mac_addr API function prototype
1727  * int wifi_direct_get_mac_address(char **mac_address)
1728  */
1729 /**
1730  * \brief This API shall get device MAC address of local device.\n
1731  * @param mac_addr              Pointer to store MAC address. Application must free this memory.
1732  *
1733  * \par Sync (or) Async:
1734  * This is a Synchronous API.
1735  *
1736  * \warning
1737  *  None
1738  *
1739  *
1740  * \return Return Type (int) \n
1741  * - WIFI_DIRECT_ERROR_NONE on success \n
1742  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1743  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1744  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1745  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1746  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1747  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1748  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1749  *
1750  *
1751  * \par Prospective Clients:
1752  * External Apps.
1753  *
1754  * \code
1755  *
1756  * #include <wifi-direct.h>
1757  *
1758  * void foo()
1759  * {
1760  * int  result;
1761  * char* mac_addr =NULL;
1762  *
1763  * result = wifi_direct_get_mac_addr(&mac_addr);
1764  *
1765  * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting device MAC is successful
1766  *
1767  *\endcode
1768  *
1769  *\remarks None.
1770  *
1771  ******************************************************************************/
1772 int wifi_direct_get_mac_address(char **mac_address);
1773
1774
1775 /*****************************************************************************************/
1776 /* wifi_direct_get_state API function prototype
1777  * int wifi_direct_get_state(wifi_direct_state_e * status);
1778  */
1779 /**
1780  * \brief This API shall get current Wi-Fi direct link status. \n
1781  * @param status Memory to store link status information. Application must allocate memory.
1782  *
1783  * \see wifi_direct_state_e
1784  *
1785  * \par Sync (or) Async:
1786  * This is a Synchronous API.
1787  *
1788  * \warning
1789  *  None
1790  *
1791  *
1792  * \return Return Type (int) \n
1793  * - WIFI_DIRECT_ERROR_NONE on success \n
1794  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1795  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1796  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1797  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1798  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1799  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1800  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1801  *
1802  *
1803  * \par Prospective Clients:
1804  * External Apps.
1805  *
1806  * \code
1807  *
1808  * #include <wifi-direct.h>
1809  *
1810  * void foo()
1811  * {
1812  * int result;
1813  * wifi_direct_state_e status;
1814  *
1815  * result = wifi_direct_get_state(&status);
1816  *
1817  * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting link status is successful
1818  *
1819  *\endcode
1820  *
1821  *\remarks None.
1822  *
1823  ******************************************************************************/
1824 int wifi_direct_get_state(wifi_direct_state_e * state);
1825
1826
1827 /*****************************************************************************************/
1828 /* wifi_direct_accept_connection API function prototype
1829  * int wifi_direct_accept_connection(char* mac_address);
1830  */
1831 /**
1832  * \brief This API shall accept connection request from specified peer. \n
1833  * This API shall be used to respond the connection request event, WIFI_DIRECT_CONNECTION_REQ.
1834  *
1835  * @param mac_addr Device address of target peer.
1836  *
1837  * \see wifi_direct_connect
1838  *
1839  * \par Sync (or) Async:
1840  * This is a Asynchronous API.
1841  *
1842  * \warning
1843  *  None
1844  *
1845  * \par Async Response Message:
1846  *    - WIFI_DIRECT_CONNECTION_IN_PROGRESS :  Applications will receive this event
1847  *                                   via callback when the connection process is started.
1848  *    - WIFI_DIRECT_CONNECTION_RSP :  Applications will receive this event
1849  *                                   via callback when the connection process is completed or failed.
1850  *
1851  * \return Return Type (int) \n
1852  * - WIFI_DIRECT_ERROR_NONE on success \n
1853  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1854  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1855  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1856  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1857  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1858  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1859  * - WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT for "Connection timed out" \n
1860  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1861  * - WIFI_DIRECT_ERROR_CONNECTION_FAILED for "Create Link fail" \n
1862  * - WIFI_DIRECT_ERROR_AUTH_FAILED for "Create Link Auth fail" \n
1863  *
1864  *
1865  * \par Prospective Clients:
1866  * External Apps.
1867  *
1868  * \code
1869  *
1870  * #include <wifi-direct.h>
1871  *
1872  * void foo(unsigned char* mac_addr)
1873  * {
1874  * int result;
1875  *
1876  * result = wifi_direct_accept_connection(mac_addr);
1877  *
1878  * if(result == WIFI_DIRECT_ERROR_NONE)......... // connect request is successful
1879  *
1880  *\endcode
1881  *
1882  *\remarks This API will not try to send provisioning request.
1883  *
1884  ******************************************************************************/
1885 int wifi_direct_accept_connection(char *mac_address);
1886
1887
1888 /*****************************************************************************************/
1889 /* wifi_direct_get_go_intent API function prototype
1890  * int wifi_direct_get_go_intent(int * intent);
1891  */
1892 /**
1893  * \brief This API shall get GO intent value. \n
1894  * @param * intent              variable to store intent value. Application must allocate memory.
1895  *
1896  * \par Sync (or) Async:
1897  * This is a Synchronous API.
1898  *
1899  * \warning
1900  *  None
1901  *
1902  *
1903  * \return Return Type (int) \n
1904  * - WIFI_DIRECT_ERROR_NONE on success \n
1905  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1906  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1907  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1908  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1909  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1910  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1911  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1912  *
1913  * \par Prospective Clients:
1914  * External Apps.
1915  *
1916  * \code
1917  *
1918  * #include <wifi-direct.h>
1919  *
1920  * void foo()
1921  * {
1922  * int  result;
1923  * int go_intent;
1924  *
1925  * result = wifi_direct_get_go_intent(&go_intent);
1926  *
1927  * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting GO intent is successful
1928  *
1929  *\endcode
1930  *
1931  *\remarks None.
1932  *
1933  ******************************************************************************/
1934 int wifi_direct_get_go_intent(int *intent);
1935
1936
1937
1938 /*****************************************************************************************/
1939 /* wifi_direct_set_wpa_passphrase API function prototype
1940  * int wifi_direct_set_wpa_passphrase(char* passphrase)
1941  */
1942 /**
1943  * \brief This API shall set or update wpa password. If a client create Group (Soft AP), this password will be used. \n
1944  * @param passphrase              new wpa password to set. Application must set the new password before.
1945  *
1946  *
1947  * \par Sync (or) Async:
1948  * This is a Synchronous API.
1949  *
1950  * \warning
1951  *  None
1952  *
1953  *
1954  * \return Return Type (int) \n
1955  * - WIFI_DIRECT_ERROR_NONE on success \n
1956  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
1957  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
1958  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
1959  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
1960  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
1961  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
1962  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
1963  *
1964  * \par Prospective Clients:
1965  * External Apps.
1966  *
1967  * \code
1968  *
1969  * #include <wifi-direct.h>
1970  *
1971  * void foo()
1972  * {
1973  * int  result;
1974  * char new_wpa[64+1] = {0,};
1975  *
1976  * printf("Input new WPA:\n");
1977  * scanf("%s",new_wpa);
1978  *
1979  *if( strlen(new_wpa) > 0 )
1980  *      result = wifi_direct_set_wpa_passphrase(new_wpa);
1981  * 
1982  * if(result == WIFI_DIRECT_ERROR_NONE)......... // setting password is successful
1983  *
1984  *\endcode
1985  *
1986  *\remarks None.
1987  *
1988  ******************************************************************************/
1989 int wifi_direct_set_wpa_passphrase(char *passphrase);
1990
1991
1992 /*****************************************************************************************/
1993 /* wifi_direct_activate_pushbutton API function prototype
1994  * int wifi_direct_activate_pushbutton(void);
1995  */
1996 /**
1997  * \brief This API shall start wps PBC.
1998
1999  * \pre Device must support the pbc button mode.
2000  *
2001  * \see wifi_direct_get_supported_wps_mode
2002  *
2003  * \par Sync (or) Async:
2004  * This is a Synchronous API.
2005  *
2006  * \warning
2007  *  None
2008  *
2009  * \return Return Type (int) \n
2010  * - WIFI_DIRECT_ERROR_NONE on success \n
2011  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
2012  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
2013  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
2014  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
2015  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
2016  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
2017  *
2018  * \par Prospective Clients:
2019  * External Apps.
2020  *
2021  * \code
2022  *
2023  * #include <wifi-direct.h>
2024  *
2025  * void foo(void)
2026  * {
2027
2028  * int result;
2029  *
2030  * result = wifi_direct_activate_pushbutton();
2031  *
2032  * if(result == WIFI_DIRECT_ERROR_NONE)......... // activating push button is successful
2033  *
2034  *\endcode
2035  *
2036  *\remarks None.
2037  *
2038  ******************************************************************************/
2039 int wifi_direct_activate_pushbutton(void);
2040
2041
2042 /*****************************************************************************************/
2043 /* wifi_direct_set_wps_pin API function prototype
2044  * int wifi_direct_set_wps_pin(char* pin)
2045  */
2046 /**
2047  * \brief This API shall set or update the WPS PIN number user expects. \n
2048  * @param pin              new pin to set. Application must set the new pin number before.
2049  *
2050  * \see wifi_direct_generate_wps_pin.
2051  * \see wifi_direct_get_wps_pin
2052  *
2053  * \par Sync (or) Async:
2054  * This is a Synchronous API.
2055  *
2056  * \warning
2057  *  None
2058  *
2059  *
2060  * \return Return Type (int) \n
2061  * - WIFI_DIRECT_ERROR_NONE on success \n
2062  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
2063  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
2064  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
2065  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
2066  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
2067  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
2068  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
2069  *
2070  *
2071  * \par Prospective Clients:
2072  * External Apps.
2073  *
2074  * \code
2075  *
2076  * #include <wifi-direct.h>
2077  *
2078  * void foo()
2079  * {
2080  * int  result;
2081  * char pin[WIFI_DIRECT_WPS_PIN_LEN+1]= { 0, };
2082  *
2083  * memset(pin, 0x00, sizeof(pin));
2084  * printf("Input 8 digit PIN number :\n");
2085  * scanf("%s", pin);
2086  *
2087  *if( strlen(pin) > 0 )
2088  *      result = wifi_direct_set_wps_pin(pin);
2089  * 
2090  * if(result == WIFI_DIRECT_ERROR_NONE)......... // setting wps pin number is successful
2091  *
2092  *\endcode
2093  *
2094  *\remarks None.
2095  *
2096  ******************************************************************************/
2097 int wifi_direct_set_wps_pin(char *pin);
2098
2099
2100 /*****************************************************************************************/
2101 /* wifi_direct_get_wps_pin API function prototype
2102  * int wifi_direct_get_wps_pin(char** pin)
2103  */
2104 /**
2105  * \brief This API shall get the WPS PIN number. \n
2106  * @param pin              Pointer to store pin number. Application must free this memory.
2107  *
2108  * \see wifi_direct_set_wps_pin
2109  *
2110  * \par Sync (or) Async:
2111  * This is a Synchronous API.
2112  *
2113  * \warning
2114  *  None
2115  *
2116  *
2117  * \return Return Type (int) \n
2118  * - WIFI_DIRECT_ERROR_NONE on success \n
2119  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
2120  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
2121  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
2122  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
2123  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
2124  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
2125  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
2126  *
2127  *
2128  * \par Prospective Clients:
2129  * External Apps.
2130  *
2131  * \code
2132  *
2133  * #include <wifi-direct.h>
2134  *
2135  * void foo()
2136  * {
2137  * int  result;
2138  * char* pin = NULL;
2139  *
2140  * result = wifi_direct_get_wps_pin(&pin);
2141  * 
2142  * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting wps pin number is successful
2143  *
2144  * free(pin); // Application should free the memory.
2145  *
2146  *\endcode
2147  *
2148  *\remarks None.
2149  *
2150  ******************************************************************************/
2151 int wifi_direct_get_wps_pin(char **pin);
2152
2153
2154 /*****************************************************************************************/
2155 /* wifi_direct_generate_wps_pin API function prototype
2156  * wifi_direct_generate_wps_pin(void);
2157  */
2158 /**
2159  * \brief This API shall generate the random WPS PIN number.\n
2160  *              To get the generated PIN number, use wifi_direct_get_wps_pin() API.
2161  *
2162  * \see wifi_direct_set_wps_pin
2163  * \see wifi_direct_get_wps_pin
2164  *
2165  * \par Sync (or) Async:
2166  * This is a Synchronous API.
2167  *
2168  * \warning
2169  *  None
2170  *
2171  *
2172  * \return Return Type (int) \n
2173  * - WIFI_DIRECT_ERROR_NONE on success \n
2174  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
2175  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
2176  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
2177  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
2178  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
2179  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
2180  *
2181  *
2182  * \par Prospective Clients:
2183  * External Apps.
2184  *
2185  * \code
2186  *
2187  * #include <wifi-direct.h>
2188  *
2189  * void foo()
2190  * {
2191  * int  result;
2192  *
2193  * result = wifi_direct_generate_wps_pin();
2194  * 
2195  * if(result == WIFI_DIRECT_ERROR_NONE)......... // generating wps pin number is successful
2196  *
2197  *\endcode
2198  *
2199  *\remarks None.
2200  *
2201  ******************************************************************************/
2202 int wifi_direct_generate_wps_pin(void);
2203
2204
2205 /*****************************************************************************************/
2206 /* wifi_direct_get_supported_wps_mode API function prototype
2207  * int wifi_direct_get_supported_wps_mode(int *wps_mode);
2208  */
2209 /**
2210  * \brief This API shall get the supported wps mode. \n
2211  *              The result is bit flag.
2212  *
2213  * @param wps_mode              Memory to store supported wps mode. Application must allocate memory.
2214  *
2215  * \see wifi_direct_wps_cfg_e
2216  *
2217  * \par Sync (or) Async:
2218  * This is a Synchronous API.
2219  *
2220  * \warning
2221  *  None
2222  *
2223  *
2224  * \return Return Type (int) \n
2225  * - WIFI_DIRECT_ERROR_NONE on success \n
2226  * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
2227  * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
2228  * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
2229  * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
2230  * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
2231  * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
2232  * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
2233  *
2234  *
2235  * \par Prospective Clients:
2236  * External Apps.
2237  *
2238  * \code
2239  *
2240  * #include <wifi-direct.h>
2241  *
2242  * void foo()
2243  * {
2244  * int  result;
2245  * int supported_wps_mode = 0;
2246  *
2247  * result = wifi_direct_get_supported_wps_mode(&supported_wps_mode);
2248  * 
2249  * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting supported wps mode is successful
2250  *
2251  *\endcode
2252  *
2253  *\remarks None.
2254  *
2255  ******************************************************************************/
2256 int wifi_direct_get_supported_wps_mode(int *wps_mode);
2257
2258
2259 /*****************************************************************************************/
2260 /* wifi_direct_get_config_data API function prototype
2261 * int wifi_direct_get_config_data(wifi_direct_config_data_s** config)
2262 */
2263 /**
2264 * \brief This API shall get Wi-Fi direct configuration data. \n
2265 * @param config Pointer to store configuration information. Application must free this memory.
2266 *
2267 * \see wifi_direct_set_config_data
2268 *
2269 * \par Sync (or) Async:
2270 * This is a Synchronous API.
2271 *
2272 * \warning
2273 *  None
2274 *
2275 *
2276 * \return Return Type (int) \n
2277 * - WIFI_DIRECT_ERROR_NONE on success \n
2278 * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
2279 * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
2280 * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
2281 * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
2282 * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
2283 * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
2284 * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
2285 *
2286 *
2287 * \par Prospective Clients:
2288 * External Apps.
2289 *
2290 * \code
2291 *
2292 * #include <wifi-direct.h>
2293 *
2294 * void foo()
2295 * {
2296 * int result;
2297 * wifi_direct_config_data_s* config;
2298 *
2299 * result = wifi_direct_get_config_data(&config);
2300 *
2301 * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting config data is successful
2302 *
2303 *\endcode
2304 *
2305 *\remarks None.
2306 *
2307 ******************************************************************************/
2308 int wifi_direct_get_config_data(wifi_direct_config_data_s ** config);
2309
2310
2311 /*****************************************************************************************/
2312 /* wifi_direct_set_config_data API function prototype
2313 * int wifi_direct_set_config_data(wifi_direct_config_data_s* config);
2314 */
2315 /**
2316 * \brief This API shall set or update Wi-Fi direct configuration data. \n
2317 * @param config Wi-Fi configuration data to be set
2318 *
2319 * \see wifi_direct_get_config_data
2320 *
2321 * \par Sync (or) Async:
2322 * This is a Synchronous API.
2323 *
2324 * \warning
2325 *  None
2326 *
2327 * \return Return Type (int) \n
2328 * - WIFI_DIRECT_ERROR_NONE on success \n
2329 * - WIFI_DIRECT_ERROR_OPERATION_FAILED for "Unkown error" \n
2330 * - WIFI_DIRECT_ERROR_OUT_OF_MEMORY for "Out of memory" \n
2331 * - WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for "I/O error" \n
2332 * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
2333 * - WIFI_DIRECT_ERROR_INVALID_PARAMETER for "Invalid function parameter" \n
2334 * - WIFI_DIRECT_ERROR_RESOURCE_BUSY for "Device or resource busy" \n
2335 * - WIFI_DIRECT_ERROR_STRANGE_CLIENT for "Invalid Client" \n
2336 *
2337 *
2338 * \par Prospective Clients:
2339 * External Apps.
2340 *
2341 * \code
2342 *
2343 * #include <wifi-direct.h>
2344 *
2345 * void foo()
2346 * {
2347 * int result;
2348 * wifi_direct_config_data_s* config;
2349 *
2350 * result = wifi_direct_get_config_data(&config);
2351 *
2352 * if(result != WIFI_DIRECT_ERROR_NONE)......... // Getting configuration data is not successful
2353 * {
2354 *        return;
2355 * }
2356 *
2357 * // Change params
2358 * config->group_owner_intent = 8;
2359 * config->wps_config = WIFI_DIRECT_WPS_PUSHBUTTON;
2360 * config->want_persistent_group = false;
2361 * config->hide_SSID = false;
2362 * strncpy(config->ssid, "My WiFi Direct", WIFI_DIRECT_MAX_SSID_LEN);
2363 *
2364 * result = wifi_direct_set_config_data(config);
2365 * if(result == WIFI_DIRECT_ERROR_NONE)......... // Setting configuration data is successful
2366 * {
2367 *
2368 *
2369 *
2370 *\endcode
2371 *
2372 *\remarks None.
2373 *
2374 ******************************************************************************/
2375 int wifi_direct_set_config_data(wifi_direct_config_data_s * config);
2376
2377
2378 /**
2379  * @}
2380  */
2381
2382 #ifdef __cplusplus
2383 }
2384 #endif
2385
2386 #endif                                                  //__WIFI_DIRECT_INTERFACE_H_