Is there any other way to register event handler functions in WifiHandler class? I do not want to make them static. I attached the files of the my component.
Thank you!
C++ event handler functions as member functions
C++ event handler functions as member functions
- Attachments
-
- CMakeLists.txt
- (213 Bytes) Downloaded 33 times
-
- WifiHandler.hpp
- (2.47 KiB) Downloaded 32 times
-
- WifiHandler.cpp
- (11.29 KiB) Downloaded 32 times
-
- Posts: 1708
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: C++ event handler functions as member functions
Use a static 'adapter' function and the user-provided void* argument of the event callback to route the callback to a non-static member function like e.g. here:
https://esp32.com/viewtopic.php?f=13&t=40146#p132955
https://esp32.com/viewtopic.php?f=13&t=40146#p132955
Who is online
Users browsing this forum: Bing [Bot], forrest and 106 guests