Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
m2m_wifi_enable_ap

Asychronous wi-fi hotspot enabling function.

The WILC supports AP mode operation with the following limitations:

Functions

NMI_API sint8 m2m_wifi_enable_ap (CONST tstrM2MAPConfig *pstrM2MAPConfig)
 

NMI_API sint8 m2m_wifi_enable_ap ( CONST tstrM2MAPConfig pstrM2MAPConfig)
Parameters
[in]pstrM2MAPConfigA structure holding the AP configurations.
Precondition
  • A Wi-Fi notification callback of type tpfAppWifiCb MUST be implemented and registered at intalization. Registering the callback is done through passing it to the m2m_wifi_init.
  • The m2m_wifi_handle_events MUST be called to receive the responses in the callback.
See Also
tpfAppWifiCb tenuM2mSecType m2m_wifi_init 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

#include "m2m_wifi.h"
#include "m2m_types.h"
void wifi_event_cb(uint8 u8WiFiEvent, void * pvMsg)
{
switch(u8WiFiEvent)
{
{
printf("STA has Associated\n");
}
break;
default:
break;
}
}
int main()
{
param.pfAppWifiCb = wifi_event_cb;
if(!m2m_wifi_init(&param))
{
tstrM2MAPConfig apConfig;
strcpy(apConfig.au8SSID, "WILC_SSID");
strcpy((char *)cfg.uniAuth.au8PSK, "12345678");
apConfig.u8ListenChannel = 1;
// Trigger AP
m2m_wifi_enable_ap(&apConfig);
while(1)
{
}
}
}

References tuniM2MWifiAuth::au8PMK, hif_send(), m2m_memcpy(), M2M_REQ_GRP_WIFI, m2m_strlen(), M2M_SUCCESS, M2M_WIFI_REQ_ENABLE_AP, M2M_WIFI_SEC_WPA_PSK, NULL, pbkdf2_sha1(), tstrM2MAPConfig::u8IsPMKUsed, and tstrM2MAPConfig::uniAuth.

Referenced by m2m_wifi_enable_ap_ex(), and os_m2m_wifi_enable_ap_imp().