tof_control/
pb_control.rs

1pub mod pb_init;
2pub mod pb_ltb_pwr;
3pub mod pb_temp;
4pub mod pb_vcp;
5
6// PBMoniData Implementation
7use serde_json;
8use crate::helper::pb_type::{PBMoniData, PBTemp, PBVcp};
9
10impl PBMoniData {
11    pub fn new() -> Self {
12        Self {
13            pb_temp: PBTemp::new(),
14            pb_vcp: PBVcp::new(),
15        }
16    }
17    pub fn print(&self) {
18        println!("PB Temperature:");
19        println!("{:?}", self.pb_temp);
20        println!("PB Voltage, Current and Power:");
21        println!("{:?}", self.pb_vcp);
22    }
23    pub fn print_json(&self) {
24        match serde_json::to_string(self) {
25            Ok(pb_moni_json) => {
26                println!("{}", pb_moni_json);
27            }
28            Err(e) => {
29                eprintln!("PBMoniData JSON Error: {}", e);
30            }
31        }
32    }
33}