void InitializeGarageDoorWebserver()
{
  static uint8_t auLocalMAC[] = LOCAL_MAC_ADDRESS;
  static uint8_t auLocalIPAddress[] = LOCAL_IP_ADDRESS;

  AccessControlServer.setDefaultCommand(ShowWebRoot);
  AccessControlServer.addCommand("LetMeIn.html", CheckLogin);
  AccessControlServer.addCommand("index.html", ShowWebRoot);
  AccessControlServer.setFailureCommand(ShowPageNotFound);

  Ethernet.begin(auLocalMAC, auLocalIPAddress);
  AccessControlServer.begin();
}
Example #2
0
void setup() {
#if DEBUG
    Serial.begin(9600);
    Serial.println("Hello world.");
#endif
    
    /* setup our default command that will be run when the user accesses
     * the root page on the server */
    webserver.setDefaultCommand(&helloCmd);
    
    /* run the same command if you try to load /index.html, a common
     * default page name */
    webserver.addCommand("index.html", &helloCmd);
    
    /* start the webserver */
    webserver.begin();
}
Example #3
0
/* ================================================================== *
 * Function: init
 * Description: Initialize the server
 * Parameters: none
 * ================================================================== */
void Server::init() {
    /* Default command accessed through http://ip_address */
    webserver.setDefaultCommand(&web_index);

    /* Command to handle web inputs, accessed through http://ip_address/web_input */
    webserver.addCommand("web_input", &web_input, this);

    /* start the webserver */
    webserver.begin();

    // Print the IP so we know where to connect
    Particle.variable("ipAddress", myIpAddress, STRING);
    IPAddress myIp = WiFi.localIP();
    sprintf(myIpAddress, "%d.%d.%d.%d", myIp[0], myIp[1], myIp[2], myIp[3]);

    power_status = SERVER_POWER_ON;
}
Example #4
0
RestDhtApi::RestDhtApi(WebServer &server) {
	server.addCommand("dht", &RestDhtApi::dht);
}
Example #5
0
RestApi::RestApi(WebServer &server) {
	server.addCommand("get", &RestApi::get);
	server.addCommand("put", &RestApi::put);
}