This commit is contained in:
2026-01-19 09:42:16 +01:00
parent 45c332e610
commit 251d245aeb
6 changed files with 43 additions and 89 deletions

View File

@@ -2,6 +2,7 @@ use std::{
sync::{Arc, Mutex},
};
use chrono::{DateTime, Local};
use cron_tab::Cron;
use gpio_cdev::Chip;
@@ -12,6 +13,11 @@ mod router;
mod scheduler;
mod ringer;
struct Alarm {
enabled: bool,
time: DateTime<Local>
}
#[derive(Clone)]
struct AppState {
scheduler: Arc<Scheduler<BeepRinger>>
@@ -30,10 +36,8 @@ fn app_state() -> AppState {
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let static_time = "0 30 7 * * *";
let app_state = app_state();
app_state.scheduler.schedule(static_time)?;
app_state.scheduler.start();
start_server(app_state).await;