WINC1500 IoT Software APIs: m2m_wifi_enable_ap

WINC1500 IoT Software API

WINC1500 IoT Software APIs  19.5.2
WINC Software API Reference Manual
m2m_wifi_enable_ap

Functions

NMI_API sint8 m2m_wifi_enable_ap (CONST tstrM2MAPConfig *pstrM2MAPConfig)
 

Detailed Description

Asynchronous Wi-FI hot-spot enabling function. The WINC supports AP mode operation with the following limitations:

  • Only 1 STA could be associated at a time.
  • Open and WEP are the only supported security types

Function Documentation

◆ m2m_wifi_enable_ap()

NMI_API sint8 m2m_wifi_enable_ap ( CONST tstrM2MAPConfig pstrM2MAPConfig)
Parameters
[in]pstrM2MAPConfigA structure holding the AP configurations.
Warning
This function is not allowed in P2P or STA modes.
Precondition
  • A Wi-Fi notification callback of type tpfAppWifiCb MUST be implemented and registered at initialization. Registering the callback is done through passing it to the m2m_wifi_init.
  • The event M2M_WIFI_REQ_DHCP_CONF must be handled in the callback.
  • The m2m_wifi_handle_events MUST be called to receive the responses in the callback.
See also
tpfAppWifiCb tenuM2mSecType m2m_wifi_init M2M_WIFI_REQ_DHCP_CONF tstrM2mWifiStateChanged tstrM2MAPConfig
Returns
The function returns M2M_SUCCESS for successful operations and a negative value otherwise.

Example

The code snippet demonstrates how the AP mode is enabled after the driver is initialized in the application's main function and the handling of the event M2M_WIFI_REQ_DHCP_CONF, to indicate successful connection.

#include "m2m_wifi.h"
#include "m2m_types.h"
void wifi_event_cb(uint8 u8WiFiEvent, void * pvMsg)
{
switch(u8WiFiEvent)
{
{
uint8 *pu8IPAddress = (uint8*)pvMsg;
printf("Associated STA has 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))
{
tstrM2MAPConfig apConfig;
strcpy(apConfig.au8SSID, "WINC_SSID");
apConfig.u8ListenChannel = 1;
apConfig.u8SsidHide = 0;
// IP Address
apConfig.au8DHCPServerIP[0] = 192;
apConfig.au8DHCPServerIP[1] = 168;
apConfig.au8DHCPServerIP[2] = 1;
apConfig.au8DHCPServerIP[0] = 1;
// Trigger AP
m2m_wifi_enable_ap(&apConfig);
while(1)
{
}
}
}
Generated on Thu Jan 26 2017 22:15:21 for WINC1500 IoT Software APIs by   doxygen 1.8.13