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

branch
eric7
changeset 141
864edfb1bb63
parent 138
871d54655ef1
child 143
51bc5bcc672a
equal deleted inserted replaced
140:853ffd248dda 141:864edfb1bb63
5 <link rel="stylesheet" href="styles.css"> 5 <link rel="stylesheet" href="styles.css">
6 </head> 6 </head>
7 <body> 7 <body>
8 <a NAME="top" ID="top"></a> 8 <a NAME="top" ID="top"></a>
9 <h1>Plugin_Mqtt_Monitor.MqttMonitor.MqttClient</h1> 9 <h1>Plugin_Mqtt_Monitor.MqttMonitor.MqttClient</h1>
10
11 <p> 10 <p>
12 Module implementing a PyQt wrapper around the paho MQTT client. 11 Module implementing a PyQt wrapper around the paho MQTT client.
13 </p> 12 </p>
13
14 <h3>Global Attributes</h3> 14 <h3>Global Attributes</h3>
15
16 <table> 15 <table>
17 <tr><td>None</td></tr> 16 <tr><td>None</td></tr>
18 </table> 17 </table>
18
19 <h3>Classes</h3> 19 <h3>Classes</h3>
20
21 <table> 20 <table>
22
23 <tr> 21 <tr>
24 <td><a href="#MqttClient">MqttClient</a></td> 22 <td><a href="#MqttClient">MqttClient</a></td>
25 <td>Class implementing a PyQt wrapper around the paho MQTT client.</td> 23 <td>Class implementing a PyQt wrapper around the paho MQTT client.</td>
26 </tr> 24 </tr>
27 </table> 25 </table>
26
28 <h3>Functions</h3> 27 <h3>Functions</h3>
29
30 <table> 28 <table>
31
32 <tr> 29 <tr>
33 <td><a href="#mqttConnackMessage">mqttConnackMessage</a></td> 30 <td><a href="#mqttConnackMessage">mqttConnackMessage</a></td>
34 <td>Module function to get the string associated with a CONNACK result.</td> 31 <td>Module function to get the string associated with a CONNACK result.</td>
35 </tr> 32 </tr>
36 <tr> 33 <tr>
40 <tr> 37 <tr>
41 <td><a href="#mqttLogLevelString">mqttLogLevelString</a></td> 38 <td><a href="#mqttLogLevelString">mqttLogLevelString</a></td>
42 <td>Module function to get the log level string associated with a log level.</td> 39 <td>Module function to get the log level string associated with a log level.</td>
43 </tr> 40 </tr>
44 </table> 41 </table>
42
45 <hr /> 43 <hr />
46 <hr /> 44 <hr />
47 <a NAME="MqttClient" ID="MqttClient"></a> 45 <a NAME="MqttClient" ID="MqttClient"></a>
48 <h2>MqttClient</h2> 46 <h2>MqttClient</h2>
49
50 <p> 47 <p>
51 Class implementing a PyQt wrapper around the paho MQTT client. 48 Class implementing a PyQt wrapper around the paho MQTT client.
52 </p> 49 </p>
50
53 <h3>Signals</h3> 51 <h3>Signals</h3>
54 <dl> 52 <dl>
55 53
56 <dt>connectTimeout()</dt> 54 <dt>connectTimeout()</dt>
57 <dd> 55 <dd>
117 </dd> 115 </dd>
118 </dl> 116 </dl>
119 <h3>Derived from</h3> 117 <h3>Derived from</h3>
120 QObject 118 QObject
121 <h3>Class Attributes</h3> 119 <h3>Class Attributes</h3>
122
123 <table> 120 <table>
124 <tr><td>DefaultConnectTimeout</td></tr><tr><td>LogDebug</td></tr><tr><td>LogDisabled</td></tr><tr><td>LogError</td></tr><tr><td>LogInfo</td></tr><tr><td>LogLevelMap</td></tr><tr><td>LogNotice</td></tr><tr><td>LogWarning</td></tr> 121 <tr><td>DefaultConnectTimeout</td></tr>
122 <tr><td>LogDebug</td></tr>
123 <tr><td>LogDisabled</td></tr>
124 <tr><td>LogError</td></tr>
125 <tr><td>LogInfo</td></tr>
126 <tr><td>LogLevelMap</td></tr>
127 <tr><td>LogNotice</td></tr>
128 <tr><td>LogWarning</td></tr>
125 </table> 129 </table>
130
126 <h3>Class Methods</h3> 131 <h3>Class Methods</h3>
127
128 <table> 132 <table>
129
130 <tr> 133 <tr>
131 <td><a href="#MqttClient.defaultConnectionOptions">defaultConnectionOptions</a></td> 134 <td><a href="#MqttClient.defaultConnectionOptions">defaultConnectionOptions</a></td>
132 <td>Class method to get a connection options dictionary with default values.</td> 135 <td>Class method to get a connection options dictionary with default values.</td>
133 </tr> 136 </tr>
134 </table> 137 </table>
138
135 <h3>Methods</h3> 139 <h3>Methods</h3>
136
137 <table> 140 <table>
138
139 <tr> 141 <tr>
140 <td><a href="#MqttClient.__init__">MqttClient</a></td> 142 <td><a href="#MqttClient.__init__">MqttClient</a></td>
141 <td>Constructor</td> 143 <td>Constructor</td>
142 </tr> 144 </tr>
143 <tr> 145 <tr>
271 <tr> 273 <tr>
272 <td><a href="#MqttClient.unsubscribe">unsubscribe</a></td> 274 <td><a href="#MqttClient.unsubscribe">unsubscribe</a></td>
273 <td>Public method to unsubscribe topics.</td> 275 <td>Public method to unsubscribe topics.</td>
274 </tr> 276 </tr>
275 </table> 277 </table>
278
276 <h3>Static Methods</h3> 279 <h3>Static Methods</h3>
277
278 <table> 280 <table>
279 <tr><td>None</td></tr> 281 <tr><td>None</td></tr>
280 </table> 282 </table>
281 283
284
282 <a NAME="MqttClient.defaultConnectionOptions" ID="MqttClient.defaultConnectionOptions"></a> 285 <a NAME="MqttClient.defaultConnectionOptions" ID="MqttClient.defaultConnectionOptions"></a>
283 <h4>MqttClient.defaultConnectionOptions (class method)</h4> 286 <h4>MqttClient.defaultConnectionOptions (class method)</h4>
284 <b>defaultConnectionOptions</b>(<i></i>) 287 <b>defaultConnectionOptions</b>(<i></i>)
285
286 <p> 288 <p>
287 Class method to get a connection options dictionary with default 289 Class method to get a connection options dictionary with default
288 values. 290 values.
289 </p> 291 </p>
292
290 <dl> 293 <dl>
291 <dt>Return:</dt> 294 <dt>Return:</dt>
292 <dd> 295 <dd>
293 dictionary containing the default connection options. It has 296 dictionary containing the default connection options. It has
294 the keys "ClientId", "Protocol", "ConnectionTimeout", "Keepalive", 297 the keys "ClientId", "Protocol", "ConnectionTimeout", "Keepalive",
304 </dd> 307 </dd>
305 </dl> 308 </dl>
306 <a NAME="MqttClient.__init__" ID="MqttClient.__init__"></a> 309 <a NAME="MqttClient.__init__" ID="MqttClient.__init__"></a>
307 <h4>MqttClient (Constructor)</h4> 310 <h4>MqttClient (Constructor)</h4>
308 <b>MqttClient</b>(<i>clientId="", cleanSession=True, userdata=None, protocol=mqtt.MQTTv311, transport="tcp", parent=None, </i>) 311 <b>MqttClient</b>(<i>clientId="", cleanSession=True, userdata=None, protocol=mqtt.MQTTv311, transport="tcp", parent=None, </i>)
309
310 <p> 312 <p>
311 Constructor 313 Constructor
312 </p> 314 </p>
315
313 <dl> 316 <dl>
314 317
315 <dt><i>clientId</i> (str)</dt> 318 <dt><i>clientId</i> (str)</dt>
316 <dd> 319 <dd>
317 ID to be used for the client 320 ID to be used for the client
338 </dd> 341 </dd>
339 </dl> 342 </dl>
340 <a NAME="MqttClient.__connectTimeout" ID="MqttClient.__connectTimeout"></a> 343 <a NAME="MqttClient.__connectTimeout" ID="MqttClient.__connectTimeout"></a>
341 <h4>MqttClient.__connectTimeout</h4> 344 <h4>MqttClient.__connectTimeout</h4>
342 <b>__connectTimeout</b>(<i></i>) 345 <b>__connectTimeout</b>(<i></i>)
343
344 <p> 346 <p>
345 Private slot handling a failed connection attempt. 347 Private slot handling a failed connection attempt.
346 </p> 348 </p>
349
347 <a NAME="MqttClient.__createPropertiesObject" ID="MqttClient.__createPropertiesObject"></a> 350 <a NAME="MqttClient.__createPropertiesObject" ID="MqttClient.__createPropertiesObject"></a>
348 <h4>MqttClient.__createPropertiesObject</h4> 351 <h4>MqttClient.__createPropertiesObject</h4>
349 <b>__createPropertiesObject</b>(<i>packetType, properties</i>) 352 <b>__createPropertiesObject</b>(<i>packetType, properties</i>)
350
351 <p> 353 <p>
352 Private method to assemble the MQTT v5 properties object. 354 Private method to assemble the MQTT v5 properties object.
353 </p> 355 </p>
356
354 <dl> 357 <dl>
355 358
356 <dt><i>packetType</i> (PacketTypes (= int))</dt> 359 <dt><i>packetType</i> (PacketTypes (= int))</dt>
357 <dd> 360 <dd>
358 type of the MQTT packet 361 type of the MQTT packet
375 </dd> 378 </dd>
376 </dl> 379 </dl>
377 <a NAME="MqttClient.__initCallbacks" ID="MqttClient.__initCallbacks"></a> 380 <a NAME="MqttClient.__initCallbacks" ID="MqttClient.__initCallbacks"></a>
378 <h4>MqttClient.__initCallbacks</h4> 381 <h4>MqttClient.__initCallbacks</h4>
379 <b>__initCallbacks</b>(<i>protocol</i>) 382 <b>__initCallbacks</b>(<i>protocol</i>)
380
381 <p> 383 <p>
382 Private method to initialize the MQTT callback methods. 384 Private method to initialize the MQTT callback methods.
383 </p> 385 </p>
386
384 <dl> 387 <dl>
385 388
386 <dt><i>protocol</i> (MqttProtocols)</dt> 389 <dt><i>protocol</i> (MqttProtocols)</dt>
387 <dd> 390 <dd>
388 MQTT protocol version 391 MQTT protocol version
389 </dd> 392 </dd>
390 </dl> 393 </dl>
391 <a NAME="MqttClient.__onConnectV3" ID="MqttClient.__onConnectV3"></a> 394 <a NAME="MqttClient.__onConnectV3" ID="MqttClient.__onConnectV3"></a>
392 <h4>MqttClient.__onConnectV3</h4> 395 <h4>MqttClient.__onConnectV3</h4>
393 <b>__onConnectV3</b>(<i>client, userdata, flags, rc, properties=None, </i>) 396 <b>__onConnectV3</b>(<i>client, userdata, flags, rc, properties=None, </i>)
394
395 <p> 397 <p>
396 Private method to handle the connect to the broker (MQTT v3.1 and v3.1.1). 398 Private method to handle the connect to the broker (MQTT v3.1 and v3.1.1).
397 </p> 399 </p>
400
398 <dl> 401 <dl>
399 402
400 <dt><i>client</i> (paho.mqtt.Client)</dt> 403 <dt><i>client</i> (paho.mqtt.Client)</dt>
401 <dd> 404 <dd>
402 reference to the client object 405 reference to the client object
419 </dd> 422 </dd>
420 </dl> 423 </dl>
421 <a NAME="MqttClient.__onConnectV5" ID="MqttClient.__onConnectV5"></a> 424 <a NAME="MqttClient.__onConnectV5" ID="MqttClient.__onConnectV5"></a>
422 <h4>MqttClient.__onConnectV5</h4> 425 <h4>MqttClient.__onConnectV5</h4>
423 <b>__onConnectV5</b>(<i>client, userdata, flags, rc, properties=None, </i>) 426 <b>__onConnectV5</b>(<i>client, userdata, flags, rc, properties=None, </i>)
424
425 <p> 427 <p>
426 Private method to handle the connect to the broker (MQTT v5.0). 428 Private method to handle the connect to the broker (MQTT v5.0).
427 </p> 429 </p>
430
428 <dl> 431 <dl>
429 432
430 <dt><i>client</i> (paho.mqtt.Client)</dt> 433 <dt><i>client</i> (paho.mqtt.Client)</dt>
431 <dd> 434 <dd>
432 reference to the client object 435 reference to the client object
449 </dd> 452 </dd>
450 </dl> 453 </dl>
451 <a NAME="MqttClient.__onDisconnectedV3" ID="MqttClient.__onDisconnectedV3"></a> 454 <a NAME="MqttClient.__onDisconnectedV3" ID="MqttClient.__onDisconnectedV3"></a>
452 <h4>MqttClient.__onDisconnectedV3</h4> 455 <h4>MqttClient.__onDisconnectedV3</h4>
453 <b>__onDisconnectedV3</b>(<i>client, userdata, rc, </i>) 456 <b>__onDisconnectedV3</b>(<i>client, userdata, rc, </i>)
454
455 <p> 457 <p>
456 Private method to handle the disconnect from the broker (MQTT v3.1 and v3.1.1). 458 Private method to handle the disconnect from the broker (MQTT v3.1 and v3.1.1).
457 </p> 459 </p>
460
458 <dl> 461 <dl>
459 462
460 <dt><i>client</i> (paho.mqtt.Client)</dt> 463 <dt><i>client</i> (paho.mqtt.Client)</dt>
461 <dd> 464 <dd>
462 reference to the client object 465 reference to the client object
471 </dd> 474 </dd>
472 </dl> 475 </dl>
473 <a NAME="MqttClient.__onDisconnectedV5" ID="MqttClient.__onDisconnectedV5"></a> 476 <a NAME="MqttClient.__onDisconnectedV5" ID="MqttClient.__onDisconnectedV5"></a>
474 <h4>MqttClient.__onDisconnectedV5</h4> 477 <h4>MqttClient.__onDisconnectedV5</h4>
475 <b>__onDisconnectedV5</b>(<i>client, userdata, rc, properties=None, </i>) 478 <b>__onDisconnectedV5</b>(<i>client, userdata, rc, properties=None, </i>)
476
477 <p> 479 <p>
478 Private method to handle the disconnect from the broker (MQTT v5.0). 480 Private method to handle the disconnect from the broker (MQTT v5.0).
479 </p> 481 </p>
482
480 <dl> 483 <dl>
481 484
482 <dt><i>client</i> (paho.mqtt.Client)</dt> 485 <dt><i>client</i> (paho.mqtt.Client)</dt>
483 <dd> 486 <dd>
484 reference to the client object 487 reference to the client object
497 </dd> 500 </dd>
498 </dl> 501 </dl>
499 <a NAME="MqttClient.__onLog" ID="MqttClient.__onLog"></a> 502 <a NAME="MqttClient.__onLog" ID="MqttClient.__onLog"></a>
500 <h4>MqttClient.__onLog</h4> 503 <h4>MqttClient.__onLog</h4>
501 <b>__onLog</b>(<i>client, userdata, level, buf, </i>) 504 <b>__onLog</b>(<i>client, userdata, level, buf, </i>)
502
503 <p> 505 <p>
504 Private method to handle a log event (MQTT v3.1, v3.1.1 and v5.0). 506 Private method to handle a log event (MQTT v3.1, v3.1.1 and v5.0).
505 </p> 507 </p>
508
506 <dl> 509 <dl>
507 510
508 <dt><i>client</i> (paho.mqtt.Client)</dt> 511 <dt><i>client</i> (paho.mqtt.Client)</dt>
509 <dd> 512 <dd>
510 reference to the client object 513 reference to the client object
523 </dd> 526 </dd>
524 </dl> 527 </dl>
525 <a NAME="MqttClient.__onMessageV3" ID="MqttClient.__onMessageV3"></a> 528 <a NAME="MqttClient.__onMessageV3" ID="MqttClient.__onMessageV3"></a>
526 <h4>MqttClient.__onMessageV3</h4> 529 <h4>MqttClient.__onMessageV3</h4>
527 <b>__onMessageV3</b>(<i>client, userdata, message, </i>) 530 <b>__onMessageV3</b>(<i>client, userdata, message, </i>)
528
529 <p> 531 <p>
530 Private method to handle a new message received from the broker (MQTT v3.1 532 Private method to handle a new message received from the broker (MQTT v3.1
531 and v3.1.1). 533 and v3.1.1).
532 </p> 534 </p>
535
533 <dl> 536 <dl>
534 537
535 <dt><i>client</i> (paho.mqtt.Client)</dt> 538 <dt><i>client</i> (paho.mqtt.Client)</dt>
536 <dd> 539 <dd>
537 reference to the client object 540 reference to the client object
546 </dd> 549 </dd>
547 </dl> 550 </dl>
548 <a NAME="MqttClient.__onMessageV5" ID="MqttClient.__onMessageV5"></a> 551 <a NAME="MqttClient.__onMessageV5" ID="MqttClient.__onMessageV5"></a>
549 <h4>MqttClient.__onMessageV5</h4> 552 <h4>MqttClient.__onMessageV5</h4>
550 <b>__onMessageV5</b>(<i>client, userdata, message, </i>) 553 <b>__onMessageV5</b>(<i>client, userdata, message, </i>)
551
552 <p> 554 <p>
553 Private method to handle a new message received from the broker (MQTT v5.0). 555 Private method to handle a new message received from the broker (MQTT v5.0).
554 </p> 556 </p>
557
555 <dl> 558 <dl>
556 559
557 <dt><i>client</i> (paho.mqtt.Client)</dt> 560 <dt><i>client</i> (paho.mqtt.Client)</dt>
558 <dd> 561 <dd>
559 reference to the client object 562 reference to the client object
568 </dd> 571 </dd>
569 </dl> 572 </dl>
570 <a NAME="MqttClient.__onPublish" ID="MqttClient.__onPublish"></a> 573 <a NAME="MqttClient.__onPublish" ID="MqttClient.__onPublish"></a>
571 <h4>MqttClient.__onPublish</h4> 574 <h4>MqttClient.__onPublish</h4>
572 <b>__onPublish</b>(<i>client, userdata, mid, </i>) 575 <b>__onPublish</b>(<i>client, userdata, mid, </i>)
573
574 <p> 576 <p>
575 Private method to handle the publishing of a message (MQTT v3.1, v3.1.1 577 Private method to handle the publishing of a message (MQTT v3.1, v3.1.1
576 and v5.0). 578 and v5.0).
577 </p> 579 </p>
580
578 <dl> 581 <dl>
579 582
580 <dt><i>client</i> (paho.mqtt.Client)</dt> 583 <dt><i>client</i> (paho.mqtt.Client)</dt>
581 <dd> 584 <dd>
582 reference to the client object 585 reference to the client object
591 </dd> 594 </dd>
592 </dl> 595 </dl>
593 <a NAME="MqttClient.__onSubscribeV3" ID="MqttClient.__onSubscribeV3"></a> 596 <a NAME="MqttClient.__onSubscribeV3" ID="MqttClient.__onSubscribeV3"></a>
594 <h4>MqttClient.__onSubscribeV3</h4> 597 <h4>MqttClient.__onSubscribeV3</h4>
595 <b>__onSubscribeV3</b>(<i>client, userdata, mid, grantedQos, </i>) 598 <b>__onSubscribeV3</b>(<i>client, userdata, mid, grantedQos, </i>)
596
597 <p> 599 <p>
598 Private method to handle a subscribe event (MQTT v3.1 and v3.1.1). 600 Private method to handle a subscribe event (MQTT v3.1 and v3.1.1).
599 </p> 601 </p>
602
600 <dl> 603 <dl>
601 604
602 <dt><i>client</i> (paho.mqtt.Client)</dt> 605 <dt><i>client</i> (paho.mqtt.Client)</dt>
603 <dd> 606 <dd>
604 reference to the client object 607 reference to the client object
617 </dd> 620 </dd>
618 </dl> 621 </dl>
619 <a NAME="MqttClient.__onSubscribeV5" ID="MqttClient.__onSubscribeV5"></a> 622 <a NAME="MqttClient.__onSubscribeV5" ID="MqttClient.__onSubscribeV5"></a>
620 <h4>MqttClient.__onSubscribeV5</h4> 623 <h4>MqttClient.__onSubscribeV5</h4>
621 <b>__onSubscribeV5</b>(<i>client, userdata, mid, reasonCodes, properties=None, </i>) 624 <b>__onSubscribeV5</b>(<i>client, userdata, mid, reasonCodes, properties=None, </i>)
622
623 <p> 625 <p>
624 Private method to handle a subscribe event (MQTT v5.0). 626 Private method to handle a subscribe event (MQTT v5.0).
625 </p> 627 </p>
628
626 <dl> 629 <dl>
627 630
628 <dt><i>client</i> (paho.mqtt.Client)</dt> 631 <dt><i>client</i> (paho.mqtt.Client)</dt>
629 <dd> 632 <dd>
630 reference to the client object 633 reference to the client object
647 </dd> 650 </dd>
648 </dl> 651 </dl>
649 <a NAME="MqttClient.__onUnsubscribeV3" ID="MqttClient.__onUnsubscribeV3"></a> 652 <a NAME="MqttClient.__onUnsubscribeV3" ID="MqttClient.__onUnsubscribeV3"></a>
650 <h4>MqttClient.__onUnsubscribeV3</h4> 653 <h4>MqttClient.__onUnsubscribeV3</h4>
651 <b>__onUnsubscribeV3</b>(<i>client, userdata, mid, </i>) 654 <b>__onUnsubscribeV3</b>(<i>client, userdata, mid, </i>)
652
653 <p> 655 <p>
654 Private method to handle an unsubscribe event (MQTT v3.1 and v3.1.1). 656 Private method to handle an unsubscribe event (MQTT v3.1 and v3.1.1).
655 </p> 657 </p>
658
656 <dl> 659 <dl>
657 660
658 <dt><i>client</i> (paho.mqtt.Client)</dt> 661 <dt><i>client</i> (paho.mqtt.Client)</dt>
659 <dd> 662 <dd>
660 reference to the client object 663 reference to the client object
669 </dd> 672 </dd>
670 </dl> 673 </dl>
671 <a NAME="MqttClient.__onUnsubscribeV5" ID="MqttClient.__onUnsubscribeV5"></a> 674 <a NAME="MqttClient.__onUnsubscribeV5" ID="MqttClient.__onUnsubscribeV5"></a>
672 <h4>MqttClient.__onUnsubscribeV5</h4> 675 <h4>MqttClient.__onUnsubscribeV5</h4>
673 <b>__onUnsubscribeV5</b>(<i>client, userdata, mid, properties, reasonCodes, </i>) 676 <b>__onUnsubscribeV5</b>(<i>client, userdata, mid, properties, reasonCodes, </i>)
674
675 <p> 677 <p>
676 Private method to handle an unsubscribe event (MQTT v5.0). 678 Private method to handle an unsubscribe event (MQTT v5.0).
677 </p> 679 </p>
680
678 <dl> 681 <dl>
679 682
680 <dt><i>client</i> (paho.mqtt.Client)</dt> 683 <dt><i>client</i> (paho.mqtt.Client)</dt>
681 <dd> 684 <dd>
682 reference to the client object 685 reference to the client object
699 </dd> 702 </dd>
700 </dl> 703 </dl>
701 <a NAME="MqttClient.clearLastWill" ID="MqttClient.clearLastWill"></a> 704 <a NAME="MqttClient.clearLastWill" ID="MqttClient.clearLastWill"></a>
702 <h4>MqttClient.clearLastWill</h4> 705 <h4>MqttClient.clearLastWill</h4>
703 <b>clearLastWill</b>(<i></i>) 706 <b>clearLastWill</b>(<i></i>)
704
705 <p> 707 <p>
706 Public method to remove a will that was previously configured with 708 Public method to remove a will that was previously configured with
707 setLastWill(). 709 setLastWill().
708 </p> 710 </p>
711
709 <a NAME="MqttClient.connectToServer" ID="MqttClient.connectToServer"></a> 712 <a NAME="MqttClient.connectToServer" ID="MqttClient.connectToServer"></a>
710 <h4>MqttClient.connectToServer</h4> 713 <h4>MqttClient.connectToServer</h4>
711 <b>connectToServer</b>(<i>host, port=1883, keepalive=60, bindAddress="", properties=None, clearWill=False, </i>) 714 <b>connectToServer</b>(<i>host, port=1883, keepalive=60, bindAddress="", properties=None, clearWill=False, </i>)
712
713 <p> 715 <p>
714 Public method to connect to a remote MQTT broker. 716 Public method to connect to a remote MQTT broker.
715 </p> 717 </p>
718
716 <dl> 719 <dl>
717 720
718 <dt><i>host</i> (str)</dt> 721 <dt><i>host</i> (str)</dt>
719 <dd> 722 <dd>
720 host name or IP address of the remote broker 723 host name or IP address of the remote broker
745 </dd> 748 </dd>
746 </dl> 749 </dl>
747 <a NAME="MqttClient.connectToServerWithOptions" ID="MqttClient.connectToServerWithOptions"></a> 750 <a NAME="MqttClient.connectToServerWithOptions" ID="MqttClient.connectToServerWithOptions"></a>
748 <h4>MqttClient.connectToServerWithOptions</h4> 751 <h4>MqttClient.connectToServerWithOptions</h4>
749 <b>connectToServerWithOptions</b>(<i>host, port=1883, bindAddress="", options=None, clearWill=False</i>) 752 <b>connectToServerWithOptions</b>(<i>host, port=1883, bindAddress="", options=None, clearWill=False</i>)
750
751 <p> 753 <p>
752 Public method to connect to a remote MQTT broker. 754 Public method to connect to a remote MQTT broker.
753 </p> 755 </p>
756
754 <dl> 757 <dl>
755 758
756 <dt><i>host</i> (str)</dt> 759 <dt><i>host</i> (str)</dt>
757 <dd> 760 <dd>
758 host name or IP address of the remote broker 761 host name or IP address of the remote broker
782 </dd> 785 </dd>
783 </dl> 786 </dl>
784 <a NAME="MqttClient.disconnectFromServer" ID="MqttClient.disconnectFromServer"></a> 787 <a NAME="MqttClient.disconnectFromServer" ID="MqttClient.disconnectFromServer"></a>
785 <h4>MqttClient.disconnectFromServer</h4> 788 <h4>MqttClient.disconnectFromServer</h4>
786 <b>disconnectFromServer</b>(<i></i>) 789 <b>disconnectFromServer</b>(<i></i>)
787
788 <p> 790 <p>
789 Public method to disconnect the client from the remote broker. 791 Public method to disconnect the client from the remote broker.
790 </p> 792 </p>
793
791 <a NAME="MqttClient.getProtocol" ID="MqttClient.getProtocol"></a> 794 <a NAME="MqttClient.getProtocol" ID="MqttClient.getProtocol"></a>
792 <h4>MqttClient.getProtocol</h4> 795 <h4>MqttClient.getProtocol</h4>
793 <b>getProtocol</b>(<i></i>) 796 <b>getProtocol</b>(<i></i>)
794
795 <p> 797 <p>
796 Public method to get the MQTT protocol version. 798 Public method to get the MQTT protocol version.
797 </p> 799 </p>
800
798 <dl> 801 <dl>
799 <dt>Return:</dt> 802 <dt>Return:</dt>
800 <dd> 803 <dd>
801 MQTT protocol version in use 804 MQTT protocol version in use
802 </dd> 805 </dd>
808 </dd> 811 </dd>
809 </dl> 812 </dl>
810 <a NAME="MqttClient.publish" ID="MqttClient.publish"></a> 813 <a NAME="MqttClient.publish" ID="MqttClient.publish"></a>
811 <h4>MqttClient.publish</h4> 814 <h4>MqttClient.publish</h4>
812 <b>publish</b>(<i>topic, payload=None, qos=0, retain=False, properties=None</i>) 815 <b>publish</b>(<i>topic, payload=None, qos=0, retain=False, properties=None</i>)
813
814 <p> 816 <p>
815 Public method to publish to a topic. 817 Public method to publish to a topic.
816 </p> 818 </p>
819
817 <dl> 820 <dl>
818 821
819 <dt><i>topic</i> (str)</dt> 822 <dt><i>topic</i> (str)</dt>
820 <dd> 823 <dd>
821 topic to publish to 824 topic to publish to
852 </dd> 855 </dd>
853 </dl> 856 </dl>
854 <a NAME="MqttClient.reconnectToServer" ID="MqttClient.reconnectToServer"></a> 857 <a NAME="MqttClient.reconnectToServer" ID="MqttClient.reconnectToServer"></a>
855 <h4>MqttClient.reconnectToServer</h4> 858 <h4>MqttClient.reconnectToServer</h4>
856 <b>reconnectToServer</b>(<i></i>) 859 <b>reconnectToServer</b>(<i></i>)
857
858 <p> 860 <p>
859 Public method to reconnect the client with the same parameters. 861 Public method to reconnect the client with the same parameters.
860 </p> 862 </p>
863
861 <a NAME="MqttClient.setConnectionTimeout" ID="MqttClient.setConnectionTimeout"></a> 864 <a NAME="MqttClient.setConnectionTimeout" ID="MqttClient.setConnectionTimeout"></a>
862 <h4>MqttClient.setConnectionTimeout</h4> 865 <h4>MqttClient.setConnectionTimeout</h4>
863 <b>setConnectionTimeout</b>(<i>timeout</i>) 866 <b>setConnectionTimeout</b>(<i>timeout</i>)
864
865 <p> 867 <p>
866 Public method to set the connection timeout value. 868 Public method to set the connection timeout value.
867 </p> 869 </p>
870
868 <dl> 871 <dl>
869 872
870 <dt><i>timeout</i> (int)</dt> 873 <dt><i>timeout</i> (int)</dt>
871 <dd> 874 <dd>
872 timeout value to be set in seconds 875 timeout value to be set in seconds
873 </dd> 876 </dd>
874 </dl> 877 </dl>
875 <a NAME="MqttClient.setLastWill" ID="MqttClient.setLastWill"></a> 878 <a NAME="MqttClient.setLastWill" ID="MqttClient.setLastWill"></a>
876 <h4>MqttClient.setLastWill</h4> 879 <h4>MqttClient.setLastWill</h4>
877 <b>setLastWill</b>(<i>topic, payload=None, qos=0, retain=False, properties=None</i>) 880 <b>setLastWill</b>(<i>topic, payload=None, qos=0, retain=False, properties=None</i>)
878
879 <p> 881 <p>
880 Public method to set the last will of the client. 882 Public method to set the last will of the client.
881 </p> 883 </p>
884
882 <dl> 885 <dl>
883 886
884 <dt><i>topic</i> (str)</dt> 887 <dt><i>topic</i> (str)</dt>
885 <dd> 888 <dd>
886 topic the will message should be published on 889 topic the will message should be published on
905 </dd> 908 </dd>
906 </dl> 909 </dl>
907 <a NAME="MqttClient.setMaxInflightMessages" ID="MqttClient.setMaxInflightMessages"></a> 910 <a NAME="MqttClient.setMaxInflightMessages" ID="MqttClient.setMaxInflightMessages"></a>
908 <h4>MqttClient.setMaxInflightMessages</h4> 911 <h4>MqttClient.setMaxInflightMessages</h4>
909 <b>setMaxInflightMessages</b>(<i>inflight=20</i>) 912 <b>setMaxInflightMessages</b>(<i>inflight=20</i>)
910
911 <p> 913 <p>
912 Public method to set the maximum number of messages with QoS > 0 that 914 Public method to set the maximum number of messages with QoS > 0 that
913 can be part way through their network flow at once. 915 can be part way through their network flow at once.
914 </p> 916 </p>
917
915 <dl> 918 <dl>
916 919
917 <dt><i>inflight</i> (int)</dt> 920 <dt><i>inflight</i> (int)</dt>
918 <dd> 921 <dd>
919 maximum number of messages in flight 922 maximum number of messages in flight
920 </dd> 923 </dd>
921 </dl> 924 </dl>
922 <a NAME="MqttClient.setMaxQueuedMessages" ID="MqttClient.setMaxQueuedMessages"></a> 925 <a NAME="MqttClient.setMaxQueuedMessages" ID="MqttClient.setMaxQueuedMessages"></a>
923 <h4>MqttClient.setMaxQueuedMessages</h4> 926 <h4>MqttClient.setMaxQueuedMessages</h4>
924 <b>setMaxQueuedMessages</b>(<i>queueSize=0</i>) 927 <b>setMaxQueuedMessages</b>(<i>queueSize=0</i>)
925
926 <p> 928 <p>
927 Public method to set the maximum number of messages with QoS > 0 that 929 Public method to set the maximum number of messages with QoS > 0 that
928 can be pending in the outgoing message queue. 930 can be pending in the outgoing message queue.
929 </p> 931 </p>
932
930 <dl> 933 <dl>
931 934
932 <dt><i>queueSize</i> (int)</dt> 935 <dt><i>queueSize</i> (int)</dt>
933 <dd> 936 <dd>
934 maximum number of queued messages (0 = unlimited) 937 maximum number of queued messages (0 = unlimited)
935 </dd> 938 </dd>
936 </dl> 939 </dl>
937 <a NAME="MqttClient.setTLS" ID="MqttClient.setTLS"></a> 940 <a NAME="MqttClient.setTLS" ID="MqttClient.setTLS"></a>
938 <h4>MqttClient.setTLS</h4> 941 <h4>MqttClient.setTLS</h4>
939 <b>setTLS</b>(<i>caCerts=None, certFile=None, keyFile=None</i>) 942 <b>setTLS</b>(<i>caCerts=None, certFile=None, keyFile=None</i>)
940
941 <p> 943 <p>
942 Public method to enable secure connections and set the TLS parameters. 944 Public method to enable secure connections and set the TLS parameters.
943 </p> 945 </p>
946
944 <dl> 947 <dl>
945 948
946 <dt><i>caCerts</i> (str)</dt> 949 <dt><i>caCerts</i> (str)</dt>
947 <dd> 950 <dd>
948 path to the Certificate Authority certificates file 951 path to the Certificate Authority certificates file
970 </dd> 973 </dd>
971 </dl> 974 </dl>
972 <a NAME="MqttClient.setUserCredentials" ID="MqttClient.setUserCredentials"></a> 975 <a NAME="MqttClient.setUserCredentials" ID="MqttClient.setUserCredentials"></a>
973 <h4>MqttClient.setUserCredentials</h4> 976 <h4>MqttClient.setUserCredentials</h4>
974 <b>setUserCredentials</b>(<i>username, password=None</i>) 977 <b>setUserCredentials</b>(<i>username, password=None</i>)
975
976 <p> 978 <p>
977 Public method to set the user name and optionally the password. 979 Public method to set the user name and optionally the password.
978 </p> 980 </p>
981
979 <dl> 982 <dl>
980 983
981 <dt><i>username</i> (str)</dt> 984 <dt><i>username</i> (str)</dt>
982 <dd> 985 <dd>
983 user name to be set 986 user name to be set
988 </dd> 991 </dd>
989 </dl> 992 </dl>
990 <a NAME="MqttClient.setUserData" ID="MqttClient.setUserData"></a> 993 <a NAME="MqttClient.setUserData" ID="MqttClient.setUserData"></a>
991 <h4>MqttClient.setUserData</h4> 994 <h4>MqttClient.setUserData</h4>
992 <b>setUserData</b>(<i>userdata</i>) 995 <b>setUserData</b>(<i>userdata</i>)
993
994 <p> 996 <p>
995 Public method to set the user data. 997 Public method to set the user data.
996 </p> 998 </p>
999
997 <dl> 1000 <dl>
998 1001
999 <dt><i>userdata</i> (any)</dt> 1002 <dt><i>userdata</i> (any)</dt>
1000 <dd> 1003 <dd>
1001 user data 1004 user data
1002 </dd> 1005 </dd>
1003 </dl> 1006 </dl>
1004 <a NAME="MqttClient.startLoop" ID="MqttClient.startLoop"></a> 1007 <a NAME="MqttClient.startLoop" ID="MqttClient.startLoop"></a>
1005 <h4>MqttClient.startLoop</h4> 1008 <h4>MqttClient.startLoop</h4>
1006 <b>startLoop</b>(<i></i>) 1009 <b>startLoop</b>(<i></i>)
1007
1008 <p> 1010 <p>
1009 Public method to start the MQTT client loop. 1011 Public method to start the MQTT client loop.
1010 </p> 1012 </p>
1013
1011 <a NAME="MqttClient.stopLoop" ID="MqttClient.stopLoop"></a> 1014 <a NAME="MqttClient.stopLoop" ID="MqttClient.stopLoop"></a>
1012 <h4>MqttClient.stopLoop</h4> 1015 <h4>MqttClient.stopLoop</h4>
1013 <b>stopLoop</b>(<i></i>) 1016 <b>stopLoop</b>(<i></i>)
1014
1015 <p> 1017 <p>
1016 Public method to stop the MQTT client loop. 1018 Public method to stop the MQTT client loop.
1017 </p> 1019 </p>
1020
1018 <a NAME="MqttClient.subscribe" ID="MqttClient.subscribe"></a> 1021 <a NAME="MqttClient.subscribe" ID="MqttClient.subscribe"></a>
1019 <h4>MqttClient.subscribe</h4> 1022 <h4>MqttClient.subscribe</h4>
1020 <b>subscribe</b>(<i>topic, qos=0, properties=None</i>) 1023 <b>subscribe</b>(<i>topic, qos=0, properties=None</i>)
1021
1022 <p> 1024 <p>
1023 Public method to subscribe to topics with quality of service. 1025 Public method to subscribe to topics with quality of service.
1024 </p> 1026 </p>
1027
1025 <dl> 1028 <dl>
1026 1029
1027 <dt><i>topic</i> (str or tuple of (str, int) or list of tuple of (str, int))</dt> 1030 <dt><i>topic</i> (str or tuple of (str, int) or list of tuple of (str, int))</dt>
1028 <dd> 1031 <dd>
1029 single topic to subscribe to or a tuple with a topic 1032 single topic to subscribe to or a tuple with a topic
1052 </dd> 1055 </dd>
1053 </dl> 1056 </dl>
1054 <a NAME="MqttClient.unsubscribe" ID="MqttClient.unsubscribe"></a> 1057 <a NAME="MqttClient.unsubscribe" ID="MqttClient.unsubscribe"></a>
1055 <h4>MqttClient.unsubscribe</h4> 1058 <h4>MqttClient.unsubscribe</h4>
1056 <b>unsubscribe</b>(<i>topic, properties=None</i>) 1059 <b>unsubscribe</b>(<i>topic, properties=None</i>)
1057
1058 <p> 1060 <p>
1059 Public method to unsubscribe topics. 1061 Public method to unsubscribe topics.
1060 </p> 1062 </p>
1063
1061 <dl> 1064 <dl>
1062 1065
1063 <dt><i>topic</i> (str or list of str)</dt> 1066 <dt><i>topic</i> (str or list of str)</dt>
1064 <dd> 1067 <dd>
1065 topic or list of topics to unsubscribe 1068 topic or list of topics to unsubscribe
1086 <hr /> 1089 <hr />
1087 <hr /> 1090 <hr />
1088 <a NAME="mqttConnackMessage" ID="mqttConnackMessage"></a> 1091 <a NAME="mqttConnackMessage" ID="mqttConnackMessage"></a>
1089 <h2>mqttConnackMessage</h2> 1092 <h2>mqttConnackMessage</h2>
1090 <b>mqttConnackMessage</b>(<i>connackCode</i>) 1093 <b>mqttConnackMessage</b>(<i>connackCode</i>)
1091
1092 <p> 1094 <p>
1093 Module function to get the string associated with a CONNACK result. 1095 Module function to get the string associated with a CONNACK result.
1094 </p> 1096 </p>
1097
1095 <dl> 1098 <dl>
1096 1099
1097 <dt><i>connackCode</i> (int)</dt> 1100 <dt><i>connackCode</i> (int)</dt>
1098 <dd> 1101 <dd>
1099 result code of the connection request 1102 result code of the connection request
1115 <hr /> 1118 <hr />
1116 <hr /> 1119 <hr />
1117 <a NAME="mqttErrorMessage" ID="mqttErrorMessage"></a> 1120 <a NAME="mqttErrorMessage" ID="mqttErrorMessage"></a>
1118 <h2>mqttErrorMessage</h2> 1121 <h2>mqttErrorMessage</h2>
1119 <b>mqttErrorMessage</b>(<i>mqttErrno</i>) 1122 <b>mqttErrorMessage</b>(<i>mqttErrno</i>)
1120
1121 <p> 1123 <p>
1122 Module function to get the error string associated with an MQTT error 1124 Module function to get the error string associated with an MQTT error
1123 number. 1125 number.
1124 </p> 1126 </p>
1127
1125 <dl> 1128 <dl>
1126 1129
1127 <dt><i>mqttErrno</i> (int)</dt> 1130 <dt><i>mqttErrno</i> (int)</dt>
1128 <dd> 1131 <dd>
1129 result code of a MQTT request 1132 result code of a MQTT request
1145 <hr /> 1148 <hr />
1146 <hr /> 1149 <hr />
1147 <a NAME="mqttLogLevelString" ID="mqttLogLevelString"></a> 1150 <a NAME="mqttLogLevelString" ID="mqttLogLevelString"></a>
1148 <h2>mqttLogLevelString</h2> 1151 <h2>mqttLogLevelString</h2>
1149 <b>mqttLogLevelString</b>(<i>mqttLogLevel, isMqttLogLevel=True</i>) 1152 <b>mqttLogLevelString</b>(<i>mqttLogLevel, isMqttLogLevel=True</i>)
1150
1151 <p> 1153 <p>
1152 Module function to get the log level string associated with a log level. 1154 Module function to get the log level string associated with a log level.
1153 </p> 1155 </p>
1156
1154 <dl> 1157 <dl>
1155 1158
1156 <dt><i>mqttLogLevel</i> (int)</dt> 1159 <dt><i>mqttLogLevel</i> (int)</dt>
1157 <dd> 1160 <dd>
1158 log level of the paho-mqtt client 1161 log level of the paho-mqtt client

eric ide

mercurial