Skip to main content

CaDevice

Trait CaDevice 

Source
pub trait CaDevice {
    // Required methods
    fn read(&mut self, buf: &mut [u8]) -> Result<usize>;
    fn write(&mut self, buf: &[u8]) -> Result<()>;
    fn reset(&mut self) -> Result<()>;
    fn slot_info(&mut self) -> Result<SlotInfo>;
    fn poll(&mut self, timeout: Duration) -> Result<bool>;
}
Expand description

The link-layer device the EN 50221 runtime drives.

All methods mirror the operations a host performs on the CA file descriptor per EN 50221. Implementations: MockCaDevice (in-memory, for tests + differential harness) and the linux CaDevice over /dev/dvb/.../ca.

Required Methods§

Source

fn read(&mut self, buf: &mut [u8]) -> Result<usize>

Read one link-layer TPDU frame into buf; returns the byte count. Ok(0) means no data available (non-blocking).

Source

fn write(&mut self, buf: &[u8]) -> Result<()>

Write one link-layer TPDU frame.

Source

fn reset(&mut self) -> Result<()>

Reset the interface / slot (ioctl CA_RESET).

Source

fn slot_info(&mut self) -> Result<SlotInfo>

Query slot status (ioctl CA_GET_SLOT_INFO).

Source

fn poll(&mut self, timeout: Duration) -> Result<bool>

Wait up to timeout for the device to become readable; Ok(true) if readable. The runtime’s poll loop calls this between reads.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§