diff --git a/SARA/sara.py b/SARA/sara.py index 410446b..e6e0996 100755 --- a/SARA/sara.py +++ b/SARA/sara.py @@ -1,4 +1,10 @@ ''' + ____ _ ____ _ + / ___| / \ | _ \ / \ + \___ \ / _ \ | |_) | / _ \ + ___) / ___ \| _ < / ___ \ + |____/_/ \_\_| \_\/_/ \_\ + Script to see if the SARA-R410 is running ex: python3 /var/www/moduleair_pro_4g/SARA/sara.py ttyAMA2 AT+CCID? 2 @@ -22,22 +28,7 @@ port='/dev/'+parameter[0] # ex: ttyAMA2 command = parameter[1] # ex: AT+CCID? 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/moduleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 9600 ser = serial.Serial( port=port, #USB0 or ttyS0 diff --git a/SARA/sara_connectNetwork.py b/SARA/sara_connectNetwork.py index 343ca7b..73b79d2 100755 --- a/SARA/sara_connectNetwork.py +++ b/SARA/sara_connectNetwork.py @@ -1,4 +1,10 @@ ''' + ____ _ ____ _ + / ___| / \ | _ \ / \ + \___ \ / _ \ | |_) | / _ \ + ___) / ___ \| _ < / ___ \ + |____/_/ \_\_| \_\/_/ \_\ + Script to connect SARA-R410 to network SARA-R410 python3 /var/www/moduleair_pro_4g/SARA/sara_connectNetwork.py ttyAMA2 20801 10 @@ -18,23 +24,7 @@ port='/dev/'+parameter[0] # ex: ttyAMA2 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 {} - -# Define the config file path -config_file = '/var/www/moduleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 9600 ser = serial.Serial( port=port, #USB0 or ttyS0 diff --git a/SARA/sara_eraseMessage.py b/SARA/sara_eraseMessage.py index 3f273aa..262740f 100755 --- a/SARA/sara_eraseMessage.py +++ b/SARA/sara_eraseMessage.py @@ -1,4 +1,10 @@ ''' + ____ _ ____ _ + / ___| / \ | _ \ / \ + \___ \ / _ \ | |_) | / _ \ + ___) / ___ \| _ < / ___ \ + |____/_/ \_\_| \_\/_/ \_\ + Script to erase memory to SARA-R410 memory ''' @@ -11,22 +17,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/moduleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 9600 ser = serial.Serial( port=port, #USB0 or ttyS0 diff --git a/SARA/sara_readMessage.py b/SARA/sara_readMessage.py index dc18b84..421e250 100755 --- a/SARA/sara_readMessage.py +++ b/SARA/sara_readMessage.py @@ -1,4 +1,9 @@ ''' + ____ _ ____ _ + / ___| / \ | _ \ / \ + \___ \ / _ \ | |_) | / _ \ + ___) / ___ \| _ < / ___ \ + |____/_/ \_\_| \_\/_/ \_\ Script to read memory to SARA-R410 memory ''' @@ -11,22 +16,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/moduleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 9600 ser = serial.Serial( port=port, #USB0 or ttyS0 diff --git a/SARA/sara_sendMessage.py b/SARA/sara_sendMessage.py index 5599bb6..46864c7 100755 --- a/SARA/sara_sendMessage.py +++ b/SARA/sara_sendMessage.py @@ -1,4 +1,10 @@ ''' + ____ _ ____ _ + / ___| / \ | _ \ / \ + \___ \ / _ \ | |_) | / _ \ + ___) / ___ \| _ < / ___ \ + |____/_/ \_\_| \_\/_/ \_\ + Script to send message to URL with SARA-R410 ''' @@ -12,22 +18,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/moduleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 9600 ser = serial.Serial( port=port, #USB0 or ttyS0 diff --git a/SARA/sara_setAPN.py b/SARA/sara_setAPN.py index c2a4260..7104c18 100755 --- a/SARA/sara_setAPN.py +++ b/SARA/sara_setAPN.py @@ -1,4 +1,10 @@ ''' + ____ _ ____ _ + / ___| / \ | _ \ / \ + \___ \ / _ \ | |_) | / _ \ + ___) / ___ \| _ < / ___ \ + |____/_/ \_\_| \_\/_/ \_\ + Script to connect SARA-R410 to APN AT+CGDCONT=1,"IP","data.mono" @@ -16,22 +22,8 @@ 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 {} +baudrate = 9600 -# Define the config file path -config_file = '/var/www/moduleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) ser = serial.Serial( port=port, #USB0 or ttyS0 diff --git a/SARA/sara_setURL.py b/SARA/sara_setURL.py index 42d5d97..68f1868 100755 --- a/SARA/sara_setURL.py +++ b/SARA/sara_setURL.py @@ -1,4 +1,10 @@ ''' + ____ _ ____ _ + / ___| / \ | _ \ / \ + \___ \ / _ \ | |_) | / _ \ + ___) / ___ \| _ < / ___ \ + |____/_/ \_\_| \_\/_/ \_\ + Script to set the URL for a HTTP request Ex: /usr/bin/python3 /var/www/moduleair_pro_4g/SARA/sara_setURL.py ttyAMA2 data.moduleair.fr 0 @@ -22,22 +28,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/moduleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 9600 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 188dcf1..b0b8af9 100755 --- a/SARA/sara_setURL_uSpot_noSSL.py +++ b/SARA/sara_setURL_uSpot_noSSL.py @@ -1,4 +1,10 @@ ''' + ____ _ ____ _ + / ___| / \ | _ \ / \ + \___ \ / _ \ | |_) | / _ \ + ___) / ___ \| _ < / ___ \ + |____/_/ \_\_| \_\/_/ \_\ + Script to set the URL for a HTTP request Ex: /usr/bin/python3 /var/www/moduleair_pro_4g/SARA/sara_setURL_uSpot_noSSL.py ttyAMA2 api-prod.uspot.probesys.net @@ -40,22 +46,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/moduleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 9600 ser_sara = serial.Serial( port=port, #USB0 or ttyS0 diff --git a/SARA/sara_writeMessage.py b/SARA/sara_writeMessage.py index afda5fc..4e0d6f9 100755 --- a/SARA/sara_writeMessage.py +++ b/SARA/sara_writeMessage.py @@ -1,4 +1,10 @@ ''' + ____ _ ____ _ + / ___| / \ | _ \ / \ + \___ \ / _ \ | |_) | / _ \ + ___) / ___ \| _ < / ___ \ + |____/_/ \_\_| \_\/_/ \_\ + Script to write message to SARA-R410 memory ''' @@ -11,22 +17,8 @@ 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/moduleair_pro_4g/config.json' -# Load the configuration data -config = load_config(config_file) -# Access the shared variables -baudrate = config.get('SaraR4_baudrate', 115200) +baudrate = 9600 ser = serial.Serial( port=port, #USB0 or ttyS0