How to get Wifi / IP events in every place / class in code

tomacaster
Posts: 3
Joined: Mon Jul 25, 2022 10:13 am

How to get Wifi / IP events in every place / class in code

Postby tomacaster » Mon Jul 25, 2022 3:57 pm

Hi,

I don't unfortunately search engine doesn't work (I get white screen every time) so can't find the solution. I've created http client class for requests and I want to check internet connection before any req send, but I can't get any wifi / ip event. If register event handler instance
ESP_ERROR_CHECK(esp_event_handler_instance_register(WIFI_EVENT, ESP_EVENT_ANY_ID, event_handler, NULL, NULL));
In handler I've got switch with Wifi events but don't get any of it. Can somebody explain me what I'm doing wrong?

Thanks a lot! :)

tomacaster
Posts: 3
Joined: Mon Jul 25, 2022 10:13 am

Re: How to get Wifi / IP events in every place / class in code

Postby tomacaster » Tue Jul 26, 2022 6:53 am

Ok, I found another solution - get info from tcpip_adapter_get_ip_info(), but it doesn't look so elegant as event handlers. I can't resume sending requests in automated way.

Thanks!

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

Re: How to get Wifi / IP events in every place / class in code

Postby chegewara » Wed Jul 27, 2022 10:44 pm

But you know you can register for events multiple times in every place of code you want?

Code: Select all

ESP_ERROR_CHECK(esp_event_handler_instance_register(WIFI_EVENT, ESP_EVENT_ANY_ID, event_handler, NULL, NULL));

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 92 guests