pub(crate) fn discover_and_open_transport(
port: Option<&str>,
baud: u32,
) -> Result<(String, EitherTransport), String>Expand description
Open a transport on the calling thread (must be main for BT).
This is synchronous — call from main before starting tokio.
On macOS, Bluetooth RFCOMM callbacks require the main thread’s
CFRunLoop, so transport discovery must happen before the tokio
runtime is spawned on a dedicated thread.
§Arguments
port: explicit serial port path (e.g./dev/cu.usbmodem*), orNonefor auto-detection of USB CDC or Bluetooth SPP.baud: baud rate (115200 for USB CDC, 9600 for BT SPP).
§Returns
(port_path, transport) on success, or an error string.