From 29458c4841357b1ed17a5b93d976db561a679c7c Mon Sep 17 00:00:00 2001 From: root Date: Wed, 2 Jul 2025 13:52:03 +0200 Subject: [PATCH] update --- loop/SARA_send_data_v2.py | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/loop/SARA_send_data_v2.py b/loop/SARA_send_data_v2.py index 5b47e4d..879e900 100755 --- a/loop/SARA_send_data_v2.py +++ b/loop/SARA_send_data_v2.py @@ -982,7 +982,7 @@ try: print("Getting error code") command = f'AT+UHTTPER={aircarto_profile_id}\r' ser_sara.write(command.encode('utf-8')) - response_SARA_9 = read_complete_response(ser_sara, wait_for_lines=["OK"], debug=False) + response_SARA_9 = read_complete_response(ser_sara, wait_for_lines=["OK","ERROR"], debug=False) print('

') print(response_SARA_9) print("

", end="") @@ -993,13 +993,13 @@ try: if error_code is not None: # Display interpretation based on error code if error_code == 0: - print('

No error detected

') + print('

No error detected

', end="") elif error_code == 4: - print('

Error 4: Invalid server Hostname

') - send_error_notification(device_id, "UHTTPER (error n°4) -> Invalid Server Hostname") + print('

Error 4: Invalid server Hostname

', end="") + send_error_notification(device_id, "UHTTPER (error n°4) -> Invalid Server Hostname", end="") server_hostname_resets = reset_server_hostname(aircarto_profile_id) if server_hostname_resets: - print("✅server hostname reset successfully") + print("✅server hostname reset successfully", end="") else: print("⛔There were issues with the modem server hostname reinitialize process") elif error_code == 11: @@ -1009,34 +1009,31 @@ try: send_error_notification(device_id, "UHTTPER (error n°22) -> PSD or CSD connection not established") psd_csd_resets = reset_PSD_CSD_connection() if psd_csd_resets: - print("✅PSD CSD connection reset successfully") + print("✅PSD CSD connection reset successfully", end="") else: - print("⛔There were issues with the modem CSD PSD reinitialize process") + print("⛔There were issues with the modem CSD PSD reinitialize process", end="") elif error_code == 26: - print('

Error 26: Connection timed out

') - send_error_notification(device_id, "UHTTPER (error n°26) -> Connection timed out") + print('

Error 26: Connection timed out

', end="") + send_error_notification(device_id, "UHTTPER (error n°26) -> Connection timed out", end="") elif error_code == 44: print('

Error 44: Connection lost

') - send_error_notification(device_id, "UHTTPER (error n°44) -> Connection lost") + send_error_notification(device_id, "UHTTPER (error n°44) -> Connection lost", end="") elif error_code == 73: - print('

Error 73: Secure socket connect error

') + print('

Error 73: Secure socket connect error

', end="") else: - print(f'

Unknown error code: {error_code}

') + print(f'

Unknown error code: {error_code}

', end="") else: - print('

Could not extract error code from response

') - + print('

Could not extract error code from response

',end="") + + if "ERROR" in response_SARA_9: + print('

⚠️Sara Module returned an error

',end="") + print('

⚠️set up hardware reboot here???

',end="") - #Software Reboot - #software_reboot_success = modem_complete_reboot_and_reinitialize(modem_version, aircarto_profile_id) - #if software_reboot_success: - # print("Modem successfully rebooted and reinitialized") - #else: - # print("There were issues with the modem reboot/reinitialize process") # 2.2 code 1 (✅✅HHTP / UUHTTPCR succeded✅✅) else: # Si la commande HTTP a réussi - print('✅✅HTTP operation successful.') + print('✅✅HTTP operation successful.',end="") #update SARA_network_status update_config_sqlite('SARA_network_status', 'connected')