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
10
src/error.rs
10
src/error.rs
|
@ -1,3 +1,6 @@
|
|||
//! Error types for OBD-II related errors
|
||||
|
||||
/// Result type defaulted with this library's error type
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// An error with OBD-II communication
|
||||
|
@ -16,8 +19,9 @@ pub enum Error {
|
|||
Other(String),
|
||||
}
|
||||
|
||||
/// An error with the ELM327 device
|
||||
#[derive(Debug)]
|
||||
pub struct DeviceError(crate::device::Error);
|
||||
pub struct DeviceError(pub crate::device::Error);
|
||||
|
||||
impl From<super::device::Error> for Error {
|
||||
fn from(e: super::device::Error) -> Self {
|
||||
|
@ -27,12 +31,12 @@ impl From<super::device::Error> for Error {
|
|||
|
||||
impl From<std::num::ParseIntError> for Error {
|
||||
fn from(e: std::num::ParseIntError) -> Self {
|
||||
Error::Other(format!("invalid data recieved: {:?}", e))
|
||||
Error::Other(format!("invalid data received: {:?}", e))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<std::string::FromUtf8Error> for Error {
|
||||
fn from(e: std::string::FromUtf8Error) -> Self {
|
||||
Error::Other(format!("invalid string recieved: {:?}", e))
|
||||
Error::Other(format!("invalid string received: {:?}", e))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue