-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
Stefan, thank you for this library.
Below are two code changes that i made to improve the results of all examples that you provide.
- Fix time issue when writing or sending a packet. Change the following lines:
uint32_t timestamp = now(); //current timestamp
uint32_t microseconds = (unsigned int)(micros() - millis() * 1000); //micro seconds offset (0 - 999)
into
uint32_t timestamp = now(); // current timestamp
uint32_t microseconds = (unsigned int)(micros() % 1000000U);
This will fix the relative time between packets, see below results:
- Can add filter to capture management and data packets:
PCAP pcap = PCAP();
int ch = CHANNEL;
unsigned long lastChannelChange = 0;
const wifi_promiscuous_filter_t filter_data_mgmt = {
.filter_mask = WIFI_PROMIS_FILTER_MASK_DATA | WIFI_PROMIS_FILTER_MASK_MGMT}; // this filter either DATA or MGMT frames```
```/* setup wifi */
nvs_flash_init();
tcpip_adapter_init();
ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL));
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_RAM)); ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_NULL));
ESP_ERROR_CHECK(esp_wifi_start());
esp_wifi_set_promiscuous_filter(&filter_data_mgmt); // the filter is used here
esp_wifi_set_promiscuous(true);
esp_wifi_set_promiscuous_rx_cb(sniffer);
wifi_second_chan_t secondCh = (wifi_second_chan_t)NULL;
esp_wifi_set_channel(ch, secondCh);```
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

