![Texas Instruments CC3220 Скачать руководство пользователя страница 56](http://html.mh-extra.com/html/texas-instruments/cc3220/cc3220_programmers-manual_1094609056.webp)
Wi-Fi Direct
56
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
WLAN
2. SL_WLAN_P2P_ROLE_NEGOTIATE (intent 7): Indicates that the device can be either CLIENT or
GO, depending on the Wi-Fi Direct negotiation tie-breaker. This tie-breaker is the system default.
3. SL_WLAN_P2P_ROLE_GROUP_OWNER (intent 15): Indicates that the device is forced to be P2P
GO.
NOTE:
This configuration is persistent according to the system-persistent configuration.
•
Negotiation Initiator
This value determines whether the SimpleLink Wi-Fi device first initiates the negotiation, or passively
waits for the remote side to initiate the negotiation. This configuration must be used when working with
two SimpleLink Wi-Fi devices. In general, the user does not have a GUI to start the negotiation by
pressing a button or by entering a pin key. Therefore, this option is given to avoid starting the
negotiation at the same time by both devices after the discovery process.
1. SL_WLAN_P2P_NEG_INITIATOR_ACTIVE: When the remote peer is found after the discovery
process, the device immediately sends the negotiation request to the peer device.
2. SL_WLAN_P2P_NEG_INITIATOR_PASSIVE: When the remote peer is found after the discovery
process, the device passively waits for the peer to start the negotiation, and only responds after.
3. SL_WLAN_P2P_NEG_INITIATOR_RAND_BACKOFF: When the remote peer is found after the
discovery process, the device triggers a random timer (1 to 6 seconds). During this period, the device
passively waits for the peer to start the negotiation. If the timer expires without negotiation, the device
immediately sends the negotiation request to the peer device. This is the system default, and also the
recommendation for working with two SimpleLink Wi-Fi devices out-of-the box, because no negotiation
synchronization must be done.
NOTE:
This configuration is persistent according to the system-persistent configuration.
Example:
_i16 Status;
Status
= sl_WlanPolicySet(SL_WLAN_POLICY_P2P,
SL_WLAN_P2P_POLICY( SL_WLAN_P2P_ROLE_NEGOTIATE,
SL_WLAN_P2P_NEG_INITIATOR_RAND_BACKOFF) , NULL,0);
if
( Status )
{
/* error */
}
4.5.3.3
Configure Connection Policy
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 follow:
•
Auto – This policy is similar to Auto Start 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 profiles parameter 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 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 CLIENT in its last connection (before reset or
remote disconnect) then following the reset, users must send the p2p_invite to the previously