jeelabs / esp-link

esp8266 wifi-serial bridge, outbound TCP, and arduino/AVR/LPC/NXP programmer
Other
2.82k stars 720 forks source link

WebServer: how to use a member function as callback #412

Open Lenticualis opened 5 years ago

Lenticualis commented 5 years ago

Hi,

I overviewed and tested the webserver_led example in the ELClient library, which is working well.

To adapt it to my project, I put all Callback functions into a Class and now need to pass a member function as a Callback to the ESP Link. But this is not possible.

example:

in ELClient.h -> void (*resetCb)(); <- means pointer to global function returning void

esp.reset = reset <- reset is the adress of the global function reset()

esp.reset = &serverfeeder::reset <- reset is now a method of Class serverfeeder, but not accepted by the compiler

I am still new with programming, so sorry for the perhabs unclear description.

Can anybody help? Regards