Description
Hi,
I have maybe similar issue as the others here.
I have a arduino library where I have a class, in which I want to use the handler:
RemoteHome.h
class RemoteHome {
public:
void handleSPIFFS(HTTPRequest * req, HTTPResponse * res);
}
Then in the RemoteHome.cpp I have:
void RemoteHome::handleSPIFFS(HTTPRequest * req, HTTPResponse * res) {
....
}
And I have in that class the method:
void RemoteHome::startWebServer() {
server = new HTTPServer();
ResourceNode *spiffsNode = new ResourceNode("", "", &RemoteHome::handleSPIFFS);
server->setDefaultNode(spiffsNode);
server->start();
if (server->isRunning()) {
LogTool::logSketch('I', PSTR("RemoteHome::setup"), PSTR("Http server is ready."));
}
Looks fine to me, but it will not compile:
Error downloading https://downloads.arduino.cc/packages/package_index.json
C:\RH\Sources\RH\RemoteHomeArduinoSketches\WiFi_ESP32\libraries\RemoteHome\src\RemoteHome.cpp: In member function 'void RemoteHome::startWebServer()':
C:\RH\Sources\RH\RemoteHomeArduinoSketches\WiFi_ESP32\libraries\RemoteHome\src\RemoteHome.cpp:788:68: error: no matching function for call to 'httpsserver::ResourceNode::ResourceNode(const char [1], const char [1], void (RemoteHome::)(httpsserver::HTTPRequest, httpsserver::HTTPResponse*))'
spiffsNode = new ResourceNode("", "", &RemoteHome::handleSPIFFS);
^
In file included from C:\RH\Sources\RH\RemoteHomeArduinoSketches\WiFi_ESP32\libraries\esp32_https_server\src/HTTPServer.hpp:20:0,
from C:\RH\Sources\RH\RemoteHomeArduinoSketches\WiFi_ESP32\libraries\esp32_https_server\src/HTTPSServer.hpp:15,
from C:\RH\Sources\RH\RemoteHomeArduinoSketches\WiFi_ESP32\libraries\RemoteHome\src\RemoteHome.h:13,
from C:\RH\Sources\RH\RemoteHomeArduinoSketches\WiFi_ESP32\libraries\RemoteHome\src\RemoteHome.cpp:9:
C:\RH\Sources\RH\RemoteHomeArduinoSketches\WiFi_ESP32\libraries\esp32_https_server\src/ResourceNode.hpp:18:3: note: candidate: httpsserver::ResourceNode::ResourceNode(const string&, const string&, void ()(httpsserver::HTTPRequest, httpsserver::HTTPResponse*), const string&)
ResourceNode(const std::string &path, const std::string &method, const HTTPSCallbackFunction * callback, const std::string &tag = "");
^
C:\RH\Sources\RH\RemoteHomeArduinoSketches\WiFi_ESP32\libraries\esp32_https_server\src/ResourceNode.hpp:18:3: note: no known conversion for argument 3 from 'void (RemoteHome::)(httpsserver::HTTPRequest, httpsserver::HTTPResponse*)' to 'void ()(httpsserver::HTTPRequest, httpsserver::HTTPResponse*)'
C:\RH\Sources\RH\RemoteHomeArduinoSketches\WiFi_ESP32\libraries\esp32_https_server\src/ResourceNode.hpp:16:7: note: candidate: httpsserver::ResourceNode::ResourceNode(const httpsserver::ResourceNode&)
class ResourceNode : public HTTPNode {
^
C:\RH\Sources\RH\RemoteHomeArduinoSketches\WiFi_ESP32\libraries\esp32_https_server\src/ResourceNode.hpp:16:7: note: candidate expects 1 argument, 3 provided
How can I make it working? Seems to me, that your code doesn't accept my method...