Serialport Support
- allow communication to elm327 device via a serialport - allow creation of elm327 device without requiring unwrap() - added some extra documentation - expose reset() functionality of device - serial_comm and ftdi_comm abstractions added
This commit is contained in:
parent
db4b4d990d
commit
821e80aaaf
14 changed files with 213 additions and 60 deletions
|
@ -2,15 +2,16 @@ use obd2::commands::Obd2DataRetrieval;
|
|||
|
||||
use std::time;
|
||||
|
||||
fn main() {
|
||||
fn main() -> Result<(), obd2::Error> {
|
||||
env_logger::init();
|
||||
let mut device: obd2::Obd2<obd2::device::Elm327> = obd2::Obd2::default();
|
||||
let mut device: obd2::Obd2<obd2::device::Elm327<obd2::device::FTDIDevice>> =
|
||||
obd2::Obd2::new(obd2::device::Elm327::new(obd2::device::FTDIDevice::new()?)?)?;
|
||||
|
||||
println!("VIN: {:?}", device.get_vin());
|
||||
for s in device.get_service_1_pid_support_1().unwrap().iter() {
|
||||
for s in device.get_service_1_pid_support_1()?.iter() {
|
||||
println!("PID support ($01-$20): {:08X}", s);
|
||||
}
|
||||
for s in device.get_service_1_pid_support_2().unwrap().iter() {
|
||||
for s in device.get_service_1_pid_support_2()?.iter() {
|
||||
println!("PID support ($21-$40): {:08X}", s);
|
||||
}
|
||||
|
||||
|
@ -47,4 +48,6 @@ fn main() {
|
|||
device.get_throttle_position()
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue