Use HTTP server, from within a lib...
Posted: Mon Oct 05, 2015 12:42 pm
I'm trying to write a lib that will need to have a function that handles all onnotfound requests made to the web server.
When the class is initialised the user passes in a pointer to the HTTP server they are running.
I am then trying to use it in the following way..
where HandleWebRequest is a function inside my lib.
I've tried all sorts but, ultimately failed. can someone point me in the right direction!
This is the error:
When the class is initialised the user passes in a pointer to the HTTP server they are running.
Code: Select all
HueBridge(ESP8266WebServer * HTTP, uint8_t lights, uint8_t groups);
I am then trying to use it in the following way..
Code: Select all
_HTTP->onNotFound(HandleHue);
where HandleWebRequest is a function inside my lib.
I've tried all sorts but, ultimately failed. can someone point me in the right direction!
This is the error:
Code: Select all
HueBridge.cpp: In constructor 'HueBridge::HueBridge(ESP8266WebServer*, uint8_t, uint8_t)':
HueBridge.cpp:13: error: no matching function for call to 'ESP8266WebServer::onNotFound(<unresolved overloaded function type>)'
_HTTP->onNotFound(HandleHue);
^
HueBridge.cpp:13:31: note: candidate is:
In file included from HueBridge.h:19:0,
from HueBridge.cpp:2:
/Users/amelvin/git/Arduino/build/Arduino-latest.app/Contents/Java/portable/packages/esp8266/hardware/esp8266/1.6.5-1160-gef26c5f/libraries/ESP8266WebServer/src/ESP8266WebServer.h:69:8: note: void ESP8266WebServer::onNotFound(ESP8266WebServer::THandlerFunction)
void onNotFound(THandlerFunction fn); //called when handler is not assigned
^
/Users/amelvin/git/Arduino/build/Arduino-latest.app/Contents/Java/portable/packages/esp8266/hardware/esp8266/1.6.5-1160-gef26c5f/libraries/ESP8266WebServer/src/ESP8266WebServer.h:69:8: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'ESP8266WebServer::THandlerFunction {aka std::function<void()>}'
no matching function for call to 'ESP8266WebServer::onNotFound(<unresolved overloaded function type>)'