コード例 #1
0
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();
}
コード例 #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();
}
コード例 #3
0
ファイル: server.cpp プロジェクト: SuperUser320/muse
/* ================================================================== *
 * 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;
}
コード例 #4
0
ファイル: RestDhtApi.cpp プロジェクト: jpfaria/RestDhtApi
RestDhtApi::RestDhtApi(WebServer &server) {
	server.addCommand("dht", &RestDhtApi::dht);
}
コード例 #5
0
ファイル: RestApi.cpp プロジェクト: jpfaria/RestApi
RestApi::RestApi(WebServer &server) {
	server.addCommand("get", &RestApi::get);
	server.addCommand("put", &RestApi::put);
}