Asynchronous wi-fi monitoring enable mode (Promiscuous mode) function. This function enables the monitoring mode, which starts transmission of the packets based on the filter information passed in as a parameter. All packets that meet the filtering criteria are passed to the application layer, to be handled by the assigned monitoring callback function. The monitoring callback function must be implemented before starting the monitoring mode, in-order to handle the packets received. Registering of the implemented callback function is through the callback pointer tpfAppMonCb in the tstrWifiInitParam structure. passed to m2m_wifi_init function at initialization.
◆ m2m_wifi_enable_monitoring_mode()
- Parameters
-
[in] | pstrMtrCtrl | Pointer to tstrM2MWifiMonitorModeCtrl structure holding the Filtering parameters. A buffer to receive data should be set during initializing m2m_wifi_init(), or m2m_wifi_set_receive_buffer() |
- See also
- tstrM2MWifiMonitorModeCtrl tstrM2MWifiRxPacketInfo tstrWifiInitParam m2m_wifi_disable_monitoring_mode m2m_wifi_init m2m_wifi_set_receive_buffer
- Returns
- The function returns M2M_SUCCESS for successful operations and a negative value otherwise.
Example
The example demonstrates the main function where-by the monitoring enable function is called after the initialization of the driver and the packets are handled in the callback function.
#include "m2m_wifi.h"
uint8 gmgmt[1600];
void wifi_cb(uint8 u8WiFiEvent, void * pvMsg)
{
;
}
{
if((
NULL != pstrWifiRxPacket) && (0 != u16PayloadSize)) {
M2M_INFO("***# MGMT PACKET #***\n");
M2M_INFO("***# DATA PACKET #***\n");
M2M_INFO("***# CONTROL PACKET #***\n");
}
}
}
int main()
{
strMonitorCtrl.u8ChannelID = 1;
while(1) {
}
}
return 0;
}