2023-12-25 21:22:08 +11:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
2024-01-08 12:00:09 +11:00
|
|
|
use crate::types::Coords;
|
2023-12-28 12:41:05 +11:00
|
|
|
|
2023-12-25 21:22:08 +11:00
|
|
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
2023-12-26 08:58:14 +11:00
|
|
|
pub struct Config {
|
2024-01-11 10:28:01 +11:00
|
|
|
pub tesla_watch_interval: u64,
|
|
|
|
pub pl_watch_interval: u64,
|
2023-12-28 12:41:05 +11:00
|
|
|
pub coords: Coords,
|
2024-01-10 15:22:28 +11:00
|
|
|
pub serial_port: String,
|
|
|
|
pub baud_rate: u32,
|
2023-12-26 08:58:14 +11:00
|
|
|
}
|
2023-12-25 21:22:08 +11:00
|
|
|
|
2023-12-26 08:58:14 +11:00
|
|
|
impl Default for Config {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
2024-01-11 10:28:01 +11:00
|
|
|
tesla_watch_interval: 120,
|
|
|
|
pl_watch_interval: 30,
|
2023-12-28 12:41:05 +11:00
|
|
|
coords: Coords {
|
|
|
|
latitude: 0.,
|
|
|
|
longitude: 0.,
|
|
|
|
},
|
2024-01-10 15:22:28 +11:00
|
|
|
serial_port: String::from("/dev/ttyUSB0"),
|
|
|
|
baud_rate: 9600,
|
2023-12-26 08:58:14 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|