dvb-ci-runtime 0.23.0

Pure-Rust EN 50221 DVB Common Interface driver runtime — device I/O, TPDU/SPDU poll loop, resource state machines, and CAM/card hot-plug notifications over the dvb-ci codecs.
Documentation
//! Record the link to a mock CAM and print the annotated trace.
//!
//! Run: `cargo run -p dvb-ci-runtime --example trace_session`

use std::time::Duration;

use dvb_ci::tpdu::tags;
use dvb_ci_runtime::device::RecordingCaDevice;
use dvb_ci_runtime::{Driver, DriverBounds, MockCaDevice, StackBounds, TransportBounds, trace};

fn driver_bounds() -> DriverBounds {
    DriverBounds {
        stack: StackBounds {
            transport: TransportBounds {
                poll_interval: Duration::from_millis(100),
                reply_timeout: Duration::from_secs(1),
                max_setup_attempts: 5,
                max_reassembly_len: 2 * 1024 * 1024,
                max_outbound_queue: 64,
            },
            max_sessions: 32,
        },
        max_pending_notifications: 1024,
        slot_ready_grace: Duration::from_secs(12),
        slot_retry: Duration::from_millis(250),
    }
}

fn main() -> std::io::Result<()> {
    let dev = RecordingCaDevice::new(MockCaDevice::new([vec![tags::C_T_C_REPLY, 0x01, 0x01]]));
    let mut driver = Driver::new(dev, driver_bounds());
    driver.init()?;
    for _ in 0..3 {
        driver.pump(Duration::from_millis(100))?;
    }
    print!("{}", trace::decode_log(driver.device().log()));
    Ok(())
}