pub struct TetherAgent { /* private fields */ }Implementations§
Source§impl TetherAgent
impl TetherAgent
pub fn is_connected(&self) -> bool
pub fn auto_connect_enabled(&self) -> bool
pub fn role(&self) -> &str
pub fn id(&self) -> Option<&str>
Sourcepub fn description(&self) -> (String, String, String)
pub fn description(&self) -> (String, String, String)
Returns the Agent Role, ID (group), Broker URI
Sourcepub fn broker_uri(&self) -> String
pub fn broker_uri(&self) -> String
Return the URI (protocol, IP address, port, path) that was used to connect to the MQTT broker
pub fn set_role(&mut self, role: &str)
pub fn set_id(&mut self, id: &str)
Sourcepub fn connect(&mut self) -> Result<()>
pub fn connect(&mut self) -> Result<()>
Self must be mutable in order to create and assign new Client (with Connection)
Sourcepub fn check_messages(&self) -> Option<(TetherOrCustomTopic, Vec<u8>)>
pub fn check_messages(&self) -> Option<(TetherOrCustomTopic, Vec<u8>)>
If a message is waiting return ThreePartTopic, Message (String, Message) Messages received on topics that are not parseable as Tether Three Part Topics will be returned with the complete Topic string instead
Sourcepub fn send_raw(
&self,
channel_definition: &ChannelDefinition,
payload: Option<&[u8]>,
) -> Result<()>
pub fn send_raw( &self, channel_definition: &ChannelDefinition, payload: Option<&[u8]>, ) -> Result<()>
Unlike .send, this function does NOT serialize the data before publishing.
Given a channel definition and a raw (u8 buffer) payload, publishes a message using an appropriate topic and with the QOS specified in the Channel Definition
Sourcepub fn send<T: Serialize>(
&self,
channel_definition: &ChannelDefinition,
data: T,
) -> Result<()>
pub fn send<T: Serialize>( &self, channel_definition: &ChannelDefinition, data: T, ) -> Result<()>
Serializes the data automatically before publishing.
Given a channel definition and serializeable data payload, publishes a message using an appropriate topic and with the QOS specified in the Channel Definition