MqttMonitor/Documentation/source/Plugin_Mqtt_Monitor.MqttMonitor.MqttClient.html

branch
eric7
changeset 108
d7808a71b234
parent 92
2fb5c08019fd
child 115
357257ad48d2
--- a/MqttMonitor/Documentation/source/Plugin_Mqtt_Monitor.MqttMonitor.MqttClient.html	Sat Jul 24 16:50:10 2021 +0200
+++ b/MqttMonitor/Documentation/source/Plugin_Mqtt_Monitor.MqttMonitor.MqttClient.html	Sat Jul 24 16:51:29 2021 +0200
@@ -72,38 +72,62 @@
 emitted to indicate, that a connection attempt
         timed out
 </dd>
-<dt>onConnect(flags, rc)</dt>
+<dt>onConnectV3(flags, rc)</dt>
 <dd>
-emitted after the client has connected to the
-        broker
+emitted after the client has connected to
+        the broker (MQTT v3)
 </dd>
-<dt>onDisconnected(rc)</dt>
+<dt>onConnectV5(flags, rc, packetType, properties emitted after theclient has connected to the broker (MQTT v5)</dt>
+<dd>
+
+</dd>
+<dt>onDisconnectedV3(rc)</dt>
 <dd>
 emitted after the client has disconnected from
-        the broker
+        the broker (MQTT v3)
+</dd>
+<dt>onDisconnectedV5(rc, packetType)</dt>
+<dd>
+emitted after the client has
+        disconnected from the broker (MQTT v5)
 </dd>
 <dt>onLog(level, message)</dt>
 <dd>
 emitted to send client log data
 </dd>
-<dt>onMessage(topic, payload, qos, retain)</dt>
+<dt>onMessageV3(topic, payload, qos, retain)</dt>
 <dd>
-emitted after a message has
-        been received by the client
+emitted after a message
+        has been received by the client (MQTT v3)
+</dd>
+<dt>onMessageV5(topic, payload, qos, retain, properties)</dt>
+<dd>
+emitted after
+        a message has been received by the client (MQTT v5)
 </dd>
 <dt>onPublish(mid)</dt>
 <dd>
 emitted after a message has been published
 </dd>
-<dt>onSubscribe(mid, grantedQos)</dt>
+<dt>onSubscribeV3(mid, grantedQos)</dt>
 <dd>
 emitted after the client has
-        subscribed to some topics
+        subscribed to some topics (MQTT v3)
 </dd>
-<dt>onUnsubscribe(mid)</dt>
+<dt>onSubscribeV5(mid, reasonCodes, properties)</dt>
+<dd>
+emitted after the
+        client has subscribed to some topics (MQTT v5)
+</dd>
+<dt>onUnsubscribeV3(mid)</dt>
 <dd>
 emitted after the client has unsubscribed from
-        some topics
+        some topics (MQTT v3)
+</dd>
+<dt>onUnsubscribeV5(mid, rc, packetType, properties)</dt>
+<dd>
+emitted after the
+        client has unsubscribed from some topics (MQTT v5)
 </dd>
 </dl>
 <h3>Derived from</h3>
@@ -116,7 +140,11 @@
 <h3>Class Methods</h3>
 
 <table>
-<tr><td>None</td></tr>
+
+<tr>
+<td><a href="#MqttClient.defaultConnectionOptions">defaultConnectionOptions</a></td>
+<td>Class method to get a connection options dictionary with default values.</td>
+</tr>
 </table>
 <h3>Methods</h3>
 
@@ -131,10 +159,18 @@
 <td>Private slot handling a failed connection attempt.</td>
 </tr>
 <tr>
+<td><a href="#MqttClient.__createPropertiesObject">__createPropertiesObject</a></td>
+<td>Private method to assemble the MQTT v5 properties object.</td>
+</tr>
+<tr>
 <td><a href="#MqttClient.__initCallbacks">__initCallbacks</a></td>
 <td>Private method to initialize the MQTT callback methods.</td>
 </tr>
 <tr>
+<td><a href="#MqttClient.__onDisconnectedV5">__onDisconnectedV5</a></td>
+<td>Private method to handle the disconnect from the broker.</td>
+</tr>
+<tr>
 <td><a href="#MqttClient.clearLastWill">clearLastWill</a></td>
 <td>Public method to remove a will that was previously configured with setLastWill().</td>
 </tr>
@@ -147,12 +183,12 @@
 <td>Public method to connect to a remote MQTT broker.</td>
 </tr>
 <tr>
-<td><a href="#MqttClient.defaultConnectionOptions">defaultConnectionOptions</a></td>
-<td>Public method to get a connection options dictionary with default values.</td>
+<td><a href="#MqttClient.disconnectFromServer">disconnectFromServer</a></td>
+<td>Public method to disconnect the client from the remote broker.</td>
 </tr>
 <tr>
-<td><a href="#MqttClient.disconnectFromServer">disconnectFromServer</a></td>
-<td>Public method to disconnect the client from the remote broker.</td>
+<td><a href="#MqttClient.getProtocol">getProtocol</a></td>
+<td>Public method to get the MQTT protocol version.</td>
 </tr>
 <tr>
 <td><a href="#MqttClient.publish">publish</a></td>
@@ -163,10 +199,6 @@
 <td>Public method to reconnect the client with the same parameters.</td>
 </tr>
 <tr>
-<td><a href="#MqttClient.reinitialise">reinitialise</a></td>
-<td>Public method to reinitialize the client with given data.</td>
-</tr>
-<tr>
 <td><a href="#MqttClient.setConnectionTimeout">setConnectionTimeout</a></td>
 <td>Public method to set the connection timeout value.</td>
 </tr>
@@ -217,6 +249,30 @@
 <tr><td>None</td></tr>
 </table>
 
+<a NAME="MqttClient.defaultConnectionOptions" ID="MqttClient.defaultConnectionOptions"></a>
+<h4>MqttClient.defaultConnectionOptions (class method)</h4>
+<b>defaultConnectionOptions</b>(<i></i>)
+
+<p>
+        Class method to get a connection options dictionary with default
+        values.
+</p>
+<dl>
+<dt>Return:</dt>
+<dd>
+dictionary containing the default connection options. It has
+            the keys "ClientId", "Protocol", "ConnectionTimeout", "Keepalive",
+            "CleanSession", "Username", "Password", "WillTopic", "WillMessage",
+            "WillQos", "WillRetain", "WillProperties", "TlsEnable",
+            "TlsCaCert", "TlsClientCert", "TlsClientKey", "UserProperties".
+</dd>
+</dl>
+<dl>
+<dt>Return Type:</dt>
+<dd>
+dict
+</dd>
+</dl>
 <a NAME="MqttClient.__init__" ID="MqttClient.__init__"></a>
 <h4>MqttClient (Constructor)</h4>
 <b>MqttClient</b>(<i>clientId="", cleanSession=True, userdata=None, protocol=mqtt.MQTTv311, transport="tcp", parent=None</i>)
@@ -238,7 +294,7 @@
 <dd>
 user data
 </dd>
-<dt><i>protocol</i> (int, one of mqtt.MQTTv3, mqtt.MQTTv311 or mqtt.MQTTv5)</dt>
+<dt><i>protocol</i> (int, one of mqtt.MQTTv31, mqtt.MQTTv311 or mqtt.MQTTv5)</dt>
 <dd>
 version of the MQTT protocol to use
 </dd>
@@ -258,13 +314,76 @@
 <p>
         Private slot handling a failed connection attempt.
 </p>
+<a NAME="MqttClient.__createPropertiesObject" ID="MqttClient.__createPropertiesObject"></a>
+<h4>MqttClient.__createPropertiesObject</h4>
+<b>__createPropertiesObject</b>(<i>packetType, properties</i>)
+
+<p>
+        Private method to assemble the MQTT v5 properties object.
+</p>
+<dl>
+
+<dt><i>packetType</i> (PacketTypes (= int))</dt>
+<dd>
+type of the MQTT packet
+</dd>
+<dt><i>properties</i> (list of tuple of (str, str))</dt>
+<dd>
+list of user properties
+</dd>
+</dl>
+<dl>
+<dt>Return:</dt>
+<dd>
+MQTT v5 properties object
+</dd>
+</dl>
+<dl>
+<dt>Return Type:</dt>
+<dd>
+Properties
+</dd>
+</dl>
 <a NAME="MqttClient.__initCallbacks" ID="MqttClient.__initCallbacks"></a>
 <h4>MqttClient.__initCallbacks</h4>
-<b>__initCallbacks</b>(<i></i>)
+<b>__initCallbacks</b>(<i>protocol</i>)
 
 <p>
         Private method to initialize the MQTT callback methods.
 </p>
+<dl>
+
+<dt><i>protocol</i> (MqttProtocols)</dt>
+<dd>
+MQTT protocol version
+</dd>
+</dl>
+<a NAME="MqttClient.__onDisconnectedV5" ID="MqttClient.__onDisconnectedV5"></a>
+<h4>MqttClient.__onDisconnectedV5</h4>
+<b>__onDisconnectedV5</b>(<i>client, userdata, rc, properties=None</i>)
+
+<p>
+        Private method to handle the disconnect from the broker.
+</p>
+<dl>
+
+<dt><i>client</i> (paho.mqtt.Client)</dt>
+<dd>
+reference to the client object
+</dd>
+<dt><i>userdata</i> (Any)</dt>
+<dd>
+user data
+</dd>
+<dt><i>rc</i> (int or ReasonCodes)</dt>
+<dd>
+result code or reason code
+</dd>
+<dt><i>properties</i> (dict (optional))</dt>
+<dd>
+optional properties (defaults to None)
+</dd>
+</dl>
 <a NAME="MqttClient.clearLastWill" ID="MqttClient.clearLastWill"></a>
 <h4>MqttClient.clearLastWill</h4>
 <b>clearLastWill</b>(<i></i>)
@@ -275,7 +394,7 @@
 </p>
 <a NAME="MqttClient.connectToServer" ID="MqttClient.connectToServer"></a>
 <h4>MqttClient.connectToServer</h4>
-<b>connectToServer</b>(<i>host, port=1883, keepalive=60, bindAddress="", reinit=True</i>)
+<b>connectToServer</b>(<i>host, port=1883, keepalive=60, bindAddress="", properties=None, clearWill=False</i>)
 
 <p>
         Public method to connect to a remote MQTT broker.
@@ -301,15 +420,19 @@
 IP address of a local network interface to bind
             this client to
 </dd>
-<dt><i>reinit</i> (bool)</dt>
+<dt><i>properties</i> (list of tuple of (str, str))</dt>
 <dd>
-flag indicating to reinitialize the MQTT client before
-            trying to connect with the given parameters
+list of user properties to be sent with the
+            subscription
+</dd>
+<dt><i>clearWill</i> (bool)</dt>
+<dd>
+flag indicating to clear the last will previously set
 </dd>
 </dl>
 <a NAME="MqttClient.connectToServerWithOptions" ID="MqttClient.connectToServerWithOptions"></a>
 <h4>MqttClient.connectToServerWithOptions</h4>
-<b>connectToServerWithOptions</b>(<i>host, port=1883, bindAddress="", options=None</i>)
+<b>connectToServerWithOptions</b>(<i>host, port=1883, bindAddress="", options=None, clearWill=False</i>)
 
 <p>
         Public method to connect to a remote MQTT broker.
@@ -333,34 +456,15 @@
 <dt><i>options</i> (dict)</dt>
 <dd>
 dictionary containing the connection options. This
-            dictionary should contain the keys "ClientId", "Keepalive",
-            "CleanSession", "Username", "Password", "WillTopic", "WillMessage",
-            "WillQos", "WillRetain", "TlsEnable", "TlsCaCert", "TlsClientCert",
-            "TlsClientKey", "ConnectionTimeout"
+            dictionary should contain the keys "ClientId", "ConnectionTimeout",
+            "Keepalive", "CleanSession", "Username", "Password", "WillTopic",
+            "WillMessage", "WillQos", "WillRetain", "WillProperties",
+            "TlsEnable", "TlsCaCert", "TlsClientCert", "TlsClientKey",
+            "UserProperties".
 </dd>
-</dl>
-<a NAME="MqttClient.defaultConnectionOptions" ID="MqttClient.defaultConnectionOptions"></a>
-<h4>MqttClient.defaultConnectionOptions</h4>
-<b>defaultConnectionOptions</b>(<i></i>)
-
-<p>
-        Public method to get a connection options dictionary with default
-        values.
-</p>
-<dl>
-<dt>Return:</dt>
+<dt><i>clearWill</i> (bool)</dt>
 <dd>
-dictionary containing the default connection options. It has
-            the keys "ClientId", "Keepalive", "CleanSession", "Username",
-            "Password", "WillTopic", "WillMessage", "WillQos", "WillRetain",
-            "TlsEnable", "TlsCaCert", "TlsClientCert", "TlsClientKey",
-            "ConnectionTimeout".
-</dd>
-</dl>
-<dl>
-<dt>Return Type:</dt>
-<dd>
-dict
+flag indicating to clear the last will previously set
 </dd>
 </dl>
 <a NAME="MqttClient.disconnectFromServer" ID="MqttClient.disconnectFromServer"></a>
@@ -370,9 +474,28 @@
 <p>
         Public method to disconnect the client from the remote broker.
 </p>
+<a NAME="MqttClient.getProtocol" ID="MqttClient.getProtocol"></a>
+<h4>MqttClient.getProtocol</h4>
+<b>getProtocol</b>(<i></i>)
+
+<p>
+        Public method to get the MQTT protocol version.
+</p>
+<dl>
+<dt>Return:</dt>
+<dd>
+MQTT protocol version in use
+</dd>
+</dl>
+<dl>
+<dt>Return Type:</dt>
+<dd>
+int
+</dd>
+</dl>
 <a NAME="MqttClient.publish" ID="MqttClient.publish"></a>
 <h4>MqttClient.publish</h4>
-<b>publish</b>(<i>topic, payload=None, qos=0, retain=False</i>)
+<b>publish</b>(<i>topic, payload=None, qos=0, retain=False, properties=None</i>)
 
 <p>
         Public method to publish to a topic.
@@ -396,6 +519,11 @@
 flag indicating to set as the "last known good"/retained
             message for the topic
 </dd>
+<dt><i>properties</i> (list of tuple of (str, str))</dt>
+<dd>
+list of user properties to be sent with the
+            subscription
+</dd>
 </dl>
 <dl>
 <dt>Return:</dt>
@@ -416,28 +544,6 @@
 <p>
         Public method to reconnect the client with the same parameters.
 </p>
-<a NAME="MqttClient.reinitialise" ID="MqttClient.reinitialise"></a>
-<h4>MqttClient.reinitialise</h4>
-<b>reinitialise</b>(<i>clientId="", cleanSession=True, userdata=None</i>)
-
-<p>
-        Public method to reinitialize the client with given data.
-</p>
-<dl>
-
-<dt><i>clientId</i> (str)</dt>
-<dd>
-ID to be used for the client
-</dd>
-<dt><i>cleanSession</i> (bool)</dt>
-<dd>
-flag indicating to start a clean session
-</dd>
-<dt><i>userdata</i> (any)</dt>
-<dd>
-user data
-</dd>
-</dl>
 <a NAME="MqttClient.setConnectionTimeout" ID="MqttClient.setConnectionTimeout"></a>
 <h4>MqttClient.setConnectionTimeout</h4>
 <b>setConnectionTimeout</b>(<i>timeout</i>)
@@ -454,7 +560,7 @@
 </dl>
 <a NAME="MqttClient.setLastWill" ID="MqttClient.setLastWill"></a>
 <h4>MqttClient.setLastWill</h4>
-<b>setLastWill</b>(<i>topic, payload=None, qos=0, retain=False</i>)
+<b>setLastWill</b>(<i>topic, payload=None, qos=0, retain=False, properties=None</i>)
 
 <p>
         Public method to set the last will of the client.
@@ -478,6 +584,11 @@
 flag indicating to set as the "last known good"/retained
             message for the will topic
 </dd>
+<dt><i>properties</i> (list of tuple of (str, str))</dt>
+<dd>
+list of user properties to be sent with the
+            last will message
+</dd>
 </dl>
 <a NAME="MqttClient.setMaxInflightMessages" ID="MqttClient.setMaxInflightMessages"></a>
 <h4>MqttClient.setMaxInflightMessages</h4>
@@ -592,7 +703,7 @@
 </p>
 <a NAME="MqttClient.subscribe" ID="MqttClient.subscribe"></a>
 <h4>MqttClient.subscribe</h4>
-<b>subscribe</b>(<i>topic, qos=0</i>)
+<b>subscribe</b>(<i>topic, qos=0, properties=None</i>)
 
 <p>
         Public method to subscribe to topics with quality of service.
@@ -608,6 +719,11 @@
 <dd>
 quality of service
 </dd>
+<dt><i>properties</i> (list of tuple of (str, str))</dt>
+<dd>
+list of user properties to be sent with the
+            subscription
+</dd>
 </dl>
 <dl>
 <dt>Return:</dt>
@@ -623,7 +739,7 @@
 </dl>
 <a NAME="MqttClient.unsubscribe" ID="MqttClient.unsubscribe"></a>
 <h4>MqttClient.unsubscribe</h4>
-<b>unsubscribe</b>(<i>topic</i>)
+<b>unsubscribe</b>(<i>topic, properties=None</i>)
 
 <p>
         Public method to unsubscribe topics.
@@ -634,6 +750,11 @@
 <dd>
 topic or list of topics to unsubscribe
 </dd>
+<dt><i>properties</i> (list of tuple of (str, str))</dt>
+<dd>
+list of user properties to be sent with the
+            subscription
+</dd>
 </dl>
 <dl>
 <dt>Return:</dt>

eric ide

mercurial