Trait canadensis_can::driver::ReceiveDriver
source · 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§
Required Methods§
sourcefn receive(&mut self, clock: &mut C) -> Result<Frame<C::Instant>, Self::Error>
fn receive(&mut self, clock: &mut C) -> Result<Frame<C::Instant>, Self::Error>
Attempts to receive a frame without blocking
sourcefn apply_filters<S>(&mut self, local_node: Option<CanNodeId>, subscriptions: S)where
S: IntoIterator<Item = Subscription>,
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.
sourcefn apply_accept_all(&mut self)
fn apply_accept_all(&mut self)
Sets up frame reception filters to accept all incoming frames