1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#[macro_use]
mod error;
#[cfg(feature = "http")]
pub mod http;
#[cfg(feature = "usb")]
pub mod usb;
use uuid::Uuid;
pub use self::error::{ConnectionError, ConnectionErrorKind};
use crate::serial_number::SerialNumber;
pub trait Connector: Send + Sync {
fn connect(&self) -> Result<Box<dyn Connection>, ConnectionError>;
fn healthcheck(&self) -> Result<(), ConnectionError>;
fn serial_number(&self) -> Result<SerialNumber, ConnectionError>;
}
pub trait Connection: Send + Sync {
fn send_message(&self, uuid: Uuid, msg: Vec<u8>) -> Result<Vec<u8>, ConnectionError>;
}