diff --git a/SARA/SSL/full_test_HTTP.py b/SARA/SSL/full_test_HTTP.py index 89aed1d..4e64d1d 100755 --- a/SARA/SSL/full_test_HTTP.py +++ b/SARA/SSL/full_test_HTTP.py @@ -25,23 +25,8 @@ url = parameter[1] # ex: data.mobileair.fr profile_id = 3 -#get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) -send_uSpot = config.get('send_uSpot', False) +baudrate = 115200 +send_uSpot = False def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2, wait_for_line=None): response = bytearray() diff --git a/SARA/SSL/full_test_HTTPS.py b/SARA/SSL/full_test_HTTPS.py index 22ac411..95789de 100755 --- a/SARA/SSL/full_test_HTTPS.py +++ b/SARA/SSL/full_test_HTTPS.py @@ -26,23 +26,8 @@ url = parameter[1] # ex: data.mobileair.fr profile_id = 3 -#get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) -send_uSpot = config.get('send_uSpot', False) +baudrate = 115200 +send_uSpot = False def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2): response = bytearray() diff --git a/SARA/SSL/full_test_HTTPS_POST.py b/SARA/SSL/full_test_HTTPS_POST.py index 3f7e83d..dc298fe 100755 --- a/SARA/SSL/full_test_HTTPS_POST.py +++ b/SARA/SSL/full_test_HTTPS_POST.py @@ -28,23 +28,8 @@ url = parameter[1] # ex: data.mobileair.fr endpoint = parameter[2] profile_id = 2 -#get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) -send_uSpot = config.get('send_uSpot', False) +baudrate = 115200 +send_uSpot = False def color_text(text, color): colors = { diff --git a/SARA/SSL/full_test_HTTP_POST.py b/SARA/SSL/full_test_HTTP_POST.py index 285a2c4..408b901 100755 --- a/SARA/SSL/full_test_HTTP_POST.py +++ b/SARA/SSL/full_test_HTTP_POST.py @@ -31,23 +31,8 @@ endpoint = parameter[2] profile_id = 3 -#get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) -send_uSpot = config.get('send_uSpot', False) +baudrate = 115200 +send_uSpot = False def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2): response = bytearray() diff --git a/SARA/SSL/prepareUspotProfile.py b/SARA/SSL/prepareUspotProfile.py index 933e92e..bca0059 100755 --- a/SARA/SSL/prepareUspotProfile.py +++ b/SARA/SSL/prepareUspotProfile.py @@ -21,23 +21,8 @@ port='/dev/'+parameter[0] # ex: ttyAMA2 url = parameter[1] # ex: data.mobileair.fr -#get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) -send_uSpot = config.get('send_uSpot', False) +baudrate = 115200 +send_uSpot = False def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2): response = bytearray() diff --git a/SARA/SSL/prepareUspotProfile_V2.py b/SARA/SSL/prepareUspotProfile_V2.py index 90014d7..837e9ab 100755 --- a/SARA/SSL/prepareUspotProfile_V2.py +++ b/SARA/SSL/prepareUspotProfile_V2.py @@ -23,24 +23,8 @@ parameter = sys.argv[1:] # Exclude the script name port='/dev/'+parameter[0] # ex: ttyAMA2 url = parameter[1] # ex: data.mobileair.fr - -#get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) -send_uSpot = config.get('send_uSpot', False) +baudrate = 115200 +send_uSpot = False def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2): response = bytearray() diff --git a/SARA/SSL/sara_add_certif_v2.py b/SARA/SSL/sara_add_certif_v2.py index d0cde5b..358b7e4 100755 --- a/SARA/SSL/sara_add_certif_v2.py +++ b/SARA/SSL/sara_add_certif_v2.py @@ -14,19 +14,7 @@ parameter = sys.argv[1:] # Exclude the script name port = '/dev/' + parameter[0] # e.g., ttyAMA2 timeout = float(parameter[1]) # e.g., 2 seconds -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -config = load_config(config_file) -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 115200 def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2): response = bytearray() diff --git a/SARA/sara.py b/SARA/sara.py index 50f4102..9f96382 100755 --- a/SARA/sara.py +++ b/SARA/sara.py @@ -35,7 +35,6 @@ timeout = float(parameter[2]) # ex:2 # Access the shared variables baudrate = 115200 - try: ser = serial.Serial( diff --git a/SARA/sara_checkDNS.py b/SARA/sara_checkDNS.py index fbbe199..3e036f7 100644 --- a/SARA/sara_checkDNS.py +++ b/SARA/sara_checkDNS.py @@ -22,23 +22,7 @@ parameter = sys.argv[1:] # Exclude the script name port='/dev/'+parameter[0] # ex: ttyAMA2 url = parameter[1] # ex: data.mobileair.fr - -#get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 115200 ser = serial.Serial( port=port, #USB0 or ttyS0 diff --git a/SARA/sara_connectNetwork.py b/SARA/sara_connectNetwork.py index 6342cca..d96755e 100755 --- a/SARA/sara_connectNetwork.py +++ b/SARA/sara_connectNetwork.py @@ -26,15 +26,7 @@ networkID = parameter[1] # ex: 20801 timeout = float(parameter[2]) # ex:2 -#get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} + def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2, wait_for_lines=None, debug=True): ''' @@ -81,12 +73,7 @@ def read_complete_response(serial_connection, timeout=2, end_of_response_timeout return response.decode('utf-8', errors='replace') # Return the full response if no target line is found -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 115200 ser = serial.Serial( port=port, #USB0 or ttyS0 diff --git a/SARA/sara_eraseMessage.py b/SARA/sara_eraseMessage.py index c205c50..08dbf88 100755 --- a/SARA/sara_eraseMessage.py +++ b/SARA/sara_eraseMessage.py @@ -11,22 +11,7 @@ parameter = sys.argv[1:] # Exclude the script name port='/dev/'+parameter[0] # ex: ttyAMA2 message = parameter[1] # ex: Hello -#get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 115200 ser = serial.Serial( port=port, #USB0 or ttyS0 diff --git a/SARA/sara_google_ping.py b/SARA/sara_google_ping.py index 2ea0c97..376685f 100644 --- a/SARA/sara_google_ping.py +++ b/SARA/sara_google_ping.py @@ -18,24 +18,7 @@ import sys import json - - -#get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 115200 ser = serial.Serial( port='/dev/ttyAMA2', diff --git a/SARA/sara_ping.py b/SARA/sara_ping.py index 7d9c92a..57be98e 100644 --- a/SARA/sara_ping.py +++ b/SARA/sara_ping.py @@ -17,23 +17,7 @@ import json # SARA R4 UHTTPC profile IDs aircarto_profile_id = 0 - -#get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 115200 ser_sara = serial.Serial( port='/dev/ttyAMA2', diff --git a/SARA/sara_readMessage.py b/SARA/sara_readMessage.py index 33739fe..2c18f38 100755 --- a/SARA/sara_readMessage.py +++ b/SARA/sara_readMessage.py @@ -11,22 +11,7 @@ parameter = sys.argv[1:] # Exclude the script name port='/dev/'+parameter[0] # ex: ttyAMA2 message = parameter[1] # ex: Hello -#get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 115200 ser = serial.Serial( port=port, #USB0 or ttyS0 diff --git a/SARA/sara_sendMessage.py b/SARA/sara_sendMessage.py index f5e3e95..6e48248 100755 --- a/SARA/sara_sendMessage.py +++ b/SARA/sara_sendMessage.py @@ -12,22 +12,7 @@ port='/dev/'+parameter[0] # ex: ttyAMA2 endpoint = parameter[1] # ex: /pro_4G/notif_message.php profile_id = parameter[2] -#get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 115200 ser = serial.Serial( port=port, #USB0 or ttyS0 diff --git a/SARA/sara_setAPN.py b/SARA/sara_setAPN.py index aad7243..6f38144 100755 --- a/SARA/sara_setAPN.py +++ b/SARA/sara_setAPN.py @@ -21,23 +21,7 @@ port='/dev/'+parameter[0] # ex: ttyAMA2 apn_address = parameter[1] # ex: data.mono timeout = float(parameter[2]) # ex:2 - -#get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 115200 ser = serial.Serial( port=port, #USB0 or ttyS0 diff --git a/SARA/sara_setURL.py b/SARA/sara_setURL.py index bb0079c..2bfe410 100755 --- a/SARA/sara_setURL.py +++ b/SARA/sara_setURL.py @@ -27,22 +27,7 @@ url = parameter[1] # ex: data.mobileair.fr profile_id = parameter[2] #ex: 0 -#get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 115200 ser = serial.Serial( port=port, #USB0 or ttyS0 diff --git a/SARA/sara_setURL_uSpot_noSSL.py b/SARA/sara_setURL_uSpot_noSSL.py index 4c37f42..04b1b0d 100755 --- a/SARA/sara_setURL_uSpot_noSSL.py +++ b/SARA/sara_setURL_uSpot_noSSL.py @@ -40,22 +40,7 @@ def read_complete_response(serial_connection, timeout=2, end_of_response_timeout return response.decode('utf-8', errors='replace') -#get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 115200 ser_sara = serial.Serial( port=port, #USB0 or ttyS0 diff --git a/SARA/sara_writeMessage.py b/SARA/sara_writeMessage.py index 72188af..704eb39 100755 --- a/SARA/sara_writeMessage.py +++ b/SARA/sara_writeMessage.py @@ -12,21 +12,7 @@ port='/dev/'+parameter[0] # ex: ttyAMA2 message = parameter[1] # ex: Hello #get baudrate -def load_config(config_file): - try: - with open(config_file, 'r') as file: - config_data = json.load(file) - return config_data - except Exception as e: - print(f"Error loading config file: {e}") - return {} - -# Define the config file path -config_file = '/var/www/nebuleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 115200 ser = serial.Serial( port=port, #USB0 or ttyS0