-
Notifications
You must be signed in to change notification settings - Fork 131
How to pass a object member function to ResourceNode constructor? #105
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
That won't work with the current release version, but #91 enables it when merged. However, you cannot use your class method without an instance. So at some point, you need to create an instance of your HttpsHandler. If that instance is called // At the top of your sketch:
#include <HTTPSCallbackFunction.hpp>
// In your setup code:
HTTPSCallbackFunction handler =
std::bind(&HttpsHandler::root, &myHandler, std::placeholders::_1, std::placeholders::_2);
server.registerNode(new ResourceNode("/", "GET", handler)); A bit simplified, using #90 has more details on this. |
Thanks for the quick response! |
Thanks for testing and giving feedback! I'm currently working on building a reliable, automated, and hardware-based CI pipeline for this repository, since I want to be sure that after merging a PR the examples still work (not only that they are able to build) and to be able to test all functionality in isolation. Doing that manually for each PR takes me some hours each time I'm merging something, which makes it hard to merge even little changes. For that reason I decided to prioritize working on the CI first instead of spending my (currently quite limited) spare time on manual testing – that's also the reason why most issues are stale at the moment. I hope to get everything running around Christmas, and then merging PRs and working on issues should be easier and be doable with more confidence in the codebase. If I don't stumble upon any issues with the way the PR is implemented, it will stay as it is. So you could in theory start working on the PR branch, since the only code changes to 1.0.0 are the ones required for implementing the callbacks, all other commits are just documentation, and when 1.1.0 is out, you could switch back to using normal semver. |
Excellent decision! I will continue using the pr branch and awaiting the merge. Thank you very much for your attention! I hope to be able to contribute to the community as I progress in my studies. |
I need to register a node callback with a object member function
I created a class to hold all my https request callbacks functions and I want to pass those functions to ResourceNode constructor and register in my server.
Some of my files
https_handler.h
https_handler.cpp
my_server.h
my_server.cpp
platformio.ini
Here the error logs
Is it possible to do what I am proposing? how?
I'm a beginner in CPP
thanks in advance
ESP32-D0WDQ6 (revision 1)
Tools
The text was updated successfully, but these errors were encountered: