tof_control/
rb_control.rs1pub mod rb_clk;
2pub mod rb_config;
3pub mod rb_dac;
4pub mod rb_gpioe;
5pub mod rb_info;
6pub mod rb_init;
7pub mod rb_input;
8pub mod rb_mag;
9pub mod rb_mode;
10pub mod rb_ph;
11pub mod rb_temp;
12pub mod rb_vcp;
13pub mod rb_reset;
14
15use serde_json;
17use crate::helper::rb_type::{RBMoniData, RBInfo, RBTemp, RBVcp, RBPh, RBMag};
18
19impl RBMoniData {
20 pub fn new() -> Self {
21 Self {
22 rb_info: RBInfo::new(),
23 rb_temp: RBTemp::new(),
24 rb_vcp: RBVcp::new(),
25 rb_ph: RBPh::new(),
26 rb_mag: RBMag::new(),
27 }
28 }
29 pub fn print(&self) {
30 println!("RB Information:");
31 println!("{:?}", self.rb_info);
32 println!("RB Temperature:");
33 println!("{:?}", self.rb_temp);
34 println!("RB Voltage, Current and Power:");
35 println!("{:?}", self.rb_vcp);
36 println!("RB Humidity and Pressure:");
37 println!("{:?}", self.rb_ph);
38 println!("RB Magnetic Field:");
39 println!("{:?}", self.rb_mag);
40 }
41 pub fn print_json(&self) {
42 match serde_json::to_string(self) {
43 Ok(rb_moni_json) => {
44 println!("{}", rb_moni_json);
45 }
46 Err(e) => {
47 eprintln!("RBMoniData JSON Error: {}", e);
48 }
49 }
50 }
51}