Moved battery, os docking into a new "v1" module
Added all_info to a module in v1
This commit is contained in:
parent
8169dfd022
commit
1e5bda520a
16 changed files with 18 additions and 16 deletions
39
src/v1/docking/structs.rs
Normal file
39
src/v1/docking/structs.rs
Normal file
|
@ -0,0 +1,39 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone)]
|
||||
pub struct Dock {
|
||||
pub brand: String, // ex: JSAUX
|
||||
pub model: String, // ex: HB0603
|
||||
pub usb_ids: Vec<[u16; 2]>,
|
||||
}
|
||||
|
||||
impl Dock {
|
||||
pub fn new() -> Dock {
|
||||
Dock { brand: String::new(),
|
||||
model: String::new(),
|
||||
usb_ids: vec![],
|
||||
}
|
||||
}
|
||||
pub fn to_string(self) -> String {
|
||||
serde_json::to_string(&self).expect("Failed to parse into string")
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone)]
|
||||
pub struct DockInfo {
|
||||
pub dock_info: Dock,
|
||||
pub is_docked: bool,
|
||||
pub fallback_detection: bool,
|
||||
}
|
||||
|
||||
impl DockInfo {
|
||||
pub fn new() -> DockInfo {
|
||||
DockInfo { dock_info: Dock::new(),
|
||||
is_docked: false,
|
||||
fallback_detection: false
|
||||
}
|
||||
}
|
||||
pub fn to_string(self) -> String {
|
||||
serde_json::to_string(&self).expect("Failed to parse into string")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue