This policy is used for automatic connection. The system tries to connect to a peer automatically after reset, or after disconnect operation by the remote peer. There is a general mechanism for the peer profile and peer profile configuration which is not described in this section, though an example of how to add a profile is explained in a later section. The mechanism described here explains how the device uses these profiles in relation to the Wi-Fi Direct automatic connection. The same connection policy can also be configured in STA mode, use the same setting parameters, and be applied in both modes, but it has slight differences.
The four connection policy options:
- Auto – This policy is similar to Auto connection in STA mode. The device starts the Wi-Fi Direct find process, and searches for all Wi-Fi Direct profiles stored on the device, then tries to find the best candidate to start negotiating. If at least one candidate is found, the connection attempt is triggered. If more than one device is found, the best candidate according to profile parameters is chosen.
- Fast – In Wi-Fi Direct mode, this policy is the equivalent to the Wi-Fi Direct persistent group, but it has a different meaning between GO and CLIENT. This option is very useful for making a fast connection after reset, but it is dependent on the last connection state. This option is active only if there was a successful connection before the device was reset, because the last connection parameters are saved and used by the fast connection option. If the device was a CLIENT in its last connection (before reset or remote disconnect) then following the reset, users must send the p2p_invite to the previously connected GO, to perform a fast reconnection. If the device was the 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 */
}