@@ -378,8 +378,81 @@ def configureMQTTOperationTimeout(self, timeoutSecond):
378
378
"""
379
379
self ._mqtt_core .configure_operation_timeout_sec (timeoutSecond )
380
380
381
+ def configureUsernamePassword (self , username , password = None ):
382
+ """
383
+ **Description**
384
+
385
+ Used to configure the username and password used in CONNECT packet.
386
+
387
+ **Syntax**
388
+
389
+ .. code:: python
390
+
391
+ # Configure user name and password
392
+ myAWSIoTMQTTClient.configureUsernamePassword("myUsername", "myPassword")
393
+
394
+ **Parameters**
395
+
396
+ *username* - Username used in the username field of CONNECT packet.
397
+
398
+ *password* - Password used in the password field of CONNECT packet.
399
+
400
+ **Returns**
401
+
402
+ None
403
+
404
+ """
405
+ self ._mqtt_core .configure_username_password (username , password )
406
+
407
+ def enableMetricsCollection (self ):
408
+ """
409
+ **Description**
410
+
411
+ Used to enable SDK metrics collection. Username field in CONNECT packet will be used to append the SDK name
412
+ and SDK version in use and communicate to AWS IoT cloud. This metrics collection is enabled by default.
413
+
414
+ **Syntax**
415
+
416
+ .. code:: python
417
+
418
+ myAWSIoTMQTTClient.enableMetricsCollection()
419
+
420
+ **Parameters**
421
+
422
+ None
423
+
424
+ **Returns**
425
+
426
+ None
427
+
428
+ """
429
+ self ._mqtt_core .enable_metrics_collection ()
430
+
431
+ def disableMetricsCollection (self ):
432
+ """
433
+ **Description**
434
+
435
+ Used to disable SDK metrics collection.
436
+
437
+ **Syntax**
438
+
439
+ .. code:: python
440
+
441
+ myAWSIoTMQTTClient.disableMetricsCollection()
442
+
443
+ **Parameters**
444
+
445
+ None
446
+
447
+ **Returns**
448
+
449
+ None
450
+
451
+ """
452
+ self ._mqtt_core .disable_metrics_collection ()
453
+
381
454
# MQTT functionality APIs
382
- def connect (self , keepAliveIntervalSecond = 30 ):
455
+ def connect (self , keepAliveIntervalSecond = 600 ):
383
456
"""
384
457
**Description**
385
458
@@ -389,15 +462,15 @@ def connect(self, keepAliveIntervalSecond=30):
389
462
390
463
.. code:: python
391
464
392
- # Connect to AWS IoT with default keepalive set to 30 seconds
465
+ # Connect to AWS IoT with default keepalive set to 600 seconds
393
466
myAWSIoTMQTTClient.connect()
394
- # Connect to AWS IoT with keepalive interval set to 55 seconds
395
- myAWSIoTMQTTClient.connect(55 )
467
+ # Connect to AWS IoT with keepalive interval set to 1200 seconds
468
+ myAWSIoTMQTTClient.connect(1200 )
396
469
397
470
**Parameters**
398
471
399
472
*keepAliveIntervalSecond* - Time in seconds for interval of sending MQTT ping request.
400
- Default set to 30 seconds.
473
+ Default set to 600 seconds.
401
474
402
475
**Returns**
403
476
@@ -407,7 +480,7 @@ def connect(self, keepAliveIntervalSecond=30):
407
480
self ._load_callbacks ()
408
481
return self ._mqtt_core .connect (keepAliveIntervalSecond )
409
482
410
- def connectAsync (self , keepAliveIntervalSecond = 30 , ackCallback = None ):
483
+ def connectAsync (self , keepAliveIntervalSecond = 600 , ackCallback = None ):
411
484
"""
412
485
**Description**
413
486
@@ -417,15 +490,15 @@ def connectAsync(self, keepAliveIntervalSecond=30, ackCallback=None):
417
490
418
491
.. code:: python
419
492
420
- # Connect to AWS IoT with default keepalive set to 30 seconds and a custom CONNACK callback
493
+ # Connect to AWS IoT with default keepalive set to 600 seconds and a custom CONNACK callback
421
494
myAWSIoTMQTTClient.connectAsync(ackCallback=my_connack_callback)
422
- # Connect to AWS IoT with default keepalive set to 55 seconds and a custom CONNACK callback
423
- myAWSIoTMQTTClient.connectAsync(keepAliveInternvalSecond=55 , ackCallback=myConnackCallback)
495
+ # Connect to AWS IoT with default keepalive set to 1200 seconds and a custom CONNACK callback
496
+ myAWSIoTMQTTClient.connectAsync(keepAliveInternvalSecond=1200 , ackCallback=myConnackCallback)
424
497
425
498
**Parameters**
426
499
427
500
*keepAliveIntervalSecond* - Time in seconds for interval of sending MQTT ping request.
428
- Default set to 30 seconds.
501
+ Default set to 600 seconds.
429
502
430
503
*ackCallback* - Callback to be invoked when the client receives a CONNACK. Should be in form
431
504
:code:`customCallback(mid, data)`, where :code:`mid` is the packet id for the connect request
@@ -1036,8 +1109,81 @@ def configureMQTTOperationTimeout(self, timeoutSecond):
1036
1109
# AWSIoTMQTTClient.configureMQTTOperationTimeout
1037
1110
self ._AWSIoTMQTTClient .configureMQTTOperationTimeout (timeoutSecond )
1038
1111
1112
+ def configureUsernamePassword (self , username , password = None ):
1113
+ """
1114
+ **Description**
1115
+
1116
+ Used to configure the username and password used in CONNECT packet.
1117
+
1118
+ **Syntax**
1119
+
1120
+ .. code:: python
1121
+
1122
+ # Configure user name and password
1123
+ myAWSIoTMQTTShadowClient.configureUsernamePassword("myUsername", "myPassword")
1124
+
1125
+ **Parameters**
1126
+
1127
+ *username* - Username used in the username field of CONNECT packet.
1128
+
1129
+ *password* - Password used in the password field of CONNECT packet.
1130
+
1131
+ **Returns**
1132
+
1133
+ None
1134
+
1135
+ """
1136
+ self ._AWSIoTMQTTClient .configureUsernamePassword (username , password )
1137
+
1138
+ def enableMetricsCollection (self ):
1139
+ """
1140
+ **Description**
1141
+
1142
+ Used to enable SDK metrics collection. Username field in CONNECT packet will be used to append the SDK name
1143
+ and SDK version in use and communicate to AWS IoT cloud. This metrics collection is enabled by default.
1144
+
1145
+ **Syntax**
1146
+
1147
+ .. code:: python
1148
+
1149
+ myAWSIoTMQTTClient.enableMetricsCollection()
1150
+
1151
+ **Parameters**
1152
+
1153
+ None
1154
+
1155
+ **Returns**
1156
+
1157
+ None
1158
+
1159
+ """
1160
+ self ._AWSIoTMQTTClient .enableMetricsCollection ()
1161
+
1162
+ def disableMetricsCollection (self ):
1163
+ """
1164
+ **Description**
1165
+
1166
+ Used to disable SDK metrics collection.
1167
+
1168
+ **Syntax**
1169
+
1170
+ .. code:: python
1171
+
1172
+ myAWSIoTMQTTClient.disableMetricsCollection()
1173
+
1174
+ **Parameters**
1175
+
1176
+ None
1177
+
1178
+ **Returns**
1179
+
1180
+ None
1181
+
1182
+ """
1183
+ self ._AWSIoTMQTTClient .disableMetricsCollection ()
1184
+
1039
1185
# Start the MQTT connection
1040
- def connect (self , keepAliveIntervalSecond = 30 ):
1186
+ def connect (self , keepAliveIntervalSecond = 600 ):
1041
1187
"""
1042
1188
**Description**
1043
1189
@@ -1047,10 +1193,10 @@ def connect(self, keepAliveIntervalSecond=30):
1047
1193
1048
1194
.. code:: python
1049
1195
1050
- # Connect to AWS IoT with default keepalive set to 30 seconds
1196
+ # Connect to AWS IoT with default keepalive set to 600 seconds
1051
1197
myAWSIoTMQTTShadowClient.connect()
1052
- # Connect to AWS IoT with keepalive interval set to 55 seconds
1053
- myAWSIoTMQTTShadowClient.connect(55 )
1198
+ # Connect to AWS IoT with keepalive interval set to 1200 seconds
1199
+ myAWSIoTMQTTShadowClient.connect(1200 )
1054
1200
1055
1201
**Parameters**
1056
1202
0 commit comments