Skip to content

Commit

Permalink
Added notify command to quickly send notifications from console
Browse files Browse the repository at this point in the history
Signed-off-by: simonmicro <[email protected]>
  • Loading branch information
simonmicro committed Nov 10, 2024
1 parent e636cc0 commit 00fcf9d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/services/OswServiceTaskConsole.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <OswSerial.h>
#include "./services/OswServiceTaskConsole.h"
#include "osw_hal.h"
#include "osw_ui.h"

void OswServiceTaskConsole::setup() {
OswServiceTask::setup();
Expand Down Expand Up @@ -131,6 +132,9 @@ void OswServiceTaskConsole::runPrompt() {
#endif
} else if (this->m_inputBuffer == "lock") {
this->m_locked = true;
} else if (this->m_inputBuffer.find("notify ") == 0 and this->m_inputBuffer.length() > 7) {
auto value = this->m_inputBuffer.substr(7);
OswUI::getInstance()->showNotification(value, false);
#ifndef OSW_EMULATOR
} else if (this->m_inputBuffer == "reboot") {
// this does not work in the emulator as it is running under an own thread, of which the shutdown-exception is not captured - populating here and crashing
Expand Down Expand Up @@ -172,17 +176,18 @@ void OswServiceTaskConsole::showHelp() {
serial->println(" reset <id> - reset a key to default value");
serial->println(" set <id> <value> - set a value for a key (value is everything until the end of the line)");
} else {
serial->println(" configure - enter configuration mode");
serial->println(" help - show this help");
serial->println(" configure - enter configuration mode");
serial->println(" help - show this help");
#ifdef OSW_FEATURE_WIFI
serial->println(" hostname - show the device hostname");
serial->println(" hostname - show the device hostname");
#endif
serial->println(" lock - lock the console");
serial->println(" lock - lock the console");
serial->println(" notify <value> - display a notification with the value (value is everything until the end of the line)");
#ifndef OSW_EMULATOR
serial->println(" reboot - warm-start the device forcefully");
serial->println(" reboot - warm-start the device forcefully");
#endif
serial->println(" time - show current UTC time");
serial->println(" wipe - format NVS partition and reset configuration");
serial->println(" time - show current UTC time");
serial->println(" wipe - format NVS partition and reset configuration");
}
}

Expand Down

0 comments on commit 00fcf9d

Please sign in to comment.