umsh_ulcp_device/
lib.rs

1#![cfg_attr(not(test), no_std)]
2
3//! Device-side session engine for the minimal ULCP profile and
4//! independently advertised full-profile extensions.
5//!
6//! [`Session`] is a pure state machine: it consumes decoded
7//! ULCP frames (framing such as HDLC-Lite is handled by the
8//! caller), emits response frames through a caller-provided sink, and
9//! returns radio side effects ([`Effect`]) for the caller to execute.
10//! It performs no I/O and takes time as a parameter, so the whole
11//! protocol surface is testable on the host; firmware only supplies
12//! the byte pipes and the radio.
13//!
14//! Design constraints from the spec
15//! (`docs/protocol/src/ulcp-core.md`,
16//! `docs/protocol/src/ulcp-transport.md`):
17//!
18//! - one confirmed transmit in flight at a time (`STATUS_BUSY`);
19//! - transmits never wait for duty-cycle allowance
20//!   (`STATUS_DUTY_LIMIT` unless the `NODUTY` flag is set);
21//! - `CMD_RST` is a protocol-level reset: all session state returns to
22//!   post-reset defaults and the radio is re-applied, but the MCU (and
23//!   therefore the USB link) stays up.
24//!
25//! v0 limitations (all surfaced through defined status codes):
26//! `PROP_PHY_RSSI` is unimplemented, the sync word only accepts the
27//! value the firmware was built with, and the CCA transmit flag is
28//! ignored (frames transmit without a clear-channel check, matching
29//! the existing firmware radio path).
30
31pub mod duty;
32pub mod session;
33
34pub use duty::{DutyExceeded, DutyLedger, DutyTracker};
35pub use session::{
36    AlertConfig, BatteryFields, DEFAULT_IDENT_PRECISION, Effect, GnssConfig, IdentitySource,
37    MAX_CHANNEL_KEYS, MAX_DEV_PEERS, MAX_DEVICE_NAME_LEN, MAX_IDENT_PRECISION,
38    MAX_REPEATER_REGIONS, PRIVATE_KEY_LEN, RadioSettings, SNAPSHOT_MAX, SavedStatus, Session,
39    SessionConfig, SnapshotError, TimeConfig, TxOutcome, TxPower,
40};