diff --git a/loop/SARA_send_data_v2.py b/loop/SARA_send_data_v2.py index abb7175..7990d61 100755 --- a/loop/SARA_send_data_v2.py +++ b/loop/SARA_send_data_v2.py @@ -450,7 +450,7 @@ def modem_complete_reboot_and_reinitialize(modem_version, aircarto_profile_id): certificate = cert_file.read() size_of_string = len(certificate) - print("\033[0;33m Import certificate\033[0m") + print("➡️ Import certificate") # AT+USECMNG=0,,, # type-> 0 -> trusted root CA command = f'AT+USECMNG=0,0,"{certificate_name}",{size_of_string}\r' @@ -460,7 +460,7 @@ def modem_complete_reboot_and_reinitialize(modem_version, aircarto_profile_id): time.sleep(0.5) - print("\033[0;33mAdd certificate\033[0m") + print("➡️Add certificate") ser_sara.write(certificate) response_SARA_2 = read_complete_response(ser_sara) print(response_SARA_2) @@ -469,7 +469,7 @@ def modem_complete_reboot_and_reinitialize(modem_version, aircarto_profile_id): # SECURITY PROFILE # op_code: 3 -> trusted root certificate internal name - print("\033[0;33mSet the security profile (choose cert)\033[0m") + print("➡️Set the security profile (choose cert)") command = f'AT+USECPRF={security_profile_id},3,"{certificate_name}"\r' ser_sara.write((command + '\r').encode('utf-8')) response_SARA_5c = read_complete_response(ser_sara, wait_for_lines=["OK"]) @@ -484,7 +484,7 @@ def modem_complete_reboot_and_reinitialize(modem_version, aircarto_profile_id): time.sleep(1) #step 4: set PORT (op_code = 5) - print("set port 443") + print("➡️set port 443") command = f'AT+UHTTP={uSpot_profile_id},5,443\r' ser_sara.write((command + '\r').encode('utf-8')) response_SARA_55 = read_complete_response(ser_sara, wait_for_lines=["OK"]) @@ -492,7 +492,7 @@ def modem_complete_reboot_and_reinitialize(modem_version, aircarto_profile_id): time.sleep(1) #step 4: set url to SSL (op_code = 6) (http_secure = 1 for HTTPS)(USECMNG_PROFILE = 2) - print("\033[0;33mSET SSL\033[0m") + print("➡️SET SSL") http_secure = 1 command = f'AT+UHTTP={uSpot_profile_id},6,{http_secure},{security_profile_id}\r' #command = f'AT+UHTTP={profile_id},6,{http_secure}\r' @@ -974,6 +974,7 @@ try: #Parse the server datetime # Extract just the date from the response date_string = None + server_datetime = "" date_start = response_SARA_4.find("Date: ") if date_start != -1: date_end = response_SARA_4.find("\n", date_start) @@ -1196,7 +1197,7 @@ try: led_thread.start() # Get error code - print("Getting error code") + print("Getting error code", end="") command = f'AT+UHTTPER={uSpot_profile_id}\r' ser_sara.write(command.encode('utf-8')) response_SARA_9b = read_complete_response(ser_sara, wait_for_lines=["OK"], debug=False) @@ -1210,15 +1211,17 @@ try: if error_code == 0: print('

No error detected

') elif error_code == 4: - print('

Error 4: Invalid server Hostname

') + print('

Error 4: Invalid server Hostname

', end="") send_error_notification(device_id, "uSpot - Invalid server Hostname") elif error_code == 11: - print('

Error 11: Server connection error

') + print('

Error 11: Server connection error

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

Error 22: PSD or CSD connection not established

') + print('

Error 22: PSD or CSD connection not established

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

Error 73: Secure socket connect error

') + print('

Error 73: Secure socket connect error

', end="") send_error_notification(device_id, "uSpot - Secure socket connect error") + #Software Reboot ?? + else: print(f'

Unknown error code: {error_code}

') else: