pub trait ReceiveDriver<C>where
    C: Clock,{
    type Error: Debug;

    // Required methods
    fn receive(
        &mut self,
        clock: &mut C
    ) -> Result<Frame<C::Instant>, Self::Error>;
    fn apply_filters<S>(
        &mut self,
        local_node: Option<CanNodeId>,
        subscriptions: S
    )
       where S: IntoIterator<Item = Subscription>;
    fn apply_accept_all(&mut self);
}
Expand description

A CAN driver that can receive frames

The result type is nb::Result, which allows the driver to indicate that no frame is available to receive.

Required Associated Types§

source

type Error: Debug

The error type

Required Methods§

source

fn receive(&mut self, clock: &mut C) -> Result<Frame<C::Instant>, Self::Error>

Attempts to receive a frame without blocking

source

fn apply_filters<S>(&mut self, local_node: Option<CanNodeId>, subscriptions: S)where S: IntoIterator<Item = Subscription>,

Sets up frame reception filters to accept only frames matching the provided subscriptions

The filters may allow frames that this node is not subscribed to (false positives), but they must not block any frames that this node is not subscribed to (false negatives).

local_node is the ID of this node, which can be used to filter service transfers based on the destination address. If this is None, the filters should block all service transfers (because anonymous nodes can’t participate in service transfers)

If the hardware does not support filtering, this function may be empty and the hardware should receive all available frames.

The optimize_filters function may be helpful when implementing this function.

source

fn apply_accept_all(&mut self)

Sets up frame reception filters to accept all incoming frames

Implementors§

source§

impl<C, Q, D> ReceiveDriver<C> for SingleQueueDriver<C, Q, D>where C: Clock, D: ReceiveDriver<C>,

§

type Error = <D as ReceiveDriver<C>>::Error

source§

impl<C: Clock, const TC: usize, const RC: usize> ReceiveDriver<C> for QueueOnlyDriver<C::Instant, TC, RC>