Staging:CC3220 P2P (Texas Instruments NDA restrictions applicable)

Overview
P2P or Wi-Fi Direct enables devices to connect to each other without requiring a Wireless Access Point(AP). This application demonstrates the P2P capability of CC32xx device. The application waits for a P2P device to connect and then pings to it.

Different supported P2P roles of CC32xx are:
 * SL_WLAN_P2P_ROLE_GROUP_OWNER: CC32xx will be configured in 'Group-Owner' mode
 * SL_WLAN_P2P_ROLE_CLIENT: CC32xx will be configured in 'Client' mode
 * SL_WLAN_P2P_ROLE_NEGOTIATE: CC32xx will negotiate with remote device for client/GO role.

CC32xx can be configured in below modes to initiate negotiation
 * SL_WLAN_P2P_NEG_INITIATOR_ACTIVE: CC32xx will perform discovery - Once the remote device is found, it sends the negotiation request immediately
 * SL_WLAN_P2P_NEG_INITIATOR_PASSIVE: CC32xx will perform discovery - Once the remote device is found, CC32xx waits for it to start negotiation
 * SL_WLAN_P2P_NEG_INITIATOR_RAND_BACKOFF: CC32xx will perform discovery - Once the remote device is found, it triggers a random timer (1-7 seconds) and waits for the remote device to negotiate. On timer expiry, CC32xx starts negotiation itself

Supported security types used during p2p negotiation are:
 * SL_WLAN_SEC_TYPE_P2P_PBC
 * SL_WLAN_SEC_TYPE_P2P_PIN_KEYPAD
 * SL_WLAN_SEC_TYPE_P2P_PIN_DISPLAY
 * SL_WLAN_SEC_TYPE_P2P_PIN_AUTO

Application details
The example intends to demonstrate how p2p mode can be configured and used. Application configure the device with following settings :
 * P2P role negotiate (SL_WLAN_P2P_ROLE_NEGOTIATE)
 * P2P negotiation initiation active (SL_WLAN_P2P_NEG_INITIATOR_ACTIVE)
 * P2P device listens on channel 11 and P2P device's operation channel is set to 6
 * P2P device name as "cc3220-p2p-device"
 * P2P connect security type 'PBC'

The figure below shows the various states of the application, and the events that trigger the transition between these states.



Source Files briefly explained

 * 1) main - main file contains the application state machine.
 * 2) cc_launchpad - contains Initialization and configuration for peripherals used.

Supporting Files
 * 1) pinmux - pinmux file to mux the device to configure UART peripheral

Common Files
 * 1) common - contains NotifyreturnToFactoryImage function
 * 2) uart_if - Common UART interface APIs
 * 3) timer_if - interface file for general purpose timers
 * 4) startup_* - IDE specific interrupt vector table implementation and startup functions(not required when working with TI-RTOS)

Usage

 * Setup a serial communication application (HyperTerminal/TeraTerm). For detail info visit Terminal setup

On the host PC. The settings are:   - Port: Enumerated COM port (XDS110 Class Application/User UART)    - Baud rate: 115200    - Data: 8 bit    - Parity: None    - Stop: 1 bit    - Flow control: None CC32xx will be visible as P2P_DEVICE_NAME (which is set in the sample application) to the remote P2P device
 * Build and run the application
 * Start P2P (or Wi-Fi Direct) service on remote device and scan (search) for other P2P devices.
 * Connect to CC3220 device. On successful connection, CC3220's IP address will be displayed on the terminal-program's console
 * The CC3220 device pings to the remote P2P device and report the ping result on the serial terminal.

Limitations/Known Issues
None