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:
Nicholas Orlowsky 2025-05-23 18:41:49 -04:00
parent db4b4d990d
commit 821e80aaaf
No known key found for this signature in database
GPG key ID: A9F3BA4C0AA7A70B
14 changed files with 213 additions and 60 deletions

View file

@ -6,17 +6,23 @@
//!
//! # Usage
//! ```
//! use obd2::{commands::Obd2DataRetrieval, device::Elm327, Obd2};
//! use obd2::{commands::Obd2DataRetrieval, device::{Elm327, FTDIDevice}, Obd2};
//!
//! fn main() -> Result<(), obd2::Error> {
//! let mut device = Obd2::<Elm327>::default();
//! let mut device = Obd2::<Elm327::<FTDIDevice>>::new(Elm327::new(FTDIDevice::new()?)?)?;
//! println!("VIN: {}", device.get_vin()?);
//! Ok(())
//! }
//! ```
//!
//! alternatively, you could use a serial port provided by your operating system such as
//! /dev/ttyUSB0 on unix-like systems
//! ```
//! let mut device = Obd2::<Elm327::<SerialPort>>::new(Elm327::new(SerialPort::new("/dev/ttyUSB0")?)?)?;
//! ```
#![forbid(unsafe_code)]
#![warn(missing_docs)]
#![warn(missing_docs, clippy::panic)]
pub mod commands;