pub struct NmtMaster<S, R> { /* private fields */ }Expand description
An NMT master which allows monitoring the bus for heartbeats and commanding state changes
Implementations§
Source§impl<S: AsyncCanSender, R: AsyncCanReceiver> NmtMaster<S, R>
impl<S: AsyncCanSender, R: AsyncCanReceiver> NmtMaster<S, R>
Sourcepub fn new(sender: S, receiver: R) -> Self
pub fn new(sender: S, receiver: R) -> Self
Create a new NmtMaster
§Arguments
sender: An object which implementsAsyncCanSenderto be used for sending messages to the busreceiver: An object which implementsAsyncCanReceiverto be used for receiving messages from the bus
When using socketcan, these can be created with crate::open_socketcan.
Sourcepub fn process_rx(&mut self)
pub fn process_rx(&mut self)
Receive and process all messages available from the message receiver
Sourcepub fn get_nodes(&mut self) -> &[Node]
pub fn get_nodes(&mut self) -> &[Node]
Get a list of all nodes detected on the bus via heartbeat/reset messages
Sourcepub async fn nmt_reset_app(&mut self, node: u8) -> Result<(), ()>
pub async fn nmt_reset_app(&mut self, node: u8) -> Result<(), ()>
Send application reset command
§Arguments
node: The node ID to command, or 0 to broadcast to all nodes
Sourcepub async fn nmt_reset_comms(&mut self, node: u8) -> Result<(), ()>
pub async fn nmt_reset_comms(&mut self, node: u8) -> Result<(), ()>
Send communications reset command
§Arguments
node: The node ID to command, or 0 to broadcast to all nodes
Trait Implementations§
Auto Trait Implementations§
impl<S, R> Freeze for NmtMaster<S, R>
impl<S, R> RefUnwindSafe for NmtMaster<S, R>where
S: RefUnwindSafe,
R: RefUnwindSafe,
impl<S, R> Send for NmtMaster<S, R>
impl<S, R> Sync for NmtMaster<S, R>
impl<S, R> Unpin for NmtMaster<S, R>
impl<S, R> UnwindSafe for NmtMaster<S, R>where
S: UnwindSafe,
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more