Trait sep2_client::event::Scheduler
source · pub trait Scheduler<E: SEEvent> {
type Program;
// Required methods
fn new(
client: Client,
device: Arc<RwLock<SEDevice>>,
handler: impl EventCallback<E>,
tickrate: Duration
) -> Self;
fn add_event<'life0, 'life1, 'async_trait>(
&'life0 mut self,
event: E,
program: &'life1 Self::Program,
server_id: u8
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
event
only.Expand description
A Trait representing the common interface of all schedules.
Required Associated Types§
Required Methods§
sourcefn new(
client: Client,
device: Arc<RwLock<SEDevice>>,
handler: impl EventCallback<E>,
tickrate: Duration
) -> Self
fn new( client: Client, device: Arc<RwLock<SEDevice>>, handler: impl EventCallback<E>, tickrate: Duration ) -> Self
Create a new Schedule for a particular function set.
Any Client instance with an appropriate certificate can be used, as automated Response POST requests will be made to the replyTo field in the event, which is an absolute URI.
An Arc<RwLock<SEDevice>>
is supplied to allow the schedule to retrieve the latest information about the device when creating automated responses.
The specified Handler will be called whenever there is an event status update that requires a response from the client.
The given tickrate determines how often the Schedule should wake from sleep to check if an event has started or ended.
sourcefn add_event<'life0, 'life1, 'async_trait>(
&'life0 mut self,
event: E,
program: &'life1 Self::Program,
server_id: u8
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_event<'life0, 'life1, 'async_trait>( &'life0 mut self, event: E, program: &'life1 Self::Program, server_id: u8 ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Add a type implementing SEEvent
to the schedule. The concrete type depends on the type of schedule.
The program the event belongs to is also required, to determine the primacy of the event, and to send the appropriate response for events that get superseded by other programs.
Events from different servers should be added with different server ids, the ids chosen are irrelevant.
Subsequent retrievals/notifications of any and all SEEvent
resources should call this function.
Implementors§
source§impl Scheduler<DERControl> for Schedule<DERControl>
Available on crate feature der
only.
impl Scheduler<DERControl> for Schedule<DERControl>
der
only.DER is a function set where events exhibit ‘direct control’, according to the specification. Thus, this Schedule will determine when overlapping or superseded events should be superseded based off their target, their primacy, and their creation time and when they are no longer superseded, if their superseding event is cancelled.
type Program = DERProgram
source§impl Scheduler<EndDeviceControl> for Schedule<EndDeviceControl>
Available on crate feature drlc
only.
impl Scheduler<EndDeviceControl> for Schedule<EndDeviceControl>
drlc
only.type Program = DemandResponseProgram
source§impl Scheduler<FlowReservationResponse> for Schedule<FlowReservationResponse>
Available on crate feature flow_reservation
only.
impl Scheduler<FlowReservationResponse> for Schedule<FlowReservationResponse>
flow_reservation
only.source§impl Scheduler<TextMessage> for Schedule<TextMessage>
Available on crate feature messaging
only.
impl Scheduler<TextMessage> for Schedule<TextMessage>
messaging
only.Messaging is NOT a function set where events exhibit ‘direct control’. Unlike direct control function sets, multiple text messages can be active at any given time.
This schedule simply calls the given handler when the start time arrives, if and when the event is cancelled, The supplied handler is given the primacy, and the priority of the text message, and it is up to them how they are displayed.
TODO: This implementation currently does not support manual acknowledgement of text messages, as while the client’s handler is called, a lock is acquired on the scheduler, meaning it cannot progress.
type Program = MessagingProgram
source§impl Scheduler<TimeTariffInterval> for Schedule<TimeTariffInterval>
Available on crate feature pricing
only.
impl Scheduler<TimeTariffInterval> for Schedule<TimeTariffInterval>
pricing
only.