This commit is contained in:
Nicholas Orlowsky 2025-03-18 18:59:58 -04:00
parent ab604f3c51
commit 6effd4f1a8
5 changed files with 129 additions and 274 deletions

View file

@ -1,10 +1,7 @@
//! Lower level OBD-II interfacing structures
mod elm327;
pub use elm327::Elm327;
mod elm327_linux;
pub use elm327_linux::Elm327Linux;
pub use elm327::{Elm327, SerialPort, FTDIDevice};
type Result<T> = std::result::Result<T, Error>;
@ -56,6 +53,9 @@ pub enum Error {
/// An error with the underlying [FTDI device](ftdi::Device)
#[error("FTDI error: `{0:?}`")]
Ftdi(ftdi::Error),
#[error("Serialport error: `{0:?}`")]
Serialport(serialport::Error),
/// An I/O error in a low-level [std::io] stream operation
#[error("IO error: `{0:?}`")]
@ -72,6 +72,12 @@ impl From<ftdi::Error> for Error {
}
}
impl From<serialport::Error> for Error {
fn from(e: serialport::Error) -> Self {
Error::Serialport(e)
}
}
impl From<std::io::Error> for Error {
fn from(e: std::io::Error) -> Self {
Error::IO(e)