pub struct SdoClient<S, R> { /* private fields */ }Expand description
A client for accessing a node’s SDO server
A single server can talk to a single client at a time.
Implementations§
Source§impl<S: AsyncCanSender, R: AsyncCanReceiver> SdoClient<S, R>
impl<S: AsyncCanSender, R: AsyncCanReceiver> SdoClient<S, R>
Sourcepub fn new_std(server_node_id: u8, sender: S, receiver: R) -> Self
pub fn new_std(server_node_id: u8, sender: S, receiver: R) -> Self
Create a new SdoClient using a node ID
Nodes have a default SDO server, which uses a COB ID based on the node ID. This is a shortcut to create a client that that default SDO server.
It is possible for nodes to have other SDO servers on other COB IDs, and clients for these
can be created using Self::new()
Sourcepub fn new(
req_cob_id: CanId,
resp_cob_id: CanId,
sender: S,
receiver: R,
) -> Self
pub fn new( req_cob_id: CanId, resp_cob_id: CanId, sender: S, receiver: R, ) -> Self
Create a new SdoClient from request and response COB IDs
Sourcepub fn set_timeout(&mut self, timeout: Duration)
pub fn set_timeout(&mut self, timeout: Duration)
Set the timeout for waiting on SDO server responses
Sourcepub fn get_timeout(&self) -> Duration
pub fn get_timeout(&self) -> Duration
Get the current timeout for waiting on SDO server responses
Sourcepub async fn download(
&mut self,
index: u16,
sub: u8,
data: &[u8],
) -> Result<(), SdoClientError>
pub async fn download( &mut self, index: u16, sub: u8, data: &[u8], ) -> Result<(), SdoClientError>
Write data to a sub-object on the SDO server
Sourcepub async fn upload(
&mut self,
index: u16,
sub: u8,
) -> Result<Vec<u8>, SdoClientError>
pub async fn upload( &mut self, index: u16, sub: u8, ) -> Result<Vec<u8>, SdoClientError>
Read a sub-object on the SDO server
Sourcepub async fn block_download(
&mut self,
index: u16,
sub: u8,
data: &[u8],
) -> Result<(), SdoClientError>
pub async fn block_download( &mut self, index: u16, sub: u8, data: &[u8], ) -> Result<(), SdoClientError>
Perform a block download to transfer data to an object
Block downloads are more efficient for large amounts of data, but may not be supported by all devices.
Sourcepub async fn block_upload(
&mut self,
index: u16,
sub: u8,
) -> Result<Vec<u8>, SdoClientError>
pub async fn block_upload( &mut self, index: u16, sub: u8, ) -> Result<Vec<u8>, SdoClientError>
Perform a block upload of data from the node
Sourcepub async fn read_f64(
&mut self,
index: u16,
sub: u8,
) -> Result<f64, SdoClientError>
pub async fn read_f64( &mut self, index: u16, sub: u8, ) -> Result<f64, SdoClientError>
Read a f64 sub object from the SDO server
This is an alias for upload_f64 for a more intuitive API
Sourcepub async fn upload_f64(
&mut self,
index: u16,
sub: u8,
) -> Result<f64, SdoClientError>
pub async fn upload_f64( &mut self, index: u16, sub: u8, ) -> Result<f64, SdoClientError>
Read a f64 sub object from the SDO server
Sourcepub async fn write_f64(
&mut self,
index: u16,
sub: u8,
value: f64,
) -> Result<(), SdoClientError>
pub async fn write_f64( &mut self, index: u16, sub: u8, value: f64, ) -> Result<(), SdoClientError>
Write a f64 sub object on the SDO server
This is an alias for download_f64 for a more intuitive API
Sourcepub async fn download_f64(
&mut self,
index: u16,
sub: u8,
value: f64,
) -> Result<(), SdoClientError>
pub async fn download_f64( &mut self, index: u16, sub: u8, value: f64, ) -> Result<(), SdoClientError>
Read a f64 sub object from the SDO server
Sourcepub async fn read_f32(
&mut self,
index: u16,
sub: u8,
) -> Result<f32, SdoClientError>
pub async fn read_f32( &mut self, index: u16, sub: u8, ) -> Result<f32, SdoClientError>
Read a f32 sub object from the SDO server
This is an alias for upload_f32 for a more intuitive API
Sourcepub async fn upload_f32(
&mut self,
index: u16,
sub: u8,
) -> Result<f32, SdoClientError>
pub async fn upload_f32( &mut self, index: u16, sub: u8, ) -> Result<f32, SdoClientError>
Read a f32 sub object from the SDO server
Sourcepub async fn write_f32(
&mut self,
index: u16,
sub: u8,
value: f32,
) -> Result<(), SdoClientError>
pub async fn write_f32( &mut self, index: u16, sub: u8, value: f32, ) -> Result<(), SdoClientError>
Write a f32 sub object on the SDO server
This is an alias for download_f32 for a more intuitive API
Sourcepub async fn download_f32(
&mut self,
index: u16,
sub: u8,
value: f32,
) -> Result<(), SdoClientError>
pub async fn download_f32( &mut self, index: u16, sub: u8, value: f32, ) -> Result<(), SdoClientError>
Read a f32 sub object from the SDO server
Sourcepub async fn read_u64(
&mut self,
index: u16,
sub: u8,
) -> Result<u64, SdoClientError>
pub async fn read_u64( &mut self, index: u16, sub: u8, ) -> Result<u64, SdoClientError>
Read a u64 sub object from the SDO server
This is an alias for upload_u64 for a more intuitive API
Sourcepub async fn upload_u64(
&mut self,
index: u16,
sub: u8,
) -> Result<u64, SdoClientError>
pub async fn upload_u64( &mut self, index: u16, sub: u8, ) -> Result<u64, SdoClientError>
Read a u64 sub object from the SDO server
Sourcepub async fn write_u64(
&mut self,
index: u16,
sub: u8,
value: u64,
) -> Result<(), SdoClientError>
pub async fn write_u64( &mut self, index: u16, sub: u8, value: u64, ) -> Result<(), SdoClientError>
Write a u64 sub object on the SDO server
This is an alias for download_u64 for a more intuitive API
Sourcepub async fn download_u64(
&mut self,
index: u16,
sub: u8,
value: u64,
) -> Result<(), SdoClientError>
pub async fn download_u64( &mut self, index: u16, sub: u8, value: u64, ) -> Result<(), SdoClientError>
Read a u64 sub object from the SDO server
Sourcepub async fn read_u32(
&mut self,
index: u16,
sub: u8,
) -> Result<u32, SdoClientError>
pub async fn read_u32( &mut self, index: u16, sub: u8, ) -> Result<u32, SdoClientError>
Read a u32 sub object from the SDO server
This is an alias for upload_u32 for a more intuitive API
Sourcepub async fn upload_u32(
&mut self,
index: u16,
sub: u8,
) -> Result<u32, SdoClientError>
pub async fn upload_u32( &mut self, index: u16, sub: u8, ) -> Result<u32, SdoClientError>
Read a u32 sub object from the SDO server
Sourcepub async fn write_u32(
&mut self,
index: u16,
sub: u8,
value: u32,
) -> Result<(), SdoClientError>
pub async fn write_u32( &mut self, index: u16, sub: u8, value: u32, ) -> Result<(), SdoClientError>
Write a u32 sub object on the SDO server
This is an alias for download_u32 for a more intuitive API
Sourcepub async fn download_u32(
&mut self,
index: u16,
sub: u8,
value: u32,
) -> Result<(), SdoClientError>
pub async fn download_u32( &mut self, index: u16, sub: u8, value: u32, ) -> Result<(), SdoClientError>
Read a u32 sub object from the SDO server
Sourcepub async fn read_u16(
&mut self,
index: u16,
sub: u8,
) -> Result<u16, SdoClientError>
pub async fn read_u16( &mut self, index: u16, sub: u8, ) -> Result<u16, SdoClientError>
Read a u16 sub object from the SDO server
This is an alias for upload_u16 for a more intuitive API
Sourcepub async fn upload_u16(
&mut self,
index: u16,
sub: u8,
) -> Result<u16, SdoClientError>
pub async fn upload_u16( &mut self, index: u16, sub: u8, ) -> Result<u16, SdoClientError>
Read a u16 sub object from the SDO server
Sourcepub async fn write_u16(
&mut self,
index: u16,
sub: u8,
value: u16,
) -> Result<(), SdoClientError>
pub async fn write_u16( &mut self, index: u16, sub: u8, value: u16, ) -> Result<(), SdoClientError>
Write a u16 sub object on the SDO server
This is an alias for download_u16 for a more intuitive API
Sourcepub async fn download_u16(
&mut self,
index: u16,
sub: u8,
value: u16,
) -> Result<(), SdoClientError>
pub async fn download_u16( &mut self, index: u16, sub: u8, value: u16, ) -> Result<(), SdoClientError>
Read a u16 sub object from the SDO server
Sourcepub async fn read_u8(
&mut self,
index: u16,
sub: u8,
) -> Result<u8, SdoClientError>
pub async fn read_u8( &mut self, index: u16, sub: u8, ) -> Result<u8, SdoClientError>
Read a u8 sub object from the SDO server
This is an alias for upload_u8 for a more intuitive API
Sourcepub async fn upload_u8(
&mut self,
index: u16,
sub: u8,
) -> Result<u8, SdoClientError>
pub async fn upload_u8( &mut self, index: u16, sub: u8, ) -> Result<u8, SdoClientError>
Read a u8 sub object from the SDO server
Sourcepub async fn write_u8(
&mut self,
index: u16,
sub: u8,
value: u8,
) -> Result<(), SdoClientError>
pub async fn write_u8( &mut self, index: u16, sub: u8, value: u8, ) -> Result<(), SdoClientError>
Write a u8 sub object on the SDO server
This is an alias for download_u8 for a more intuitive API
Sourcepub async fn download_u8(
&mut self,
index: u16,
sub: u8,
value: u8,
) -> Result<(), SdoClientError>
pub async fn download_u8( &mut self, index: u16, sub: u8, value: u8, ) -> Result<(), SdoClientError>
Read a u8 sub object from the SDO server
Sourcepub async fn read_i64(
&mut self,
index: u16,
sub: u8,
) -> Result<i64, SdoClientError>
pub async fn read_i64( &mut self, index: u16, sub: u8, ) -> Result<i64, SdoClientError>
Read a i64 sub object from the SDO server
This is an alias for upload_i64 for a more intuitive API
Sourcepub async fn upload_i64(
&mut self,
index: u16,
sub: u8,
) -> Result<i64, SdoClientError>
pub async fn upload_i64( &mut self, index: u16, sub: u8, ) -> Result<i64, SdoClientError>
Read a i64 sub object from the SDO server
Sourcepub async fn write_i64(
&mut self,
index: u16,
sub: u8,
value: i64,
) -> Result<(), SdoClientError>
pub async fn write_i64( &mut self, index: u16, sub: u8, value: i64, ) -> Result<(), SdoClientError>
Write a i64 sub object on the SDO server
This is an alias for download_i64 for a more intuitive API
Sourcepub async fn download_i64(
&mut self,
index: u16,
sub: u8,
value: i64,
) -> Result<(), SdoClientError>
pub async fn download_i64( &mut self, index: u16, sub: u8, value: i64, ) -> Result<(), SdoClientError>
Read a i64 sub object from the SDO server
Sourcepub async fn read_i32(
&mut self,
index: u16,
sub: u8,
) -> Result<i32, SdoClientError>
pub async fn read_i32( &mut self, index: u16, sub: u8, ) -> Result<i32, SdoClientError>
Read a i32 sub object from the SDO server
This is an alias for upload_i32 for a more intuitive API
Sourcepub async fn upload_i32(
&mut self,
index: u16,
sub: u8,
) -> Result<i32, SdoClientError>
pub async fn upload_i32( &mut self, index: u16, sub: u8, ) -> Result<i32, SdoClientError>
Read a i32 sub object from the SDO server
Sourcepub async fn write_i32(
&mut self,
index: u16,
sub: u8,
value: i32,
) -> Result<(), SdoClientError>
pub async fn write_i32( &mut self, index: u16, sub: u8, value: i32, ) -> Result<(), SdoClientError>
Write a i32 sub object on the SDO server
This is an alias for download_i32 for a more intuitive API
Sourcepub async fn download_i32(
&mut self,
index: u16,
sub: u8,
value: i32,
) -> Result<(), SdoClientError>
pub async fn download_i32( &mut self, index: u16, sub: u8, value: i32, ) -> Result<(), SdoClientError>
Read a i32 sub object from the SDO server
Sourcepub async fn read_i16(
&mut self,
index: u16,
sub: u8,
) -> Result<i16, SdoClientError>
pub async fn read_i16( &mut self, index: u16, sub: u8, ) -> Result<i16, SdoClientError>
Read a i16 sub object from the SDO server
This is an alias for upload_i16 for a more intuitive API
Sourcepub async fn upload_i16(
&mut self,
index: u16,
sub: u8,
) -> Result<i16, SdoClientError>
pub async fn upload_i16( &mut self, index: u16, sub: u8, ) -> Result<i16, SdoClientError>
Read a i16 sub object from the SDO server
Sourcepub async fn write_i16(
&mut self,
index: u16,
sub: u8,
value: i16,
) -> Result<(), SdoClientError>
pub async fn write_i16( &mut self, index: u16, sub: u8, value: i16, ) -> Result<(), SdoClientError>
Write a i16 sub object on the SDO server
This is an alias for download_i16 for a more intuitive API
Sourcepub async fn download_i16(
&mut self,
index: u16,
sub: u8,
value: i16,
) -> Result<(), SdoClientError>
pub async fn download_i16( &mut self, index: u16, sub: u8, value: i16, ) -> Result<(), SdoClientError>
Read a i16 sub object from the SDO server
Sourcepub async fn read_i8(
&mut self,
index: u16,
sub: u8,
) -> Result<i8, SdoClientError>
pub async fn read_i8( &mut self, index: u16, sub: u8, ) -> Result<i8, SdoClientError>
Read a i8 sub object from the SDO server
This is an alias for upload_i8 for a more intuitive API
Sourcepub async fn upload_i8(
&mut self,
index: u16,
sub: u8,
) -> Result<i8, SdoClientError>
pub async fn upload_i8( &mut self, index: u16, sub: u8, ) -> Result<i8, SdoClientError>
Read a i8 sub object from the SDO server
Sourcepub async fn write_i8(
&mut self,
index: u16,
sub: u8,
value: i8,
) -> Result<(), SdoClientError>
pub async fn write_i8( &mut self, index: u16, sub: u8, value: i8, ) -> Result<(), SdoClientError>
Write a i8 sub object on the SDO server
This is an alias for download_i8 for a more intuitive API
Sourcepub async fn download_i8(
&mut self,
index: u16,
sub: u8,
value: i8,
) -> Result<(), SdoClientError>
pub async fn download_i8( &mut self, index: u16, sub: u8, value: i8, ) -> Result<(), SdoClientError>
Read a i8 sub object from the SDO server
Sourcepub async fn download_time_of_day(
&mut self,
index: u16,
sub: u8,
data: TimeOfDay,
) -> Result<(), SdoClientError>
pub async fn download_time_of_day( &mut self, index: u16, sub: u8, data: TimeOfDay, ) -> Result<(), SdoClientError>
Write to a TimeOfDay object on the SDO server
Sourcepub async fn write_time_of_day(
&mut self,
index: u16,
sub: u8,
data: TimeOfDay,
) -> Result<(), SdoClientError>
pub async fn write_time_of_day( &mut self, index: u16, sub: u8, data: TimeOfDay, ) -> Result<(), SdoClientError>
Write to a TimeOfDay object on the SDO server
Alias for download_time_of_day. This is a convenience function to allow for a more intuitive API.
Sourcepub async fn download_time_difference(
&mut self,
index: u16,
sub: u8,
data: TimeDifference,
) -> Result<(), SdoClientError>
pub async fn download_time_difference( &mut self, index: u16, sub: u8, data: TimeDifference, ) -> Result<(), SdoClientError>
Write to a TimeDifference object on the SDO server
Sourcepub async fn write_time_difference(
&mut self,
index: u16,
sub: u8,
data: TimeDifference,
) -> Result<(), SdoClientError>
pub async fn write_time_difference( &mut self, index: u16, sub: u8, data: TimeDifference, ) -> Result<(), SdoClientError>
Write to a TimeDifference object on the SDO server
Alias for download_time_difference. This is a convenience function to allow for a more intuitive API.
Sourcepub async fn upload_utf8(
&mut self,
index: u16,
sub: u8,
) -> Result<String, SdoClientError>
pub async fn upload_utf8( &mut self, index: u16, sub: u8, ) -> Result<String, SdoClientError>
Read a string from the SDO server
Sourcepub async fn read_utf8(
&mut self,
index: u16,
sub: u8,
) -> Result<String, SdoClientError>
pub async fn read_utf8( &mut self, index: u16, sub: u8, ) -> Result<String, SdoClientError>
Alias for upload_utf8
Sourcepub async fn upload_time_of_day(
&mut self,
index: u16,
sub: u8,
) -> Result<TimeOfDay, SdoClientError>
pub async fn upload_time_of_day( &mut self, index: u16, sub: u8, ) -> Result<TimeOfDay, SdoClientError>
Read a TimeOfDay object from the SDO server
Sourcepub async fn read_time_of_day(
&mut self,
index: u16,
sub: u8,
) -> Result<TimeOfDay, SdoClientError>
pub async fn read_time_of_day( &mut self, index: u16, sub: u8, ) -> Result<TimeOfDay, SdoClientError>
Read a TimeOfDay object from the SDO server
Alias for upload_time_of_day. This is a convenience function to allow for a more intuitive
API.
Sourcepub async fn upload_time_difference(
&mut self,
index: u16,
sub: u8,
) -> Result<TimeDifference, SdoClientError>
pub async fn upload_time_difference( &mut self, index: u16, sub: u8, ) -> Result<TimeDifference, SdoClientError>
Read a TimeOfDay object from the SDO server
Sourcepub async fn read_time_difference(
&mut self,
index: u16,
sub: u8,
) -> Result<TimeDifference, SdoClientError>
pub async fn read_time_difference( &mut self, index: u16, sub: u8, ) -> Result<TimeDifference, SdoClientError>
Read a TimeOfDay object from the SDO server
Alias for upload_time_of_day. This is a convenience function to allow for a more intuitive
API.
Sourcepub async fn read_visible_string(
&mut self,
index: u16,
sub: u8,
) -> Result<String, SdoClientError>
pub async fn read_visible_string( &mut self, index: u16, sub: u8, ) -> Result<String, SdoClientError>
Read an object as a visible string
It will be read and assumed to contain valid UTF8 characters
Sourcepub async fn read_identity(&mut self) -> Result<LssIdentity, SdoClientError>
pub async fn read_identity(&mut self) -> Result<LssIdentity, SdoClientError>
Read the identity object
All nodes should implement this object
Sourcepub async fn save_objects(&mut self) -> Result<(), SdoClientError>
pub async fn save_objects(&mut self) -> Result<(), SdoClientError>
Write object 0x1010sub1 to command all objects be saved
Sourcepub async fn read_device_name(&mut self) -> Result<String, SdoClientError>
pub async fn read_device_name(&mut self) -> Result<String, SdoClientError>
Read the device name object
All nodes should implement this object
Sourcepub async fn read_software_version(&mut self) -> Result<String, SdoClientError>
pub async fn read_software_version(&mut self) -> Result<String, SdoClientError>
Read the software version object
All nodes should implement this object
Sourcepub async fn read_hardware_version(&mut self) -> Result<String, SdoClientError>
pub async fn read_hardware_version(&mut self) -> Result<String, SdoClientError>
Read the hardware version object
All nodes should implement this object
Sourcepub async fn configure_tpdo(
&mut self,
pdo_num: usize,
cfg: &PdoConfig,
) -> Result<(), SdoClientError>
pub async fn configure_tpdo( &mut self, pdo_num: usize, cfg: &PdoConfig, ) -> Result<(), SdoClientError>
Configure a transmit PDO on the device
This is a convenience function to write the PDO comm and mapping objects based on a
PdoConfig.
Sourcepub async fn configure_rpdo(
&mut self,
pdo_num: usize,
cfg: &PdoConfig,
) -> Result<(), SdoClientError>
pub async fn configure_rpdo( &mut self, pdo_num: usize, cfg: &PdoConfig, ) -> Result<(), SdoClientError>
Configure a receive PDO on the device
This is a convenience function to write the PDO comm and mapping objects based on a
PdoConfig.
Sourcepub async fn read_rpdo_config(
&mut self,
pdo_num: usize,
) -> Result<PdoConfig, SdoClientError>
pub async fn read_rpdo_config( &mut self, pdo_num: usize, ) -> Result<PdoConfig, SdoClientError>
Read the configuration of an RPDO from the node
Sourcepub async fn read_tpdo_config(
&mut self,
pdo_num: usize,
) -> Result<PdoConfig, SdoClientError>
pub async fn read_tpdo_config( &mut self, pdo_num: usize, ) -> Result<PdoConfig, SdoClientError>
Read the configuration of a TPDO from the node
Trait Implementations§
Auto Trait Implementations§
impl<S, R> Freeze for SdoClient<S, R>
impl<S, R> RefUnwindSafe for SdoClient<S, R>where
S: RefUnwindSafe,
R: RefUnwindSafe,
impl<S, R> Send for SdoClient<S, R>
impl<S, R> Sync for SdoClient<S, R>
impl<S, R> Unpin for SdoClient<S, R>
impl<S, R> UnwindSafe for SdoClient<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
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>
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>
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