Skip to content

Commit

Permalink
better handle mqtt disconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
ftylitak committed Jun 15, 2022
1 parent a5c1207 commit 4003bab
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions insighioNode/lib/networking/modem/modem_bg600.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def is_connected(self):
return status and len(lines) > 0 and "1,1" in lines[0]

def disconnect(self):
self.mqtt_disconnect()
self.send_at_cmd("AT+QIDEACT=1")

return super().disconnect()
Expand Down Expand Up @@ -281,8 +280,10 @@ def extract_topic_message_without_regex(self, line):
return res

def mqtt_disconnect(self):
(status, _) = self.send_at_cmd("AT+QMTDISC=0")
return status
(statusMqttDisconnect, _) = self.send_at_cmd("AT+QMTDISC=0", 20000, r"\+QMTDISC:\s+0.*")
(statusNetworkClose, _) = self.send_at_cmd("AT+QMTCLOSE=0", 20000, r"\+QMTCLOSE:\s+0.*")

return statusMqttDisconnect and statusNetworkClose

def get_next_bytes_from_file(self, file_handle, num_of_bytes, timeout_ms=2000):
# clear incoming message buffer
Expand Down

0 comments on commit 4003bab

Please sign in to comment.