Struct fundamentum_sdk_mqtt::Client
source · pub struct Client { /* private fields */ }Expand description
Fundamentum IoT Async Client
Implementations§
source§impl Client
impl Client
sourcepub async fn new(
settings: ClientSettings
) -> Result<(Self, (EventLoop, Sender<Message>)), Error>
pub async fn new( settings: ClientSettings ) -> Result<(Self, (EventLoop, Sender<Message>)), Error>
Create new FundamentumIoTAsyncClient. Input argument should be the FundamentumIoTSettings. Returns a tuple where the first element is the
FundamentumIoTAsyncClient, and the second element is a new tuple with the eventloop and incoming
event sender. This tuple should be sent as an argument to the async_event_loop_listener.
Errors
If the creation failed then the result returns an error FundamentumIoTError
sourcepub async fn subscribe<S: Into<String> + Send>(
&self,
topic: S,
qos: QoS
) -> Result<(), ClientError>
pub async fn subscribe<S: Into<String> + Send>( &self, topic: S, qos: QoS ) -> Result<(), ClientError>
sourcepub async fn subscribe_config(&self, qos: QoS) -> Result<(), ClientError>
pub async fn subscribe_config(&self, qos: QoS) -> Result<(), ClientError>
sourcepub async fn subscribe_commands(&self, qos: QoS) -> Result<(), ClientError>
pub async fn subscribe_commands(&self, qos: QoS) -> Result<(), ClientError>
sourcepub async fn publish<S, V>(
&self,
topic: S,
qos: QoS,
payload: V
) -> Result<(), ClientError>where
S: Into<String> + Send,
V: Into<Vec<u8>> + Send,
pub async fn publish<S, V>( &self, topic: S, qos: QoS, payload: V ) -> Result<(), ClientError>where S: Into<String> + Send, V: Into<Vec<u8>> + Send,
sourcepub async fn publish_events<V>(
&self,
qos: QoS,
payload: V
) -> Result<(), ClientError>where
V: Into<Vec<u8>> + Send,
pub async fn publish_events<V>( &self, qos: QoS, payload: V ) -> Result<(), ClientError>where V: Into<Vec<u8>> + Send,
sourcepub async fn publish_heartbeat(
&self,
qos: QoS,
params: &HeartBeat
) -> Result<(), ClientError>
pub async fn publish_heartbeat( &self, qos: QoS, params: &HeartBeat ) -> Result<(), ClientError>
sourcepub async fn publish_states(
&self,
qos: QoS,
params: &StatesEvent
) -> Result<(), ClientError>
pub async fn publish_states( &self, qos: QoS, params: &StatesEvent ) -> Result<(), ClientError>
sourcepub async fn publish_update_command(
&self,
cmdid: u64,
qos: QoS,
params: &DeviceCommandUpdate
) -> Result<(), ClientError>
pub async fn publish_update_command( &self, cmdid: u64, qos: QoS, params: &DeviceCommandUpdate ) -> Result<(), ClientError>
Publish Device Command Update
The command update the current status of a receive command.
The device_command_id comes from the command receive by the client.
Reference
registries/{REGISTRY_ID}/devices/{DEVICE_SN}/commands/{DEVICE_COMMAND_ID}
Errors
Returns ClientError if the request failed
Panics
This function should never panic because the string is controled by rust types
sourcepub fn get_receiver(&self) -> Receiver<Message>
pub fn get_receiver(&self) -> Receiver<Message>
Get a receiver of the incoming messages. Send this to any function that wants to read the
incoming messages from IoT Core.
sourcepub fn get_client(self) -> AsyncClient
pub fn get_client(self) -> AsyncClient
If you want to use the Rumqttc AsyncClient and EventLoop manually, this method can be used
to get the AsyncClient.