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