app_shell.c
ESP32-IDF console shell for the standalone Aliro UWB responder bench app: registers status, range, aliro-start/stop, pro…
Overview
ESP32-IDF console shell for the standalone Aliro UWB responder bench app: registers status, range, aliro-start/stop, provisioning, trust, and clear commands and runs the linenoise-based REPL.
depends on app_shell.h
flowchart TD app_responder_start --> lock_init
API
Fstatic const char *col(const char *c)
Returns the given ANSI color code, or an empty string when linenoise is in dumb-terminal mode.
cmd_status, print_bannerFstatic void print_banner(void)
Prints the shell's startup banner: app name, version, IDF version, and a one-line usage hint.
app_shell_start · calls colFstatic void lock_init(void)
Lazily creates the s_lock mutex on first call; subsequent calls are a no-op. Not thread-safe against concurrent first calls.
app_responder_start, app_responder_stopFint app_responder_start(void)
Start the demo CCC DS-TWR responder (canned URSK/cfg). Serialized by mutex. Returns 0 on success, 1 if already running, negative on facade failure.
cmd_aliro_start · calls lock_initFvoid app_responder_stop(void)
Stop the demo responder and unbind the CCC shim. No-op if already stopped.
cmd_aliro_stop · calls lock_initFbool app_responder_up(void)
True while the demo responder is up.
cmd_statusFstatic int cmd_status(int argc, char **argv)
Shell command handler: prints the demo responder's up/down status and the last measured and last trusted UWB ranges in cm, or "none" if unavailable. Always returns 0.
app_responder_up, colFstatic int cmd_range(int argc, char **argv)
Shell command handler: prints the last measured UWB range in cm via woz_uwb_last_range_cm, or "no range yet" if none is available. Always returns 0.
Fstatic int cmd_aliro_start(int argc, char **argv)
Shell command handler: starts the Aliro UWB responder via app_responder_start. Prints "busy" if a responder is already running (rc == 1), otherwise reports ok/FAILED with the return code. Always returns 0 to the shell.
app_responder_startFstatic int cmd_aliro_stop(int argc, char **argv)
Shell command handler: stops the Aliro UWB responder via app_responder_stop and prints confirmation. Always returns 0.
app_responder_stopFstatic int cmd_aliro_prov(int argc, char **argv)
Shell command handler: prints the current Aliro reader provisioning state. Always returns 0.
Fstatic int cmd_uwbdiag(int argc, char **argv)
Shell command handler: toggles the raw per-frame UWB trace (cia#/PREPOLL/POLL/ RESPTX/FINALDATA/DIST/GATE). Boot default off: the trace prints synchronously from the UWB task and costs ranging-slot deadlines. With no argument, prints the current state. Always returns 0.
Fstatic int cmd_lab(int argc, char **argv)
Shell command handler: toggles the [ALAB] transaction/power trace consumed by tools/aliro_lab.py and tools/power_profile.py (rssi, gate.hold/open/close, phase boundaries). Compiled in by default (CONFIG_WOZ_ALIRO_LAB) but off at boot so it costs nothing until asked for. With no argument, prints the current state. Always returns 0.
Fstatic int cmd_clear(int argc, char **argv)
Shell command handler: clears the terminal screen via linenoiseClearScreen. Always returns 0.
Fstatic int cmd_aliro_trust(int argc, char **argv)
Shell command handler: trusts the last-presented Aliro credential and persists it to NVS via aliro_reader_trust_last. Prints success, "nothing to add" (no credential presented or already trusted, rc == 1), or failure (trust store full or NVS error, other nonzero rc). Always returns 0 to the shell.
Fstatic int cmd_aliro_stepup(int argc, char **argv)
Shell command handler: aliro-stepup [arm|status]. With arm (or no argument)
it arms a one-shot Access-Document request for the next transaction; status
prints the armed state and the most recent verification verdict. Always 0.
Fvoid app_shell_start(void)
Register commands and start the UART console REPL (own task).
print_banner