api modifications

This commit is contained in:
Nicholas Orlowsky 2025-03-16 15:12:29 -04:00
parent db4b4d990d
commit 0994648ed1
7 changed files with 18 additions and 10 deletions

View file

@ -6,7 +6,6 @@ use super::{device::Obd2BaseDevice, Error, Obd2Device, Result};
///
/// Wraps an implementer of [Obd2BaseDevice] to allow for higher-level usage of the OBD-II
/// interface.
#[derive(Default)]
pub struct Obd2<T: Obd2BaseDevice> {
device: T,
}
@ -41,6 +40,14 @@ impl<T: Obd2BaseDevice> Obd2Device for Obd2<T> {
}
impl<T: Obd2BaseDevice> Obd2<T> {
pub fn new(dev: T) -> ::anyhow::Result<Self> {
let mut device = Obd2 {
device: dev
};
Ok(device)
}
fn command(&mut self, command: &[u8]) -> Result<Vec<Vec<u8>>> {
let response = self
.device