-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Implement std::function variants of WiFi.onEvent similar to ESP8266 #1174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I would second this. :) |
Any progress on this? Thinking of implementing. |
Yes I third this, not only for functionality but also for easy porting of ESP8266 projects over to ESP32 👍 |
Any update on this ? |
Think this now supported with #1366. See this for example: https://github.com/timpur/arduino-esp32/blob/d72e8137b3933470bfa8292e801389064fd8d001/libraries/WiFi/examples/WiFiClientEvents/WiFiClientEvents.ino#L78 |
I need too |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This stale issue has been automatically closed. Thank you for your contributions. |
Still not have std::function callbacks on events. WiFiEventId_t eventID = WiFi.onEvent([](WiFiEvent_t event, WiFiEventInfo_t info){
Serial.print("WiFi lost connection. Reason: ");
Serial.println(info.disconnected.reason);
}, WiFiEvent_t::SYSTEM_EVENT_STA_DISCONNECTED); In this example there is a lambda without any capturing parameters, which C++ converts to a standard function pointer. Setting the same lambda with capture by reference will not compile. WiFiEventId_t eventID = WiFi.onEvent([&](WiFiEvent_t event, WiFiEventInfo_t info){
Serial.print("WiFi lost connection. Reason: ");
Serial.println(info.disconnected.reason);
}, WiFiEvent_t::SYSTEM_EVENT_STA_DISCONNECTED); |
Description:
Could we get equivalent functions as the ESP8266 has for WiFi events:
These functions allow using std::function, which allows handling events in class functions cleanly.
The text was updated successfully, but these errors were encountered: