diff options
author | Mike Beattie <mike@ethernal.org> | 2012-03-22 23:01:48 +1300 |
---|---|---|
committer | Mike Beattie <mike@ethernal.org> | 2012-03-22 23:01:48 +1300 |
commit | bbcdb10933e35b4582985ee484381aeb6ccb42cb (patch) | |
tree | 39f2a6e25d7b9c9944a5c0183166c6fb698f78a5 /HouseControl.ino | |
parent | 8b6c084eb911b80234bcd4fee6f359d018656a3d (diff) |
Add stubs for config handling
Signed-off-by: Mike Beattie <mike@ethernal.org>
Diffstat (limited to 'HouseControl.ino')
-rw-r--r-- | HouseControl.ino | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/HouseControl.ino b/HouseControl.ino index 622ce3d..e8b0841 100644 --- a/HouseControl.ino +++ b/HouseControl.ino @@ -302,6 +302,35 @@ void doHandler(WebServer &server, WebServer::ConnectionType type, char *url_tail } +void configHandler(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete) { + /* for a GET or HEAD, send the standard "it's all OK headers" */ + server.httpSuccess("text/html"); + + /* we don't output the body for a HEAD request */ + if (type == WebServer::GET) { + } +} + +void configGetHandler(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete) { + /* for a GET or HEAD, send the standard "it's all OK headers" */ + server.httpSuccess("text/plain"); + + /* we don't output the body for a HEAD request */ + if (type == WebServer::GET) { + } +} + +void configSetHandler(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete) { + if (type == WebServer::POST) { + server.httpSuccess(); + server.write("OK"); + return; + } + + server.httpSeeOther("/"); + return; +} + /*********************************************************************************/ /* Miscellaneous functions */ @@ -373,6 +402,11 @@ void setup() { httpServer.setDefaultCommand(&httpHandler); httpServer.addCommand("json", &jsonHandler); httpServer.addCommand("do", &doHandler); + + httpServer.addCommand("config", &configHandler); + httpServer.addCommand("config/get", &configGetHandler); + httpServer.addCommand("config/set", &configSetHandler); + httpServer.begin(); setupDoor(&frontDoor, FDOOR_STRIKE, FDOOR_CLOSED, 255); |