Open Bart-van-Ingen opened 1 year ago
I have tried the example found here : https://github.com/lasselukkari/aWOT/blob/master/examples/MemberFunction/MemberFunction.ino
but this example on compilation creates the following error
src/main.cpp: In function 'void setup()':
src/main.cpp:50:106: error: no matching function for call to 'awot::Application::get(const char [2], std::_Bind_helper<false, void (Counter::*)(awot::Request&, awot::Response&), Counter*, const std::_Placeholder<1>&, const std::_Placeholder<2>&>::type)'
app.get("/", std::bind(&Counter::handleRequest, &counter, std::placeholders::_1, std::placeholders::_2));
^
In file included from src/main.cpp:8:
.pio/libdeps/esp32dev/aWOT/src/aWOT.h:300:8: note: candidate: 'void awot::Application::get(const char*, void (*)(awot::Request&, awot::Response&))'
void get(const char* path, Router::Middleware* middleware);
^~~
.pio/libdeps/esp32dev/aWOT/src/aWOT.h:300:8: note: no known conversion for argument 2 from 'std::_Bind_helper<false, void (Counter::*)(awot::Request&, awot::Response&), Counter*, const std::_Placeholder<1>&, const std::_Placeholder<2>&>::type' {aka 'std::_Bind<void (Counter::*(Counter*, std::_Placeholder<1>, std::_Placeholder<2>))(awot::Request&, awot::Response&)>'} to 'void (*)(awot::Request&, awot::Response&)'
.pio/libdeps/esp32dev/aWOT/src/aWOT.h:301:8: note: candidate: 'void awot::Application::get(void (*)(awot::Request&, awot::Response&))'
void get(Router::Middleware* middleware);
^~~
.pio/libdeps/esp32dev/aWOT/src/aWOT.h:301:8: note: candidate expects 1 argument, 2 provided
*** [.pio/build/esp32dev/src/main.cpp.o] Error 1
It seems that I have forgotten to release the latest version that enables the support for std:function callbacks. I'll try to make the release in the following days.
In the meantime you can manually copy the latest version here from github and see if that solves the problem.
The support for the std:function callbacks is at the moment a bit suboptimal. The overloaded functions in Application and Router classes cause some extra hassle in some cases when defining the callback types. This is something that will be addressed in the upcoming v4.
that is good news! any indication on when you expect the v4 to be done ?
Hi I still see this in v3.5. Am I missing something?
Hi I still see this in v3.5. Am I missing something?
Sorry I have been busy with real life. You are missing the v4 that is still just sitting on my computer. The problem is I have not had the time to update the docs and the other tooling to reflect the changes. The api has changed a lot for some of the functions. I will try to push the branch soon so you can try it out.
I am getting the following error when trying to implement AWOT in a class
the function has return type
void
, why shouldnt this work ?