Pluggable cellular modem RF metrics for Rust streaming stacks.
A small trait crate plus one or more provider crates. Consumers wire the providers they need at compile time and poll a Registry for snapshots (RSRP, RSRQ, SINR, registration state, operator, bands, cell id, vendor extras).
| Crate | Role |
|---|---|
modem-metrics-core |
ModemProvider trait, RfMetrics, ModemSnapshot, Registry |
modem-metrics-modemmanager |
Provider backed by ModemManager over DBus (zbus) |
modem-metrics-at |
Serial AT-command provider (Quectel, SimCom, Fibocom, Telit) |
modem-metrics-netgear |
NETGEAR Nighthawk / MiFi HTTP API provider (M1, MR1100, LM1200) |
modem-metrics-huawei |
Huawei HiLink HTTP API provider (E3372, E5577, B525, B618, B818, 5G CPE) |
modem-metrics-cli |
modem-metrics-probe binary that polls every registered provider and emits NDJSON |
Each provider is a separate crate so consumers opt in only to the backends they actually need. Unknown or vendor-specific fields flow through RfMetrics::extras instead of being lost.
use std::sync::Arc;
use modem_metrics_core::registry::Registry;
use modem_metrics_modemmanager::ModemManagerProvider;
let mut r = Registry::new();
r.push(Arc::new(ModemManagerProvider::new()));
let snapshots = r.snapshot_all().await;# Default: only ModemManager.
cargo run -p modem-metrics-cli -- --interval-ms 1000
# Add AT serial, MiFi, and Huawei providers (requires building with their features).
cargo run -p modem-metrics-cli --features all-providers -- \
--at-device /dev/ttyUSB2 \
--at-device /dev/ttyUSB6 \
--mifi-url http://192.168.1.1 \
--huawei-device http://192.168.8.1
Emits one JSON object per modem per tick on stdout. --once runs a single poll and exits.
Each --huawei-device is url[,username,password], so one device's login travels with it. Repeat the flag to cover several Huawei modems, each with its own credentials (--huawei-device http://192.168.8.1,admin,secret --huawei-device http://192.168.8.2). Open devices (many E3372 sticks) need no credentials. A lone password (url,,secret) defaults the username to admin.
- New crate
modem-metrics-<vendor>. - Implement
modem_metrics_core::ModemProvider. - Consumers add it to the
Registry.
Providers should:
- Return
falsefromavailable()when the backend is not present (missing binary, daemon down, bus unreachable) so the registry can skip them quietly. - Populate
ModemInfo::idwith something stable across polls (IMEI when available). - Leave unknown numeric fields as
None, not zero.
MIT.