Expand description
DongLoRa host library — connect, configure, send/receive LoRa packets.
Implements the DongLoRa Protocol v2 on top of the
donglora-protocol wire crate. All I/O is
async via tokio; the public surface mirrors the Python client in
client-py/.
§Quick start
use donglora_client::{
connect, LoRaBandwidth, LoRaCodingRate, LoRaConfig, LoRaHeaderMode, Modulation,
};
let dongle = connect().await?;
dongle.set_config(Modulation::LoRa(LoRaConfig {
freq_hz: 910_525_000,
sf: 7,
bw: LoRaBandwidth::Khz62,
cr: LoRaCodingRate::Cr4_5,
preamble_len: 16,
sync_word: 0x1424,
tx_power_dbm: 20,
header_mode: LoRaHeaderMode::Explicit,
payload_crc: true,
iq_invert: false,
})).await?;
dongle.tx(b"hello world").await?;§Module layout
- [
connect] — auto-discovery +ConnectOptionsbuilder. dongle— publicDongleradio session type.session— internal async plumbing (not public).transport— tokio-based byte-stream transports.errors—ClientErrortaxonomy.retry—RetryPolicy+TxOutcomefortx_with_retry.discovery— USB VID/PID scan + asyncwait_for_device.
Re-exports§
pub use connect::mux_unix_connect;pub use connect::ConnectOptions;pub use connect::connect;pub use connect::connect_mux_auto;pub use connect::connect_mux_auto_with;pub use connect::connect_with;pub use connect::default_socket_path;pub use connect::find_mux_socket;pub use connect::mux_tcp_connect;pub use connect::try_connect;pub use connect::try_connect_with;pub use discovery::USB_PID;pub use discovery::USB_VID;pub use discovery::find_port;pub use discovery::wait_for_device;pub use dongle::Dongle;pub use dongle::KEEPALIVE_INTERVAL;pub use dongle::TransportKind;pub use errors::ClientError;pub use errors::ClientResult;pub use retry::RetryPolicy;pub use retry::TxAttempt;pub use retry::TxOutcome;pub use transport::UnixSocketTransport;pub use transport::AnyTransport;pub use transport::SerialTransport;pub use transport::TcpTransport;pub use transport::Transport;
Modules§
- cap
- Capability bitmap bit positions (
PROTOCOL.md §9). - connect
- High-level
connect()entry points. - discovery
- USB device discovery for DongLoRa dongles.
- dongle
- The user-facing
Dongle— a connected, configured, ready-to-TX radio. - errors
- Error taxonomy for
donglora-client. - retry
- TX retry policy + outcome reporting.
- session
- Internal session plumbing: tag counter, outstanding-tag correlation, background reader task, async event queue.
- transport
- Async transport abstractions.
Structs§
- Flrc
Config - FLRC configuration payload (13 bytes after
modulation_id). - FskConfig
- FSK / GFSK configuration payload (
PROTOCOL.md §10.2). - Info
GET_INFOresponse payload.- LoRa
Config - LoRa configuration payload (15 bytes after
modulation_id). - LrFhss
Config - LR-FHSS configuration payload (10 bytes after
modulation_id). - RxPayload
RXevent payload (PROTOCOL.md §6.9). Metadata is the 20-byte prefix;datais the OTA packet body (0..=MAX_OTA_PAYLOAD bytes).- SetConfig
Result - Payload of
OKin response toSET_CONFIG(PROTOCOL.md §6.3). - TxDone
Payload TX_DONEpayload (PROTOCOL.md §6.10).- TxFlags
TXflag byte (PROTOCOL.md §6.4).
Enums§
- Command
- Host-to-device command.
- Device
Message - Any device→host message, parsed into its semantic form.
- Error
Code - Wire-level error code.
- Flrc
Bitrate - FLRC bitrate enum (
PROTOCOL.md §10.4). - FlrcBt
- FLRC Gaussian BT-product enum (
PROTOCOL.md §10.4). - Flrc
Coding Rate - FLRC coding rate enum (
PROTOCOL.md §10.4). - Flrc
Preamble Len - FLRC preamble length enum (
PROTOCOL.md §10.4). - LoRa
Bandwidth - LoRa signal bandwidth enum (
PROTOCOL.md §10.1). The small integer is what goes on the wire, NOT the kHz value. - LoRa
Coding Rate - LoRa coding rate enum (
PROTOCOL.md §10.1). - LoRa
Header Mode - LoRa header mode (
PROTOCOL.md §10.1). - LrFhss
Bandwidth - LR-FHSS occupied-bandwidth enum (
PROTOCOL.md §10.3). - LrFhss
Coding Rate - LR-FHSS coding rate enum (
PROTOCOL.md §10.3). - LrFhss
Grid - LR-FHSS grid selection (
PROTOCOL.md §10.3). - Modulation
- Any of the four modulation configs, tagged by
ModulationId. - Modulation
Id - One-byte modulation selector (
PROTOCOL.md §10). Prefixes everySET_CONFIGpayload. - OkPayload
- Payload shape carried by an
OKframe. - Owner
SET_CONFIGlock owner (PROTOCOL.md §6.3).- Radio
Chip Id - Radio chip identifier (u16, little-endian on the wire).
- RxOrigin
- Packet origin — over-the-air vs. local-loopback from another client
(
PROTOCOL.md §6.9, §13.4). In single-client firmware alwaysOta. - SetConfig
Result Code SET_CONFIGresult code (PROTOCOL.md §6.3).- TxResult
TX_DONEresult code (PROTOCOL.md §6.10).