Hope it's not to offtopic.
I want to use the promiscuous mode of the esp32. So we have a function called
esp_err_t esp_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb);
// Each time a packet is received, the registered callback function will be called.
The callback looks like this
typedef void (* wifi_promiscuous_cb_t)(void *buf, wifi_promiscuous_pkt_type_t type);
/**
* @brief The RX callback function in the promiscuous mode.
* Each time a packet is received, the callback function will be called.
*
* @param buf Data received. Type of data in buffer (wifi_promiscuous_pkt_t or wifi_pkt_rx_ctrl_t) indicated by 'type' parameter.
* @param type promiscuous packet type.
*
*/
And this works (look at my example script below). But i've got some error messages while compiling threw the esp sdk. These error messages have more to do with c++:
But after compiling all of this, the script works fine. I'll get my callback. But how do i get rid of those errors?
#include "freertos/FreeRTOS.h"
#include "esp_wifi.h"
#include "esp_wifi_internal.h"
#include "lwip/err.h"
#include "esp_system.h"
#include "esp_event.h"
#include "esp_event_loop.h"
#include "nvs_flash.h"
#include "driver/gpio.h"
esp_err_t event_handler(void *ctx, system_event_t *event)
{
return ESP_OK;
}
void promiscuous_mode(void *buf, uint16_t len)
{
// some stuff will happen
}
void app_main(void)
{
esp_wifi_set_promiscuous(true);
esp_wifi_set_promiscuous_rx_cb(&promiscuous_mode);
ESP_ERROR_CHECK( esp_wifi_start() );
}