tof_control/
pa_control.rs

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
30
31
32
pub mod pa_bias;
pub mod pa_init;
pub mod pa_temp;

// PAMoniData Implementation
use serde_json;
use crate::helper::pa_type::{PAMoniData, PATemp, PAReadBias};

impl PAMoniData {
    pub fn new() -> Self {
        Self {
            pa_temp: PATemp::new(),
            pa_bias: PAReadBias::new(),
        }
    }
    pub fn print(&self) {
        println!("PA Temperature:");
        println!("{:?}", self.pa_temp);
        println!("PA SiPM Bias Voltage:");
        println!("{:?}", self.pa_bias);
    }
    pub fn print_json(&self) {
        match serde_json::to_string(self) {
            Ok(pa_moni_json) => {
                println!("{}", pa_moni_json);
            }
            Err(e) => {
                eprintln!("PAMoniData JSON Error: {}", e);
            }
        }
    }
}