swaits 7dd717a887 fix(clients/rust): harden client resilience for v0.1.0 release
- Track serial timeout in field instead of returning hardcoded 2s
- Always restore timeout in drain_rx, even on read errors
- Handle EINTR/Interrupted in read_frame (retry instead of error)
- Use connect_timeout for TCP mux (no more 2-min hangs)
- Set write timeout on mux sockets (unix + tcp)
- Log unexpected unsolicited frames in recv via tracing::warn
- Add unix socket timeout test for WouldBlock handling
- Add CHANGELOG.md, remove resolved CLAUDE_TODO.md
2026-04-06 14:00:42 -06:00

DongLoRa Rust Client

Rust client library for talking to a DongLoRa device — either directly over USB or through the mux daemon.

What's in Here

  • src/protocol.rs — wire protocol types (RadioConfig, Command, Response, ErrorCode)
  • src/codec.rs — COBS framing, frame accumulator
  • src/discovery.rs — USB VID:PID device discovery
  • src/transport.rs — serial and mux socket transports
  • src/client.rs — high-level Client<T> with send/recv
  • src/connect.rs — auto-detection (mux socket, TCP, direct USB)

Usage

use donglora_client::*;

let mut client = connect_default()?;
client.ping()?;
client.set_config(RadioConfig::default())?;
client.start_rx()?;

loop {
    if let Some(Response::RxPacket { rssi, snr, payload }) = client.recv()? {
        println!("RX rssi={rssi} snr={snr} len={}", payload.len());
    }
}

Dependencies

  • ucobs — COBS framing (same implementation as the firmware)
  • serialport — USB serial communication
  • anyhow — error handling
  • tracing — logging
S
Description
No description provided
Readme MIT
128 KiB
0 Stars 1 Watchers 0 Forks
Languages
Rust 99.3%
Just 0.7%