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.

Asynchronous API for retrieving the WINC connection status.

Asynchronous API for retrieving the WINC IC's connection status.

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)
{
}
}
}
Asynchronous connection status retrieval function, retrieves the status information of the 
currently connected AP. 
The result is passed to the Wi-Fi notification callback through the event 
@ref M2M_WIFI_RESP_CONN_INFO. Connection information is retrieved from 
the structure @ref tstrM2MConnInfo.

Connection Information retrieved:
-Connection Security
-Connection RSSI
-Remote MAC address
-Remote IP address

In case the WINC is operating in station mode, the SSID of the AP is also retrieved.
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 initialization m2m_wifi_init function.
  • The event M2M_WIFI_RESP_CONN_INFO must be handled in the callback to receive the requested connection info.
Warning
  • In case the WINC is operating in AP mode, the SSID field will be returned as a NULL string.
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.
See Also
M2M_WIFI_RESP_CONN_INFO, tstrM2MConnInfo

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;
{
// Get the current AP information.
}
break;
default:
break;
}
}
int main()
{
param.pfAppWifiCb = wifi_event_cb;
if(!m2m_wifi_init(&param))
{
// connect to the default AP
while(1)
{
}
}
}
Requests the connection status from the WINC including information regarding any access
point to which it is currently connected, or any non-AP station that is connected to the WINC.
All information will be returned to the application via the Wi-Fi notification callback through
the event @ref M2M_WIFI_RESP_CONN_INFO.

The connection info can be retrieved using the structure @ref tstrM2MConnInfo which contains:
- Connection Security
- Connection RSSI
- Remote MAC address
- Remote IP address
- SSID of the network (in cases where the WINC is in non-AP mode)
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 initialization m2m_wifi_init function.
  • The event M2M_WIFI_RESP_CONN_INFO must be handled in the callback to receive the requested connection info.
Warning
  • In case the WINC is operating in AP mode or P2P mode, the SSID field will be returned as a NULL string.
Returns
The function returns M2M_SUCCESS if the command has been successfully queued to the WINC and a negative value otherwise.
See Also
M2M_WIFI_RESP_CONN_INFO, tstrM2MConnInfo

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;
{
// Get the current AP information.
}
break;
default:
break;
}
}
int main()
{
param.pfAppWifiCb = wifi_event_cb;
if(!m2m_wifi_init(&param))
{
// connect to the default AP
while(1)
{
}
}
}