Compare commits

2 Commits

Author SHA1 Message Date
marcel
f0fe632cae Fixed crash after receiving empty APRS payload 2024-01-08 10:26:17 +01:00
marcel
62484e3c52 Fixed: can now receive messages after reconnect to MQTT broker 2024-01-04 12:02:24 +01:00
2 changed files with 36 additions and 6 deletions

View File

@@ -10,10 +10,28 @@ All notable changes to this project will be documented in this file.
Security : in case of vulnerabilities.
## [1.0.0] - 2023-01-13
First working version.
- First working version.
## [1.0.1] - 2023-01-14
Changed: aprs_status (published on the MQTT broker) now returns actual state of transmision (sending, retrying, send or failed) instead if just 'ready' and 'busy'.
### Changed
- aprs_status (published on the MQTT broker) now returns actual state of transmision (sending, retrying, send or failed) instead if just 'ready' and 'busy'.
## [1.1.0] - 2023-07-08
Added: APRS nodes can now be polled to get there actual status. An extra section in the YAML configuration file is added for this functionality.
### Added
- APRS nodes can now be polled to get there actual status. An extra section in the YAML configuration file is added for this functionality.
## [1.1.1] - 2024-01-04
### Fixed
- after reconnect to MQTT broker messages from broker were not received.
## [1.1.2] - 2024-01--8
### Fixed
- In parsePacket(string): Occasionally a bad APRS packet is received causing the program to crash with an "IndexError: list index out of range". Fix: check if index IS out of range before copying it to payload

View File

@@ -76,7 +76,11 @@ def parsePacket(string):
source = listAddress[1]
destination = listAddress[0]
digipeaters = listAddress[2:]
# Occasionally a bad packet is received causng the program to crash with an "IndexError: list index out of range". Fix: check if index IS out of range before copying it to payload
if len(buffer) > 1:
payload = buffer[1]
else:
payload = 'NOT VALID'
else:
# If there was an error decoding the address we return save values which will be ignored by the rest of the program
source = 'NOCALL'
@@ -164,7 +168,14 @@ def connect_mqtt():
else:
print("Failed to connect, return code %d\n", rc)
# Set Connecting Client ID
client = mqtt_client.Client(mqtt.client_id)
# After reconnect messages from the MQTT broker where not received.
# clean_session: a boolean that determines the client type.
# If True, the broker will remove all information about this client
# when it disconnects. If False, the client is a durable client and
# subscription information and queued messages will be retained when
# the client disconnects.
# client = mqtt_client.Client(mqtt.client_id)
client = mqtt_client.Client(mqtt.client_id, clean_session=False)
#client.username_pw_set(username, password)
client.on_connect = on_connect
client.connect(mqtt.broker, mqtt.port)
@@ -490,6 +501,7 @@ def run():
if __name__ == '__main__':
#sys.stdout = sys.stderr = open('debug.log', 'w')
sys.stdout = sys.stderr = open('/home/marcel/aprs-mqtt-bridge_debug.log', 'w')
run()