class documentation
MQTT Agent
This is a virtual class acting as the base for MQTT agents that set up subscriptions, process received publications and publish.
| Method | __init__ |
Initialise the subscription |
| Method | get |
Get the topic filter for this subscription |
| Method | handle |
Handle a publication |
| Method | matches |
check if topic matches filter |
| Method | _create |
Create Publication check task |
| Class Variable | _client |
Undocumented |
| Class Variable | _dcc |
Undocumented |
| Instance Variable | _qos |
Undocumented |
| Instance Variable | _topic |
Undocumented |
overridden in
rp2da2.mqtt.mqtt.WillInitialise the subscription
| Parameters | |
| topic | the topic filter to match against received topics |
| qos | the Quality of Service for this subscription. Must be either MQTTClient.QOS0 or MQTTClient.QOS1 |
overridden in
rp2da2.mqtt.mqtt.WillHandle a publication
This method is called by the MQTT client when a publication is received. It must be implemented by the derived class.
| Parameters | |
| topic | the topic of the publication |
| dup | True if this is a duplicate publication |
| ret | True if this is a retained publication |
| payload | the payload of the publication as a string |
check if topic matches filter
Parse the received topic against the topic filter to see if it matches.
'+' matches a single item in the topic name. '#' matches any remaining topic name including none
| Parameters | |
| self | |
| topic | the received topic as a string |
| Returns | |
| True if matches else false |