Wi-Fi Direct is a technology that allows devices to connect to each other directly without having to join a traditional home / hotspot network. You can search for available devices and request for a connection, or receive an invitation to connect to another device. When two or more Wi-Fi Direct devices connect to each other, they form a Wi-Fi Direct group with one of the devices as the group owner.
Wi-Fi Direct also supports legacy devices that do not have P2P features. Once the P2P group is established, legacy clients can communicate with the group owner with WPA2 security. They would not be able to use the P2P functions but would be able to connect with the group owner as a traditional AP, seen as the SSID "DIRECT-test" in SDK 3.1.2.
Our WICED console application includes a number of Wi-Fi Direct(also referred to as P2P) commands(Type in "help" for the list of commands and usage). WICED supports all mandatory features of Wi-Fi Direct plus the following optional features: Invitation Procedure, Persistent Groups, Group Owner Intent Configurable to 15, and Group Owner Support for Multiple Clients.
Setting up the Group Owner on a WICED Device
You can use the following command to set up your WICED device as the group owner.
>> p2p_go_start <p|n> <SSID> <key> <operating channel>
You'll see the device set up a network.
You can check the info by typing in "status". It shows that the device is set up as the group owner and the network SSID is DIRECT-test.
Once a group owner is operating the WPS registrar can be started in PIN or PBC mode to allow clients to join. Clients may also join without using WPS if they know the SSID and WPA2 passphrase, but will not be able to use P2P features. If the WPS registrar is started in PIN mode without supplying a PIN it will generate one that can be entered into the client. The group owner registrar can be started before or after the connection request. If the client starts first and wants to use PIN mode with its own PIN then the client's PIN must be entered into the registrar when it is started. If the registrar starts first using PIN mode, then its PIN must be entered into the client. Legacy WPS clients always supply the PIN so they need to generate a PIN first. The p2p_registrar_stop command can be used to abort the group owner registrar.
Start the registrar process by
>> p2p_registrar_start <pin | pbc>
If you choose the pin method without specifying one, it will give an 8 digit pin to enter on the other device.
Connecting to the Group Owner From Another WICED Device
From another WICED device, you can request a connection by the command
>> p2p_connect <pin | pbc>
If you started the registrar in the group owner device with a pin, enter that 8 digit pin as well.
It will give you a list of group owners to connect to. In this case #9 is the one I set up on the first WICED device so I type in 9.
The connection is now set up between the two.
Connecting to the Group Owner From an Android Device
Group Owner Negotiation
Instead of setting up a group owner explicitly, you can issue p2p_connect on both WICED devices and let them negotiate who the group owner will be.
Do the following on both devices.
Check that you can see the other device
If you see it, issue the p2p_connect command on both devices and pick the the peer you want to connect to
>> p2p_connect pbc
Once it is issued on both devices they will communicate, decide on who will be the group owner, and set the network up. You should see a screen like the following
You can change the priority beforehand if you want a particular device to be the group owner. The priorities are from 0 to 15, where 15 is the highest meaning that it must be the group owner in all cases.
>> p2p_set_go_intent <intent value>
Discovery Related Console Commands
Enables P2P discovery mode. This device can now be seen on other P2P devices.
Enables discovery and prints out the list of P2P peers. It will discover peer devices, group owners and group clients. Devices do not need to be on the social channels in order to be discovered. Devices are aged out of the list over time if they are not seen.The type on left indicates whether the peer is a group owner.
Disable P2P discovery mode
Group Owner Related Console Commands
>> p2p_go_start <p|n> [<ssid_suffix> <key> <operating channel>]
Start P2P (p)ersistent or (n)on-persistent group.
Stop P2P group owner
>> p2p_registrar_start <pin|pbc> [8 digit PIN]
Start P2P group owner's WPS registrar
Stop P2P group owner's WPS registrar
Some Examples :
Once you set up a group with the SSID, passphrase and channel, you can stop the group owner then bring it up without needing to supply the information again.
Client Related Console Commands
>> p2p_connect <pin | pbc> [8 digit PIN]
Connect to an existing Group Owner or negotiate to form a group"
Disassociate from P2P group owner
P2P Settings Related Commands
>> p2p_set_go_intent <intent value>
Set P2P group owner intent (0..15 where 15 = must be GO)
>> p2p_set_go_pbc_mode_support <0|1>
Set P2P group owner support for PBC mode (1 = allow, 0 = disallow). This command allows connection requests where the WPS method is push button mode to be ignored.
>> p2p_set_listen_channel <channel>
Set listen channel (1, 6 or 11)
>> p2p_set_operating_channel <channel>
Set operating channel (1..11)