Skip to main content

donglora_client/
lib.rs

1//! DongLoRa host library — connect, configure, send/receive LoRa packets.
2//!
3//! Implements the DongLoRa USB protocol (COBS-framed fixed-size LE).
4//! See the [`protocol`] module for wire types and constants.
5//!
6//! # Quick start
7//!
8//! ```no_run
9//! use donglora_client::*;
10//!
11//! let mut client = connect_default()?;
12//! client.set_config(RadioConfig::default())?;
13//! client.start_rx()?;
14//!
15//! loop {
16//!     if let Some(Response::RxPacket { rssi, snr, payload }) = client.recv()? {
17//!         println!("RX rssi={rssi} snr={snr} len={}", payload.len());
18//!     }
19//! }
20//! # Ok::<(), anyhow::Error>(())
21//! ```
22
23pub mod client;
24pub mod codec;
25pub mod connect;
26pub mod discovery;
27pub mod protocol;
28pub mod transport;
29
30// Flat re-exports for convenience
31pub use client::Client;
32pub use codec::{FrameReader, decode_frame, encode_frame, read_frame};
33pub use connect::{connect, connect_default, connect_mux_auto, default_socket_path, try_connect};
34pub use discovery::{USB_PID, USB_VID, find_port, wait_for_device};
35pub use protocol::{
36    Bandwidth, Command, ErrorCode, MAX_PAYLOAD, PREAMBLE_DEFAULT, RADIO_CONFIG_SIZE, RadioConfig, Response,
37    TX_POWER_MAX,
38};
39pub use transport::{AnyTransport, MuxTransport, SerialTransport, Transport};
40
41#[cfg(unix)]
42pub use connect::mux_connect;
43pub use connect::mux_tcp_connect;