4 * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Sungsik Jang <sungsik.jang@samsung.com>, Dongwook Lee <dwmax.lee@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #ifndef __WIFI_DIRECT_INTERFACE_H_
23 #define __WIFI_DIRECT_INTERFACE_H_
35 * @addtogroup CAPI_NET_WIFI_DIRECT_MODULE
40 * @brief Enumeration for Wi-Fi Direct error code
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;
61 * @brief Enumeration for Wi-Fi Direct link status
65 WIFI_DIRECT_STATE_DEACTIVATED = 0,
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;
78 * @brief Enumeration for Wi-Fi Direct device state
82 WIFI_DIRECT_DEVICE_STATE_ACTIVATED,
83 WIFI_DIRECT_DEVICE_STATE_DEACTIVATED,
84 } wifi_direct_device_state_e;
87 * @brief Enumeration for Wi-Fi Direct discovery state
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;
98 * @brief Enumeration for Wi-Fi Direct connection state
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;
114 * @brief Enumeration for Wi-Fi Direct secondary device type
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,
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,
176 WIFI_DIRECT_SECONDARY_DEVICE_TYPE_AUDIO_MIC = 6, /**< */
177 } wifi_direct_secondary_device_type_e;
180 * @brief Enumeration for Wi-Fi Direct primary device type
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;
200 * @brief Enumeration for Wi-Fi WPS type
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;
210 * @struct wifi_direct_config_data_s
211 * Wi-Fi Direct configuration data structure
218 /** Specifies the operating channel. If zero, auto channel selection
219 * will be used to find a quiet channel.
223 /** WPS configuration parameters. */
224 wifi_direct_wps_type_e wps_config;
226 /** Max number of STAs allowed associations */
229 /** TRUE to hide SSID in beacons and probe responses, FALSE otherwise. */
232 /** P2P Group owner intent value. */
233 int group_owner_intent;
235 bool want_persistent_group;
237 /** Auto connection mode */
238 bool auto_connection;
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;
246 * @struct wifi_direct_discovered_peer_info_s
247 * Wi-Fi Direct buffer structure to store result of peer discovery
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;
266 * @struct wifi_direct_connected_peer_info_s
267 * Wi-Fi Direct buffer structure to store information of connected peer
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;
281 * Notification callback function type. \n
283 * Discover notifications can occur at the peers or P2P groups are found.
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.
294 typedef void (*wifi_direct_discovery_state_chagned_cb) (int error_code,
295 wifi_direct_discovery_state_e
300 * Notification callback function type. \n
302 * Activation notifications callback function type.
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.
311 typedef void (*wifi_direct_device_state_changed_cb) (int error_code,
312 wifi_direct_device_state_e
317 * connection notification callback function type. \n
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
330 * @param error_code In failure case.
332 * @param param1 additional data for connection. ex) MAC
333 * @param param2 additional data for connection. ex) SSID
335 * @param user_data User can transfer the user specific data in callback.
338 typedef void (*wifi_direct_connection_state_changed_cb) (int error_code,
339 wifi_direct_connection_state_e
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()
356 typedef void (*wifi_direct_client_ip_address_assigned_cb) (const char* mac_address,
357 const char* ip_address,
358 const char* interface_address,
363 /*=============================================================================
364 Wifi Direct Client APIs
365 =============================================================================*/
367 /*****************************************************************************/
368 /* wifi_direct_initialize API function prototype
369 * int wifi_direct_initialize (void);
372 * \brief This API shall register the client application with the Wi-Fi Direct server and initialize the various variables. \n
376 * \post Application is registered.
378 * \see wifi_direct_device_state_changed_cb
379 * \see wifi_direct_discovery_state_chagned_cb
380 * \see wifi_direct_connection_state_changed_cb
382 * \par Sync (or) Async:
383 * This is a Synchronous API.
388 * \return Return Type (int) \n
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
398 * \par Prospective Clients:
404 * #include <wifi-direct.h>
411 * result = wifi_direct_initialize();
413 * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully connected to the wifi direct server
416 ******************************************************************************/
417 int wifi_direct_initialize(void);
420 /*****************************************************************************************/
421 /* wifi_direct_deinitialize API function prototype
422 * int wifi_direct_deinitialize(void);
426 * \brief This API shall deregister the client application with the Wi-Fi Direct server and releases all resources.
428 * \pre Application must be already registered to the Wi-Fi Direct server.
430 * \post Application is de-registered.
432 * \see wifi_direct_initialize
434 * \par Sync (or) Async:
435 * This is a Synchronous API.
441 * \par Async Response Message:
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
454 * \par Prospective Clients:
459 * #include <wifi-direct.h>
466 * result = wifi_direct_deinitialize();
468 * if(result == WIFI_DIRECT_ERROR_NONE)......... // Deregister is successful
474 ******************************************************************************/
475 int wifi_direct_deinitialize(void);
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)
483 * \brief This API shall register the activation callback function and user data from client. \n
485 * \pre The Client should be initialized.
487 * \see wifi_direct_initialize
488 * \see wifi_direct_device_state_changed_cb
490 * \par Sync (or) Async:
491 * This is a Synchronous API.
496 * \param[in] cb Application Callback function pointer to receive Wi-Fi Direct events
497 * \param[in] user_data user data
499 * \return Return Type (int) \n
501 * - WIFI_DIRECT_ERROR_NONE on success \n
502 * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
504 * \par Prospective Clients:
510 * #include <wifi-direct.h>
517 * result = wifi_direct_set_connection_state_changed_cb(_cb_activation, void* user_data);
519 * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully registered the callback function
522 ******************************************************************************/
523 int wifi_direct_set_device_state_changed_cb(wifi_direct_device_state_changed_cb cb, void *user_data);
526 /*****************************************************************************/
527 /* wifi_direct_unset_connection_state_changed_cb API function prototype
528 * int wifi_direct_unset_connection_state_changed_cb(void)
531 * \brief This API shall deregister the activation callback function and user data from client. \n
533 * \pre The Client should be initialized.
535 * \see wifi_direct_initialize
536 * \see wifi_direct_set_connection_state_changed_cb
538 * \par Sync (or) Async:
539 * This is a Synchronous API.
544 * \return Return Type (int) \n
546 * - WIFI_DIRECT_ERROR_NONE on success \n
547 * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
549 * \par Prospective Clients:
555 * #include <wifi-direct.h>
562 * result = wifi_direct_unset_connection_state_changed_cb();
564 * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully deregistered the callback function
567 ******************************************************************************/
568 int wifi_direct_unset_device_state_changed_cb(void);
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)
577 * \brief This API shall register the discover callback function and user data from client. \n
579 * \pre The Client should be initialized.
581 * \see wifi_direct_initialize
582 * \see wifi_direct_discovery_state_chagned_cb
584 * \par Sync (or) Async:
585 * This is a Synchronous API.
590 * \param[in] cb Application Callback function pointer to receive Wi-Fi Direct events
591 * \param[in] user_data user data
593 * \return Return Type (int) \n
595 * - WIFI_DIRECT_ERROR_NONE on success \n
596 * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
598 * \par Prospective Clients:
604 * #include <wifi-direct.h>
611 * result = wifi_direct_set_discovery_state_changed_cb(_cb_discover, void* user_data);
613 * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully registered the callback function
616 ******************************************************************************/
617 int wifi_direct_set_discovery_state_changed_cb(wifi_direct_discovery_state_chagned_cb cb, void *user_data);
620 /*****************************************************************************/
621 /* wifi_direct_unset_discovery_state_changed_cb API function prototype
622 * int wifi_direct_unset_discovery_state_changed_cb(void)
625 * \brief This API shall deregister the discover callback function and user data from client. \n
627 * \pre The Client should be initialized.
629 * \see wifi_direct_initialize
630 * \see wifi_direct_set_discovery_state_changed_cb
632 * \par Sync (or) Async:
633 * This is a Synchronous API.
638 * \return Return Type (int) \n
640 * - WIFI_DIRECT_ERROR_NONE on success \n
641 * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
643 * \par Prospective Clients:
649 * #include <wifi-direct.h>
656 * result = wifi_direct_unset_discovery_state_changed_cb();
658 * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully deregistered the callback function
661 ******************************************************************************/
662 int wifi_direct_unset_discovery_state_changed_cb(void);
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)
671 * \brief This API shall register the connection callback function and user data from client. \n
673 * \pre The Client should be initialized.
675 * \see wifi_direct_initialize
676 * \see wifi_direct_connection_state_changed_cb
678 * \par Sync (or) Async:
679 * This is a Synchronous API.
684 * \param[in] cb Application Callback function pointer to receive Wi-Fi Direct events
685 * \param[in] user_data user data
687 * \return Return Type (int) \n
689 * - WIFI_DIRECT_ERROR_NONE on success \n
690 * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
692 * \par Prospective Clients:
698 * #include <wifi-direct.h>
705 * result = wifi_direct_set_connection_state_changed_cb(_cb_connection, void* user_data);
707 * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully registered the callback function
710 ******************************************************************************/
711 int wifi_direct_set_connection_state_changed_cb(wifi_direct_connection_state_changed_cb cb, void *user_data);
714 /*****************************************************************************/
715 /* wifi_direct_unset_connection_state_changed_cb API function prototype
716 * int wifi_direct_unset_connection_state_changed_cb(void)
719 * \brief This API shall deregister the connection callback function and user data from client. \n
721 * \pre The Client should be initialized.
723 * \see wifi_direct_initialize
724 * \see wifi_direct_set_connection_state_changed_cb
726 * \par Sync (or) Async:
727 * This is a Synchronous API.
732 * \return Return Type (int) \n
734 * - WIFI_DIRECT_ERROR_NONE on success \n
735 * - WIFI_DIRECT_ERROR_NOT_PERMITTED for "Operation not permitted" \n
737 * \par Prospective Clients:
743 * #include <wifi-direct.h>
750 * result = wifi_direct_unset_connection_state_changed_cb();
752 * if(result == WIFI_DIRECT_ERROR_NONE).........// Successfully deregistered the callback function
755 ******************************************************************************/
756 int wifi_direct_unset_connection_state_changed_cb(void);
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()
772 int wifi_direct_set_client_ip_address_assigned_cb(wifi_direct_client_ip_address_assigned_cb cb, void* user_data);
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()
784 int wifi_direct_unset_client_ip_address_assigned_cb(void);
789 /*****************************************************************************************/
790 /* wifi_direct_activate API function prototype
791 * int wifi_direct_activate(void);
795 * \brief This API shall open a wireless adapter device for P2P use.
797 * \pre Application must be already registered to the Wi-Fi Direct server.
799 * \post wireless adapter device will be ready to use.
801 * \see wifi_direct_initialize
803 * \par Sync (or) Async:
804 * This is a Asynchronous API.
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
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
826 * \par Prospective Clients:
831 * #include <wifi-direct.h>
838 * result = wifi_direct_activate();
840 * if(result == WIFI_DIRECT_ERROR_NONE)......... // activation is successful
846 ******************************************************************************/
847 int wifi_direct_activate(void);
850 /*****************************************************************************************/
851 /* wifi_direct_deactivate API function prototype
852 * int wifi_direct_deactivate(void);
856 * \brief This API shall close a wireless adapter device for P2P use
858 * \pre Wireless adapter device must be already opened.
860 * \post wireless adapter device will be closed.
862 * \see wifi_direct_activate
864 * \par Sync (or) Async:
865 * This is a Asynchronous API.
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
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
884 * \par Prospective Clients:
889 * #include <wifi-direct.h>
895 * result = wifi_direct_deactivate();
897 * if(result == WIFI_DIRECT_ERROR_NONE)......... // Deactivation is successful
903 ******************************************************************************/
904 int wifi_direct_deactivate(void);
907 /*****************************************************************************************/
908 /* wifi_direct_start_discovery API function prototype
909 * int wifi_direct_start_discovery(bool listen_only, int timeout);
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
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.
920 * \pre Wireless adapter device must be already opened.
923 * \see wifi_direct_get_discovery_result
925 * \par Sync (or) Async:
926 * This is a Asynchronous API.
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
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
953 * \par Prospective Clients:
958 * #include <wifi-direct.h>
965 * result = wifi_direct_start_discovery(TRUE, 0);
967 * if(result == WIFI_DIRECT_ERROR_NONE)......... // discovery request is successful
971 *\remarks If discover is over, peer can not find the device and the device can not find peer, too.
973 ******************************************************************************/
974 int wifi_direct_start_discovery(bool listen_only, int timeout);
977 /*****************************************************************************************/
978 /* wifi_direct_cancel_discovery API function prototype
979 * int wifi_direct_cancel_discovery(void);
982 * \brief This API shall cancel the discovery process started from wifi_direct_start_discovery. \n
984 * \pre discovery process must be started.
986 * \post discovery process stopped.
988 * \see wifi_direct_client_start_discovery
990 * \par Sync (or) Async:
991 * This is a Asynchronous API.
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.
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
1011 * \par Prospective Clients:
1016 * #include <wifi-direct.h>
1023 * result = wifi_direct_cancel_discovery();
1025 * if(result == WIFI_DIRECT_ERROR_NONE)......... // discovery cancel request is successful
1031 ******************************************************************************/
1032 int wifi_direct_cancel_discovery(void);
1036 * discorverd peers notification callback function type. \n
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.
1043 * @pre wifi_direct_foreach_discovered_peers() will invoke this function.
1045 * @see wifi_direct_foreach_discovered_peers()
1048 typedef bool(*wifi_direct_discovered_peer_cb) (wifi_direct_discovered_peer_info_s * peer, void *user_data);
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)
1056 * \brief This API shall get the information of all discovered peers. \n
1058 * @param callback The callback function to invoke.
1059 * @param user_data The user data passed from the foreach function.
1061 * \see wifi_direct_discovered_peer_cb
1063 * \par Sync (or) Async:
1064 * This is a Synchronous API.
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
1080 * \par Prospective Clients:
1085 * #include <wifi-direct.h>
1087 * bool _cb_discovered_peers_impl(wifi_direct_discovered_peer_info_s* peer, void* user_data)
1089 * struct appdata* ad = (struct appdata*) user_data;
1093 * if ( ad->peer_count >= MAX_PEER_NUM )
1094 * return false; // break out of the loop
1096 * memcpy(&ad->peer_list[ad->peer_count], peer, sizeof(wifi_direct_discovered_peer_info_s));
1100 * return true; // continue with the next iteration of the loop
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);
1113 * if(result == WIFI_DIRECT_ERROR_NONE)......... // get discovery result is successful
1119 ******************************************************************************/
1120 int wifi_direct_foreach_discovered_peers(wifi_direct_discovered_peer_cb
1121 callback, void *user_data);
1124 /*****************************************************************************************/
1125 /* wifi_direct_connect API function prototype
1126 * int wifi_direct_connect(const char* mac_address);
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
1134 * @param mac_addr Device address of target peer.
1136 * \par Sync (or) Async:
1137 * This is a Asynchronous API.
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.
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
1163 * \par Prospective Clients:
1168 * #include <wifi-direct.h>
1170 * void foo(unsigned char* mac_addr)
1175 * result = wifi_direct_connect(mac_addr);
1177 * if(result == WIFI_DIRECT_ERROR_NONE)......... // connect request is successful
1181 *\remarks This API will try to send provisioning request befre connecting.
1183 ******************************************************************************/
1184 int wifi_direct_connect(const char *mac_address);
1187 /*****************************************************************************************/
1188 /* wifi_direct_disconnect_all API function prototype
1189 * int wifi_direct_disconnect_all(void);
1192 * \brief This API shall tear down all connected links to peers (stop soft AP, and close interface). \n
1194 * \see wifi_direct_connect
1196 * \par Sync (or) Async:
1197 * This is a Asynchronous API.
1203 * \par Async Response Message:
1204 * - WIFI_DIRECT_DISCONNECTION_RSP : Applications will receive this event
1205 * via callback when the disconnection process is completed.
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
1218 * \par Prospective Clients:
1223 * #include <wifi-direct.h>
1230 * result = wifi_direct_disconnect_all();
1232 * if(result == WIFI_DIRECT_ERROR_NONE)......... // disconnect request is successful
1238 ******************************************************************************/
1239 int wifi_direct_disconnect_all(void);
1243 /*****************************************************************************************/
1244 /* wifi_direct_disconnect API function prototype
1245 * int wifi_direct_disconnect(const char* mac_address);
1248 * \brief This API shall disconnect the specified peer by mac address.
1250 * @param mac_addr Device address of target peer.
1254 * \par Sync (or) Async:
1255 * This is a Asynchronous API.
1261 * \par Async Response Message:
1262 * - WIFI_DIRECT_DISCONNECTION_RSP : Applications will receive a this event
1263 * via callback when a peer is disconnected.
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
1276 * \par Prospective Clients:
1281 * #include <wifi-direct.h>
1283 * void foo(unsigned char* mac_addr)
1288 * result = wifi_direct_disconnect(mac_addr);
1290 * if(result == WIFI_DIRECT_ERROR_NONE)......... // disconnect request is successful
1296 ******************************************************************************/
1297 int wifi_direct_disconnect(const char *mac_address);
1302 * connected peers notification callback function type. \n
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.
1309 * @pre wifi_direct_foreach_connected_peers() will invoke this function.
1311 * @see wifi_direct_foreach_connected_peers()
1314 typedef bool(*wifi_direct_connected_peer_cb) (wifi_direct_connected_peer_info_s
1315 * peer, void *user_data);
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)
1323 * \brief This API shall get the information of all connected peers. \n
1325 * @param callback The callback function to invoke.
1326 * @param user_data The user data passed from the foreach function.
1328 * \see wifi_direct_connected_peer_cb
1330 * \par Sync (or) Async:
1331 * This is a Synchronous API.
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
1346 * \par Prospective Clients:
1351 * #include <wifi-direct.h>
1353 * bool _cb_connected_peers_impl(wifi_direct_connected_peer_info_s* peer, void* user_data)
1356 * struct appdata* ad = (struct appdata*) user_data;
1360 * if ( ad->connected_peer_count >= MAX_PEER_NUM )
1361 * return false; // break out of the loop
1363 * memcpy(&ad->connected_peer_list[ad->connected_peer_count], peer, sizeof(wifi_direct_connected_peer_info_s));
1364 * ad->connected_peer_count++;
1368 * return true; // continue with the next iteration of the loop
1375 * ad->connected_peer_list = NULL;
1376 * ad->connected_peer_count = 0;
1378 * result = wifi_direct_foreach_connected_peers(_cb_connected_peers_impl, (void*)ad);
1380 * if(result == WIFI_DIRECT_ERROR_NONE)......... // get discovery result is successful
1386 ******************************************************************************/
1387 int wifi_direct_foreach_connected_peers(wifi_direct_connected_peer_cb
1388 callback, void *user_data);
1392 /*****************************************************************************************/
1393 /* wifi_direct_create_group API function prototype
1394 * int wifi_direct_create_group();
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
1400 * \see wifi_direct_destroy_group
1402 * \par Sync (or) Async:
1403 * This is a Asynchronous API.
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
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
1426 * \par Prospective Clients:
1431 * #include <wifi-direct.h>
1438 * result = wifi_direct_create_group();
1440 * if(result == WIFI_DIRECT_ERROR_NONE)......... // create group request is successful
1446 ******************************************************************************/
1447 int wifi_direct_create_group(void);
1451 /*****************************************************************************************/
1452 /* wifi_direct_destroy_group API function prototype
1453 * int wifi_direct_destroy_group();
1456 * \brief This API shall cancel P2P Group create or tear down a P2P Group that we own. \n
1458 * \see wifi_direct_create_group
1460 * \par Sync (or) Async:
1461 * This is a Asynchronous API.
1467 * \par Async Response Message:
1468 * - WIFI_DIRECT_GROUP_DESTROYED : Applications will receive this event via callback when the group is cancelled. \n
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
1482 * \par Prospective Clients:
1487 * #include <wifi-direct.h>
1494 * result = wifi_direct_destroy_group();
1496 * if(result == WIFI_DIRECT_ERROR_NONE)......... // cancel group request is successful
1502 ******************************************************************************/
1503 int wifi_direct_destroy_group(void);
1506 /*****************************************************************************************/
1507 /* wifi_direct_is_group_owner API function prototype
1508 * int wifi_direct_is_group_owner(bool *owner);
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.
1514 * \see wifi_direct_create_group
1516 * \par Sync (or) Async:
1517 * This is a Synchronous API.
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
1532 * \par Prospective Clients:
1537 * #include <wifi-direct.h>
1545 * result = wifi_direct_is_group_owner(&owner);
1548 * if(result == WIFI_DIRECT_ERROR_NONE)......... // checking the value is successful
1554 ******************************************************************************/
1555 int wifi_direct_is_group_owner(bool * is_group_owner);
1559 /*****************************************************************************************/
1560 /* wifi_direct_is_autonomous_group API function prototype
1561 * int wifi_direct_is_autonomous_group(bool *autonomous_group);
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.
1567 * \see wifi_direct_create_group
1569 * \par Sync (or) Async:
1570 * This is a Synchronous API.
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
1585 * \par Prospective Clients:
1590 * #include <wifi-direct.h>
1596 * bool autonomous_group;
1598 * result = wifi_direct_is_autonomous_group(&autonomous_group);
1601 * if(result == WIFI_DIRECT_ERROR_NONE)......... // checking the value is successful
1607 ******************************************************************************/
1608 int wifi_direct_is_autonomous_group(bool * is_autonomous_group);
1613 /*****************************************************************************************/
1614 /* wifi_direct_set_ssid API function prototype
1615 * int wifi_direct_set_ssid(const char* ssid);
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.
1621 * \see wifi_direct_get_ssid
1623 * \par Sync (or) Async:
1624 * This is a Synchronous API.
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
1641 * \par Prospective Clients:
1646 * #include <wifi-direct.h>
1651 * char ssid[11] = {0,};
1653 * memset(pin, 0x00, sizeof(pin));
1654 * printf("Input 8 digit PIN number :\n");
1657 *if( strlen(ssid) > 0 )
1658 * result = wifi_direct_set_ssid(ssid);
1660 * if(result == WIFI_DIRECT_ERROR_NONE)......... // setting ssid is successful
1664 *\remarks When the wifi direct is re-activated, ssid will be reset to the device name. \n
1667 ******************************************************************************/
1668 int wifi_direct_set_ssid(const char *ssid);
1671 /*****************************************************************************************/
1672 /* wifi_direct_get_ssid API function prototype
1673 * int wifi_direct_get_ssid(char** ssid)
1676 * \brief This API shall get ssid of local device. \n
1677 * @param ssid Pointer to store ssid. Application must free this memory.
1679 * \par Sync (or) Async:
1680 * This is a Synchronous API.
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
1697 * \par Prospective Clients:
1702 * #include <wifi-direct.h>
1707 * char* ssid = NULL;
1709 * result = wifi_direct_get_ssid(&ssid);
1711 * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting ssid is successful
1713 * free(ssid); // Application should free the memory.
1720 ******************************************************************************/
1721 int wifi_direct_get_ssid(char **ssid);
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()
1740 int wifi_direct_get_network_interface_name(char** name);
1743 /*****************************************************************************************/
1744 /* wifi_direct_get_ip_address API function prototype
1745 * int wifi_direct_get_ip_address(char** ip_address)
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.
1751 * \par Sync (or) Async:
1752 * This is a Synchronous API.
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
1769 * \par Prospective Clients:
1774 * #include <wifi-direct.h>
1781 * result = wifi_direct_get_ip_address(&ip);
1783 * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting IP is successful
1785 * free(ip); // Application should free the memory.
1791 ******************************************************************************/
1792 int wifi_direct_get_ip_address(char **ip_address);
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()
1810 int wifi_direct_get_subnet_mask(char** subnet_mask);
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()
1829 int wifi_direct_get_gateway_address(char** gateway_address);
1833 /*****************************************************************************************/
1834 /* wifi_direct_get_mac_addr API function prototype
1835 * int wifi_direct_get_mac_address(char **mac_address)
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.
1841 * \par Sync (or) Async:
1842 * This is a Synchronous API.
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
1859 * \par Prospective Clients:
1864 * #include <wifi-direct.h>
1869 * char* mac_addr =NULL;
1871 * result = wifi_direct_get_mac_addr(&mac_addr);
1873 * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting device MAC is successful
1879 ******************************************************************************/
1880 int wifi_direct_get_mac_address(char **mac_address);
1883 /*****************************************************************************************/
1884 /* wifi_direct_get_state API function prototype
1885 * int wifi_direct_get_state(wifi_direct_state_e * status);
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.
1891 * \see wifi_direct_state_e
1893 * \par Sync (or) Async:
1894 * This is a Synchronous API.
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
1911 * \par Prospective Clients:
1916 * #include <wifi-direct.h>
1921 * wifi_direct_state_e status;
1923 * result = wifi_direct_get_state(&status);
1925 * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting link status is successful
1931 ******************************************************************************/
1932 int wifi_direct_get_state(wifi_direct_state_e * state);
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()
1950 int wifi_direct_is_discoverable(bool* discoverable);
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()
1967 int wifi_direct_get_primary_device_type(wifi_direct_primary_device_type_e* type);
1971 /*****************************************************************************************/
1972 /* wifi_direct_accept_connection API function prototype
1973 * int wifi_direct_accept_connection(char* mac_address);
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.
1979 * @param mac_addr Device address of target peer.
1981 * \see wifi_direct_connect
1983 * \par Sync (or) Async:
1984 * This is a Asynchronous API.
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.
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
2009 * \par Prospective Clients:
2014 * #include <wifi-direct.h>
2016 * void foo(unsigned char* mac_addr)
2020 * result = wifi_direct_accept_connection(mac_addr);
2022 * if(result == WIFI_DIRECT_ERROR_NONE)......... // connect request is successful
2026 *\remarks This API will not try to send provisioning request.
2028 ******************************************************************************/
2029 int wifi_direct_accept_connection(char *mac_address);
2033 /*****************************************************************************************/
2034 /* wifi_direct_set_wpa_passphrase API function prototype
2035 * int wifi_direct_set_wpa_passphrase(char* passphrase)
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.
2042 * \par Sync (or) Async:
2043 * This is a Synchronous API.
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
2059 * \par Prospective Clients:
2064 * #include <wifi-direct.h>
2069 * char new_wpa[64+1] = {0,};
2071 * printf("Input new WPA:\n");
2072 * scanf("%s",new_wpa);
2074 *if( strlen(new_wpa) > 0 )
2075 * result = wifi_direct_set_wpa_passphrase(new_wpa);
2077 * if(result == WIFI_DIRECT_ERROR_NONE)......... // setting password is successful
2083 ******************************************************************************/
2084 int wifi_direct_set_wpa_passphrase(char *passphrase);
2087 /*****************************************************************************************/
2088 /* wifi_direct_activate_pushbutton API function prototype
2089 * int wifi_direct_activate_pushbutton(void);
2092 * \brief This API shall start wps PBC.
2094 * \pre Device must support the pbc button mode.
2096 * \see wifi_direct_foreach_supported_wps_types
2098 * \par Sync (or) Async:
2099 * This is a Synchronous API.
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
2113 * \par Prospective Clients:
2118 * #include <wifi-direct.h>
2125 * result = wifi_direct_activate_pushbutton();
2127 * if(result == WIFI_DIRECT_ERROR_NONE)......... // activating push button is successful
2133 ******************************************************************************/
2134 int wifi_direct_activate_pushbutton(void);
2137 /*****************************************************************************************/
2138 /* wifi_direct_set_wps_pin API function prototype
2139 * int wifi_direct_set_wps_pin(char* pin)
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.
2145 * \see wifi_direct_generate_wps_pin.
2146 * \see wifi_direct_get_wps_pin
2148 * \par Sync (or) Async:
2149 * This is a Synchronous API.
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
2166 * \par Prospective Clients:
2171 * #include <wifi-direct.h>
2176 * char pin[WIFI_DIRECT_WPS_PIN_LEN+1]= { 0, };
2178 * memset(pin, 0x00, sizeof(pin));
2179 * printf("Input 8 digit PIN number :\n");
2182 *if( strlen(pin) > 0 )
2183 * result = wifi_direct_set_wps_pin(pin);
2185 * if(result == WIFI_DIRECT_ERROR_NONE)......... // setting wps pin number is successful
2191 ******************************************************************************/
2192 int wifi_direct_set_wps_pin(char *pin);
2195 /*****************************************************************************************/
2196 /* wifi_direct_get_wps_pin API function prototype
2197 * int wifi_direct_get_wps_pin(char** pin)
2200 * \brief This API shall get the WPS PIN number. \n
2201 * @param pin Pointer to store pin number. Application must free this memory.
2203 * \see wifi_direct_set_wps_pin
2205 * \par Sync (or) Async:
2206 * This is a Synchronous API.
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
2223 * \par Prospective Clients:
2228 * #include <wifi-direct.h>
2235 * result = wifi_direct_get_wps_pin(&pin);
2237 * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting wps pin number is successful
2239 * free(pin); // Application should free the memory.
2245 ******************************************************************************/
2246 int wifi_direct_get_wps_pin(char **pin);
2249 /*****************************************************************************************/
2250 /* wifi_direct_generate_wps_pin API function prototype
2251 * wifi_direct_generate_wps_pin(void);
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.
2257 * \see wifi_direct_set_wps_pin
2258 * \see wifi_direct_get_wps_pin
2260 * \par Sync (or) Async:
2261 * This is a Synchronous API.
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
2277 * \par Prospective Clients:
2282 * #include <wifi-direct.h>
2288 * result = wifi_direct_generate_wps_pin();
2290 * if(result == WIFI_DIRECT_ERROR_NONE)......... // generating wps pin number is successful
2296 ******************************************************************************/
2297 int wifi_direct_generate_wps_pin(void);
2300 /*****************************************************************************************/
2301 /* wifi_direct_get_supported_wps_mode API function prototype
2302 * int wifi_direct_get_supported_wps_mode(int *wps_mode);
2305 * \brief This API shall get the supported wps mode. \n
2306 * The result is bit flag.
2308 * @param wps_mode Memory to store supported wps mode. Application must allocate memory.
2310 * \see wifi_direct_wps_type_e
2312 * \par Sync (or) Async:
2313 * This is a Synchronous API.
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
2330 * \par Prospective Clients:
2335 * #include <wifi-direct.h>
2340 * int supported_wps_mode = 0;
2342 * result = wifi_direct_get_supported_wps_mode(&supported_wps_mode);
2344 * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting supported wps mode is successful
2350 ******************************************************************************/
2351 int wifi_direct_get_supported_wps_mode(int *wps_mode);
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()
2362 typedef bool(*wifi_direct_supported_wps_type_cb)(wifi_direct_wps_type_e type, void* user_data);
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()
2372 int wifi_direct_foreach_supported_wps_types(wifi_direct_supported_wps_type_cb callback, void* user_data);
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()
2381 int wifi_direct_set_wps_type(wifi_direct_wps_type_e type);
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()
2389 int wifi_direct_get_wps_type(wifi_direct_wps_type_e* type);
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()
2399 int wifi_direct_set_group_owner_intent(int intent);
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()
2408 int wifi_direct_get_group_owner_intent(int* intent);
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()
2417 int wifi_direct_set_max_clients(int max);
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()
2426 int wifi_direct_get_max_clients(int* max);
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()
2443 int wifi_direct_get_own_group_channel(int* channel);
2446 /*****************************************************************************************/
2447 /* wifi_direct_get_config_data API function prototype
2448 * int wifi_direct_get_config_data(wifi_direct_config_data_s** config)
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.
2454 * \see wifi_direct_set_config_data
2456 * \par Sync (or) Async:
2457 * This is a Synchronous API.
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
2474 * \par Prospective Clients:
2479 * #include <wifi-direct.h>
2484 * wifi_direct_config_data_s* config;
2486 * result = wifi_direct_get_config_data(&config);
2488 * if(result == WIFI_DIRECT_ERROR_NONE)......... // getting config data is successful
2494 ******************************************************************************/
2495 int wifi_direct_get_config_data(wifi_direct_config_data_s ** config);
2498 /*****************************************************************************************/
2499 /* wifi_direct_set_config_data API function prototype
2500 * int wifi_direct_set_config_data(wifi_direct_config_data_s* config);
2503 * \brief This API shall set or update Wi-Fi direct configuration data. \n
2504 * @param config Wi-Fi configuration data to be set
2506 * \see wifi_direct_get_config_data
2508 * \par Sync (or) Async:
2509 * This is a Synchronous API.
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
2525 * \par Prospective Clients:
2530 * #include <wifi-direct.h>
2535 * wifi_direct_config_data_s* config;
2537 * result = wifi_direct_get_config_data(&config);
2539 * if(result != WIFI_DIRECT_ERROR_NONE)......... // Getting configuration data is not successful
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);
2551 * result = wifi_direct_set_config_data(config);
2552 * if(result == WIFI_DIRECT_ERROR_NONE)......... // Setting configuration data is successful
2561 ******************************************************************************/
2562 int wifi_direct_set_config_data(wifi_direct_config_data_s * config);
2566 * @brief Sets the Autoconnection mode.
2568 * @retval #WIFI_DIRECT_ERROR_NONE Successful
2569 * @retval #WIFI_DIRECT_ERROR_INVALID_PARAMETER Invalid parameter
2570 * @see wifi_direct_foreach_supported_wps_types()
2572 int wifi_direct_set_autoconnection_mode(bool mode);
2583 #endif //__WIFI_DIRECT_INTERFACE_H_