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(
&self,
channel_definition: &ChannelDefinition,
payload: Option<&[u8]>,
) -> Result<()>
pub fn send( &self, channel_definition: &ChannelDefinition, payload: Option<&[u8]>, ) -> Result<()>
Given a channel definition and a raw (u8 buffer) payload, publish a message using an appropriate topic and with the QOS specified in the Channel Definition
Sourcepub fn encode_and_send<T: Serialize>(
&self,
channel_definition: &ChannelDefinition,
data: T,
) -> Result<()>
pub fn encode_and_send<T: Serialize>( &self, channel_definition: &ChannelDefinition, data: T, ) -> Result<()>
Similar to send but serializes the data automatically before sending
pub fn publish_raw( &self, topic: &str, payload: &[u8], qos: Option<i32>, retained: Option<bool>, ) -> Result<()>
Auto Trait Implementations§
impl Freeze for TetherAgent
impl RefUnwindSafe for TetherAgent
impl Send for TetherAgent
impl !Sync for TetherAgent
impl Unpin for TetherAgent
impl UnwindSafe for TetherAgent
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
Mutably borrows from an owned value. Read more