Module connection

Module connection 

Source
Expand description

Finding a device, opening a link to it, and holding the attached session.

Discovery is BLE-only on purpose. Identifying a ULCP device over serial means opening the port and speaking to whatever is behind it, and opening a port has side effects — DTR toggles reset some boards, and a 1200-baud touch is this repository’s own DFU trigger. A bench is full of usbmodem/usbserial devices that are not ULCP radios, so a serial port is used only when the user names one. BLE scanning is passive and filtered to the ULCP GATT service, so it cannot land on a foreign device.

Structs§

DefaultDevice
The device to reach for when the command line names none.
Found
One radio seen during a scan, in the form the chooser and the saved default both work with.
Prefs
Persisted tool preferences. Deliberately tiny: setting = value lines with # comments, the same vocabulary the provisioning file uses, and no dependency to read it.
Session
An attached device plus everything needed to describe it, tap it, and re-attach it in the other mode.
SessionLink
A link that copies every ULCP frame into the tap, when one is installed.

Enums§

AnyLink
Every transport this tool can open, as one type, so a REPL can move between them without the session being generic over the link.
Discovery
How a scan result set is resolved into one radio.
Target
A device this tool knows how to reach, in the form it would use to reach it again.

Constants§

DISCOVERY_EXTENSION 🔒
How much longer discovery listens when the first window came up empty (or missed the saved default). Power-conscious boards can straddle a two-second advertising window.
DISCOVERY_WINDOW 🔒
How long general discovery listens before deciding what it found.

Functions§

attach_config
The RF parameters here only size the driver’s airtime-derived timeouts; an administrative or tethered attach never writes PHY configuration.
attach_tapped 🔒
choose
Turn a scan result set into a single target, asking the user when the answer is ambiguous — or, under Discovery::Ask, whenever there is anything to ask about.
config_path
confirm
Ask a yes/no question, defaulting to no.
connect
Open, attach, and name a device in one step.
discover
Find the device to talk to when the command line named none.
history_path
install_trace
Wire the frame-trace hook to stderr.
merge_found
Fold a later scan’s results into an earlier one, keeping order stable and preferring the fresher name and RSSI.
new_tap
open
Open the transport named by target.
open_ble 🔒
open_serial 🔒
prompt_index 🔒
Read a 1-based choice from the terminal. None means the user declined (empty line or EOF).
reattach_link 🔒
Attach to an already-wrapped link.
render_found
Print a numbered listing of scan results.
scan
Scan for ULCP radios advertising the GATT service.
sort_found
Stable ordering: by name, then by id.
state_dir 🔒
Where the preferences file and the REPL history live. One directory, following XDG_STATE_HOME when it is set.

Type Aliases§

FrameTap
The pcap sink shared by the link wrapper (ULCP frames) and the capture loop (radio frames).