Add get_dtcs

- Required new function obd_mode_command for commands without PIDs
- Required new reading function for single line responses
- Multiple devices can respond to get_dtcs, so the responses are now
  vectors of the previous type - vectors of u8
This commit is contained in:
Robert Sammelson 2023-05-13 19:11:44 -04:00
parent 5231c3c9b7
commit 4139dcea60
No known key found for this signature in database
GPG key ID: 92F1F04EDB06B9E9
2 changed files with 130 additions and 11 deletions

View file

@ -3,5 +3,17 @@ mod obd2;
fn main() {
env_logger::init();
let mut device = obd2::Obd2::default();
println!("VIN: {:?}", device.get_vin());
let dtcs = device.get_dtcs();
println!("DTCs: {:?}", dtcs);
if let Ok(dtcs) = dtcs {
for (i, response) in dtcs.iter().enumerate() {
println!("DTCs from response {}:", i);
for dtc in response {
println!(" - {}", dtc);
}
}
}
}