Created
October 8, 2012 12:17
-
-
Save biskandar/3852222 to your computer and use it in GitHub Desktop.
Simplified webserver module using Webduino library 2012100803
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// prepare for the default command request | |
void defaultCommand( WebServer &webserver , WebServer::ConnectionType connType , char *tailUrl , bool tailComplete ) { | |
Serial.print( "New Command: " ) ; | |
// first, accepting all kind of request | |
webserver.httpSuccess() ; | |
// validate based on http method, | |
// only GET or POST is allow to continue | |
Serial.print( "connType = " ) ; | |
Serial.print( connType ) ; | |
if ( ( connType != WebServer::GET ) && ( connType != WebServer::POST) ) { | |
Serial.println( "" ) ; | |
return ; | |
} | |
// print message response into the http response body | |
webserver.println( aJson.print( jsonResponse( "OK" , "OK" ) ) ) ; | |
// print the query string if found any | |
if ( strlen( tailUrl ) ) { | |
Serial.print( ", tailUrl = " ) ; | |
Serial.print( tailUrl ) ; | |
} | |
Serial.println( "" ) ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment