I'm implementing some code to serve a list of files on the SD card on a web page. I'd like to pass the Webserver instance from my webduino registered command to a subroutine. I've tried eveery way I can think of to do this and can't figure it out.
So I have a default command like this
void helloCmd(WebServer &server, WebServer::ConnectionType type, char *, bool) // this command is registered with the webserver
{
server.print("Stuff to serve")
listFiles(server, other parms);
}
void listFiles(Webserver& server, other parms) // this command is not registered with the webserver
{
Code to read SD card;
server.print(filename);
server.print(filesize);
server.print(filesize);
etc.....
}
How can I pass the current webserver instance to a subroutine, or how can I pass a pointer to the current instance. I've thought about modding websever.h to make m_client public and pass server.client, but I'm not sure that would work either.
Being able to pass the webserver instance would make code for my various pages less redundant and more effecient. Anyone have any ideas how to do this?