mqtt::MqttConnector¶
Mqtt Connector class.
Public Functions¶
Name | |
---|---|
def | init(self self) Initialise the module. |
def | connect_mqtt(self self) Connect to the MQTT server. |
def | on_connect(self self, client client, userdata userdata, flags flags, response_code response_code) Callback on client connect. |
def | on_message(self self, client client, userdata userdata, message message) Callback on message received. |
def | send_message(self self, topic topic, payload payload) Helper function to send a message. |
def | prep_payload(self self, data data) Helper function to prepare the wrapper for the message. |
Public Attributes¶
Name | |
---|---|
broker | |
port | |
string | client_id |
username | |
password | |
client | |
bool | connected |
connected |
Public Functions Documentation¶
function init¶
Initialise the module.
function connect_mqtt¶
Connect to the MQTT server.
function on_connect¶
def on_connect(
self self,
client client,
userdata userdata,
flags flags,
response_code response_code
)
Callback on client connect.
Parameters:
- client The client object
- userdata Data on the user
- flags Flags!
- response_code Response code from the server
Return: None
function on_message¶
Callback on message received.
Parameters:
- client The client object
- userdata Data on the user
- message Object representing the message that has been received
Return: None
function send_message¶
Helper function to send a message.
Parameters:
- topic The topic to which to send a message
- payload The payload to send in the message
Return: None
function prep_payload¶
Helper function to prepare the wrapper for the message.
Parameters:
- data The data to wrap within the envelope
Return: The wrapped message
Public Attributes Documentation¶
variable broker¶
variable port¶
variable client_id¶
variable username¶
variable password¶
variable client¶
variable connected¶
variable connected¶
Updated on 2022-11-28 at 15:55:23 +0000