diff --git a/SARA/reboot/start.py b/SARA/reboot/start.py index 001d93f..5d5ca8b 100644 --- a/SARA/reboot/start.py +++ b/SARA/reboot/start.py @@ -301,7 +301,7 @@ try: print(response_SARA_5cf) time.sleep(0.5) - #step 4: set url (op_code = 1) + #step 4: set url (op_code = 1) print("➡️SET URL") command = f'AT+UHTTP={uSpot_profile_id},1,"{uSpot_url}"\r' ser_sara.write((command + '\r').encode('utf-8')) diff --git a/html/admin.html b/html/admin.html index 1d109d8..9908c0a 100755 --- a/html/admin.html +++ b/html/admin.html @@ -118,6 +118,13 @@ +
SEND TO AIRCARTO SERVERS
') @@ -881,9 +887,9 @@ try: #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") + print("✅Modem successfully rebooted and reinitialized") else: - print("There were issues with the modem reboot/reinitialize process") + print("⛔There were issues with the modem reboot/reinitialize process") # 2.2 code 1 (✅✅HHTP / UUHTTPCR succeded✅✅) @@ -1044,7 +1050,12 @@ try: ''' - SEND TO uSPOT + _ ____ _ + ___ ___ _ __ __| | _ _/ ___| _ __ ___ | |_ + / __|/ _ \ '_ \ / _` | | | | \___ \| '_ \ / _ \| __| + \__ \ __/ | | | (_| | | |_| |___) | |_) | (_) | |_ + |___/\___|_| |_|\__,_| \__,_|____/| .__/ \___/ \__| + |_| ''' if send_uSpot: @@ -1202,6 +1213,7 @@ try: print('No error detected
') elif error_code == 4: print('Error 4: Invalid server Hostname
') + elif error_code == 11: print('Error 11: Server connection error
') elif error_code == 22: @@ -1215,13 +1227,14 @@ try: #Pas forcément un moyen de résoudre le soucis - # 2.2 code 1 (HHTP succeded) + # 2.2 code 1 (✅✅HHTP / UUHTTPCR succeded✅✅) else: # Si la commande HTTP a réussi print('✅✅HTTP operation successful.') print("Blink blue LED") led_thread = Thread(target=blink_led, args=(23, 5, 0.5)) led_thread.start() + #4. Read reply from server print("Reply from server:") ser_sara.write(b'AT+URDFILE="uSpot_server_response.txt"\r') @@ -1230,6 +1243,32 @@ try: print(response_SARA_4b) print("", end="") + # Initialize http_response_code to 0 as a default value + http_response_code = 0 + + # Safely extract HTTP code + try: + http_prefix = "HTTP/" + # response_SARA_4b is a string, not a function - use .find() method + http_pos = response_SARA_4b.find(http_prefix) + + if http_pos != -1: + # Find the space after the HTTP version + space_pos = response_SARA_4b.find(" ", http_pos) + if space_pos != -1: + # Extract the code after the space + code_start = space_pos + 1 + code_end = response_SARA_4b.find(" ", code_start) + if code_end != -1: + # Extract and convert to integer + http_code_str = response_SARA_4b[code_start:code_end] + http_response_code = int(http_code_str) + print(f"HTTP response code: {http_response_code}") + except Exception as e: + # If any error occurs during parsing, keep the default value + print(f"Error parsing HTTP code: {e}") + + #5. empty json