Struct CommandsClient
pub struct CommandsClient {
prefix: &'static str,
device_type: DeviceType,
mqtt: MqttClient,
payload_format: PayloadFormat,
}Expand description
IoT Commands client.
Fields§
§prefix: &'static str§device_type: DeviceType§mqtt: MqttClient§payload_format: PayloadFormatThe payload format only affects the format of the response.
Implementations§
§impl CommandsClient
impl CommandsClient
pub const fn new(mqtt: MqttClient, device_type: DeviceType) -> Self
pub const fn new(mqtt: MqttClient, device_type: DeviceType) -> Self
Creates a new commands client.
pub const fn with_prefix(self, prefix: &'static str) -> Self
pub const fn with_prefix(self, prefix: &'static str) -> Self
Sets the topic prefix to something other than $aws.
pub const fn mqtt_client(&self) -> &MqttClient
pub const fn mqtt_client(&self) -> &MqttClient
Returns a reference to the underlying MQTT client.
pub fn into_mqtt_client(self) -> MqttClient
pub fn into_mqtt_client(self) -> MqttClient
Consumes the commands client and returns the underlying MQTT client.
pub async fn subscribe_executions(&self) -> Result<CommandExecutionStream>
pub async fn subscribe_executions(&self) -> Result<CommandExecutionStream>
Subscribes to command execution requests for the given device.
Returns a stream of Result<CommandExecution>. Errors are forwarded
as-is, but are not critical. You can safely continue using the stream
after receiving an error.
The client does not automatically acknowledge or reject command
executions. It is up to the consumer to handle them and call
update_execution accordingly.
pub async fn update_execution(
&self,
execution_id: &str,
status: CommandExecutionStatus,
status_reason: Option<StatusReason<'_>>,
) -> Result<()>
pub async fn update_execution( &self, execution_id: &str, status: CommandExecutionStatus, status_reason: Option<StatusReason<'_>>, ) -> Result<()>
Updates the status of a command execution.
Depending on the current status of the command execution, not all transitions are valid. See: https://docs.aws.amazon.com/iot/latest/developerguide/iot-remote-command-concepts.html
pub async fn update_execution_no_wait(
&self,
execution_id: &str,
status: CommandExecutionStatus,
status_reason: Option<StatusReason<'_>>,
) -> Result<()>
pub async fn update_execution_no_wait( &self, execution_id: &str, status: CommandExecutionStatus, status_reason: Option<StatusReason<'_>>, ) -> Result<()>
Updates the status of a command execution without waiting for a response.
Compared to update_execution, this method
does not wait for an accepted or rejected response. It returns as
soon as the update message has been queued for publishing.
Trait Implementations§
§impl Clone for CommandsClient
impl Clone for CommandsClient
§fn clone(&self) -> CommandsClient
fn clone(&self) -> CommandsClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more