Skip to main content

rusty_esp_signal_core/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![forbid(unsafe_code)]
3//! `rusty_esp_signal-core` — the pure heart of `rusty_esp_signal`: the radio
4//! *application* layer with no radio in it.
5//!
6//! - [`radar`] — presence and motion from Wi-Fi CSI ([`radar::csi`]) and the
7//!   HLK-LD2410 mmWave UART protocol ([`radar::ld2410`]).
8//! - [`link`] — the mID-authenticated session and the MAC'd frame envelope
9//!   every ESP-NOW and LoRa frame travels in.
10//! - [`wifi`] — credentials that never print, and the station policy
11//!   (reconnect back-off, fallback to provisioning).
12//! - [`ble`] — the GATT table (provisioning, manifest, telemetry) as data.
13//! - [`lora`] — modem parameters, exact time-on-air, region duty cycle, the
14//!   discovery beacon.
15//!
16//! Rules this crate lives by (from the Janus mission plan):
17//!
18//! 1. `no_std` by default; `alloc` is a feature, never an assumption.
19//! 2. No drivers, no HAL types, no `esp-*` crate, no allocator. Backends live
20//!    in `rusty_esp_signal-esp`.
21//! 3. Every type that crosses to another Janus package comes from
22//!    `rusty_esp_core`; identity comes from `rusty_esp_mid-core`.
23//! 4. Frames and buffers are **borrowed over caller-owned memory**; nothing
24//!    here allocates per frame on a hot path.
25//! 5. `forbid(unsafe)`. Detectors are fixed-point and developed on the host
26//!    from recorded captures against an external oracle before any radio.
27//! 6. Sign the session, MAC the frames: P-256 ECDH under the device DID for
28//!    the session key, HMAC-SHA256 truncated to 16 bytes per frame.
29
30#[cfg(feature = "alloc")]
31extern crate alloc;
32
33pub use rusty_esp_core as esp_core;
34pub use rusty_esp_mid_core as mid;
35
36pub mod ble;
37pub mod link;
38pub mod lora;
39pub mod provision;
40pub mod radar;
41pub mod setup;
42pub mod wifi;
43
44/// The names a sketch or firmware wants in scope.
45pub mod prelude {
46    pub use rusty_esp_core::prelude::*;
47
48    pub use crate::ble::{Characteristic, GattTable, Props, Service};
49    pub use crate::link::{Envelope, Handshake, Session};
50    pub use crate::lora::{Beacon, DutyCycle, Params as LoraParams, Region};
51    pub use crate::provision::{Provisioner, ScanEntry, ScanList};
52    pub use crate::radar::csi::{CsiFrame, Features, PresenceDetector, Verdict};
53    pub use crate::radar::ld2410::{Parser as Ld2410Parser, Report as Ld2410Report};
54    pub use crate::wifi::{Action, Credentials, Event, Phase, StationPolicy};
55}
56
57/// Crate version, for capability manifests and logs.
58pub const VERSION: &str = env!("CARGO_PKG_VERSION");