Add guarded Bluetooth CLI on/off with force override

Add get bluetooth and set bluetooth on|off, with ble aliases. Require another
active management connection before disabling Bluetooth unless off has a
trailing force argument. Keep the toggle local to the current boot.

Drain Bluetooth replies before disconnecting and recheck the remaining
connection before applying a normal shutdown. Enabling Bluetooth cancels a
pending shutdown. Document the commands and add compiled regression coverage
to CI for native USB, HWCDC, UART, network clients, force, and timer rollover.

Validation: CLI, Bluetooth, and USB regression tests passed. XIAO ESP32-S3
and RAK4631 Full Companion builds passed RAM, flash, and capability checks.
This commit is contained in:
mikecarper committed 2026-09-14 23:02:54 -07:00
1 parent 170c2c44b1
commit 975167938d
6 files changed
+428 -2

No files matched your search

+33
View File
@@ -1410,6 +1410,39 @@ Station G2/G3 targets default to `off`.
---
#### Turn Bluetooth on or off (Companion)
```text
get bluetooth
set bluetooth off
set bluetooth off force
set bluetooth on
```
`get ble` and `set ble ...` are aliases. This controls the running Bluetooth
service on ESP32 and nRF52 Companions: `off` stops advertising and disconnects
Bluetooth clients; `on` enables it again. The change lasts until reboot.
Plain `off` requires another active management connection. A connected USB
terminal or binary client, TCP client, or browser terminal can provide that
connection. WiFi association, a listening server, and USB power alone do not.
On USB hardware without an observable open-host session (HWCDC or a UART
bridge), issue the command through that USB client so the request itself proves
it is active.
Append `force` to `off` to permit disconnecting the only active connection.
Use USB, another management transport, or reboot to regain access afterward.
`force` is accepted only as the final argument to `off`.
Commands sent through Bluetooth allow its reply to drain before shutdown
(normally 250 ms, at most two seconds). `get bluetooth` shows `off pending`
during that wait. A normal shutdown is cancelled if the other management
connection disappears before it applies; `force` bypasses that check too.
Bluetooth must be available in the current build and boot transport mode.
An exclusive-WiFi boot still requires `set companion.transport ble` and a
reboot before Bluetooth can be enabled.
#### View or change the independent Bluetooth name (Companion)
**Usage:**