api modifications
This commit is contained in:
parent
db4b4d990d
commit
0994648ed1
7 changed files with 18 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue