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>;

    // Provided method
    fn reset_settle(&self) -> Duration { ... }
}
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.

Provided Methods§

Source

fn reset_settle(&self) -> Duration

How long the module needs after reset returns before it accepts Create_T_C (the DD/cxd2099 class of drivers only re-initialise the slot seconds after CA_RESET).

reset itself must not sleep for this: the sans-IO Driver reads this value after reset and holds the transport quiet until it elapses on its injectable clock, so a CAM hot-plug edge no longer freezes pump (audit r10-O-10). Defaults to Duration::ZERO — an implementation whose reset already blocks until the module is usable keeps working unchanged.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl CaDevice for LinuxCaDevice

Available on Linux and crate feature linux only.
Source§

impl CaDevice for MockCaDevice

Source§

impl<D: CaDevice> CaDevice for RecordingCaDevice<D>