aliro_shell.c
aliro UART shell command: colored console over the UWB engine.
Overview
aliro UART shell command: colored console over the UWB engine.
depends on ccc_shim.h uwb_min.h uwb_rxdiag.h flight_recorder.h uwb_cirdiag.h fira_session.h aliro_shell.h
API
Fstatic void hdr(const struct shell *sh, const char *title)
Section header: green "aliro · <title>" over a dim rule.
cmd_chip, cmd_factoryreset, cmd_range, cmd_rx, cmd_selftest, cmd_status, cmd_versionFstatic int cmd_chip(const struct shell *sh, size_t argc, char **argv)
Read and display the DW3110 DEV_ID register; verify chip identification.
sh- Shell context.
argc- Argument count (unused).
argv- Argument vector (unused).
- returns
- 0 on success; nonzero SPI error code on read failure.
hdrFstatic int cmd_rx(const struct shell *sh, size_t argc, char **argv)
Display RX/TX frame tally and error counters.
sh- Shell context.
argc- Argument count (unused).
argv- Argument vector (unused).
- returns
- 0 on success.
hdrFstatic int cmd_range(const struct shell *sh, size_t argc, char **argv)
Display the last valid DS-TWR distance measurement and metadata.
sh- Shell context.
argc- Argument count (unused).
argv- Argument vector (unused).
- returns
- 0 on success.
hdrFstatic int cmd_selftest(const struct shell *sh, size_t argc, char **argv)
Run radio TX/RX self-test and display results.
sh- Shell context.
argc- Argument count (unused).
argv- Argument vector (unused).
- returns
- 0 on success; nonzero error code if self-test fails.
hdrFstatic int cmd_log(const struct shell *sh, size_t argc, char **argv)
Enable, disable, or query the ranging heartbeat log output stream.
sh- Shell context.
argc- Argument count; if ≥2, argv[1] must be "on" or "off".
argv- Command arguments; argv[1] optionally specifies "on" or "off".
- returns
- 0 on success; -EINVAL if argv[1] is neither "on" nor "off".
Fstatic int cmd_frames(const struct shell *sh, size_t argc, char **argv)
Enable, disable, or query the per-block distance stream output.
sh- Shell context.
argc- Argument count; if ≥2, argv[1] must be "on" or "off".
argv- Command arguments; argv[1] optionally specifies "on" or "off".
- returns
- 0 on success; -EINVAL if argv[1] is neither "on" nor "off".
Fstatic int cmd_frec(const struct shell *sh, size_t argc, char **argv)
Arm/disarm the flight recorder, or dump/clear its RAM ring.
sh- Shell context.
argc- Argument count; if ≥2, argv[1] is on|off|dump|clear.
argv- Command arguments.
- returns
- 0 on success; -EINVAL on an unrecognised sub-argument.
Fstatic int cmd_cir(const struct shell *sh, size_t argc, char **argv)
Control the per-reception CIA diagnostics stream ([ALAB] uwb.diag) and, via the dump sub-form, the windowed-CIR tap dump ([ALAB] uwb.cir).
sh- Shell context.
argc- Argument count.
cir [on|off]toggles the summary stream;cir dump [on|off]toggles the windowed-CIR dump;cir proberuns the one-shot accumulator read diagnostic. argv- Command arguments.
- returns
- 0 on success; -EINVAL on a malformed argument.
Fvoid aliro_shell_set_factory_reset(void (*fn)(void))
Supply the handler that aliro factoryreset yes invokes. A factory reset is a Matter/CHIP operation, and CHIP is C++. This file's module is pure C and has no CHIP include paths, so the application registers the call instead of this layer reaching up for it. Pass NULL to unregister. The handler is expected to erase provisioning and reboot; it may not return. Left unregistered (host tests, a build without the application) the command refuses with -ENOTSUP rather than pretending to have done anything.
fn- Reset handler, or NULL.
Fstatic int cmd_factoryreset(const struct shell *sh, size_t argc, char **argv)
Erase every stored credential and reboot, but only on an explicit "yes". The confirm word is the whole safety mechanism: this is reachable over a bare UART with no undo, and aliro fa<TAB> completes to something that would otherwise unpair the lock on Enter. Without it the command only explains what it would destroy.
sh- Shell context.
argc- Argument count; argv[1] must be the literal "yes" to proceed.
argv- Command arguments.
- returns
- 0 once the reset is scheduled; -EINVAL when unconfirmed; -ENOTSUP when the application never registered a handler.
hdrFstatic int cmd_version(const struct shell *sh, size_t argc, char **argv)
Display the build commit SHA.
sh- Shell context.
argc- Argument count (unused).
argv- Argument vector (unused).
- returns
- 0 on success.
hdrFstatic int cmd_status(const struct shell *sh, size_t argc, char **argv)
Display all system status: chip ID, CCC bind state, URSK provisioning, last range, RX tally, and stream state.
sh- Shell context.
argc- Argument count (unused).
argv- Argument vector (unused).
- returns
- 0 on success.
hdrFstatic int cmd_aliro(const struct shell *sh, size_t argc, char **argv)
Print aliro shell command help and list all available subcommands.
sh- Shell context.
argc- Argument count; if >1, returns error for unknown subcommand.
argv- Argument vector; argv[1] if present must be empty or help request.
- returns
- 0 on success; -EINVAL if argc >1.