pub(crate) async fn spawn_with_transport(
path: String,
transport: EitherTransport,
mcp_speed: String,
tx: UnboundedSender<Message>,
cmd_rx: UnboundedReceiver<RadioCommand>,
bt_req_tx: Sender<(Option<String>, u32)>,
bt_resp_rx: Receiver<Result<(String, EitherTransport), String>>,
) -> Result<String, String>Expand description
Spawn the radio communication task with a pre-opened transport.
Performs initial handshake (identify, enable AI mode, read firmware version and radio type), then spawns a tokio task that:
- Polls band state (FQ, SQ, MD, PC, RA, FS) and global state on a timer
- Processes AI-pushed BY notifications as a gate for SM reads
- Handles user commands (tune, set squelch, MCP write, etc.)
S-meter and busy state are event-driven via AI mode, not polled. This avoids spurious firmware spikes on Band B that occur with direct SM/BY polling.
ยงArguments
mcp_speed:"fast"forMcpSpeed::Fast(risky), anything else for Safe.tx: channel for sending state updates and errors to the TUI.bt_req_tx/bt_resp_rx: channels for requesting BT reconnect from the main thread (IOBluetoothRFCOMM must be opened on main).cmd_rx: channel for receiving user commands from the TUI.