JvmScannerViewModel
Desktop/JVM ScannerViewModel registration.
On Desktop, the base ScannerViewModel is used directly. The default requestBonding connects without explicit bonding since the OS Bluetooth stack handles pairing during the GATT connection.
Constructors
Properties
The single transport pane currently rendered by the Connections screen.
User preference that controls whether BLE scanning auto-starts when the Connections screen opens.
BLE devices for the UI — restricted to those currently visible via an active scan.
Transient, fine-grained status text emitted during connect/bonding (e.g. "Bonding…", "Requesting config…"). Nullable because serviceRepository.connectionProgress does not emit during steady-state.
Discovered (NSD) TCP devices for the Connections device list, gated by the network-scan flag.
Whether a BLE scan is currently active.
Whether an NSD network scan is currently active.
User preference that controls whether NSD network scanning auto-starts when the Connections screen opens.
A firmware update that didn't finish, leaving a device stranded in bootloader mode. Non-null drives the recovery banner on the Connections screen, whose tap deep-links into the Firmware Update screen to re-flash the device.
The persisted device name from the last selection, for use as a UI fallback.
Recently-used TCP addresses for the Connections device list.
The currently-selected device address, or null when nothing is selected.
Non-null variant of selectedAddressFlow that substitutes NO_DEVICE_SELECTED for null.
Whether the mock/demo transport is currently selected.
Functions
Persists address in the recent-TCP list under name. No-op when address does not start with TCP_DEVICE_PREFIX.
Asynchronously tells the radio controller to connect to address.
Connects to a manually-entered TCP address. Wraps the manual-entry flow with the same scan-cancel invariant as onSelected: stops discovery before connection setup so the manual connect does not race an in-progress BLE/network scan for radio resources.
Clears the persisted device name and tells the radio controller to disconnect.
Manually retire the pending recovery record (user dismissed the banner). Needed for a device whose bootloader can't be re-flashed over BLE at all — e.g. a stock nRF Legacy-DFU bootloader that never answers its control point — where recovery persistently fails and would otherwise nag forever (it only auto-clears on a successful reconnect or re-flash). The record is re-created next time a DFU update is triggered.
Called by the UI when a device has been tapped. BLE and USB entries may still need bonding/permission — the concrete return value tells the caller whether the connection was initiated immediately.
Persists the user's intent to auto-scan the network on next screen entry without flipping the active scan flag. Used by the Connections screen when it must defer the actual scan start until after the system permission grant dialog resolves. When enabled is true, also clears bleAutoScan so persisted state mirrors the runtime mutual-exclusion invariant (at most one of bleAutoScan / networkAutoScan may be true).
Removes address from the recent-TCP list.
Selects one Connections transport pane and stops scans that cannot belong to that pane.
Starts BLE scanning for screen-entry auto-scan only when no device is already selected. Manual scan toggles call startBleScan directly so users can still discover/switch devices while connected.
Starts BLE scanning. Enforces mutual exclusion (cancels any active network scan first). No-op if already scanning or if bleScanner is null.
Starts NSD scanning for screen-entry auto-scan only when the Network pane is active.
Starts NSD network scanning. Enforces the same mutual-exclusion invariant as startBleScan; starting Network cancels any active BLE scan first.
Cancels the active BLE scan and resets the scanning flag. Idempotent.
Cancels the active network scan and resets the scanning flag. Idempotent.
Toggles BLE scanning. Persists the auto-scan preference only when the scan actually activates, and clears the opposite networkAutoScan preference to keep persisted state consistent with the runtime mutual-exclusion invariant.
Toggles network scanning. Persists the auto-scan preference only when the scan actually activates, and clears the opposite bleAutoScan preference to keep persisted state consistent with the runtime mutual-exclusion invariant.