Wi-Fi Direct
57
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
WLAN
connected GO, to perform fast reconnecting. If the device was GO in its last connection (before reset
or remote disconnect) then following reset, users must reinvoke the p2p_group_owner, and wait for the
previously connected peer to reconnect to the device.
•
AnyP2P policy – This policy creates a connection to any Wi-Fi Direct peer device found during
discovery. This option does not use any stored profiles and is relevant for negotiation with push-button
only.
•
Auto Provisioning – This policy is not relevant in Wi-Fi Direct mode. Each option in this macro should
be sent or set as true or false. Multiple options can be used. This configuration is persistent according
to the system-persistent configuration.
Example:
_i16 Status;
Status = sl_WlanPolicySet(SL_WLAN_POLICY_CONNECTION,SL_WLAN_CONNECTION_POLICY(1,1,0,1),NULL,0);
if
( Status )
{
/* error */
}
4.5.4 Connection
•
Discovering Remote Wi-Fi Direct Peers
This section describes how to start a Wi-Fi Direct search or discovery, and how to view the discovered
remote Wi-Fi Direct devices. The scan policy must be set to start the Wi-Fi Direct find process, and to
discover remote Wi-Fi Direct peers. This process is done by setting a scan policy for Wi-Fi Direct
mode.
NOTE:
•
Setting the scan policy should be done while the device is in Wi-Fi Direct mode.
•
Wi-Fi Direct discovery is performed as a part of any connection, but it can be activated
using SCAN_POLICY as well.
•
This configuration is not persistent.
Example:
_u32 intervalInSeconds = 20;
_i16 Status;
Status
= sl_WlanPolicySet(SL_WLAN_POLICY_SCAN, SL_WLAN_SCAN_POLICY(1,1),
(_u8*)&intervalInSeconds,
sizeof
(intervalInSeconds));
if
( Status )
{
/* error */
}
•
Retrieve Remote Wi-Fi Direct Peers
There are two ways to see and get Wi-Fi Direct remote devices that were discovered during the Wi-Fi
Direct find and search operation:
–
Listening to the event SL_WLAN_EVENT_P2P_DEVFOUND:
This event is sent asynchronously to the host when a remote Wi-Fi Direct is found, and contains the
MAC address, device name, and length of the device name. By listening to this event, the user can
immediately find each remote Wi-Fi Direct device that exists in their neighborhood, and issue a
connect or add profile command.
–
Calling to API sl_WlanGetNetworkList:
By calling to this API the user receives a list of remote peers that were found during the scan and
are saved in the device cache memory. By receiving the network list, the user can immediately find
any remote Wi-Fi Direct device and issue a manual connection or add profile command.
Example: