diff --git a/loop/SARA_send_data_v2.py b/loop/SARA_send_data_v2.py index 04b6cd2..e204d6d 100755 --- a/loop/SARA_send_data_v2.py +++ b/loop/SARA_send_data_v2.py @@ -455,6 +455,31 @@ def reset_PSD_CSD_connection(): return pdp_reset_success +def reset_PSD_CSD_connection(profile_id): + """ + Function that reset server hostname (URL) connection for the SARA R5 + returns true or false + """ + print("⚠️Reseting Server Hostname connection ") + http_reset_success = False # Default fallback + + if profile_id == 0: + print('🔧 Resetting AirCarto HTTP Profile') + command = f'AT+UHTTP={profile_id},1,"data.nebuleair.fr"\r' + ser_sara.write((command + '\r').encode('utf-8')) + response_SARA_5 = read_complete_response(ser_sara, wait_for_lines=["OK"]) + print(response_SARA_5) + time.sleep(1) + http_reset_success = response_SARA_5 is not None and "OK" in response_SARA_5 + if not http_reset_success: + print("⚠️ AirCarto HTTP profile reset failed") + elif profile_id ==1: + #do other things + else: + print(f"❌ Unsupported profile ID: {profile_id}") + http_reset_success = False + return http_reset_success + def modem_complete_reboot_and_reinitialize(modem_version, aircarto_profile_id): """ Performs a complete modem restart sequence: @@ -1056,6 +1081,13 @@ try: print('
No error detected
') elif error_code == 4: print('Error 4: Invalid server Hostname
') + send_error_notification(device_id, "UHTTPER (error n°4) -> Invalid Server Hostname") + server_hostname_resets = reset_server_hostname(aircarto_profile_id) + if server_hostname_resets: + print("✅server hostname reset successfully") + else: + print("⛔There were issues with the modem server hostname reinitialize process") + elif error_code == 11: print('Error 11: Server connection error
') elif error_code == 22: