WINC1500 IoT Software APIs: m2m_wifi_p2p

WINC1500 IoT Software API

WINC1500 IoT Software APIs  19.5.2
WINC Software API Reference Manual
m2m_wifi_p2p

Functions

NMI_API sint8 m2m_wifi_p2p (uint8 u8Channel)
 

Detailed Description

Asynchronous Wi-Fi direct (P2P) enabling mode function. The WINC supports P2P in device listening mode ONLY (intent is ZERO). The WINC P2P implementation does not support P2P GO (Group Owner) mode. Active P2P devices (e.g. phones) could find the WINC in the search list. When a device is connected to WINC, a Wi-Fi notification event M2M_WIFI_RESP_CON_STATE_CHANGED is triggered. After a short while, the DHCP IP Address is obtained and an event M2M_WIFI_REQ_DHCP_CONF 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 M2M_WIFI_REQ_DHCP_CONF 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;
{
uint8 *pu8IPAddress = (uint8*)pvMsg;
printf("P2P IP Address \"%u.%u.%u.%u\"\n",pu8IPAddress[0],pu8IPAddress[1],pu8IPAddress[2],pu8IPAddress[3]);
}
break;
default:
break;
}
}
int main()
{
param.pfAppWifiCb = wifi_event_cb;
if(!m2m_wifi_init(&param))
{
// Trigger P2P
while(1)
{
}
}
}
Generated on Thu Jan 26 2017 22:15:21 for WINC1500 IoT Software APIs by   doxygen 1.8.13