Arduino-esp32: Implement std::function variants of WiFi.onEvent similar to ESP8266

Created on 4 Mar 2018  路  9Comments  路  Source: espressif/arduino-esp32

Description:

Could we get equivalent functions as the ESP8266 has for WiFi events:

WiFiEventHandler onStationModeConnected(std::function<void(const WiFiEventStationModeConnected&)>);
WiFiEventHandler onStationModeDisconnected(std::function<void(const WiFiEventStationModeDisconnected&)>);
WiFiEventHandler onStationModeAuthModeChanged(std::function<void(const WiFiEventStationModeAuthModeChanged&)>);
WiFiEventHandler onStationModeGotIP(std::function<void(const WiFiEventStationModeGotIP&)>);
WiFiEventHandler onStationModeDHCPTimeout(std::function<void(void)>);
WiFiEventHandler onSoftAPModeStationConnected(std::function<void(const WiFiEventSoftAPModeStationConnected&)>);
WiFiEventHandler onSoftAPModeStationDisconnected(std::function<void(const WiFiEventSoftAPModeStationDisconnected&)>);

These functions allow using std::function, which allows handling events in class functions cleanly.

stale

Most helpful comment

All 9 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 ?

@timpur This probably would not solve the portability of ESP8266 projects @tripflex mentioned as there's not separate functions for each event but at least I find this new approach much more versatile and clean.

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.

Was this page helpful?
0 / 5 - 0 ratings