Exemplo n.º 1
0
void CommandHandler::registerSystemCommands()
{
	registerCommand(CommandDelegate("status", "Displays System Information", "system", commandFunctionDelegate(&CommandHandler::procesStatusCommand,this)));
	registerCommand(CommandDelegate("echo", "Displays command entered", "system", commandFunctionDelegate(&CommandHandler::procesEchoCommand,this)));
	registerCommand(CommandDelegate("help", "Displays all available commands", "system", commandFunctionDelegate(&CommandHandler::procesHelpCommand,this)));
	registerCommand(CommandDelegate("debugon", "Set Serial debug on", "system", commandFunctionDelegate(&CommandHandler::procesDebugOnCommand,this)));
	registerCommand(CommandDelegate("debugoff", "Set Serial debug off", "system", commandFunctionDelegate(&CommandHandler::procesDebugOffCommand,this)));
}
Exemplo n.º 2
0
void otaEnable()
{
    commandHandler.registerCommand(CommandDelegate("upgrade",
                                                   "Upgrade the system",
                                                   "System",
                                                   processUpgradeCommand));
}
Exemplo n.º 3
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
}
Exemplo n.º 4
0
CommandDelegate CommandHandler::getCommandDelegate(String commandString)
{
	if (registeredCommands->contains(commandString))
	{
		debugf("Returning Delegate for %s \r\n",commandString.c_str());
		return (*registeredCommands)[commandString];
	}
	else
	{
		debugf("Command %s not recognized, returning NULL\r\n",commandString.c_str());
		return CommandDelegate("","","",NULL);
	}
}
Exemplo n.º 5
0
void CommandHandler::registerSystemCommands()
{
	registerCommand(CommandDelegate("status", "Displays System Information", "system", CommandProcessDelegate(&CommandHandler::procesStatusCommand,this)));
	registerCommand(CommandDelegate("echo", "Displays command entered", "system", CommandProcessDelegate(&CommandHandler::procesEchoCommand,this)));
	registerCommand(CommandDelegate("help", "Displays all available commands", "system", CommandProcessDelegate(&CommandHandler::procesHelpCommand,this)));
	registerCommand(CommandDelegate("debugon", "Set Serial debug on", "system", CommandProcessDelegate(&CommandHandler::procesDebugOnCommand,this)));
	registerCommand(CommandDelegate("debugoff", "Set Serial debug off", "system", CommandProcessDelegate(&CommandHandler::procesDebugOffCommand,this)));
	registerCommand(CommandDelegate("command","Use verbose/silent/prompt as command options","system", CommandProcessDelegate(&CommandHandler::processCommandOptions,this)));
}
Exemplo n.º 6
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));
}
Exemplo n.º 7
0
void init() {
	Serial.begin(SERIAL_BAUD_RATE); // 115200 by default
	Serial.systemDebugOutput(false); // Debug output to serial
	
	// mount spiffs
	int slot = rboot_get_current_rom();

	if (slot == 0) {
#ifdef RBOOT_SPIFFS_0
		debugf("trying to mount spiffs at %x, length %d", RBOOT_SPIFFS_0 + 0x40200000, SPIFF_SIZE);
		spiffs_mount_manual(RBOOT_SPIFFS_0 + 0x40200000, SPIFF_SIZE);
#else
		debugf("trying to mount spiffs at %x, length %d", 0x40300000, SPIFF_SIZE);
		spiffs_mount_manual(0x40300000, SPIFF_SIZE);
#endif
	} else {
#ifdef RBOOT_SPIFFS_1
		debugf("trying to mount spiffs at %x, length %d", RBOOT_SPIFFS_1 + 0x40200000, SPIFF_SIZE);
		spiffs_mount_manual(RBOOT_SPIFFS_1 + 0x40200000, SPIFF_SIZE);
#else
		debugf("trying to mount spiffs at %x, length %d", 0x40500000, SPIFF_SIZE);
		spiffs_mount_manual(0x40500000, SPIFF_SIZE);
#endif
	}

	WifiAccessPoint.enable(false);
	WifiStation.config(WIFI_SSID, WIFI_PWD);
    WifiStation.enable(true);
	
    Serial.printf("\r\nCurrently running rom %d.\r\n", slot);
	Serial.println("Type 'help' and press enter for instructions.");
	Serial.println();
	Serial.commandProcessing(true);
    
    commandHandler.registerCommand(CommandDelegate("ip","show current ip address","user", cmdIP));
    commandHandler.registerCommand(CommandDelegate("ota","perform ota update, switch rom and reboot","user", cmdOTA));
    commandHandler.registerCommand(CommandDelegate("heap","display free heap","user", cmdAppHeap));
    commandHandler.registerCommand(CommandDelegate("ls","list files in spiffs","user", cmdLs));
    commandHandler.registerCommand(CommandDelegate("connect","connect to wifi","user", cmdConnect));
    commandHandler.registerCommand(CommandDelegate("disconnect","disconnect from wifi","user", cmdConnect));
    commandHandler.registerCommand(CommandDelegate("ap","create access point","user", cmdAP));
    
	//Serial.setCallback(serialCallBack);
    init_servos(); 
    WifiStation.waitConnection(startWebServer, 30, startAP);    
    
}
Exemplo n.º 8
0
void init()
{
	Serial.begin(SERIAL_BAUD_RATE); // 115200 by default
	Serial.systemDebugOutput(true); // Enable debug output to serial
	Serial.commandProcessing(true);
	WifiStation.enable(true);
	WifiStation.config(WIFI_SSID, WIFI_PWD);
	WifiAccessPoint.enable(false);

	// Run our method when station was connected to AP
	WifiStation.waitConnection(connectOk, 30, connectFail);
	Debug.setDebug(Serial);
	Debug.initCommand();
	Debug.start();
	Debug.printf("This is the debug output\r\n");
	telnetServer.setDebug(true);/* is default but here to show possibility */
	commandHandler.registerCommand(CommandDelegate("appheap","Usage appheap on/off/now for heapdisplay\r\n","testGroup", appheapCommand));
	memoryTimer.initializeMs(250,checkHeap).start();

}
Exemplo n.º 9
0
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
void CApplication::cmdInit() {
  char str[32];

  // set prompt
  sprintf(str, "%s/%s> ", szAPP_ALIAS, szAPP_TOPOLOGY); 
  commandHandler.setCommandPrompt(str);

  // add new commands
  commandHandler.registerCommand(
    CommandDelegate("info", "Show  information", "System",
                    commandFunctionDelegate(&CApplication::cmdOnInfo, this)));

  commandHandler.registerCommand(
    CommandDelegate("debug", "Enable or disable debugging", "System",
                    commandFunctionDelegate(&CApplication::cmdOnDebug, this)));

  commandHandler.registerCommand(
    CommandDelegate("restart", "Restart the system", "System",
                    commandFunctionDelegate(&CApplication::cmdOnRestart, this)));

  commandHandler.registerCommand(
    CommandDelegate("cpu", "Adjust CPU speed", "System",
                    commandFunctionDelegate(&CApplication::cmdOnCpu, this)));

  commandHandler.registerCommand(
    CommandDelegate("show", "Show the current configuration", "System",
                    commandFunctionDelegate(&CApplication::cmdOnShow, this)));

  commandHandler.registerCommand(
    CommandDelegate("apMode", "Adjust the AccessPoint Mode", "System",
                    commandFunctionDelegate(&CNetwork::OnCmdApMode, &g_network)));

  commandHandler.registerCommand(
    CommandDelegate("upgrade","Upgrade the system", "System",
                    commandFunctionDelegate(&CApplication::cmdOnUpgrade, this)));
  } // cmdInit
Exemplo n.º 10
0
void DebugClass::initCommand()
{
	commandHandler.registerCommand(CommandDelegate("debug","New debug in development","Debug",CommandProcessDelegate(&DebugClass::processDebugCommands,this)));
}
Exemplo n.º 11
0
void ExampleCommand::initCommand()
{
	commandHandler.registerCommand(CommandDelegate("example","Example Command from Class","Application",commandFunctionDelegate(&ExampleCommand::processExampleCommands,this)));
}
Exemplo n.º 12
0
void startExampleApplicationCommand()
{
	exampleCommand.initCommand();
	commandHandler.registerCommand(CommandDelegate("example","Example Command from Class","Application",processApplicationCommands));
}