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:
parent
5231c3c9b7
commit
4139dcea60
2 changed files with 130 additions and 11 deletions
12
src/main.rs
12
src/main.rs
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue