Microchip® Advanced Software Framework

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

Asynchronous connection status retrieval function, retrieves the status information of the currently connected AP.

Asynchronous associated status retrieval function in the AP mode, retrieves the status information of the currently connected connected stations to the WILC1000 AP.

The result is passed to the Wi-Fi notification callback through the event M2M_WIFI_RESP_CONN_INFO. Connection information is retrieved from the structure tstrM2MConnInfo.

The result is passed to the Wi-Fi notification callback through the event M2M_WIFI_RESP_AP_ASSOC_INFO. Connection information is retrieved from the structure tstrM2MAPAssocInfo.

Functions

NMI_API sint8 m2m_wifi_ap_get_assoc_info (void)
 Request the status information of the currently connected stations to the WILC1000 AP. The result is passed to the Wi-Fi notification callback with the event M2M_WIFI_RESP_AP_ASSOC_INFO. More...
 
NMI_API sint8 m2m_wifi_get_connection_info (void)
 Request the status information of the currently connected Wi-Fi AP. The result is passed to the Wi-Fi notification callback with the event M2M_WIFI_RESP_CONN_INFO. More...
 

NMI_API sint8 m2m_wifi_ap_get_assoc_info ( void  )

Request the status information of the currently connected stations to the WILC1000 AP. The result is passed to the Wi-Fi notification callback with the event M2M_WIFI_RESP_AP_ASSOC_INFO.

Precondition
  • A Wi-Fi notification callback of type tpfAppWifiCb MUST be implemented and registered at startup. Registering the callback is done through passing it to the intialization m2m_wifi_init function.
  • The event M2M_WIFI_RESP_AP_ASSOC_INFO must be handled in the callback to receive the requested connection info.
Warning
Calling this function is valid ONLY in the AP mode. Otherwise, the WILC SW shall ignore the request silently.
See Also
tpfAppWifiCb m2m_wifi_init M2M_WIFI_RESP_AP_ASSOC_INFO tstrM2MAPAssocInfo
Returns
The function returns M2M_SUCCESS for successful operations and a negative value otherwise.

Example

The code snippet shows an example of how wi-fi connection information is retrieved .

#include "m2m_wifi.h"
#include "m2m_types.h"
void wifi_event_cb(uint8 u8WiFiEvent, void * pvMsg)
{
switch(u8WiFiEvent)
{
{
tstrM2MAPAssocInfo* pstrAssocInfo =(tstrM2MAPAssocInfo*)pvMsg;
printk("AP Assoc list received[%d]\n",pstrAssocInfo->u8NoConnSta);
for(i=0;i<pstrAssocInfo->u8NoConnSta;i++)
{
printk("STA %x:%x:%x:%x:%x:%x connected RSSI %d\n",pstrAssocInfo->astrM2MAssocEntryInfo[i].BSSID[0],
pstrAssocInfo->astrM2MAssocEntryInfo[i].BSSID[1],pstrAssocInfo->astrM2MAssocEntryInfo[i].BSSID[2],
pstrAssocInfo->astrM2MAssocEntryInfo[i].BSSID[3],pstrAssocInfo->astrM2MAssocEntryInfo[i].BSSID[4],
pstrAssocInfo->astrM2MAssocEntryInfo[i].BSSID[5],pstrAssocInfo->astrM2MAssocEntryInfo[i].s8RSSI);
}
}
break;
{
pstrConnectState = (tstrM2mWifiStateChanged*)pvMsg;
if(pstrConnectState->u8CurrState)
{
}
break;
default:
break;
}
}
int main()
{
param.pfAppWifiCb = wifi_event_cb;
if(!m2m_wifi_init(&param))
{
tstrM2MAPConfig strM2MAPConfig;
strcpy(strM2MAPConfig.au8PSK,"1234567890");
strcpy(strM2MAPConfig.au8SSID,"WILC1000_AP");
strM2MAPConfig.u8ListenChannel = M2M_WIFI_CH_11;
strM2MAPConfig.u8SecType = M2M_WIFI_SEC_WPA_PSK;//M2M_WIFI_SEC_OPEN;//;//M2M_WIFI_SEC_WEP;
strM2MAPConfig.u8SsidHide = 0;
m2m_wifi_enable_ap(&strM2MAPConfig);
while(1)
{
}
}
}

References hif_send(), M2M_REQ_GRP_WIFI, M2M_SUCCESS, M2M_WIFI_REQ_AP_ASSOC_INFO, and NULL.

Referenced by os_m2m_wifi_ap_get_assoc_info().

NMI_API sint8 m2m_wifi_get_connection_info ( void  )

Request the status information of the currently connected Wi-Fi AP. The result is passed to the Wi-Fi notification callback with the event M2M_WIFI_RESP_CONN_INFO.

Precondition
  • A Wi-Fi notification callback of type tpfAppWifiCb MUST be implemented and registered at startup. Registering the callback is done through passing it to the intialization m2m_wifi_init function.
  • The event M2M_WIFI_RESP_CONN_INFO must be handled in the callback to receive the requested connection info.
Warning
Calling this function is valid ONLY in the STA CONNECTED state. Otherwise, the WILC SW shall ignore the request silently.
See Also
tpfAppWifiCb m2m_wifi_init M2M_WIFI_RESP_CONN_INFO tstrM2MConnInfo
Returns
The function returns M2M_SUCCESS for successful operations and a negative value otherwise.

Example

The code snippet shows an example of how wi-fi connection information is retrieved .

#include "m2m_wifi.h"
#include "m2m_types.h"
void wifi_event_cb(uint8 u8WiFiEvent, void * pvMsg)
{
switch(u8WiFiEvent)
{
{
tstrM2MConnInfo *pstrConnInfo = (tstrM2MConnInfo*)pvMsg;
printf("CONNECTED AP INFO\n");
printf("SSID : %s\n",pstrConnInfo->acSSID);
printf("SEC TYPE : %d\n",pstrConnInfo->u8SecType);
printf("Signal Strength : %d\n", pstrConnInfo->s8RSSI);
printf("Local IP Address : %d.%d.%d.%d\n",
pstrConnInfo->au8IPAddr[0] , pstrConnInfo->au8IPAddr[1], pstrConnInfo->au8IPAddr[2], pstrConnInfo->au8IPAddr[3]);
}
break;
default:
break;
}
}
int main()
{
tuniM2MWifiAuth sta_auth_param;
param.pfAppWifiCb = wifi_event_cb;
if(!m2m_wifi_init(&param))
{
// connect to the AP
m2m_wifi_connect((char *)DEMO_WLAN_SSID, sizeof(DEMO_WLAN_SSID),
M2M_WIFI_SEC_OPEN, &sta_auth_param, M2M_WIFI_CH_ALL);
while(1)
{
}
}
}

References hif_send(), M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_GET_CONN_INFO, and NULL.

Referenced by os_m2m_wifi_get_connection_info().