示例#1
0
void StartServers()
{
	server.listen(80);
	server.addPath("/", onIndex);
	server.setDefaultHandler(onFile);

	// Web Sockets configuration
	server.enableWebSockets(true);
	server.commandProcessing(true,"command");

	server.setWebSocketConnectionHandler(wsConnected);
	server.setWebSocketMessageHandler(wsMessageReceived);
	server.setWebSocketBinaryHandler(wsBinaryReceived);
	server.setWebSocketDisconnectionHandler(wsDisconnected);

	Serial.println("\r\n=== WEB SERVER STARTED ===");
	Serial.println(WifiStation.getIP());
	Serial.println("==============================\r\n");

	// Start FTP server
	ftp.listen(21);
	ftp.addUser("me", "123"); // FTP account

	Serial.println("\r\n=== FTP SERVER STARTED ===");
	Serial.println("==============================\r\n");

	telnet.listen(23);
	telnet.enableDebug(true);

	Serial.println("\r\n=== TelnetServer SERVER STARTED ===");
	Serial.println("==============================\r\n");
}
示例#2
0
void startServers()
{
	tcpServer.listen(8023);

	Serial.println("\r\n=== TCP SERVER Port 8023 STARTED ===");
	Serial.println(WifiStation.getIP());
	Serial.println("==============================\r\n");

	telnetServer.listen(23);

	Serial.println("\r\n=== Telnet SERVER Port 23 STARTED ===");
	Serial.println(WifiStation.getIP());
	Serial.println("==============================\r\n");

	commandHandler.registerCommand(CommandDelegate("application","This command is defined by the application\r\n","testGroup", applicationCommand));
}
示例#3
0
/*
 * start http and telnet server
 * telnet can be used to configure cammera settings
 * unsing ArdCammCommand handler
 */
void StartServers()
{
	server.listen(80);
	server.addPath("/", onIndex);
	server.addPath("/cam/set", onCamSetup);
	server.addPath("/cam/capture", onCapture);
//	server.addPath("/stream", onStream);
	server.addPath("/favicon.ico", onFavicon);
	server.setDefaultHandler(onFile);

	Serial.println("\r\n=== WEB SERVER STARTED ===");
	Serial.println(WifiStation.getIP());
	Serial.println("==============================\r\n");


	telnet.listen(23);
	telnet.enableDebug(true);

	Serial.println("\r\n=== TelnetServer SERVER STARTED ===");
	Serial.println("==============================\r\n");
}
示例#4
0
// Will be called when WiFi station was connected to AP
void connectOk()
{

	NtpSming = new ntpClientSming();

	Serial.println("I'm CONNECTED");
	Serial.print("My IP: ");
	Serial.println(WifiStation.getIP().toString());
	Serial.print("My gate: ");
	Serial.println(WifiStation.getNetworkGateway().toString());

	telnetServer.listen(23);
	commandHandler.registerCommand(CommandDelegate("info","Info from ESP via Telnet\r\n","testGroup", EspInfoCommand));
	commandHandler.registerCommand(CommandDelegate("reset","Software reset via Telnet\r\n","testGroup", ResetCommand));

	test_spiffs();


	// Start send data loop
	procTimer.initializeMs(60 * 1000, sendData).start(true); // every 60 seconds
	resetTimer.initializeMs(240 * 1000, resetData).start(true); // every 240 seconds if errors
}