#![cfg(feature = "pcan")]
use host_can::adapter::Adapter;
use host_can::adapter::pcan::PcanAdapter;
use host_can::frame::{CanFrame, Frame};
use host_can::id;
use std::error::Error;
use std::time::Duration;
#[test]
fn main() -> Result<(), Box<dyn Error>> {
let adapter = PcanAdapter::new("1", 1_000_000)?;
let frame = CanFrame::new(id::new_standard(0x123).unwrap(), &[4, 5, 6])
.ok_or::<Box<dyn Error>>("Can't create frame".into())?;
adapter.send(&frame)?;
let frame = adapter.recv(Some(Duration::from_millis(1500)));
println!("Received: {frame:?}");
Ok(())
}