wip
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user