Wi-Fi Direct
54
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
WLAN
Table 4-6. Wi-Fi Direct Default Parameters (continued)
Configuration
Default Value
Device type
1-0050F204-1
listen channel
Random channel between 1, 6, or 11
Operational channel
Random channel between 1, 6, or 11
4.5.3.1
Configuring Wi-Fi Direct General Parameters
•
Set Mode
Wi-Fi Direct mode is not the initialization mode by default, therefore it must be set by the application.
The following API should be called to set the device in Wi-Fi Direct mode. Wi-Fi Direct configuration is
not effective until the device enters Wi-Fi Direct mode. This configuration requires a reset and
persistent with no dependency on the system-persistent configuration.
Example:
_i16 Role;
_i16 Status;
Status = sl_WlanSetMode(ROLE_P2P);
if
( Status )
{
/* error */
}
Status = sl_Stop(0);
Role = sl_Start(NULL,NULL,NULL);
if
(ROLE_P2P != Role)
{
/* error */
}
•
Set Network Configuration
The network configuration for Wi-Fi Direct mode is similar to the STA and AP modes. For CLIENT use
STA network configuration parameters, and for GO use AP network configuration parameters.
Persistent:
–
CL – This configuration is persistent according to the system-persistent configuration
–
GO – This configuration is persistent regardless of the system-persistent configuration
To change the default configuration, the following settings are available:
•
CLIENT – same network confirmation as the STA mode (static or DHCP address)
•
GO – same network confirmation as the AP mode (static address)
An example of setting CLIENT static IPv4 address:
SlNetCfgIpV4Args_t
ipV4;
_i16 Status;
ipV4.Ip
= (_u32)SL_IPV4_VAL(192,168,0,108);
/* IP address */
ipV4.IpMask
= (_u32)SL_IPV4_VAL(255,255,255,0);
/* Subnet mask for this STA/P2P */
ipV4.IpGateway
= (_u32)SL_IPV4_VAL(192,168,0,1);
/* Default gateway address */
ipV4.IpDnsServer = (_u32)SL_IPV4_VAL(192,168,0,1);
/*
DNS server address */
Status = sl_NetCfgSet(SL_NETCFG_IPV4_STA_ADDR_MODE,
SL_NETCFG_ADDR_STATIC,
sizeof
(SlNetCfgIpV4Args_t) ,(_u8 *)&ipV4);
if
( Status )
{
/* error */
}
•
Set Device Name
The device name must be unique because the Wi-Fi Direct connection is device-name based. The