use sep2_common::packages::flow_reservation::FlowReservationResponse;
use crate::event::{EventCallback, Schedule};
use std::{
future::Future,
sync::{atomic::AtomicI64, Arc},
time::Duration,
};
use tokio::sync::RwLock;
use crate::{
client::Client,
device::SEDevice,
event::{Events, Scheduler},
};
impl Scheduler<FlowReservationResponse> for Schedule<FlowReservationResponse> {
type Program = ();
#[allow(unused_variables)]
fn new(
client: Client,
device: Arc<RwLock<SEDevice>>,
handler: impl EventCallback<FlowReservationResponse>,
tickrate: Duration,
) -> Self {
let (tx, rx) = tokio::sync::broadcast::channel::<()>(1);
Schedule {
client,
device,
events: Arc::new(RwLock::new(Events::new())),
handler: Arc::new(move |ei| {
let handler = handler.clone();
Box::pin(async move { handler.event_update(ei).await })
}),
bc_sd: tx.clone(),
tickrate,
time_offset: Arc::new(AtomicI64::new(0)),
}
}
#[allow(unused_variables)]
fn add_event(
&mut self,
event: FlowReservationResponse,
program: &Self::Program,
server_id: u8,
) -> impl Future<Output = ()> + Send {
async {}
}
}