pub struct CanOpenInterface {
pub connection: Arc<Mutex<Connection>>,
pub tx: Sender<TxPacket>,
pub rx: Receiver<RxMessage>,
pub sdo_clients: HashMap<u8, Arc<Mutex<SdoClient>>>,
pub info: Arc<Mutex<CanOpenInfo>>,
/* private fields */
}Expand description
Struct representing a CANopen interface.
Fields§
§connection: Arc<Mutex<Connection>>Connection details.
tx: Sender<TxPacket>Transmitter channel.
rx: Receiver<RxMessage>Receiver channel.
sdo_clients: HashMap<u8, Arc<Mutex<SdoClient>>>Map of SDO clients.
info: Arc<Mutex<CanOpenInfo>>CANopen information.
Implementations§
Source§impl CanOpenInterface
impl CanOpenInterface
Source§impl CanOpenInterface
impl CanOpenInterface
Sourcepub async fn send_nmt(&self, nmt: NmtCommand) -> Result<(), CoError>
pub async fn send_nmt(&self, nmt: NmtCommand) -> Result<(), CoError>
Sends an NMT command through the CANopen interface.
§Arguments
nmt- The NMT command to be sent.
§Returns
A Result indicating success or failure.
§Examples
use oze_canopen::CanOpenInterface;
use oze_canopen::proto::nmt::{NmtCommand, NmtCommandSpecifier};
let interface = oze_canopen::start_interface();
let result = interface.send_nmt(NmtCommand::new(NmtCommandSpecifier::StartRemoteNode, 0)).await;Sourcepub async fn send_nmt_command(
&self,
nmt_command: NmtCommandSpecifier,
) -> Result<(), CoError>
pub async fn send_nmt_command( &self, nmt_command: NmtCommandSpecifier, ) -> Result<(), CoError>
Sends an NMT command through the CANopen interface using a command specifier.
§Arguments
nmt_command- The NMT command specifier to be used.
§Returns
A Result indicating success or failure.
§Examples
use oze_canopen::CanOpenInterface;
use oze_canopen::proto::nmt::NmtCommandSpecifier;
let interface = oze_canopen::start_interface();
let result = interface.send_nmt_command(NmtCommandSpecifier::StartRemoteNode).await;Trait Implementations§
Auto Trait Implementations§
impl Freeze for CanOpenInterface
impl !RefUnwindSafe for CanOpenInterface
impl Send for CanOpenInterface
impl Sync for CanOpenInterface
impl Unpin for CanOpenInterface
impl !UnwindSafe for CanOpenInterface
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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