Trait profirust::fdl::FdlApplication

source ·
pub trait FdlApplication {
    type Events: Default;

    // Required methods
    fn transmit_telegram(
        &mut self,
        now: Instant,
        fdl: &FdlMaster,
        tx: TelegramTx<'_>,
        high_prio_only: bool
    ) -> (Option<TelegramTxResponse>, Self::Events);
    fn receive_reply(
        &mut self,
        now: Instant,
        fdl: &FdlMaster,
        addr: u8,
        telegram: Telegram<'_>
    ) -> Self::Events;
    fn handle_timeout(&mut self, now: Instant, fdl: &FdlMaster, addr: u8);
}
Expand description

The interface for application layer components.

Only one application layer component is permitted per FDL master.

Required Associated Types§

Required Methods§

source

fn transmit_telegram( &mut self, now: Instant, fdl: &FdlMaster, tx: TelegramTx<'_>, high_prio_only: bool ) -> (Option<TelegramTxResponse>, Self::Events)

Possibly transmit a telegram.

The FDL layer will know whether a reply is expected based on the telegram that is sent. If a reply is received, receive_reply() will be called to handle it. If no reply is received in Tsl time, transmit_telegram() is called again. It should then retry transmission according to the retry count configured in fdl.parameters().max_retry_limit.

When transmit_telegram() returns None, the FDL master will interpret this as end of cycle and will pass on the token.

source

fn receive_reply( &mut self, now: Instant, fdl: &FdlMaster, addr: u8, telegram: Telegram<'_> ) -> Self::Events

Receive the reply for the telegram that was last transmitted.

source

fn handle_timeout(&mut self, now: Instant, fdl: &FdlMaster, addr: u8)

Handle a timeout while waiting for a reply from the given address.

Implementations on Foreign Types§

source§

impl FdlApplication for ()

§

type Events = ()

source§

fn transmit_telegram( &mut self, now: Instant, fdl: &FdlMaster, tx: TelegramTx<'_>, high_prio_only: bool ) -> (Option<TelegramTxResponse>, Self::Events)

source§

fn receive_reply( &mut self, now: Instant, fdl: &FdlMaster, addr: u8, telegram: Telegram<'_> ) -> Self::Events

source§

fn handle_timeout(&mut self, now: Instant, fdl: &FdlMaster, addr: u8)

Implementors§