pub struct Connection { /* private fields */ }Expand description
An SMP protocol layer connection to a device.
In most cases this struct will not be used directly by the user,
but instead it is used indirectly through MCUmgrClient.
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn max_transport_frame_size(&self) -> usize
pub fn max_transport_frame_size(&self) -> usize
Returns the maximum SMP frame size the underlying transport can deliver reliably.
Sourcepub fn set_timeout(
&self,
timeout: Duration,
) -> Result<(), Box<dyn Error + Send + Sync>>
pub fn set_timeout( &self, timeout: Duration, ) -> Result<(), Box<dyn Error + Send + Sync>>
Changes the communication timeout.
When the device does not respond to packets within the set duration, an error will be raised.
Sourcepub fn set_retries(&self, retries: u8)
pub fn set_retries(&self, retries: u8)
Changes the retry amount.
When the device encounters a transport error, it will retry this many times until giving up.
Sourcepub fn execute_command<R: McuMgrCommand>(
&self,
request: &R,
) -> Result<R::Response, ExecuteError>
pub fn execute_command<R: McuMgrCommand>( &self, request: &R, ) -> Result<R::Response, ExecuteError>
Executes a given CBOR based SMP command.
Sourcepub fn execute_command_without_retries<R: McuMgrCommand>(
&self,
request: &R,
) -> Result<R::Response, ExecuteError>
pub fn execute_command_without_retries<R: McuMgrCommand>( &self, request: &R, ) -> Result<R::Response, ExecuteError>
Executes a given CBOR based SMP command.
Does not use retries.
Sourcepub fn execute_raw_command(
&self,
write_operation: bool,
group_id: u16,
command_id: u8,
data: &[u8],
use_retries: bool,
) -> Result<Box<[u8]>, ExecuteError>
pub fn execute_raw_command( &self, write_operation: bool, group_id: u16, command_id: u8, data: &[u8], use_retries: bool, ) -> Result<Box<[u8]>, ExecuteError>
Executes a raw SMP command.
Same as Connection::execute_command, but the payload can be anything and must not
necessarily be CBOR encoded.
Errors are also not decoded but instead will be returned as raw CBOR data.
Read Zephyr’s SMP Protocol Specification for more information.
Auto Trait Implementations§
impl !Freeze for Connection
impl RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnsafeUnpin for Connection
impl UnwindSafe for Connection
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