NetBurner 3.1

Functions

NMI_API sint8 m2m_wifi_p2p (uint8 u8Channel)
 

Detailed Description

Asynchronous Wi-Fi direct (P2P) enabling mode function. The WILC supports P2P in device listening mode ONLY (intent is ZERO). The WILC P2P implementation does not support P2P GO (Group Owner) mode. Active P2P devices (e.g. phones) could find the WILC in the search list. When a device is connected to WILC, a Wi-Fi notification event M2M_WIFI_RESP_CON_STATE_CHANGED is triggered. Refer to the code examples for a more illustrative example.

Function Documentation

◆ m2m_wifi_p2p()

NMI_API sint8 m2m_wifi_p2p ( uint8  u8Channel)
Parameters
[in]u8ChannelP2P Listen RF channel. According to the P2P standard It must hold only one of the following values 1, 6 or 11.
Precondition
Warning
This function is not allowed in AP or STA modes.
See also
tpfAppWifiCb m2m_wifi_init M2M_WIFI_RESP_CON_STATE_CHANGED tstrM2mWifiStateChanged
Returns
The function returns M2M_SUCCESS for successful operations and a negative value otherwise.

Example

The code snippet shown an example of how the p2p mode operates.

#include "m2m_wifi.h"
#include "m2m_types.h"
void wifi_event_cb(uint8 u8WiFiEvent, void * pvMsg)
{
switch(u8WiFiEvent)
{
{
M2M_INFO("Wifi State :: %s :: ErrCode %d\n", pstrWifiState->u8CurrState? "CONNECTED":"DISCONNECTED",pstrWifiState->u8ErrCode);
// Do something
}
break;
default:
break;
}
}
int main()
{
param.pfAppWifiCb = wifi_event_cb;
if(!m2m_wifi_init(&param))
{
// Trigger P2P
while(1)
{
}
}
}