use std::time::Duration;
use dvb_ci_runtime::dvb_ci::tpdu::tags;
use dvb_ci_runtime::{Driver, MockCaDevice, Notification};
fn main() -> std::io::Result<()> {
let dev = MockCaDevice::new([vec![tags::C_T_C_REPLY, 0x01, 0x01]]);
let mut driver = Driver::new(dev);
driver.init()?;
println!("init: sent {} device op(s)", driver.device().ops.len());
for step in 0..5 {
let read = driver.pump(Duration::from_millis(100))?;
println!("pump {step}: processed_frame={read}");
}
for note in driver.take_notifications() {
match note {
Notification::CamReady => println!("note: CAM ready — safe to send ca_pmt"),
Notification::ApplicationInfo { menu, .. } => {
println!("note: application_information menu={menu:?}")
}
Notification::CaInfo { ca_system_ids } => {
println!("note: ca_info system_ids={ca_system_ids:?}")
}
other => println!("note: {other:?}"),
}
}
println!("total recorded device ops: {}", driver.device().ops.len());
Ok(())
}