Skip to content

Commit 9aaf956

Browse files
committed
MCU8MASS-1828 Retrieve response from issuing MQTT disconnect such the next AT command isn't instantly sent without an ACK from the modem
1 parent f55b276 commit 9aaf956

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/mqtt_client.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,13 @@ bool MqttClientClass::begin(const char* client_id,
404404
SequansController.writeBytes((uint8_t*)MQTT_DISCONNECT,
405405
strlen(MQTT_DISCONNECT),
406406
true);
407+
408+
// Force to read the result so that we don't go on with the next command
409+
// instantly. We just want to close the current connection if there are any.
410+
// If there aren't, this will return an error from the modem, but that is
411+
// fine as it just means that there aren't any connections active.
412+
SequansController.readResponse(NULL, 0);
413+
407414
SequansController.clearReceiveBuffer();
408415

409416
// -- Configuration --

0 commit comments

Comments
 (0)