mod gen;
use crate::gen::j1939;
use futures_util::stream::StreamExt;
use std::io;
use std::time::Duration;
#[tokio::main]
async fn main() -> io::Result<()> {
let ival = Duration::from_secs(0);
let mut oel_stream = j1939::Oel::stream("vcan0", &ival, &ival)?;
while let Some(Ok(oel)) = oel_stream.next().await {
match oel.hazard_light_switch() {
j1939::HazardLightSwitch2365443326::HazardLampsToBeFlashing => {
println!("Hazard Lamps To Be Flashing")
}
j1939::HazardLightSwitch2365443326::HazardLampsToBeOff => {
println!("Hazard Lamps To Be Off")
}
j1939::HazardLightSwitch2365443326::NotAvailable => println!("Not available"),
j1939::HazardLightSwitch2365443326::Error => println!("Error"),
j1939::HazardLightSwitch2365443326::XValue(_) => unreachable!(),
}
}
Ok(())
}