Skip to main content

leodos_protocols/physical/
mod.rs

1//! Physical layer: modulation, demodulation, and channel I/O.
2//!
3//! Defines the async traits for reading/writing raw bytes on a
4//! physical channel. Higher layers (coding, datalink) depend on
5//! these traits — this module has no upward dependencies.
6
7use core::future::Future;
8
9/// Hardware-backed physical channel implementations.
10#[cfg(feature = "nos3")]
11pub mod hardware;
12/// Modulation and demodulation schemes (BPSK, QPSK, OQPSK, 8PSK, GMSK).
13pub mod modulator;
14/// Proximity-1 physical layer parameters (CCSDS 211.1-B-4).
15pub mod proximity1;
16
17/// Async trait for writing raw bytes to a physical channel.
18pub trait PhysicalWrite {
19    /// Error type for write operations.
20    type Error;
21
22    /// Writes the given data bytes to the physical channel.
23    fn write(&mut self, data: &[u8]) -> impl Future<Output = Result<(), Self::Error>>;
24}
25
26/// Async trait for reading raw bytes from a physical channel.
27pub trait PhysicalRead {
28    /// Error type for read operations.
29    type Error;
30
31    /// Reads bytes into the buffer, returning the number of bytes read.
32    fn read(&mut self, buffer: &mut [u8]) -> impl Future<Output = Result<usize, Self::Error>>;
33}