NmtMaster

Struct NmtMaster 

Source
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>

Source

pub fn new(sender: S, receiver: R) -> Self

Create a new NmtMaster

§Arguments
  • sender: An object which implements AsyncCanSender to be used for sending messages to the bus
  • receiver: An object which implements AsyncCanReceiver to be used for receiving messages from the bus

When using socketcan, these can be created with crate::open_socketcan.

Source

pub fn process_rx(&mut self)

Receive and process all messages available from the message receiver

Source

pub fn get_nodes(&mut self) -> &[Node]

Get a list of all nodes detected on the bus via heartbeat/reset messages

Source

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
Source

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
Source

pub async fn nmt_start(&mut self, node: u8) -> Result<(), ()>

Send start operation command

§Arguments
  • node: The node ID to command, or 0 to broadcast to all nodes
Source

pub async fn nmt_stop(&mut self, node: u8) -> Result<(), ()>

Send start operation command

§Arguments
  • node: The node ID to command, or 0 to broadcast to all nodes

Trait Implementations§

Source§

impl<S: Debug, R: Debug> Debug for NmtMaster<S, R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S, R> Freeze for NmtMaster<S, R>
where S: Freeze, R: Freeze,

§

impl<S, R> RefUnwindSafe for NmtMaster<S, R>

§

impl<S, R> Send for NmtMaster<S, R>
where S: Send, R: Send,

§

impl<S, R> Sync for NmtMaster<S, R>
where S: Sync, R: Sync,

§

impl<S, R> Unpin for NmtMaster<S, R>
where S: Unpin, R: Unpin,

§

impl<S, R> UnwindSafe for NmtMaster<S, R>
where S: UnwindSafe, R: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.