update
This commit is contained in:
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
logs/app.log
|
||||||
|
logs/loop.log
|
||||||
|
deviceID.txt
|
||||||
|
loop/loop.log
|
||||||
|
loop/data.json
|
||||||
|
config.json
|
||||||
|
.ssh/
|
||||||
|
matrix/input.txt
|
||||||
|
matrix/input_NPM.txt
|
||||||
|
matrix/input_MHZ16.txt
|
||||||
87
MH-Z19/get_data.py
Normal file
87
MH-Z19/get_data.py
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
'''
|
||||||
|
Script to get CO2 values
|
||||||
|
need parameter: CO2_port
|
||||||
|
/usr/bin/python3 /var/www/moduleair_pro_4g/MH-Z19/get_data.py ttyAMA4
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
import time
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0]
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port,
|
||||||
|
baudrate=9600,
|
||||||
|
parity=serial.PARITY_NONE,
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 1
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# Command to read CO2 concentration
|
||||||
|
# Contains 9 bytes (byte 0 ~ 8)
|
||||||
|
# FIRST byte: fixed to 0xFF
|
||||||
|
# SECOND byte: sensor number (factory default is 0 x01)
|
||||||
|
# THIRD byte: 0x86 Gas Concentration
|
||||||
|
|
||||||
|
# end with proof test value Checksum
|
||||||
|
|
||||||
|
|
||||||
|
READ_CO2_COMMAND = b'\xFF\x01\x86\x00\x00\x00\x00\x00\x79'
|
||||||
|
|
||||||
|
|
||||||
|
def read_co2():
|
||||||
|
# Send the read command to the MH-Z19
|
||||||
|
ser.write(READ_CO2_COMMAND)
|
||||||
|
|
||||||
|
# Wait for the response from the sensor
|
||||||
|
time.sleep(2) # Wait for the sensor to respond
|
||||||
|
|
||||||
|
# Read the response from the sensor (9 bytes expected)
|
||||||
|
response = ser.read(9)
|
||||||
|
|
||||||
|
# Print the response to debug
|
||||||
|
# print(f"Response: {response}")
|
||||||
|
|
||||||
|
# Check if the response is valid (the first byte should be 0xFF)
|
||||||
|
if len(response) < 9:
|
||||||
|
print("Error: No data or incomplete data received.")
|
||||||
|
return None
|
||||||
|
|
||||||
|
if response[0] == 0xFF:
|
||||||
|
# Extract the CO2 concentration value (byte 2 and 3)
|
||||||
|
co2_concentration = response[2] * 256 + response[3]
|
||||||
|
return co2_concentration
|
||||||
|
else:
|
||||||
|
print("Error reading data from sensor.")
|
||||||
|
return None
|
||||||
|
|
||||||
|
def main():
|
||||||
|
try:
|
||||||
|
co2 = read_co2()
|
||||||
|
if co2 is not None:
|
||||||
|
# Create a dictionary to store the data
|
||||||
|
data = {
|
||||||
|
"CO2": co2
|
||||||
|
}
|
||||||
|
|
||||||
|
# Convert the dictionary to a JSON string
|
||||||
|
json_data = json.dumps(data)
|
||||||
|
print(json_data) # Output the JSON string
|
||||||
|
else:
|
||||||
|
print("Failed to get CO2 data.")
|
||||||
|
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("Program terminated.")
|
||||||
|
finally:
|
||||||
|
ser.close()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
88
MH-Z19/write_data.py
Normal file
88
MH-Z19/write_data.py
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
'''
|
||||||
|
Script to get CO2 values and write it to text file
|
||||||
|
need parameter: CO2_port
|
||||||
|
/usr/bin/python3 /var/www/moduleair_pro_4g/MH-Z19/write_data.py ttyAMA4
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
import time
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0]
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port,
|
||||||
|
baudrate=9600,
|
||||||
|
parity=serial.PARITY_NONE,
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 1
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# Command to read CO2 concentration
|
||||||
|
# Contains 9 bytes (byte 0 ~ 8)
|
||||||
|
# FIRST byte: fixed to 0xFF
|
||||||
|
# SECOND byte: sensor number (factory default is 0 x01)
|
||||||
|
# THIRD byte: 0x86 Gas Concentration
|
||||||
|
|
||||||
|
# end with proof test value Checksum
|
||||||
|
|
||||||
|
|
||||||
|
READ_CO2_COMMAND = b'\xFF\x01\x86\x00\x00\x00\x00\x00\x79'
|
||||||
|
|
||||||
|
file_path = "/var/www/moduleair_pro_4g/matrix/input.txt"
|
||||||
|
|
||||||
|
|
||||||
|
def read_co2():
|
||||||
|
# Send the read command to the MH-Z19
|
||||||
|
ser.write(READ_CO2_COMMAND)
|
||||||
|
|
||||||
|
# Wait for the response from the sensor
|
||||||
|
time.sleep(2) # Wait for the sensor to respond
|
||||||
|
|
||||||
|
# Read the response from the sensor (9 bytes expected)
|
||||||
|
response = ser.read(9)
|
||||||
|
|
||||||
|
# Print the response to debug
|
||||||
|
print(f"Response: {response}")
|
||||||
|
|
||||||
|
# Check if the response is valid (the first byte should be 0xFF)
|
||||||
|
if len(response) < 9:
|
||||||
|
print("Error: No data or incomplete data received.")
|
||||||
|
return None
|
||||||
|
|
||||||
|
if response[0] == 0xFF:
|
||||||
|
# Extract the CO2 concentration value (byte 2 and 3)
|
||||||
|
co2_concentration = response[2] * 256 + response[3]
|
||||||
|
return co2_concentration
|
||||||
|
else:
|
||||||
|
print("Error reading data from sensor.")
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
try:
|
||||||
|
co2 = read_co2()
|
||||||
|
if co2 is not None:
|
||||||
|
print(f"CO2 Concentration: {co2} ppm")
|
||||||
|
output_file = "/var/www/moduleair_pro_4g/matrix/input_MHZ16.txt"
|
||||||
|
with open(output_file, "w") as file:
|
||||||
|
file.write(f"{co2} \n")
|
||||||
|
print(f"Data written to {output_file}")
|
||||||
|
else:
|
||||||
|
print("Failed to get CO2 data.")
|
||||||
|
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("Program terminated.")
|
||||||
|
finally:
|
||||||
|
ser.close()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
64
NPM/firmware_version.py
Normal file
64
NPM/firmware_version.py
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
'''
|
||||||
|
Script to get NPM firmware version
|
||||||
|
need parameter: port
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/NPM/firmware_version.py ttyAMA5
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0]
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port,
|
||||||
|
baudrate=115200,
|
||||||
|
parity=serial.PARITY_EVEN,
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 1
|
||||||
|
)
|
||||||
|
|
||||||
|
ser.write(b'\x81\x17\x68') #firmware version
|
||||||
|
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
byte_data = ser.readline()
|
||||||
|
formatted = ''.join(f'\\x{byte:02x}' for byte in byte_data)
|
||||||
|
#print(formatted)
|
||||||
|
|
||||||
|
'''
|
||||||
|
la réponse est de type
|
||||||
|
\x81\x17\x00\x10\x46\x12
|
||||||
|
avec
|
||||||
|
\x81 address
|
||||||
|
\x17 command code
|
||||||
|
\x00 state
|
||||||
|
\x10\x46 firmware version
|
||||||
|
\x12 checksum
|
||||||
|
'''
|
||||||
|
# Extract byte 4 and byte 5
|
||||||
|
byte4 = byte_data[3] # 4th byte (index 3)
|
||||||
|
byte5 = byte_data[4] # 5th byte (index 4)
|
||||||
|
firmware_version = int(f"{byte4:02x}{byte5:02x}")
|
||||||
|
|
||||||
|
|
||||||
|
data = {
|
||||||
|
'firmware_version': firmware_version,
|
||||||
|
}
|
||||||
|
json_data = json.dumps(data)
|
||||||
|
print(json_data)
|
||||||
|
break
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("User interrupt encountered. Exiting...")
|
||||||
|
time.sleep(3)
|
||||||
|
exit()
|
||||||
|
except:
|
||||||
|
# for all other kinds of error, but not specifying which one
|
||||||
|
print("Unknown error...")
|
||||||
|
time.sleep(3)
|
||||||
|
exit()
|
||||||
|
|
||||||
75
NPM/get_data.py
Normal file
75
NPM/get_data.py
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
'''
|
||||||
|
_ _ ____ __ __
|
||||||
|
| \ | | _ \| \/ |
|
||||||
|
| \| | |_) | |\/| |
|
||||||
|
| |\ | __/| | | |
|
||||||
|
|_| \_|_| |_| |_|
|
||||||
|
|
||||||
|
Script to get NPM values
|
||||||
|
need parameter: port
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/NPM/get_data.py ttyAMA5
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0]
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port,
|
||||||
|
baudrate=115200,
|
||||||
|
parity=serial.PARITY_EVEN,
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 1
|
||||||
|
)
|
||||||
|
|
||||||
|
ser.write(b'\x81\x11\x6E') #data10s
|
||||||
|
#ser.write(b'\x81\x12\x6D') #data60s
|
||||||
|
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
byte_data = ser.readline()
|
||||||
|
#print(byte_data)
|
||||||
|
stateByte = int.from_bytes(byte_data[2:3], byteorder='big')
|
||||||
|
Statebits = [int(bit) for bit in bin(stateByte)[2:].zfill(8)]
|
||||||
|
PM1 = int.from_bytes(byte_data[9:11], byteorder='big')/10
|
||||||
|
PM25 = int.from_bytes(byte_data[11:13], byteorder='big')/10
|
||||||
|
PM10 = int.from_bytes(byte_data[13:15], byteorder='big')/10
|
||||||
|
#print(f"State: {Statebits}")
|
||||||
|
#print(f"PM1: {PM1}")
|
||||||
|
#print(f"PM25: {PM25}")
|
||||||
|
#print(f"PM10: {PM10}")
|
||||||
|
#create JSON
|
||||||
|
data = {
|
||||||
|
'capteurID': 'nebuleairpro1',
|
||||||
|
'sondeID':'USB2',
|
||||||
|
'PM1': PM1,
|
||||||
|
'PM25': PM25,
|
||||||
|
'PM10': PM10,
|
||||||
|
'sleep' : Statebits[0],
|
||||||
|
'degradedState' : Statebits[1],
|
||||||
|
'notReady' : Statebits[2],
|
||||||
|
'heatError' : Statebits[3],
|
||||||
|
't_rhError' : Statebits[4],
|
||||||
|
'fanError' : Statebits[5],
|
||||||
|
'memoryError' : Statebits[6],
|
||||||
|
'laserError' : Statebits[7]
|
||||||
|
}
|
||||||
|
json_data = json.dumps(data)
|
||||||
|
print(json_data)
|
||||||
|
break
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("User interrupt encountered. Exiting...")
|
||||||
|
time.sleep(3)
|
||||||
|
exit()
|
||||||
|
except:
|
||||||
|
# for all other kinds of error, but not specifying which one
|
||||||
|
print("Unknown error...")
|
||||||
|
time.sleep(3)
|
||||||
|
exit()
|
||||||
|
|
||||||
137
NPM/get_data_modbus.py
Normal file
137
NPM/get_data_modbus.py
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
'''
|
||||||
|
_ _ ____ __ __
|
||||||
|
| \ | | _ \| \/ |
|
||||||
|
| \| | |_) | |\/| |
|
||||||
|
| |\ | __/| | | |
|
||||||
|
|_| \_|_| |_| |_|
|
||||||
|
|
||||||
|
Script to get NPM data via Modbus
|
||||||
|
need parameter: port
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/NPM/get_data_modbus.py
|
||||||
|
|
||||||
|
Modbus RTU
|
||||||
|
[Slave Address][Function Code][Starting Address][Quantity of Registers][CRC]
|
||||||
|
|
||||||
|
Pour récupérer les 5 cannaux (a partir du registre 0x80)
|
||||||
|
Donnée actualisée toutes les 10 secondes
|
||||||
|
|
||||||
|
Request
|
||||||
|
\x01\x03\x00\x80\x00\x0A\xE4\x1E
|
||||||
|
|
||||||
|
\x01 Slave Address (slave device address)
|
||||||
|
\x03 Function code (read multiple holding registers)
|
||||||
|
\x00\x80 Starting Address (The request starts reading from holding register address 0x80 or 128)
|
||||||
|
\x00\x0A Quantity of Registers (Requests to read 0x0A or 10 consecutive registers starting from address 128)
|
||||||
|
\xE4\x1E Cyclic Redundancy Check (checksum )
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
import crcmod
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
|
# Connect to the SQLite database
|
||||||
|
conn = sqlite3.connect("/var/www/nebuleair_pro_4g/sqlite/sensors.db")
|
||||||
|
cursor = conn.cursor()
|
||||||
|
|
||||||
|
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 {}
|
||||||
|
|
||||||
|
# Load the configuration data
|
||||||
|
config_file = '/var/www/nebuleair_pro_4g/config.json'
|
||||||
|
config = load_config(config_file)
|
||||||
|
npm_solo_port = config.get('NPM_solo_port', '') #port du NPM solo
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=npm_solo_port,
|
||||||
|
baudrate=115200,
|
||||||
|
parity=serial.PARITY_EVEN,
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 0.5
|
||||||
|
)
|
||||||
|
|
||||||
|
# Define Modbus CRC-16 function
|
||||||
|
crc16 = crcmod.predefined.mkPredefinedCrcFun('modbus')
|
||||||
|
|
||||||
|
# Request frame without CRC
|
||||||
|
data = b'\x01\x03\x00\x80\x00\x0A'
|
||||||
|
|
||||||
|
# Calculate CRC
|
||||||
|
crc = crc16(data)
|
||||||
|
crc_low = crc & 0xFF
|
||||||
|
crc_high = (crc >> 8) & 0xFF
|
||||||
|
|
||||||
|
# Append CRC to the frame
|
||||||
|
request = data + bytes([crc_low, crc_high])
|
||||||
|
#print(f"Request frame: {request.hex()}")
|
||||||
|
|
||||||
|
ser.write(request)
|
||||||
|
|
||||||
|
#GET RTC TIME from SQlite
|
||||||
|
cursor.execute("SELECT * FROM timestamp_table LIMIT 1")
|
||||||
|
row = cursor.fetchone() # Get the first (and only) row
|
||||||
|
rtc_time_str = row[1] # '2025-02-07 12:30:45'
|
||||||
|
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
byte_data = ser.readline()
|
||||||
|
formatted = ''.join(f'\\x{byte:02x}' for byte in byte_data)
|
||||||
|
#print(formatted)
|
||||||
|
|
||||||
|
# Extract LSW (first 2 bytes) and MSW (last 2 bytes)
|
||||||
|
lsw_channel1 = int.from_bytes(byte_data[3:5], byteorder='big')
|
||||||
|
msw_chanel1 = int.from_bytes(byte_data[5:7], byteorder='big')
|
||||||
|
raw_value_channel1 = (msw_chanel1 << 16) | lsw_channel1
|
||||||
|
|
||||||
|
lsw_channel2 = int.from_bytes(byte_data[7:9], byteorder='big')
|
||||||
|
msw_chanel2 = int.from_bytes(byte_data[9:11], byteorder='big')
|
||||||
|
raw_value_channel2 = (msw_chanel2 << 16) | lsw_channel2
|
||||||
|
|
||||||
|
lsw_channel3 = int.from_bytes(byte_data[11:13], byteorder='big')
|
||||||
|
msw_chanel3 = int.from_bytes(byte_data[13:15], byteorder='big')
|
||||||
|
raw_value_channel3 = (msw_chanel3 << 16) | lsw_channel3
|
||||||
|
|
||||||
|
lsw_channel4 = int.from_bytes(byte_data[15:17], byteorder='big')
|
||||||
|
msw_chanel4 = int.from_bytes(byte_data[17:19], byteorder='big')
|
||||||
|
raw_value_channel4 = (msw_chanel1 << 16) | lsw_channel4
|
||||||
|
|
||||||
|
lsw_channel5 = int.from_bytes(byte_data[19:21], byteorder='big')
|
||||||
|
msw_chanel5 = int.from_bytes(byte_data[21:23], byteorder='big')
|
||||||
|
raw_value_channel5 = (msw_chanel5 << 16) | lsw_channel5
|
||||||
|
|
||||||
|
print(f"Channel 1 (0.2->0.5): {raw_value_channel1}")
|
||||||
|
print(f"Channel 2 (0.5->1.0): {raw_value_channel2}")
|
||||||
|
print(f"Channel 3 (1.0->2.5): {raw_value_channel3}")
|
||||||
|
print(f"Channel 4 (2.5->5.0): {raw_value_channel4}")
|
||||||
|
print(f"Channel 5 (5.0->10.): {raw_value_channel5}")
|
||||||
|
|
||||||
|
cursor.execute('''
|
||||||
|
INSERT INTO data_NPM_5channels (timestamp,PM_ch1, PM_ch2, PM_ch3, PM_ch4, PM_ch5) VALUES (?,?,?,?,?,?)'''
|
||||||
|
, (rtc_time_str,raw_value_channel1,raw_value_channel2,raw_value_channel3,raw_value_channel4,raw_value_channel5))
|
||||||
|
|
||||||
|
# Commit and close the connection
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
|
|
||||||
|
break
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("User interrupt encountered. Exiting...")
|
||||||
|
time.sleep(3)
|
||||||
|
exit()
|
||||||
|
except:
|
||||||
|
# for all other kinds of error, but not specifying which one
|
||||||
|
print("Unknown error...")
|
||||||
|
time.sleep(3)
|
||||||
|
exit()
|
||||||
|
|
||||||
|
conn.close()
|
||||||
188
NPM/get_data_modbus_v2.py
Normal file
188
NPM/get_data_modbus_v2.py
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
'''
|
||||||
|
_ _ ____ __ __
|
||||||
|
| \ | | _ \| \/ |
|
||||||
|
| \| | |_) | |\/| |
|
||||||
|
| |\ | __/| | | |
|
||||||
|
|_| \_|_| |_| |_|
|
||||||
|
|
||||||
|
Script to get NPM data via Modbus
|
||||||
|
need parameter: port
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/NPM/get_data_modbus_v2.py
|
||||||
|
|
||||||
|
Modbus RTU
|
||||||
|
[Slave Address][Function Code][Starting Address][Quantity of Registers][CRC]
|
||||||
|
|
||||||
|
Pour récupérer
|
||||||
|
les concentrations en PM1, PM10 et PM2.5 (a partir du registre 0x38)
|
||||||
|
les 5 cannaux
|
||||||
|
la température et l'humidité à l'intérieur du capteur
|
||||||
|
Donnée actualisée toutes les 10 secondes
|
||||||
|
|
||||||
|
Request
|
||||||
|
\x01\x03\x00\x38\x00\x55\...\...
|
||||||
|
|
||||||
|
\x01 Slave Address (slave device address)
|
||||||
|
\x03 Function code (read multiple holding registers)
|
||||||
|
\x00\x38 Starting Address (The request starts reading from holding register address x38 or 56)
|
||||||
|
\x00\x55 Quantity of Registers (Requests to read x55 or 85 consecutive registers starting from address 56)
|
||||||
|
\...\... Cyclic Redundancy Check (checksum )
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
import crcmod
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
|
# Connect to the SQLite database
|
||||||
|
conn = sqlite3.connect("/var/www/nebuleair_pro_4g/sqlite/sensors.db")
|
||||||
|
cursor = conn.cursor()
|
||||||
|
|
||||||
|
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 {}
|
||||||
|
|
||||||
|
# Load the configuration data
|
||||||
|
config_file = '/var/www/nebuleair_pro_4g/config.json'
|
||||||
|
config = load_config(config_file)
|
||||||
|
npm_solo_port = config.get('NPM_solo_port', '') #port du NPM solo
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=npm_solo_port,
|
||||||
|
baudrate=115200,
|
||||||
|
parity=serial.PARITY_EVEN,
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
# Define Modbus CRC-16 function
|
||||||
|
crc16 = crcmod.predefined.mkPredefinedCrcFun('modbus')
|
||||||
|
|
||||||
|
# Request frame without CRC
|
||||||
|
data = b'\x01\x03\x00\x38\x00\x55'
|
||||||
|
|
||||||
|
# Calculate CRC
|
||||||
|
crc = crc16(data)
|
||||||
|
crc_low = crc & 0xFF
|
||||||
|
crc_high = (crc >> 8) & 0xFF
|
||||||
|
|
||||||
|
# Append CRC to the frame
|
||||||
|
request = data + bytes([crc_low, crc_high])
|
||||||
|
#print(f"Request frame: {request.hex()}")
|
||||||
|
|
||||||
|
ser.write(request)
|
||||||
|
|
||||||
|
#GET RTC TIME from SQlite
|
||||||
|
cursor.execute("SELECT * FROM timestamp_table LIMIT 1")
|
||||||
|
row = cursor.fetchone() # Get the first (and only) row
|
||||||
|
rtc_time_str = row[1] # '2025-02-07 12:30:45'
|
||||||
|
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
byte_data = ser.readline()
|
||||||
|
formatted = ''.join(f'\\x{byte:02x}' for byte in byte_data)
|
||||||
|
print(formatted)
|
||||||
|
|
||||||
|
# Register base (56 = 0x38)
|
||||||
|
REGISTER_START = 56
|
||||||
|
|
||||||
|
# Function to extract 32-bit values from Modbus response
|
||||||
|
def extract_value(byte_data, register, scale=1, single_register=False, round_to=None):
|
||||||
|
"""Extracts a value from Modbus response.
|
||||||
|
|
||||||
|
- `register`: Modbus register to read.
|
||||||
|
- `scale`: Value is divided by this (e.g., `1000` for PM values).
|
||||||
|
- `single_register`: If `True`, only reads 16 bits (one register).
|
||||||
|
"""
|
||||||
|
offset = (register - REGISTER_START) * 2 + 3 # Calculate byte offset
|
||||||
|
|
||||||
|
if single_register:
|
||||||
|
value = int.from_bytes(byte_data[offset:offset+2], byteorder='big')
|
||||||
|
else:
|
||||||
|
lsw = int.from_bytes(byte_data[offset:offset+2], byteorder='big')
|
||||||
|
msw = int.from_bytes(byte_data[offset+2:offset+4], byteorder='big')
|
||||||
|
value = (msw << 16) | lsw # 32-bit value
|
||||||
|
|
||||||
|
value = value / scale # Apply scaling
|
||||||
|
|
||||||
|
if round_to == 0:
|
||||||
|
return int(value) # Convert to integer to remove .0
|
||||||
|
elif round_to is not None:
|
||||||
|
return round(value, round_to) # Apply normal rounding
|
||||||
|
else:
|
||||||
|
return value # No rounding if round_to is None
|
||||||
|
|
||||||
|
# 10-sec PM Concentration (PM1, PM2.5, PM10)
|
||||||
|
pm1_10s = extract_value(byte_data, 56, 1000, round_to=1)
|
||||||
|
pm25_10s = extract_value(byte_data, 58, 1000, round_to=1)
|
||||||
|
pm10_10s = extract_value(byte_data, 60, 1000, round_to=1)
|
||||||
|
|
||||||
|
print("10 sec concentration:")
|
||||||
|
print(f"PM1: {pm1_10s}")
|
||||||
|
print(f"PM2.5: {pm25_10s}")
|
||||||
|
print(f"PM10: {pm10_10s}")
|
||||||
|
|
||||||
|
# 1-min PM Concentration
|
||||||
|
pm1_1min = extract_value(byte_data, 68, 1000, round_to=1)
|
||||||
|
pm25_1min = extract_value(byte_data, 70, 1000, round_to=1)
|
||||||
|
pm10_1min = extract_value(byte_data, 72, 1000, round_to=1)
|
||||||
|
|
||||||
|
#print("1 min concentration:")
|
||||||
|
#print(f"PM1: {pm1_1min}")
|
||||||
|
#print(f"PM2.5: {pm25_1min}")
|
||||||
|
#print(f"PM10: {pm10_1min}")
|
||||||
|
|
||||||
|
# Extract values for 5 channels
|
||||||
|
channel_1 = extract_value(byte_data, 128, round_to=0) # 0.2 - 0.5μm
|
||||||
|
channel_2 = extract_value(byte_data, 130, round_to=0) # 0.5 - 1.0μm
|
||||||
|
channel_3 = extract_value(byte_data, 132, round_to=0) # 1.0 - 2.5μm
|
||||||
|
channel_4 = extract_value(byte_data, 134, round_to=0) # 2.5 - 5.0μm
|
||||||
|
channel_5 = extract_value(byte_data, 136, round_to=0) # 5.0 - 10.0μm
|
||||||
|
|
||||||
|
print(f"Channel 1 (0.2->0.5): {channel_1}")
|
||||||
|
print(f"Channel 2 (0.5->1.0): {channel_2}")
|
||||||
|
print(f"Channel 3 (1.0->2.5): {channel_3}")
|
||||||
|
print(f"Channel 4 (2.5->5.0): {channel_4}")
|
||||||
|
print(f"Channel 5 (5.0->10.): {channel_5}")
|
||||||
|
|
||||||
|
|
||||||
|
# Retrieve relative humidity from register 106 (0x6A)
|
||||||
|
relative_humidity = extract_value(byte_data, 106, 100, single_register=True)
|
||||||
|
#print(f"Internal Relative Humidity: {relative_humidity} %")
|
||||||
|
# Retrieve temperature from register 106 (0x6A)
|
||||||
|
temperature = extract_value(byte_data, 107, 100, single_register=True)
|
||||||
|
#print(f"Internal temperature: {temperature} °C")
|
||||||
|
|
||||||
|
cursor.execute('''
|
||||||
|
INSERT INTO data_NPM_5channels (timestamp,PM_ch1, PM_ch2, PM_ch3, PM_ch4, PM_ch5) VALUES (?,?,?,?,?,?)'''
|
||||||
|
, (rtc_time_str,channel_1,channel_2,channel_3,channel_4,channel_5))
|
||||||
|
|
||||||
|
cursor.execute('''
|
||||||
|
INSERT INTO data_NPM (timestamp,PM1, PM25, PM10, temp_npm, hum_npm) VALUES (?,?,?,?,?,?)'''
|
||||||
|
, (rtc_time_str,pm1_10s,pm25_10s,pm10_10s,temperature,relative_humidity ))
|
||||||
|
|
||||||
|
|
||||||
|
# Commit and close the connection
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
|
|
||||||
|
break
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("User interrupt encountered. Exiting...")
|
||||||
|
time.sleep(3)
|
||||||
|
exit()
|
||||||
|
except:
|
||||||
|
# for all other kinds of error, but not specifying which one
|
||||||
|
print("Unknown error...")
|
||||||
|
time.sleep(3)
|
||||||
|
exit()
|
||||||
|
|
||||||
|
conn.close()
|
||||||
179
NPM/get_data_modbus_v3.py
Normal file
179
NPM/get_data_modbus_v3.py
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
'''
|
||||||
|
_ _ ____ __ __
|
||||||
|
| \ | | _ \| \/ |
|
||||||
|
| \| | |_) | |\/| |
|
||||||
|
| |\ | __/| | | |
|
||||||
|
|_| \_|_| |_| |_|
|
||||||
|
|
||||||
|
Script to get NPM data via Modbus
|
||||||
|
|
||||||
|
Improved version with data stream lenght check
|
||||||
|
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/NPM/get_data_modbus_v3.py
|
||||||
|
|
||||||
|
Modbus RTU
|
||||||
|
[Slave Address][Function Code][Starting Address][Quantity of Registers][CRC]
|
||||||
|
|
||||||
|
Pour récupérer
|
||||||
|
les concentrations en PM1, PM10 et PM2.5 (a partir du registre 0x38)
|
||||||
|
les 5 cannaux
|
||||||
|
la température et l'humidité à l'intérieur du capteur
|
||||||
|
Donnée actualisée toutes les 10 secondes
|
||||||
|
|
||||||
|
Request
|
||||||
|
\x01\x03\x00\x38\x00\x55\...\...
|
||||||
|
|
||||||
|
\x01 Slave Address (slave device address)
|
||||||
|
\x03 Function code (read multiple holding registers)
|
||||||
|
\x00\x38 Starting Address (The request starts reading from holding register address x38 or 56)
|
||||||
|
\x00\x55 Quantity of Registers (Requests to read x55 or 85 consecutive registers starting from address 56)
|
||||||
|
\...\... Cyclic Redundancy Check (checksum )
|
||||||
|
|
||||||
|
'''
|
||||||
|
import serial
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
import crcmod
|
||||||
|
import sqlite3
|
||||||
|
import time
|
||||||
|
|
||||||
|
# Connect to the SQLite database
|
||||||
|
conn = sqlite3.connect("/var/www/nebuleair_pro_4g/sqlite/sensors.db")
|
||||||
|
cursor = conn.cursor()
|
||||||
|
|
||||||
|
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 {}
|
||||||
|
|
||||||
|
# Load the configuration data
|
||||||
|
config_file = '/var/www/nebuleair_pro_4g/config.json'
|
||||||
|
config = load_config(config_file)
|
||||||
|
npm_solo_port = config.get('NPM_solo_port', '') #port du NPM solo
|
||||||
|
|
||||||
|
#GET RTC TIME from SQlite
|
||||||
|
cursor.execute("SELECT * FROM timestamp_table LIMIT 1")
|
||||||
|
row = cursor.fetchone() # Get the first (and only) row
|
||||||
|
rtc_time_str = row[1] # '2025-02-07 12:30:45'
|
||||||
|
|
||||||
|
# Initialize serial port
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=npm_solo_port,
|
||||||
|
baudrate=115200,
|
||||||
|
parity=serial.PARITY_EVEN,
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout=2
|
||||||
|
)
|
||||||
|
|
||||||
|
# Define Modbus CRC-16 function
|
||||||
|
crc16 = crcmod.predefined.mkPredefinedCrcFun('modbus')
|
||||||
|
|
||||||
|
# Request frame without CRC
|
||||||
|
data = b'\x01\x03\x00\x38\x00\x55'
|
||||||
|
|
||||||
|
# Calculate and append CRC
|
||||||
|
crc = crc16(data)
|
||||||
|
crc_low = crc & 0xFF
|
||||||
|
crc_high = (crc >> 8) & 0xFF
|
||||||
|
request = data + bytes([crc_low, crc_high])
|
||||||
|
|
||||||
|
# Clear serial buffer before sending
|
||||||
|
ser.flushInput()
|
||||||
|
|
||||||
|
# Send request
|
||||||
|
ser.write(request)
|
||||||
|
time.sleep(0.2) # Wait for sensor to respond
|
||||||
|
|
||||||
|
# Read response
|
||||||
|
response_length = 2 + 1 + (2 * 85) + 2 # Address + Function + Data + CRC
|
||||||
|
byte_data = ser.read(response_length)
|
||||||
|
|
||||||
|
# Validate response length
|
||||||
|
if len(byte_data) < response_length:
|
||||||
|
print("[ERROR] Incomplete response received:", byte_data.hex())
|
||||||
|
exit()
|
||||||
|
|
||||||
|
# Verify CRC
|
||||||
|
received_crc = int.from_bytes(byte_data[-2:], byteorder='little')
|
||||||
|
calculated_crc = crc16(byte_data[:-2])
|
||||||
|
|
||||||
|
if received_crc != calculated_crc:
|
||||||
|
print("[ERROR] CRC check failed! Corrupted data received.")
|
||||||
|
exit()
|
||||||
|
|
||||||
|
# Convert response to hex for debugging
|
||||||
|
formatted = ''.join(f'\\x{byte:02x}' for byte in byte_data)
|
||||||
|
#print("Response:", formatted)
|
||||||
|
|
||||||
|
# Extract and print PM values
|
||||||
|
def extract_value(byte_data, register, scale=1, single_register=False, round_to=None):
|
||||||
|
REGISTER_START = 56
|
||||||
|
offset = (register - REGISTER_START) * 2 + 3
|
||||||
|
|
||||||
|
if single_register:
|
||||||
|
value = int.from_bytes(byte_data[offset:offset+2], byteorder='big')
|
||||||
|
else:
|
||||||
|
lsw = int.from_bytes(byte_data[offset:offset+2], byteorder='big')
|
||||||
|
msw = int.from_bytes(byte_data[offset+2:offset+4], byteorder='big')
|
||||||
|
value = (msw << 16) | lsw
|
||||||
|
|
||||||
|
value = value / scale
|
||||||
|
|
||||||
|
if round_to == 0:
|
||||||
|
return int(value)
|
||||||
|
elif round_to is not None:
|
||||||
|
return round(value, round_to)
|
||||||
|
else:
|
||||||
|
return value
|
||||||
|
|
||||||
|
pm1_10s = extract_value(byte_data, 56, 1000, round_to=1)
|
||||||
|
pm25_10s = extract_value(byte_data, 58, 1000, round_to=1)
|
||||||
|
pm10_10s = extract_value(byte_data, 60, 1000, round_to=1)
|
||||||
|
|
||||||
|
#print("10 sec concentration:")
|
||||||
|
#print(f"PM1: {pm1_10s}")
|
||||||
|
#print(f"PM2.5: {pm25_10s}")
|
||||||
|
#print(f"PM10: {pm10_10s}")
|
||||||
|
|
||||||
|
# Extract values for 5 channels
|
||||||
|
channel_1 = extract_value(byte_data, 128, round_to=0) # 0.2 - 0.5μm
|
||||||
|
channel_2 = extract_value(byte_data, 130, round_to=0) # 0.5 - 1.0μm
|
||||||
|
channel_3 = extract_value(byte_data, 132, round_to=0) # 1.0 - 2.5μm
|
||||||
|
channel_4 = extract_value(byte_data, 134, round_to=0) # 2.5 - 5.0μm
|
||||||
|
channel_5 = extract_value(byte_data, 136, round_to=0) # 5.0 - 10.0μm
|
||||||
|
|
||||||
|
#print(f"Channel 1 (0.2->0.5): {channel_1}")
|
||||||
|
#print(f"Channel 2 (0.5->1.0): {channel_2}")
|
||||||
|
#print(f"Channel 3 (1.0->2.5): {channel_3}")
|
||||||
|
#print(f"Channel 4 (2.5->5.0): {channel_4}")
|
||||||
|
#print(f"Channel 5 (5.0->10.): {channel_5}")
|
||||||
|
|
||||||
|
|
||||||
|
# Retrieve relative humidity from register 106 (0x6A)
|
||||||
|
relative_humidity = extract_value(byte_data, 106, 100, single_register=True)
|
||||||
|
# Retrieve temperature from register 106 (0x6A)
|
||||||
|
temperature = extract_value(byte_data, 107, 100, single_register=True)
|
||||||
|
|
||||||
|
#print(f"Internal Relative Humidity: {relative_humidity} %")
|
||||||
|
#print(f"Internal temperature: {temperature} °C")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cursor.execute('''
|
||||||
|
INSERT INTO data_NPM_5channels (timestamp,PM_ch1, PM_ch2, PM_ch3, PM_ch4, PM_ch5) VALUES (?,?,?,?,?,?)'''
|
||||||
|
, (rtc_time_str,channel_1,channel_2,channel_3,channel_4,channel_5))
|
||||||
|
|
||||||
|
cursor.execute('''
|
||||||
|
INSERT INTO data_NPM (timestamp,PM1, PM25, PM10, temp_npm, hum_npm) VALUES (?,?,?,?,?,?)'''
|
||||||
|
, (rtc_time_str,pm1_10s,pm25_10s,pm10_10s,temperature,relative_humidity ))
|
||||||
|
|
||||||
|
# Commit and close the connection
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
|
conn.close()
|
||||||
52
NPM/get_data_temp_hum.py
Normal file
52
NPM/get_data_temp_hum.py
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
'''
|
||||||
|
_ _ ____ __ __
|
||||||
|
| \ | | _ \| \/ |
|
||||||
|
| \| | |_) | |\/| |
|
||||||
|
| |\ | __/| | | |
|
||||||
|
|_| \_|_| |_| |_|
|
||||||
|
|
||||||
|
Script to get NPM values: ONLY temp and hum
|
||||||
|
need parameter: port
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/NPM/get_data_temp_hum.py ttyAMA5
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0]
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port,
|
||||||
|
baudrate=115200,
|
||||||
|
parity=serial.PARITY_EVEN,
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 1
|
||||||
|
)
|
||||||
|
|
||||||
|
ser.write(b'\x81\x14\x6B') # Temp and humidity command
|
||||||
|
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
byte_data_temp_hum = ser.readline()
|
||||||
|
# Decode temperature and humidity values
|
||||||
|
temperature = int.from_bytes(byte_data_temp_hum[3:5], byteorder='big') / 100.0
|
||||||
|
humidity = int.from_bytes(byte_data_temp_hum[5:7], byteorder='big') / 100.0
|
||||||
|
|
||||||
|
print(f"temp: {temperature}")
|
||||||
|
print(f"hum: {humidity}")
|
||||||
|
break
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("User interrupt encountered. Exiting...")
|
||||||
|
time.sleep(3)
|
||||||
|
exit()
|
||||||
|
except:
|
||||||
|
# for all other kinds of error, but not specifying which one
|
||||||
|
print("Unknown error...")
|
||||||
|
time.sleep(3)
|
||||||
|
exit()
|
||||||
|
|
||||||
104
NPM/get_data_v2.py
Normal file
104
NPM/get_data_v2.py
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
'''
|
||||||
|
_ _ ____ __ __
|
||||||
|
| \ | | _ \| \/ |
|
||||||
|
| \| | |_) | |\/| |
|
||||||
|
| |\ | __/| | | |
|
||||||
|
|_| \_|_| |_| |_|
|
||||||
|
|
||||||
|
Script to get NPM values (PM1, PM2.5 and PM10)
|
||||||
|
PM and the sensor temp/hum
|
||||||
|
And store them inside sqlite database
|
||||||
|
Uses RTC module for timing (from SQLite db)
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/NPM/get_data_v2.py
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
import sqlite3
|
||||||
|
import smbus2
|
||||||
|
import time
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
# Connect to the SQLite database
|
||||||
|
conn = sqlite3.connect("/var/www/nebuleair_pro_4g/sqlite/sensors.db")
|
||||||
|
cursor = conn.cursor()
|
||||||
|
|
||||||
|
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 {}
|
||||||
|
|
||||||
|
# Load the configuration data
|
||||||
|
config_file = '/var/www/nebuleair_pro_4g/config.json'
|
||||||
|
config = load_config(config_file)
|
||||||
|
npm_solo_port = config.get('NPM_solo_port', '') #port du NPM solo
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=npm_solo_port,
|
||||||
|
baudrate=115200,
|
||||||
|
parity=serial.PARITY_EVEN,
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 0.5
|
||||||
|
)
|
||||||
|
|
||||||
|
# 1️⃣ Request PM Data (PM1, PM2.5, PM10)
|
||||||
|
|
||||||
|
#ser.write(b'\x81\x11\x6E') #data10s
|
||||||
|
ser.write(b'\x81\x12\x6D') #data60s
|
||||||
|
time.sleep(0.5) # Small delay to allow the sensor to process the request
|
||||||
|
|
||||||
|
#print("Start get_data_v2.py script")
|
||||||
|
byte_data = ser.readline()
|
||||||
|
#print(byte_data)
|
||||||
|
stateByte = int.from_bytes(byte_data[2:3], byteorder='big')
|
||||||
|
Statebits = [int(bit) for bit in bin(stateByte)[2:].zfill(8)]
|
||||||
|
PM1 = int.from_bytes(byte_data[9:11], byteorder='big')/10
|
||||||
|
PM25 = int.from_bytes(byte_data[11:13], byteorder='big')/10
|
||||||
|
PM10 = int.from_bytes(byte_data[13:15], byteorder='big')/10
|
||||||
|
|
||||||
|
# 2️⃣ Request Temperature & Humidity
|
||||||
|
ser.write(b'\x81\x14\x6B') # Temp and humidity command
|
||||||
|
time.sleep(0.5) # Small delay to allow the sensor to process the request
|
||||||
|
byte_data_temp_hum = ser.readline()
|
||||||
|
|
||||||
|
# Decode temperature and humidity values
|
||||||
|
temperature = int.from_bytes(byte_data_temp_hum[3:5], byteorder='big') / 100.0
|
||||||
|
humidity = int.from_bytes(byte_data_temp_hum[5:7], byteorder='big') / 100.0
|
||||||
|
|
||||||
|
#print(f"State: {Statebits}")
|
||||||
|
#print(f"PM1: {PM1}")
|
||||||
|
#print(f"PM25: {PM25}")
|
||||||
|
#print(f"PM10: {PM10}")
|
||||||
|
#print(f"temp: {temperature}")
|
||||||
|
#print(f"hum: {humidity}")
|
||||||
|
|
||||||
|
#GET RTC TIME from SQlite
|
||||||
|
cursor.execute("SELECT * FROM timestamp_table LIMIT 1")
|
||||||
|
row = cursor.fetchone() # Get the first (and only) row
|
||||||
|
rtc_time_str = row[1] # '2025-02-07 12:30:45'
|
||||||
|
|
||||||
|
#save to sqlite database
|
||||||
|
try:
|
||||||
|
cursor.execute('''
|
||||||
|
INSERT INTO data_NPM (timestamp,PM1, PM25, PM10, temp_npm, hum_npm) VALUES (?,?,?,?,?,?)'''
|
||||||
|
, (rtc_time_str,PM1,PM25,PM10,temperature,humidity ))
|
||||||
|
|
||||||
|
# Commit and close the connection
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
|
#print("Sensor data saved successfully!")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Database error: {e}")
|
||||||
|
|
||||||
|
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
|
||||||
172
NPM/old/get_data_modbus_loop.py
Normal file
172
NPM/old/get_data_modbus_loop.py
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
'''
|
||||||
|
Loop to run every minutes
|
||||||
|
|
||||||
|
* * * * * /usr/bin/python3 /var/www/nebuleair_pro_4g/NPM/get_data_modbus_loop.py ttyAMA5
|
||||||
|
|
||||||
|
saves data (avaerage) to a json file /var/www/nebuleair_pro_4g/NPM/data/data.json
|
||||||
|
saves data (all) to a sqlite database
|
||||||
|
|
||||||
|
first time running the script?
|
||||||
|
sudo mkdir /var/www/nebuleair_pro_4g/NPM/data
|
||||||
|
sudo touch /var/www/nebuleair_pro_4g/NPM/data/data.json
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import sys
|
||||||
|
import crcmod
|
||||||
|
import time
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import sqlite3
|
||||||
|
import smbus2 # For RTC DS3231
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
# Ensure a port argument is provided
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
print("Usage: python3 get_data_modbus.py <serial_port>")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
port = '/dev/' + sys.argv[1]
|
||||||
|
|
||||||
|
# Initialize serial communication
|
||||||
|
try:
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port,
|
||||||
|
baudrate=115200,
|
||||||
|
parity=serial.PARITY_EVEN,
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout=0.5
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error opening serial port {port}: {e}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Define Modbus CRC-16 function
|
||||||
|
crc16 = crcmod.predefined.mkPredefinedCrcFun('modbus')
|
||||||
|
|
||||||
|
# Request frame without CRC
|
||||||
|
data = b'\x01\x03\x00\x80\x00\x0A'
|
||||||
|
|
||||||
|
# Calculate CRC
|
||||||
|
crc = crc16(data)
|
||||||
|
crc_low = crc & 0xFF
|
||||||
|
crc_high = (crc >> 8) & 0xFF
|
||||||
|
|
||||||
|
# Append CRC to the frame
|
||||||
|
request = data + bytes([crc_low, crc_high])
|
||||||
|
|
||||||
|
# Log request frame
|
||||||
|
print(f"Request frame: {request.hex()}")
|
||||||
|
|
||||||
|
# Initialize SQLite database
|
||||||
|
conn = sqlite3.connect("/var/www/nebuleair_pro_4g/sqlite/sensors.db")
|
||||||
|
cursor = conn.cursor()
|
||||||
|
|
||||||
|
# RTC Module (DS3231) Setup
|
||||||
|
RTC_I2C_ADDR = 0x68 # DS3231 I2C Address
|
||||||
|
bus = smbus2.SMBus(1)
|
||||||
|
|
||||||
|
def bcd_to_dec(bcd):
|
||||||
|
return (bcd // 16 * 10) + (bcd % 16)
|
||||||
|
|
||||||
|
def get_rtc_time():
|
||||||
|
"""Reads time from RTC module (DS3231)"""
|
||||||
|
try:
|
||||||
|
data = bus.read_i2c_block_data(RTC_I2C_ADDR, 0x00, 7)
|
||||||
|
seconds = bcd_to_dec(data[0] & 0x7F)
|
||||||
|
minutes = bcd_to_dec(data[1])
|
||||||
|
hours = bcd_to_dec(data[2] & 0x3F)
|
||||||
|
day = bcd_to_dec(data[4])
|
||||||
|
month = bcd_to_dec(data[5])
|
||||||
|
year = bcd_to_dec(data[6]) + 2000
|
||||||
|
return datetime(year, month, day, hours, minutes, seconds).strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"RTC Read Error: {e}")
|
||||||
|
return "N/A"
|
||||||
|
|
||||||
|
# Initialize storage for averaging
|
||||||
|
num_samples = 6
|
||||||
|
channel_sums = [0] * 5 # 5 channels
|
||||||
|
|
||||||
|
#do not start immediately to prevent multiple write/read over NPM serial port
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
# Loop 6 times to collect data every 10 seconds
|
||||||
|
for i in range(num_samples):
|
||||||
|
print(f"\nIteration {i+1}/{num_samples}")
|
||||||
|
ser.write(request)
|
||||||
|
rtc_timestamp = get_rtc_time()
|
||||||
|
|
||||||
|
try:
|
||||||
|
byte_data = ser.readline()
|
||||||
|
formatted = ''.join(f'\\x{byte:02x}' for byte in byte_data)
|
||||||
|
print(f"Raw Response: {formatted}")
|
||||||
|
|
||||||
|
if len(byte_data) < 23:
|
||||||
|
print("Incomplete response, skipping this sample.")
|
||||||
|
time.sleep(9)
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Extract and process the 5 channels
|
||||||
|
channels = []
|
||||||
|
for j in range(5):
|
||||||
|
lsw = int.from_bytes(byte_data[3 + j*4 : 5 + j*4], byteorder='little')
|
||||||
|
msw = int.from_bytes(byte_data[5 + j*4 : 7 + j*4], byteorder='little')
|
||||||
|
raw_value = (msw << 16) | lsw
|
||||||
|
channels.append(raw_value)
|
||||||
|
|
||||||
|
# Accumulate sum for each channel
|
||||||
|
for j in range(5):
|
||||||
|
channel_sums[j] += channels[j]
|
||||||
|
|
||||||
|
# Print collected values
|
||||||
|
print(f"Timestamp (RTC): {rtc_timestamp}")
|
||||||
|
for j in range(5):
|
||||||
|
print(f"Channel {j+1}: {channels[j]}")
|
||||||
|
|
||||||
|
|
||||||
|
# Save the individual reading to the database
|
||||||
|
cursor.execute('''
|
||||||
|
INSERT INTO data (timestamp, PM_ch1, PM_ch2, PM_ch3, PM_ch4, PM_ch5)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?)
|
||||||
|
''', (rtc_timestamp, channels[0], channels[1], channels[2], channels[3], channels[4]))
|
||||||
|
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error reading data: {e}")
|
||||||
|
|
||||||
|
# Wait 10 seconds before next reading
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
|
# Compute the average values
|
||||||
|
channel_means = [int(s / num_samples) for s in channel_sums]
|
||||||
|
|
||||||
|
# Create JSON structure
|
||||||
|
data_json = {
|
||||||
|
"channel_1": channel_means[0],
|
||||||
|
"channel_2": channel_means[1],
|
||||||
|
"channel_3": channel_means[2],
|
||||||
|
"channel_4": channel_means[3],
|
||||||
|
"channel_5": channel_means[4]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Print final JSON data
|
||||||
|
print("\nFinal JSON Data (Averaged over 6 readings):")
|
||||||
|
print(json.dumps(data_json, indent=4))
|
||||||
|
|
||||||
|
# Define JSON file path
|
||||||
|
output_file = "/var/www/nebuleair_pro_4g/NPM/data/data.json"
|
||||||
|
|
||||||
|
# Write results to a JSON file
|
||||||
|
try:
|
||||||
|
with open(output_file, "w") as f:
|
||||||
|
json.dump(data_json, f, indent=4)
|
||||||
|
print(f"\nAveraged JSON data saved to {output_file}")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error writing to file: {e}")
|
||||||
|
|
||||||
|
# Close serial connection
|
||||||
|
ser.close()
|
||||||
126
NPM/old/test_modbus.py
Normal file
126
NPM/old/test_modbus.py
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
'''
|
||||||
|
_ _ ____ __ __
|
||||||
|
| \ | | _ \| \/ |
|
||||||
|
| \| | |_) | |\/| |
|
||||||
|
| |\ | __/| | | |
|
||||||
|
|_| \_|_| |_| |_|
|
||||||
|
|
||||||
|
Script to get NPM data via Modbus
|
||||||
|
need parameter: port
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/NPM/old/test_modbus.py
|
||||||
|
|
||||||
|
Modbus RTU
|
||||||
|
[Slave Address][Function Code][Starting Address][Quantity of Registers][CRC]
|
||||||
|
|
||||||
|
Pour récupérer
|
||||||
|
les concentrations en PM1, PM10 et PM2.5 (a partir du registre 0x38)
|
||||||
|
les 5 cannaux
|
||||||
|
Donnée actualisée toutes les 10 secondes
|
||||||
|
|
||||||
|
Request
|
||||||
|
\x01\x03\x00\x38\x00\x55\...\...
|
||||||
|
|
||||||
|
\x01 Slave Address (slave device address)
|
||||||
|
\x03 Function code (read multiple holding registers)
|
||||||
|
\x00\x38 Starting Address (The request starts reading from holding register address x38 or 56)
|
||||||
|
\x00\x55 Quantity of Registers (Requests to read x55 or 85 consecutive registers starting from address 56)
|
||||||
|
\...\... Cyclic Redundancy Check (checksum )
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
import crcmod
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
|
# Connect to the SQLite database
|
||||||
|
conn = sqlite3.connect("/var/www/nebuleair_pro_4g/sqlite/sensors.db")
|
||||||
|
cursor = conn.cursor()
|
||||||
|
|
||||||
|
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 {}
|
||||||
|
|
||||||
|
# Load the configuration data
|
||||||
|
config_file = '/var/www/nebuleair_pro_4g/config.json'
|
||||||
|
config = load_config(config_file)
|
||||||
|
npm_solo_port = config.get('NPM_solo_port', '') #port du NPM solo
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=npm_solo_port,
|
||||||
|
baudrate=115200,
|
||||||
|
parity=serial.PARITY_EVEN,
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 0.5
|
||||||
|
)
|
||||||
|
|
||||||
|
# Define Modbus CRC-16 function
|
||||||
|
crc16 = crcmod.predefined.mkPredefinedCrcFun('modbus')
|
||||||
|
|
||||||
|
# Request frame without CRC
|
||||||
|
data = b'\x01\x03\x00\x44\x00\x06'
|
||||||
|
|
||||||
|
# Calculate CRC
|
||||||
|
crc = crc16(data)
|
||||||
|
crc_low = crc & 0xFF
|
||||||
|
crc_high = (crc >> 8) & 0xFF
|
||||||
|
|
||||||
|
# Append CRC to the frame
|
||||||
|
request = data + bytes([crc_low, crc_high])
|
||||||
|
#print(f"Request frame: {request.hex()}")
|
||||||
|
|
||||||
|
ser.write(request)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
byte_data = ser.readline()
|
||||||
|
formatted = ''.join(f'\\x{byte:02x}' for byte in byte_data)
|
||||||
|
print(formatted)
|
||||||
|
|
||||||
|
if len(byte_data) < 14:
|
||||||
|
print(f"Error: Received {len(byte_data)} bytes, expected 14!")
|
||||||
|
continue
|
||||||
|
|
||||||
|
#10 secs concentration
|
||||||
|
|
||||||
|
lsw_pm1 = int.from_bytes(byte_data[3:5], byteorder='big')
|
||||||
|
msw_pm1 = int.from_bytes(byte_data[5:7], byteorder='big')
|
||||||
|
raw_value_pm1 = (msw_pm1 << 16) | lsw_pm1
|
||||||
|
raw_value_pm1 = raw_value_pm1 / 1000
|
||||||
|
|
||||||
|
lsw_pm25 = int.from_bytes(byte_data[7:9], byteorder='big')
|
||||||
|
msw_pm25 = int.from_bytes(byte_data[9:11], byteorder='big')
|
||||||
|
raw_value_pm25 = (msw_pm25 << 16) | lsw_pm25
|
||||||
|
raw_value_pm25 = raw_value_pm25 / 1000
|
||||||
|
|
||||||
|
|
||||||
|
lsw_pm10 = int.from_bytes(byte_data[11:13], byteorder='big')
|
||||||
|
msw_pm10 = int.from_bytes(byte_data[13:15], byteorder='big')
|
||||||
|
raw_value_pm10 = (msw_pm10 << 16) | lsw_pm10
|
||||||
|
raw_value_pm10 = raw_value_pm10 / 1000
|
||||||
|
|
||||||
|
print("1 min")
|
||||||
|
print(f"PM1: {raw_value_pm1}")
|
||||||
|
print(f"PM2.5: {raw_value_pm25}")
|
||||||
|
print(f"PM10: {raw_value_pm10}")
|
||||||
|
|
||||||
|
break
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("User interrupt encountered. Exiting...")
|
||||||
|
time.sleep(3)
|
||||||
|
exit()
|
||||||
|
except:
|
||||||
|
# for all other kinds of error, but not specifying which one
|
||||||
|
print("Unknown error...")
|
||||||
|
time.sleep(3)
|
||||||
|
exit()
|
||||||
|
|
||||||
|
conn.close()
|
||||||
173
README.md
Normal file
173
README.md
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
# moduleair_pro_4g
|
||||||
|
Version Pro du ModuleAir avec CM4, SaraR4 et ecran Matrix LED p2 64x64.
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
## General
|
||||||
|
```
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install git gh apache2 php php-sqlite3 python3 python3-pip jq g++ autossh i2c-tools python3-smbus -y
|
||||||
|
sudo pip3 install pyserial requests sensirion-shdlc-sfa3x RPi.GPIO adafruit-circuitpython-bme280 crcmod psutil --break-system-packages
|
||||||
|
sudo gh auth login
|
||||||
|
git config --global user.email "paulvuarambon@gmail.com"
|
||||||
|
git config --global user.name "PaulVua"
|
||||||
|
sudo gh repo clone aircarto/moduleair_pro_4g /var/www/moduleair_pro_4g
|
||||||
|
sudo mkdir /var/www/moduleair_pro_4g/logs
|
||||||
|
sudo touch /var/www/moduleair_pro_4g/logs/app.log /var/www/moduleair_pro_4g/logs/loop.log matrix/input_NPM.txt matrix/input_MHZ16.txt
|
||||||
|
sudo cp /var/www/moduleair_pro_4g/config.json.dist /var/www/moduleair_pro_4g/config.json
|
||||||
|
sudo chmod -R 777 /var/www/moduleair_pro_4g/
|
||||||
|
```
|
||||||
|
|
||||||
|
## Apache
|
||||||
|
Configuration of Apache to redirect to the html homepage project
|
||||||
|
```
|
||||||
|
sudo sed -i 's|DocumentRoot /var/www/html|DocumentRoot /var/www/moduleair_pro_4g|' /etc/apache2/sites-available/000-default.conf
|
||||||
|
sudo systemctl reload apache2
|
||||||
|
```
|
||||||
|
|
||||||
|
## Serial
|
||||||
|
|
||||||
|
Need to open all the uart port by modifying `/boot/firmware/config.txt`
|
||||||
|
|
||||||
|
```
|
||||||
|
enable_uart=1
|
||||||
|
dtoverlay=uart0
|
||||||
|
dtoverlay=uart1
|
||||||
|
dtoverlay=uart2
|
||||||
|
dtoverlay=uart3
|
||||||
|
dtoverlay=uart4
|
||||||
|
dtoverlay=uart5
|
||||||
|
```
|
||||||
|
And reboot !
|
||||||
|
|
||||||
|
Then we need to authorize connection over device on `/etc/ttyAMA*`
|
||||||
|
```
|
||||||
|
sudo chmod 777 /dev/ttyAMA*
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sudo athorization
|
||||||
|
To make things simpler we will allow all users to use "nmcli" as sudo without entering password. For that we need to open the sudoers file with `sudo visudo` and add this to the bottom of the file:
|
||||||
|
```
|
||||||
|
ALL ALL=(ALL) NOPASSWD: /usr/bin/nmcli, /usr/sbin/reboot
|
||||||
|
www-data ALL=(ALL) NOPASSWD: /usr/bin/git pull
|
||||||
|
www-data ALL=(ALL) NOPASSWD: /usr/bin/ssh
|
||||||
|
www-data ALL=(ALL) NOPASSWD: /usr/bin/python3 *
|
||||||
|
```
|
||||||
|
|
||||||
|
## Matrix LED
|
||||||
|
|
||||||
|
### Library
|
||||||
|
|
||||||
|
To use the Matrix LED on the RPI we will use the [rpi-rgb-led-matrix](https://github.com/hzeller/rpi-rgb-led-matrix) repository from hzeller.
|
||||||
|
|
||||||
|
Before compiling any code we need the **include** folder and the **lib** folder from the library. Then we can compile any .cc code with g++.
|
||||||
|
```
|
||||||
|
g++ -Iinclude -Llib test.cc -o test -lrgbmatrix
|
||||||
|
sudo ./test --led-no-hardware-pulse --led-row-addr-type=3
|
||||||
|
```
|
||||||
|
|
||||||
|
### Pinout
|
||||||
|
|
||||||
|
Details of connection bewtween components can be found [here](https://docs.google.com/spreadsheets/d/1EJoq7nlJIN9nd_CbVmmozsGb-Ntp0cyxrEt9vokqc6g/edit?usp=sharing).
|
||||||
|
Some pins for the Matrix need to change because they use uart pins. For this we need to change pins inside `/lib/hardware-mapping.c` and recompile the library:
|
||||||
|
```
|
||||||
|
cd /var/www/moduleair_pro_4g/matrix/lib
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
### Matrix 64x32
|
||||||
|
|
||||||
|
Pour la matrix 64x32 (celle du ModuleAir mini) on utilise le pinout "regular"
|
||||||
|
|
||||||
|
Tests avec la biblio de hzeller sur un RPi4:
|
||||||
|
```
|
||||||
|
sudo examples-api-use/demo -D0 \
|
||||||
|
--led-no-hardware-pulse \
|
||||||
|
--led-chain=1 \
|
||||||
|
--led-cols=64 \
|
||||||
|
--led-rows=32 \
|
||||||
|
--led-gpio-mapping=regular
|
||||||
|
```
|
||||||
|
|
||||||
|
### Matrix 128x64
|
||||||
|
|
||||||
|
Pour le grand écran il faut mettre sur ground deux pins (E et D) et ajouter la commande `--led-row-addr-type=3` car il s'agit d'un panneau de type "ABC".
|
||||||
|
Il faut aussi préciser le type de chip-set avec `--led-panel-type=FM6126A`
|
||||||
|
|
||||||
|
Test avec la biblio de hzeller sur un RPi4:
|
||||||
|
```
|
||||||
|
sudo examples-api-use/demo -D0 \
|
||||||
|
--led-no-hardware-pulse \
|
||||||
|
--led-chain=1 \
|
||||||
|
--led-cols=128 \
|
||||||
|
--led-rows=64 \
|
||||||
|
--led-gpio-mapping=regular \
|
||||||
|
--led-row-addr-type=3 \
|
||||||
|
--led-parallel=1 \
|
||||||
|
--led-panel-type=FM6126A
|
||||||
|
```
|
||||||
|
|
||||||
|
Pour tester sur la CM4
|
||||||
|
```
|
||||||
|
sudo ./test_forms --led-no-hardware-pulse
|
||||||
|
```
|
||||||
|
|
||||||
|
### Fonts
|
||||||
|
|
||||||
|
Font "6x9.bdf" is 7 pixels height +1 (top) +1 (bottom) = 9 height.
|
||||||
|
Font "8x13.bdf" is 9 pixels height +2 (top) +2 (bottom) = 13 height.
|
||||||
|
Font "8x18.bdf" is 14 pixels height +2 (top) +2 (bottom) = 13 height.
|
||||||
|
|
||||||
|
### Troubleshooting
|
||||||
|
|
||||||
|
Switch off on-board sound:
|
||||||
|
* `dtparam=audio=off` in `/boot/firmware/config.txt`
|
||||||
|
* Add the file `sudo nano /etc/modprobe.d/blacklist.conf` with `blacklist snd_bcm2835`
|
||||||
|
* Command `lsmod | grep snd_bcm2835` should anwser nothing
|
||||||
|
|
||||||
|
Add `isolcpus=3` to `/boot/firmware/cmdline.txt`
|
||||||
|
|
||||||
|
## Start matrix loop at boot
|
||||||
|
|
||||||
|
We can use systemd to create a service (better than con because Cron doesn’t monitor the script; if it fails, it won’t restart automatically.).
|
||||||
|
```
|
||||||
|
sudo nano /etc/systemd/system/matrix_display.service
|
||||||
|
```
|
||||||
|
|
||||||
|
and we add the following:
|
||||||
|
```
|
||||||
|
[Unit]
|
||||||
|
Description=Matrix Display Script
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/var/www/moduleair_pro_4g/matrix/screen_sensors_loop
|
||||||
|
WorkingDirectory=/var/www/moduleair_pro_4g/matrix
|
||||||
|
Restart=always
|
||||||
|
User=root
|
||||||
|
Group=root
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
```
|
||||||
|
|
||||||
|
Then Reload systemd and Enable the Service:
|
||||||
|
```
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable matrix_display.service
|
||||||
|
sudo systemctl start matrix_display.service
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
You can check/restart/stop this service (restart combines stop and start)
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo systemctl status matrix_display.service
|
||||||
|
sudo systemctl stop matrix_display.service
|
||||||
|
sudo systemctl restart matrix_display.service
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
87
SARA/MQTT/get_config.py
Normal file
87
SARA/MQTT/get_config.py
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
'''
|
||||||
|
Script to see get the SARA R4 MQTT config
|
||||||
|
ex:
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/MQTT/get_config.py ttyAMA2 2
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0] # ex: ttyAMA2
|
||||||
|
timeout = float(parameter[1]) # ex:2
|
||||||
|
|
||||||
|
yellow_color = "\033[33m" # ANSI escape code for yellow
|
||||||
|
red_color = "\033[31m" # ANSI escape code for red
|
||||||
|
reset_color = "\033[0m" # Reset color to default
|
||||||
|
green_color = "\033[32m" # Green
|
||||||
|
|
||||||
|
#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):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
elif time.time() > end_time:
|
||||||
|
break
|
||||||
|
time.sleep(0.1) # Short sleep to prevent busy waiting
|
||||||
|
|
||||||
|
# Decode the response and filter out empty lines
|
||||||
|
decoded_response = response.decode('utf-8')
|
||||||
|
non_empty_lines = "\n".join(line for line in decoded_response.splitlines() if line.strip())
|
||||||
|
|
||||||
|
# Add yellow color to the output
|
||||||
|
|
||||||
|
colored_output = f"{yellow_color}{non_empty_lines}\n{reset_color}"
|
||||||
|
|
||||||
|
return colored_output
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = timeout
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
ser.write(b'AT+UMQTT?\r') #General Information
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
response_SARA_1 = read_complete_response(ser)
|
||||||
|
print(response_SARA_1)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser.is_open:
|
||||||
|
ser.close()
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
90
SARA/MQTT/login_logout.py
Normal file
90
SARA/MQTT/login_logout.py
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
'''
|
||||||
|
Script to see get the SARA R4 MQTT config
|
||||||
|
ex:
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/MQTT/login_logout.py ttyAMA2 1 2
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0] # ex: ttyAMA2
|
||||||
|
login_logout = int(parameter[1]) # ex:1
|
||||||
|
timeout = float(parameter[2]) # ex:2
|
||||||
|
|
||||||
|
|
||||||
|
yellow_color = "\033[33m" # ANSI escape code for yellow
|
||||||
|
red_color = "\033[31m" # ANSI escape code for red
|
||||||
|
reset_color = "\033[0m" # Reset color to default
|
||||||
|
green_color = "\033[32m" # Green
|
||||||
|
|
||||||
|
#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):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
elif time.time() > end_time:
|
||||||
|
break
|
||||||
|
time.sleep(0.1) # Short sleep to prevent busy waiting
|
||||||
|
|
||||||
|
# Decode the response and filter out empty lines
|
||||||
|
decoded_response = response.decode('utf-8')
|
||||||
|
non_empty_lines = "\n".join(line for line in decoded_response.splitlines() if line.strip())
|
||||||
|
|
||||||
|
# Add yellow color to the output
|
||||||
|
|
||||||
|
colored_output = f"{yellow_color}{non_empty_lines}\n{reset_color}"
|
||||||
|
|
||||||
|
return colored_output
|
||||||
|
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = timeout
|
||||||
|
)
|
||||||
|
|
||||||
|
command = f'AT+UMQTTC={login_logout}\r'
|
||||||
|
ser.write((command + '\r').encode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
response_SARA_1 = read_complete_response(ser)
|
||||||
|
print(response_SARA_1)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser.is_open:
|
||||||
|
ser.close()
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
89
SARA/MQTT/publish.py
Normal file
89
SARA/MQTT/publish.py
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
'''
|
||||||
|
Script to publish a message via MQTT
|
||||||
|
|
||||||
|
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/MQTT/publish.py ttyAMA2 Hello 2
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
port='/dev/'+parameter[0] # ex: ttyAMA2
|
||||||
|
message = parameter[1] # ex: Hello
|
||||||
|
timeout = float(parameter[2]) # ex:2
|
||||||
|
|
||||||
|
yellow_color = "\033[33m" # ANSI escape code for yellow
|
||||||
|
red_color = "\033[31m" # ANSI escape code for red
|
||||||
|
reset_color = "\033[0m" # Reset color to default
|
||||||
|
green_color = "\033[32m" # Green
|
||||||
|
|
||||||
|
def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
elif time.time() > end_time:
|
||||||
|
break
|
||||||
|
time.sleep(0.1) # Short sleep to prevent busy waiting
|
||||||
|
|
||||||
|
# Decode the response and filter out empty lines
|
||||||
|
decoded_response = response.decode('utf-8')
|
||||||
|
non_empty_lines = "\n".join(line for line in decoded_response.splitlines() if line.strip())
|
||||||
|
|
||||||
|
# Add yellow color to the output
|
||||||
|
|
||||||
|
colored_output = f"{yellow_color}{non_empty_lines}\n{reset_color}"
|
||||||
|
|
||||||
|
return colored_output
|
||||||
|
|
||||||
|
|
||||||
|
#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)
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = timeout
|
||||||
|
)
|
||||||
|
|
||||||
|
command = f'AT+UMQTTC=2,0,0,"notif","{message}"\r'
|
||||||
|
ser.write((command + '\r').encode('utf-8'))
|
||||||
|
|
||||||
|
try:
|
||||||
|
response_SARA_1 = read_complete_response(ser)
|
||||||
|
print(response_SARA_1)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser.is_open:
|
||||||
|
ser.close()
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
94
SARA/MQTT/set_config.py
Normal file
94
SARA/MQTT/set_config.py
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
'''
|
||||||
|
Script to connect set the MQTT config
|
||||||
|
1: local TCP port number
|
||||||
|
2: server name
|
||||||
|
3: server IP addr
|
||||||
|
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/MQTT/set_config.py ttyAMA2 2 aircarto.fr 2
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
port='/dev/'+parameter[0] # ex: ttyAMA2
|
||||||
|
config_id = parameter[1] # ex: 1
|
||||||
|
config_value = parameter[2] # ex: aircarto.fr
|
||||||
|
|
||||||
|
timeout = float(parameter[3]) # ex:2
|
||||||
|
|
||||||
|
yellow_color = "\033[33m" # ANSI escape code for yellow
|
||||||
|
red_color = "\033[31m" # ANSI escape code for red
|
||||||
|
reset_color = "\033[0m" # Reset color to default
|
||||||
|
green_color = "\033[32m" # Green
|
||||||
|
|
||||||
|
def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
elif time.time() > end_time:
|
||||||
|
break
|
||||||
|
time.sleep(0.1) # Short sleep to prevent busy waiting
|
||||||
|
|
||||||
|
# Decode the response and filter out empty lines
|
||||||
|
decoded_response = response.decode('utf-8')
|
||||||
|
non_empty_lines = "\n".join(line for line in decoded_response.splitlines() if line.strip())
|
||||||
|
|
||||||
|
# Add yellow color to the output
|
||||||
|
|
||||||
|
colored_output = f"{yellow_color}{non_empty_lines}\n{reset_color}"
|
||||||
|
|
||||||
|
return colored_output
|
||||||
|
|
||||||
|
|
||||||
|
#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)
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = timeout
|
||||||
|
)
|
||||||
|
|
||||||
|
command = f'AT+UMQTT={config_id},"{config_value}"\r'
|
||||||
|
ser.write((command + '\r').encode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
response_SARA_1 = read_complete_response(ser)
|
||||||
|
print(response_SARA_1)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser.is_open:
|
||||||
|
ser.close()
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
BIN
SARA/SSL/certificate/e5.der
Normal file
BIN
SARA/SSL/certificate/e5.der
Normal file
Binary file not shown.
17
SARA/SSL/certificate/e5.pem
Normal file
17
SARA/SSL/certificate/e5.pem
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICtDCCAjugAwIBAgIQGG511O6woF39Lagghl0eMTAKBggqhkjOPQQDAzBPMQsw
|
||||||
|
CQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2gg
|
||||||
|
R3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMjAeFw0yNDAzMTMwMDAwMDBaFw0y
|
||||||
|
NzAzMTIyMzU5NTlaMDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNy
|
||||||
|
eXB0MQswCQYDVQQDEwJFNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABA0LOoprYY62
|
||||||
|
79xfWOfGQkVUq2P2ZmFICi5ZdbSBAjdQtz8WedyY7KEol3IgHCzP1XxSIE5UeFuE
|
||||||
|
FGvAkK6F7MBRQTxah38GTdT+YNH6bC3hfZUQiKIIVA+ZGkzm6gqs2KOB+DCB9TAO
|
||||||
|
BgNVHQ8BAf8EBAMCAYYwHQYDVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMBMBIG
|
||||||
|
A1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFJ8rX888IU+dBLftKyzExnCL0tcN
|
||||||
|
MB8GA1UdIwQYMBaAFHxClq7eS0g7+pL4nozPbYupcjeVMDIGCCsGAQUFBwEBBCYw
|
||||||
|
JDAiBggrBgEFBQcwAoYWaHR0cDovL3gyLmkubGVuY3Iub3JnLzATBgNVHSAEDDAK
|
||||||
|
MAgGBmeBDAECATAnBgNVHR8EIDAeMBygGqAYhhZodHRwOi8veDIuYy5sZW5jci5v
|
||||||
|
cmcvMAoGCCqGSM49BAMDA2cAMGQCMBttLkVBHEU+2V80GHRnE3m6qym1thBOgydK
|
||||||
|
i0VOx3vP9EAwHWGl5hxtpJAJkm5GSwIwRikYhDR6vPve2BvYGacE9ct+522E2dqO
|
||||||
|
6s42MLmigEws5mASS6l2quhtlUfacgkM
|
||||||
|
-----END CERTIFICATE-----
|
||||||
BIN
SARA/SSL/certificate/e6.der
Normal file
BIN
SARA/SSL/certificate/e6.der
Normal file
Binary file not shown.
17
SARA/SSL/certificate/e6.pem
Normal file
17
SARA/SSL/certificate/e6.pem
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICtjCCAjygAwIBAgIRAICpc0jvJ2ip4/a7Q8D5xikwCgYIKoZIzj0EAwMwTzEL
|
||||||
|
MAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNo
|
||||||
|
IEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDIwHhcNMjQwMzEzMDAwMDAwWhcN
|
||||||
|
MjcwMzEyMjM1OTU5WjAyMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNTGV0J3MgRW5j
|
||||||
|
cnlwdDELMAkGA1UEAxMCRTYwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAATZ8Z5Gh/gh
|
||||||
|
cWCoJuuj+rnq2h25EqfUJtlRFLFhfHWWvyILOR/VvtEKRqotPEoJhC6+QJVV6RlA
|
||||||
|
N2Z17TJOdwRJ+HB7wxjnzvdxEP6sdNgA1O1tHHMWMxCcOrLqbGL0vbijgfgwgfUw
|
||||||
|
DgYDVR0PAQH/BAQDAgGGMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDATAS
|
||||||
|
BgNVHRMBAf8ECDAGAQH/AgEAMB0GA1UdDgQWBBSTJ0aYA6lRaI6Y1sRCSNsjv1iU
|
||||||
|
0jAfBgNVHSMEGDAWgBR8Qpau3ktIO/qS+J6Mz22LqXI3lTAyBggrBgEFBQcBAQQm
|
||||||
|
MCQwIgYIKwYBBQUHMAKGFmh0dHA6Ly94Mi5pLmxlbmNyLm9yZy8wEwYDVR0gBAww
|
||||||
|
CjAIBgZngQwBAgEwJwYDVR0fBCAwHjAcoBqgGIYWaHR0cDovL3gyLmMubGVuY3Iu
|
||||||
|
b3JnLzAKBggqhkjOPQQDAwNoADBlAjBgGMvAszhCd1BsRuMwGYCC0QCzf5d//MC5
|
||||||
|
ASqIyswj3hGcoZREOKDKdvJPHhgdZr8CMQCWq4Kjl/RmuF49LBq9eP7oGWAc55w4
|
||||||
|
G72FoKw5a9WywSwBzoJunrayTB8nDSjEhu8=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
BIN
SARA/SSL/certificate/isrg-root-x2.der
Normal file
BIN
SARA/SSL/certificate/isrg-root-x2.der
Normal file
Binary file not shown.
BIN
SARA/SSL/certificate/isrgrootx1.der
Normal file
BIN
SARA/SSL/certificate/isrgrootx1.der
Normal file
Binary file not shown.
31
SARA/SSL/certificate/isrgrootx1.pem
Normal file
31
SARA/SSL/certificate/isrgrootx1.pem
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
|
||||||
|
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
|
||||||
|
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
|
||||||
|
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
|
||||||
|
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
|
||||||
|
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
|
||||||
|
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
|
||||||
|
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
|
||||||
|
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
|
||||||
|
T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
|
||||||
|
B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC
|
||||||
|
B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv
|
||||||
|
KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn
|
||||||
|
OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn
|
||||||
|
jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw
|
||||||
|
qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI
|
||||||
|
rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
|
||||||
|
HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq
|
||||||
|
hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
|
||||||
|
ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ
|
||||||
|
3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK
|
||||||
|
NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5
|
||||||
|
ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
|
||||||
|
TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
|
||||||
|
jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
|
||||||
|
oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
|
||||||
|
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
|
||||||
|
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
|
||||||
|
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
BIN
SARA/SSL/certificate/r11.der
Normal file
BIN
SARA/SSL/certificate/r11.der
Normal file
Binary file not shown.
29
SARA/SSL/certificate/r11.pem
Normal file
29
SARA/SSL/certificate/r11.pem
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIFBjCCAu6gAwIBAgIRAIp9PhPWLzDvI4a9KQdrNPgwDQYJKoZIhvcNAQELBQAw
|
||||||
|
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
|
||||||
|
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMjQwMzEzMDAwMDAw
|
||||||
|
WhcNMjcwMzEyMjM1OTU5WjAzMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNTGV0J3Mg
|
||||||
|
RW5jcnlwdDEMMAoGA1UEAxMDUjExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
|
||||||
|
CgKCAQEAuoe8XBsAOcvKCs3UZxD5ATylTqVhyybKUvsVAbe5KPUoHu0nsyQYOWcJ
|
||||||
|
DAjs4DqwO3cOvfPlOVRBDE6uQdaZdN5R2+97/1i9qLcT9t4x1fJyyXJqC4N0lZxG
|
||||||
|
AGQUmfOx2SLZzaiSqhwmej/+71gFewiVgdtxD4774zEJuwm+UE1fj5F2PVqdnoPy
|
||||||
|
6cRms+EGZkNIGIBloDcYmpuEMpexsr3E+BUAnSeI++JjF5ZsmydnS8TbKF5pwnnw
|
||||||
|
SVzgJFDhxLyhBax7QG0AtMJBP6dYuC/FXJuluwme8f7rsIU5/agK70XEeOtlKsLP
|
||||||
|
Xzze41xNG/cLJyuqC0J3U095ah2H2QIDAQABo4H4MIH1MA4GA1UdDwEB/wQEAwIB
|
||||||
|
hjAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwEgYDVR0TAQH/BAgwBgEB
|
||||||
|
/wIBADAdBgNVHQ4EFgQUxc9GpOr0w8B6bJXELbBeki8m47kwHwYDVR0jBBgwFoAU
|
||||||
|
ebRZ5nu25eQBc4AIiMgaWPbpm24wMgYIKwYBBQUHAQEEJjAkMCIGCCsGAQUFBzAC
|
||||||
|
hhZodHRwOi8veDEuaS5sZW5jci5vcmcvMBMGA1UdIAQMMAowCAYGZ4EMAQIBMCcG
|
||||||
|
A1UdHwQgMB4wHKAaoBiGFmh0dHA6Ly94MS5jLmxlbmNyLm9yZy8wDQYJKoZIhvcN
|
||||||
|
AQELBQADggIBAE7iiV0KAxyQOND1H/lxXPjDj7I3iHpvsCUf7b632IYGjukJhM1y
|
||||||
|
v4Hz/MrPU0jtvfZpQtSlET41yBOykh0FX+ou1Nj4ScOt9ZmWnO8m2OG0JAtIIE38
|
||||||
|
01S0qcYhyOE2G/93ZCkXufBL713qzXnQv5C/viOykNpKqUgxdKlEC+Hi9i2DcaR1
|
||||||
|
e9KUwQUZRhy5j/PEdEglKg3l9dtD4tuTm7kZtB8v32oOjzHTYw+7KdzdZiw/sBtn
|
||||||
|
UfhBPORNuay4pJxmY/WrhSMdzFO2q3Gu3MUBcdo27goYKjL9CTF8j/Zz55yctUoV
|
||||||
|
aneCWs/ajUX+HypkBTA+c8LGDLnWO2NKq0YD/pnARkAnYGPfUDoHR9gVSp/qRx+Z
|
||||||
|
WghiDLZsMwhN1zjtSC0uBWiugF3vTNzYIEFfaPG7Ws3jDrAMMYebQ95JQ+HIBD/R
|
||||||
|
PBuHRTBpqKlyDnkSHDHYPiNX3adPoPAcgdF3H2/W0rmoswMWgTlLn1Wu0mrks7/q
|
||||||
|
pdWfS6PJ1jty80r2VKsM/Dj3YIDfbjXKdaFU5C+8bhfJGqU3taKauuz0wHVGT3eo
|
||||||
|
6FlWkWYtbt4pgdamlwVeZEW+LM7qZEJEsMNPrfC03APKmZsJgpWCDWOKZvkZcvjV
|
||||||
|
uYkQ4omYCTX5ohy+knMjdOmdH9c7SpqEWBDC86fiNex+O0XOMEZSa8DA
|
||||||
|
-----END CERTIFICATE-----
|
||||||
35
SARA/SSL/curl_script.sh
Normal file
35
SARA/SSL/curl_script.sh
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# to run this script ./curl_script.sh
|
||||||
|
|
||||||
|
# URL to send the request
|
||||||
|
URL_microSpot="http://api-prod.uspot.probesys.net:81/nebuleair?token=2AFF6dQk68daFZ"
|
||||||
|
URL_microSpot_HTTPS="https://api-prod.uspot.probesys.net:443/nebuleair?token=2AFF6dQk68daFZ"
|
||||||
|
URL_airCarto_HTTPS="https://aircarto.fr/tests/test.php"
|
||||||
|
URL_webhook="https://webhook.site/6bee2237-099a-4ff4-8452-9f4126df7151"
|
||||||
|
|
||||||
|
CERT_PATH="/var/www/nebuleair_pro_4g/SARA/SSL/certificate/e6.pem"
|
||||||
|
CIPHER="TLS_AES_256_GCM_SHA384"
|
||||||
|
#CIPHER="TLS_AES_256_GCM_SHA384"
|
||||||
|
#CIPHER="POLY1305_SHA256"
|
||||||
|
|
||||||
|
# JSON payload to send
|
||||||
|
PAYLOAD='{
|
||||||
|
"nebuleairid": "C04F8B8D3A08",
|
||||||
|
"software_version": "ModuleAir-V1-012023",
|
||||||
|
"sensordatavalues": [
|
||||||
|
{"value_type": "NPM_P0", "value": "2.3"},
|
||||||
|
{"value_type": "NPM_P0", "value": "3.30"},
|
||||||
|
{"value_type": "NPM_P1", "value": "9.05"},
|
||||||
|
{"value_type": "NPM_P2", "value": "20.60"},
|
||||||
|
{"value_type": "NPM_N1", "value": "49.00"},
|
||||||
|
{"value_type": "NPM_N10", "value": "49.00"},
|
||||||
|
{"value_type": "NPM_N25", "value": "49.00"}
|
||||||
|
]
|
||||||
|
}'
|
||||||
|
|
||||||
|
# Perform the curl command
|
||||||
|
curl --http1.1 -v -X POST "$URL_microSpot_HTTPS" \
|
||||||
|
--tlsv1.2 \
|
||||||
|
--cacert "$CERT_PATH" \
|
||||||
|
-d "$PAYLOAD"
|
||||||
134
SARA/SSL/full_test_HTTP.py
Normal file
134
SARA/SSL/full_test_HTTP.py
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
'''
|
||||||
|
Script to set the URL for a HTTP request and trigger the POST Request
|
||||||
|
Ex:
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTP.py ttyAMA2 data.nebuleair.fr
|
||||||
|
To do: need to add profile id as parameter
|
||||||
|
|
||||||
|
First profile id:
|
||||||
|
AT+UHTTP=0,1,"data.nebuleair.fr"
|
||||||
|
Second profile id:
|
||||||
|
AT+UHTTP=1,1,"api-prod.uspot.probesys.net"
|
||||||
|
Third profile id:
|
||||||
|
AT+UHTTP=2,1,"aircarto.fr"
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0] # ex: ttyAMA2
|
||||||
|
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)
|
||||||
|
|
||||||
|
def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2, wait_for_line=None):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
start_time = time.time()
|
||||||
|
|
||||||
|
while True:
|
||||||
|
elapsed_time = time.time() - start_time # Time since function start
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
|
||||||
|
# Decode and check for the specific line
|
||||||
|
if wait_for_line:
|
||||||
|
decoded_response = response.decode('utf-8', errors='replace')
|
||||||
|
if wait_for_line in decoded_response:
|
||||||
|
print(f"[DEBUG] 🔎Found target line: {wait_for_line}")
|
||||||
|
break
|
||||||
|
elif time.time() > end_time:
|
||||||
|
print(f"[DEBUG] Timeout reached. No more data received.")
|
||||||
|
break
|
||||||
|
time.sleep(0.1) # Short sleep to prevent busy waiting
|
||||||
|
# Final response and debug output
|
||||||
|
total_elapsed_time = time.time() - start_time
|
||||||
|
print(f"[DEBUG] ⏱️ elapsed time: {total_elapsed_time:.2f}s. ⏱️")
|
||||||
|
return response.decode('utf-8', errors='replace')
|
||||||
|
|
||||||
|
ser_sara = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
|
||||||
|
#step 4: set url (op_code = 1)
|
||||||
|
print("****")
|
||||||
|
print("SET URL")
|
||||||
|
command = f'AT+UHTTP={profile_id},1,"{url}"\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_5)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 4: set PORT (op_code = 5)
|
||||||
|
print("****")
|
||||||
|
print("SET PORT")
|
||||||
|
command = f'AT+UHTTP={profile_id},5,80\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_55 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_55)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
#step 4: trigger the request
|
||||||
|
print("****")
|
||||||
|
print("Trigger POST REQUEST")
|
||||||
|
command = f'AT+UHTTPC={profile_id},1,"/pro_4G/test.php","http.resp"\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_6 = read_complete_response(ser_sara, timeout=5, end_of_response_timeout=50, wait_for_line="+UUHTTPCR")
|
||||||
|
|
||||||
|
print(response_SARA_6)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#READ REPLY
|
||||||
|
print("****")
|
||||||
|
print("Read reply from server")
|
||||||
|
ser_sara.write(b'AT+URDFILE="http.resp"\r')
|
||||||
|
response_SARA_7 = read_complete_response(ser_sara)
|
||||||
|
print("Reply from server:")
|
||||||
|
print(response_SARA_7)
|
||||||
|
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser_sara.is_open:
|
||||||
|
ser_sara.close()
|
||||||
|
print("****")
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
160
SARA/SSL/full_test_HTTPS.py
Normal file
160
SARA/SSL/full_test_HTTPS.py
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
'''
|
||||||
|
Script to set the URL for a HTTP request and trigger the POST Request
|
||||||
|
Ex:
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS.py ttyAMA2 api-prod.uspot.probesys.net
|
||||||
|
|
||||||
|
To do: need to add profile id as parameter
|
||||||
|
|
||||||
|
First profile id:
|
||||||
|
AT+UHTTP=0,1,"data.nebuleair.fr"
|
||||||
|
Second profile id:
|
||||||
|
AT+UHTTP=1,1,"api-prod.uspot.probesys.net"
|
||||||
|
Third profile id:
|
||||||
|
AT+UHTTP=2,1,"aircarto.fr"
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0] # ex: ttyAMA2
|
||||||
|
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)
|
||||||
|
|
||||||
|
def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
elif time.time() > end_time:
|
||||||
|
break
|
||||||
|
time.sleep(0.1) # Short sleep to prevent busy waiting
|
||||||
|
|
||||||
|
return response.decode('utf-8', errors='replace')
|
||||||
|
|
||||||
|
ser_sara = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
#step 1: import the certificate
|
||||||
|
print("****")
|
||||||
|
print("Add certificate")
|
||||||
|
with open("/var/www/nebuleair_pro_4g/SARA/SSL/isrgrootx1.der", "rb") as cert_file:
|
||||||
|
certificate = cert_file.read()
|
||||||
|
|
||||||
|
size_of_string = len(certificate)
|
||||||
|
|
||||||
|
command = f'AT+USECMNG=0,0,"myCertificate2",{size_of_string}\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_1 = read_complete_response(ser_sara)
|
||||||
|
print("Write certificate metadata")
|
||||||
|
print(response_SARA_1)
|
||||||
|
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
ser_sara.write(certificate)
|
||||||
|
response_SARA_2 = read_complete_response(ser_sara)
|
||||||
|
print("Write certificate data")
|
||||||
|
print(response_SARA_2)
|
||||||
|
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
#step 4: set url (op_code = 1)
|
||||||
|
print("****")
|
||||||
|
print("SET URL")
|
||||||
|
command = f'AT+UHTTP={profile_id},1,"{url}"\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_5)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 4: set PORT (op_code = 5)
|
||||||
|
print("****")
|
||||||
|
print("SET PORT")
|
||||||
|
command = f'AT+UHTTP={profile_id},5,443\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_55 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_55)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 4: set url to SSL (op_code = 6) (http_secure = 1 for HTTPS)(USECMNG_PROFILE = 2)
|
||||||
|
print("****")
|
||||||
|
print("SET SSL")
|
||||||
|
command = f'AT+UHTTP={profile_id},6,1\r'
|
||||||
|
ser_sara.write(command.encode('utf-8'))
|
||||||
|
response_SARA_5 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_5)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 4: trigger the request (http_command=1 for GET)
|
||||||
|
print("****")
|
||||||
|
print("Trigger POST REQUEST")
|
||||||
|
command = f'AT+UHTTPC={profile_id},1,"/tests/test.php","https.resp"\r'
|
||||||
|
#command = f'AT+UHTTPC={profile_id},1,"/nebuleair?token=2AFF6dQk68daFZ","https.resp"\r'
|
||||||
|
|
||||||
|
ser_sara.write(command.encode('utf-8'))
|
||||||
|
|
||||||
|
# Wait for the +UUHTTPCR response
|
||||||
|
print("Waiting for +UUHTTPCR response...")
|
||||||
|
|
||||||
|
response_received = False
|
||||||
|
while not response_received:
|
||||||
|
response = read_complete_response(ser_sara, timeout=5)
|
||||||
|
print(response)
|
||||||
|
if "+UUHTTPCR" in response:
|
||||||
|
response_received = True
|
||||||
|
|
||||||
|
#READ REPLY
|
||||||
|
print("****")
|
||||||
|
print("Read reply from server")
|
||||||
|
ser_sara.write(b'AT+URDFILE="https.resp"\r')
|
||||||
|
response_SARA_7 = read_complete_response(ser_sara)
|
||||||
|
print("Reply from server:")
|
||||||
|
print(response_SARA_7)
|
||||||
|
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser_sara.is_open:
|
||||||
|
ser_sara.close()
|
||||||
|
print("****")
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
358
SARA/SSL/full_test_HTTPS_POST.py
Normal file
358
SARA/SSL/full_test_HTTPS_POST.py
Normal file
@@ -0,0 +1,358 @@
|
|||||||
|
'''
|
||||||
|
Script to set the URL for a HTTP request and trigger the POST Request
|
||||||
|
Ex:
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS_POST.py ttyAMA2 api-prod.uspot.probesys.net /nebuleair?token=2AFF6dQk68daFZ
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS_POST.py ttyAMA2 webhook.site /0904d7b1-2558-43b9-8b35-df5bc40df967
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS_POST.py ttyAMA2 aircarto.fr /tests/test.php
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS_POST.py ttyAMA2 ssl.aircarto.fr /test.php
|
||||||
|
|
||||||
|
|
||||||
|
First profile id:
|
||||||
|
AT+UHTTP=0,1,"data.nebuleair.fr"
|
||||||
|
Second profile id:
|
||||||
|
AT+UHTTP=1,1,"api-prod.uspot.probesys.net"
|
||||||
|
Third profile id:
|
||||||
|
AT+UHTTP=2,1,"aircarto.fr"
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0] # ex: ttyAMA2
|
||||||
|
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)
|
||||||
|
|
||||||
|
def color_text(text, color):
|
||||||
|
colors = {
|
||||||
|
"red": "\033[31m",
|
||||||
|
"green": "\033[32m",
|
||||||
|
"yellow": "\033[33m",
|
||||||
|
"blue": "\033[34m",
|
||||||
|
"magenta": "\033[35m",
|
||||||
|
"cyan": "\033[36m",
|
||||||
|
"white": "\033[37m",
|
||||||
|
}
|
||||||
|
reset = "\033[0m"
|
||||||
|
return f"{colors.get(color, '')}{text}{reset}"
|
||||||
|
|
||||||
|
def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2, wait_for_line=None):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
start_time = time.time()
|
||||||
|
|
||||||
|
while True:
|
||||||
|
elapsed_time = time.time() - start_time # Time since function start
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
|
||||||
|
# Decode and check for the specific line
|
||||||
|
if wait_for_line:
|
||||||
|
decoded_response = response.decode('utf-8', errors='replace')
|
||||||
|
if wait_for_line in decoded_response:
|
||||||
|
print(f"[DEBUG] 🔎Found target line: {wait_for_line}")
|
||||||
|
break
|
||||||
|
elif time.time() > end_time:
|
||||||
|
print(f"[DEBUG] Timeout reached. No more data received.")
|
||||||
|
break
|
||||||
|
time.sleep(0.1) # Short sleep to prevent busy waiting
|
||||||
|
# Final response and debug output
|
||||||
|
total_elapsed_time = time.time() - start_time
|
||||||
|
print(f"[DEBUG] ⏱️ elapsed time: {total_elapsed_time:.2f}s. ⏱️")
|
||||||
|
return response.decode('utf-8', errors='replace')
|
||||||
|
|
||||||
|
ser_sara = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
#step 1: import the certificate
|
||||||
|
print("****")
|
||||||
|
certificate_name = "e6"
|
||||||
|
with open("/var/www/nebuleair_pro_4g/SARA/SSL/certificate/e6.pem", "rb") as cert_file:
|
||||||
|
certificate = cert_file.read()
|
||||||
|
size_of_string = len(certificate)
|
||||||
|
|
||||||
|
print("\033[0;33m Import certificate\033[0m")
|
||||||
|
# AT+USECMNG=0,<type>,<internal_name>,<data_size>
|
||||||
|
# type-> 0 -> trusted root CA
|
||||||
|
command = f'AT+USECMNG=0,0,"{certificate_name}",{size_of_string}\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_1 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_1)
|
||||||
|
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
print("\033[0;33mAdd certificate\033[0m")
|
||||||
|
ser_sara.write(certificate)
|
||||||
|
response_SARA_2 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_2)
|
||||||
|
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
#check certificate (List all available certificates and private keys)
|
||||||
|
print("\033[0;33mCheck certificate\033[0m")
|
||||||
|
command = f'AT+USECMNG=3\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5b = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_5b)
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
# *******************************
|
||||||
|
# SECURITY PROFILE
|
||||||
|
# AT+USECPRF=<profile_id>[,<op_code>[,<param_val>]]
|
||||||
|
security_profile_id = 1
|
||||||
|
|
||||||
|
|
||||||
|
# op_code: 0 -> certificate validation level
|
||||||
|
# param_val : 0 -> Level 0 No validation; 1-> Level 1 Root certificate validation
|
||||||
|
print("\033[0;33mSet the security profile (params)\033[0m")
|
||||||
|
certification_level=0
|
||||||
|
command = f'AT+USECPRF={security_profile_id},0,{certification_level}\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5b = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_5b)
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
# op_code: 1 -> minimum SSL/TLS version
|
||||||
|
# param_val : 0 -> any; server can use any version for the connection; 1-> LSv1.0; 2->TLSv1.1; 3->TLSv1.2;
|
||||||
|
print("\033[0;33mSet the security profile (params)\033[0m")
|
||||||
|
minimum_SSL_version = 0
|
||||||
|
command = f'AT+USECPRF={security_profile_id},1,{minimum_SSL_version}\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5bb = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_5bb)
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
#op_code: 2 -> legacy cipher suite selection
|
||||||
|
# 0 (factory-programmed value): a list of default cipher suites is proposed at the beginning of handshake process, and a cipher suite will be negotiated among the cipher suites proposed in the list.
|
||||||
|
print("\033[0;33mSet cipher \033[0m")
|
||||||
|
cipher_suite = 0
|
||||||
|
command = f'AT+USECPRF={security_profile_id},2,{cipher_suite}\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5cc = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_5cc)
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
# op_code: 3 -> trusted root certificate internal name
|
||||||
|
print("\033[0;33mSet the security profile (choose cert)\033[0m")
|
||||||
|
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_line="OK")
|
||||||
|
print(response_SARA_5c)
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
# op_code: 10 -> SNI (server name indication)
|
||||||
|
print("\033[0;33mSet the SNI\033[0m")
|
||||||
|
command = f'AT+USECPRF={security_profile_id},10,"{url}"\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5cf = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_5cf)
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
|
||||||
|
# *************************
|
||||||
|
# *************************
|
||||||
|
|
||||||
|
|
||||||
|
#step 4: set url (op_code = 1)
|
||||||
|
print("\033[0;33mSET URL\033[0m")
|
||||||
|
command = f'AT+UHTTP={profile_id},1,"{url}"\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_5)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 4: set PORT (op_code = 5)
|
||||||
|
print("\033[0;33mSET PORT\033[0m")
|
||||||
|
port = 443
|
||||||
|
command = f'AT+UHTTP={profile_id},5,{port}\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_55 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_55)
|
||||||
|
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")
|
||||||
|
http_secure = 1
|
||||||
|
command = f'AT+UHTTP={profile_id},6,{http_secure},{security_profile_id}\r'
|
||||||
|
#command = f'AT+UHTTP={profile_id},6,{http_secure}\r'
|
||||||
|
|
||||||
|
ser_sara.write(command.encode('utf-8'))
|
||||||
|
response_SARA_5 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_5)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
# Write Data to saraR4
|
||||||
|
payload_json = {
|
||||||
|
"nebuleairid": "C04F8B8D3A08",
|
||||||
|
"software_version": "ModuleAir-V1-012023",
|
||||||
|
"sensordatavalues": [
|
||||||
|
{
|
||||||
|
"value_type": "NPM_P0",
|
||||||
|
"value": "2.3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_P0",
|
||||||
|
"value": "3.30"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_P1",
|
||||||
|
"value": "9.05"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_P2",
|
||||||
|
"value": "20.60"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_N1",
|
||||||
|
"value": "49.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_N10",
|
||||||
|
"value": "49.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_N25",
|
||||||
|
"value": "49.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "BME280_temperature",
|
||||||
|
"value": "25.82"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
# 1. Open sensordata_csv.json (with correct data size)
|
||||||
|
payload_string = json.dumps(payload_json) # Convert dict to JSON string
|
||||||
|
size_of_string = len(payload_string)
|
||||||
|
print("\033[0;33mOPEN JSON\033[0m")
|
||||||
|
command = f'AT+UDWNFILE="sensordata_json.json",{size_of_string}\r'
|
||||||
|
ser_sara.write(command.encode('utf-8'))
|
||||||
|
response_SARA_1 = read_complete_response(ser_sara, wait_for_line=">")
|
||||||
|
print(response_SARA_1)
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
#2. Write to shell
|
||||||
|
print("\033[0;33mWrite to Memory\033[0m")
|
||||||
|
ser_sara.write(payload_string.encode())
|
||||||
|
response_SARA_2 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_2)
|
||||||
|
|
||||||
|
#step 4: trigger the request (http_command=1 for GET and http_command=1 for POST)
|
||||||
|
print("****")
|
||||||
|
print("\033[0;33mPOST REQUEST\033[0m")
|
||||||
|
#parameter (POST)
|
||||||
|
command = f'AT+UHTTPC={profile_id},4,"{endpoint}","https.resp","sensordata_json.json",4\r'
|
||||||
|
#AIRCARTO
|
||||||
|
#command = f'AT+UHTTPC={profile_id},4,"/tests/test.php","https.resp","sensordata_json.json",4\r'
|
||||||
|
#uSPOT
|
||||||
|
#command = f'AT+UHTTPC={profile_id},4,"/nebuleair?token=2AFF6dQk68daFZ","https.resp","sensordata_json.json",4\r'
|
||||||
|
#AtmoSud
|
||||||
|
#command = f'AT+UHTTPC={profile_id},1,"/","https.resp"\r'
|
||||||
|
#Webhook
|
||||||
|
#command = f'AT+UHTTPC={profile_id},4,"/6bee2237-099a-4ff4-8452-9f4126df7151","https.resp","sensordata_json.json",4\r'
|
||||||
|
|
||||||
|
|
||||||
|
ser_sara.write(command.encode('utf-8'))
|
||||||
|
|
||||||
|
# Wait for the +UUHTTPCR response
|
||||||
|
print("Waiting for +UUHTTPCR response...")
|
||||||
|
|
||||||
|
response_SARA_3 = read_complete_response(ser_sara, timeout=5, end_of_response_timeout=50, wait_for_line="+UUHTTPCR")
|
||||||
|
|
||||||
|
print("\033[0;34m")
|
||||||
|
print(response_SARA_3)
|
||||||
|
print("\033[0m")
|
||||||
|
|
||||||
|
if "+UUHTTPCR" in response_SARA_3:
|
||||||
|
print("✅ Received +UUHTTPCR response.")
|
||||||
|
lines = response_SARA_3.strip().splitlines()
|
||||||
|
http_response = lines[-1] # "+UUHTTPCR: 0,4,0"
|
||||||
|
parts = http_response.split(',')
|
||||||
|
# code 0 (HTTP failed)
|
||||||
|
if len(parts) == 3 and parts[-1] == '0': # The third value indicates success
|
||||||
|
print("\033[0;31mATTENTION: HTTP operation failed\033[0m")
|
||||||
|
else:
|
||||||
|
print("\033[0;32m HTTP operation successful!!!\033[0m")
|
||||||
|
|
||||||
|
|
||||||
|
#READ REPLY
|
||||||
|
print("****")
|
||||||
|
print("\033[0;33mREPLY SERVER\033[0m")
|
||||||
|
ser_sara.write(b'AT+URDFILE="https.resp"\r')
|
||||||
|
response_SARA_7 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print("Reply from server:")
|
||||||
|
|
||||||
|
print("\033[0;32m")
|
||||||
|
print(response_SARA_7)
|
||||||
|
print("\033[0m")
|
||||||
|
|
||||||
|
#5. empty json
|
||||||
|
print("\033[0;33mEmpty Memory\033[0m")
|
||||||
|
ser_sara.write(b'AT+UDELFILE="sensordata_json.json"\r')
|
||||||
|
response_SARA_8 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_8)
|
||||||
|
|
||||||
|
# Get error code
|
||||||
|
print("\033[0;33mGet error code\033[0m")
|
||||||
|
command = f'AT+UHTTPER={profile_id}\r'
|
||||||
|
ser_sara.write(command.encode('utf-8'))
|
||||||
|
response_SARA_9 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_9)
|
||||||
|
|
||||||
|
'''
|
||||||
|
+UHTTPER: profile_id,error_class,error_code
|
||||||
|
|
||||||
|
error_class
|
||||||
|
0 OK, no error
|
||||||
|
3 HTTP Protocol error class
|
||||||
|
10 Wrong HTTP API USAGE
|
||||||
|
|
||||||
|
error_code (for error_class 3 or 10)
|
||||||
|
0 No error
|
||||||
|
11 Server connection error
|
||||||
|
22 PSD or CSD connection not established
|
||||||
|
73 Secure socket connect error
|
||||||
|
'''
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser_sara.is_open:
|
||||||
|
ser_sara.close()
|
||||||
|
print("****")
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
207
SARA/SSL/full_test_HTTP_POST.py
Normal file
207
SARA/SSL/full_test_HTTP_POST.py
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
'''
|
||||||
|
Script to set the URL for a HTTP request and trigger the POST Request
|
||||||
|
FONCTIONNE SUR data.nebuleair.fr
|
||||||
|
FONCTIONNE SUR uSpot
|
||||||
|
Ex:
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTP_POST.py ttyAMA2 api-prod.uspot.probesys.net
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTP_POST.py ttyAMA2 aircarto.fr /tests/test.php
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTP_POST.py ttyAMA2 ssl.aircarto.fr /test.php
|
||||||
|
|
||||||
|
To do: need to add profile id as parameter
|
||||||
|
|
||||||
|
First profile id:
|
||||||
|
AT+UHTTP=0,1,"data.nebuleair.fr"
|
||||||
|
Second profile id:
|
||||||
|
AT+UHTTP=1,1,"api-prod.uspot.probesys.net"
|
||||||
|
Third profile id:
|
||||||
|
AT+UHTTP=2,1,"aircarto.fr"
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0] # ex: ttyAMA2
|
||||||
|
url = parameter[1] # ex: data.mobileair.fr
|
||||||
|
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)
|
||||||
|
|
||||||
|
def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
elif time.time() > end_time:
|
||||||
|
break
|
||||||
|
time.sleep(0.1) # Short sleep to prevent busy waiting
|
||||||
|
|
||||||
|
return response.decode('utf-8', errors='replace')
|
||||||
|
|
||||||
|
ser_sara = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
#step 4: set url (op_code = 1)
|
||||||
|
print("****")
|
||||||
|
print("SET URL")
|
||||||
|
command = f'AT+UHTTP={profile_id},1,"{url}"\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_5)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
#step 4: set PORT (op_code = 5)
|
||||||
|
print("****")
|
||||||
|
print("SET PORT")
|
||||||
|
command = f'AT+UHTTP={profile_id},5,80\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_55 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_55)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
# Write Data to saraR4
|
||||||
|
payload_json = {
|
||||||
|
"nebuleairid": "C04F8B8D3A08",
|
||||||
|
"software_version": "ModuleAir-V1-012023",
|
||||||
|
"sensordatavalues": [
|
||||||
|
{
|
||||||
|
"value_type": "NPM_P0",
|
||||||
|
"value": "2.3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_P0",
|
||||||
|
"value": "3.30"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_P1",
|
||||||
|
"value": "9.05"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_P2",
|
||||||
|
"value": "20.60"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_N1",
|
||||||
|
"value": "49.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_N10",
|
||||||
|
"value": "49.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_N25",
|
||||||
|
"value": "49.00"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
payload_csv = [None] * 20
|
||||||
|
payload_csv[0] = 1
|
||||||
|
payload_csv[1] = 1
|
||||||
|
payload_csv[2] = 1
|
||||||
|
#csv_string = ','.join(str(value) if value is not None else '' for value in payload_csv)
|
||||||
|
#size_of_string = len(csv_string)
|
||||||
|
|
||||||
|
# 1. Open sensordata_csv.json (with correct data size)
|
||||||
|
payload_string = json.dumps(payload_json) # Convert dict to JSON string
|
||||||
|
size_of_string = len(payload_string)
|
||||||
|
command = f'AT+UDWNFILE="sensordata_json.json",{size_of_string}\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_1 = read_complete_response(ser_sara)
|
||||||
|
print("Open JSON:")
|
||||||
|
print(response_SARA_1)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#2. Write to shell
|
||||||
|
ser_sara.write(payload_string.encode())
|
||||||
|
response_SARA_2 = read_complete_response(ser_sara)
|
||||||
|
print("Write to memory:")
|
||||||
|
print(response_SARA_2)
|
||||||
|
|
||||||
|
#step 4: trigger the request (http_command=1 for GET and http_command=1 for POST)
|
||||||
|
print("****")
|
||||||
|
print("Trigger POST REQUEST")
|
||||||
|
command = f'AT+UHTTPC={profile_id},4,"{endpoint}","http.resp","sensordata_json.json",4\r'
|
||||||
|
#AirCarto
|
||||||
|
#command = f'AT+UHTTPC={profile_id},1,"/tests/test.php","http.resp"\r'
|
||||||
|
#command = f'AT+UHTTPC={profile_id},4,"/wifi.php","http.resp","sensordata_json.json",4\r'
|
||||||
|
#command = f'AT+UHTTPC={profile_id},4,"/pro_4G/data.php?sensor_id=52E7573A","http.resp","sensordata_json.json",4\r'
|
||||||
|
#AtmoSud
|
||||||
|
#command = f'AT+UHTTPC={profile_id},4,"/nebuleair?token=2AFF6dQk68daFZ","http.resp","sensordata_json.json",4\r'
|
||||||
|
|
||||||
|
|
||||||
|
ser_sara.write(command.encode('utf-8'))
|
||||||
|
|
||||||
|
# Wait for the +UUHTTPCR response
|
||||||
|
print("Waiting for +UUHTTPCR response...")
|
||||||
|
|
||||||
|
response_received = False
|
||||||
|
while not response_received:
|
||||||
|
response = read_complete_response(ser_sara, timeout=5)
|
||||||
|
print(response)
|
||||||
|
if "+UUHTTPCR" in response:
|
||||||
|
response_received = True
|
||||||
|
|
||||||
|
#READ REPLY
|
||||||
|
print("****")
|
||||||
|
print("Read reply from server")
|
||||||
|
ser_sara.write(b'AT+URDFILE="http.resp"\r')
|
||||||
|
response_SARA_7 = read_complete_response(ser_sara)
|
||||||
|
print("Reply from server:")
|
||||||
|
print(response_SARA_7)
|
||||||
|
|
||||||
|
#5. empty json
|
||||||
|
print("Empty SARA memory:")
|
||||||
|
ser_sara.write(b'AT+UDELFILE="sensordata_json.json"\r')
|
||||||
|
response_SARA_8 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_8)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser_sara.is_open:
|
||||||
|
ser_sara.close()
|
||||||
|
print("****")
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
35
SARA/SSL/old/ISRGRootX1.txt
Normal file
35
SARA/SSL/old/ISRGRootX1.txt
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
00:ad:e8:24:73:f4:14:37:f3:9b:9e:2b:57:28:1c:
|
||||||
|
87:be:dc:b7:df:38:90:8c:6e:3c:e6:57:a0:78:f7:
|
||||||
|
75:c2:a2:fe:f5:6a:6e:f6:00:4f:28:db:de:68:86:
|
||||||
|
6c:44:93:b6:b1:63:fd:14:12:6b:bf:1f:d2:ea:31:
|
||||||
|
9b:21:7e:d1:33:3c:ba:48:f5:dd:79:df:b3:b8:ff:
|
||||||
|
12:f1:21:9a:4b:c1:8a:86:71:69:4a:66:66:6c:8f:
|
||||||
|
7e:3c:70:bf:ad:29:22:06:f3:e4:c0:e6:80:ae:e2:
|
||||||
|
4b:8f:b7:99:7e:94:03:9f:d3:47:97:7c:99:48:23:
|
||||||
|
53:e8:38:ae:4f:0a:6f:83:2e:d1:49:57:8c:80:74:
|
||||||
|
b6:da:2f:d0:38:8d:7b:03:70:21:1b:75:f2:30:3c:
|
||||||
|
fa:8f:ae:dd:da:63:ab:eb:16:4f:c2:8e:11:4b:7e:
|
||||||
|
cf:0b:e8:ff:b5:77:2e:f4:b2:7b:4a:e0:4c:12:25:
|
||||||
|
0c:70:8d:03:29:a0:e1:53:24:ec:13:d9:ee:19:bf:
|
||||||
|
10:b3:4a:8c:3f:89:a3:61:51:de:ac:87:07:94:f4:
|
||||||
|
63:71:ec:2e:e2:6f:5b:98:81:e1:89:5c:34:79:6c:
|
||||||
|
76:ef:3b:90:62:79:e6:db:a4:9a:2f:26:c5:d0:10:
|
||||||
|
e1:0e:de:d9:10:8e:16:fb:b7:f7:a8:f7:c7:e5:02:
|
||||||
|
07:98:8f:36:08:95:e7:e2:37:96:0d:36:75:9e:fb:
|
||||||
|
0e:72:b1:1d:9b:bc:03:f9:49:05:d8:81:dd:05:b4:
|
||||||
|
2a:d6:41:e9:ac:01:76:95:0a:0f:d8:df:d5:bd:12:
|
||||||
|
1f:35:2f:28:17:6c:d2:98:c1:a8:09:64:77:6e:47:
|
||||||
|
37:ba:ce:ac:59:5e:68:9d:7f:72:d6:89:c5:06:41:
|
||||||
|
29:3e:59:3e:dd:26:f5:24:c9:11:a7:5a:a3:4c:40:
|
||||||
|
1f:46:a1:99:b5:a7:3a:51:6e:86:3b:9e:7d:72:a7:
|
||||||
|
12:05:78:59:ed:3e:51:78:15:0b:03:8f:8d:d0:2f:
|
||||||
|
05:b2:3e:7b:4a:1c:4b:73:05:12:fc:c6:ea:e0:50:
|
||||||
|
13:7c:43:93:74:b3:ca:74:e7:8e:1f:01:08:d0:30:
|
||||||
|
d4:5b:71:36:b4:07:ba:c1:30:30:5c:48:b7:82:3b:
|
||||||
|
98:a6:7d:60:8a:a2:a3:29:82:cc:ba:bd:83:04:1b:
|
||||||
|
a2:83:03:41:a1:d6:05:f1:1b:c2:b6:f0:a8:7c:86:
|
||||||
|
3b:46:a8:48:2a:88:dc:76:9a:76:bf:1f:6a:a5:3d:
|
||||||
|
19:8f:eb:38:f3:64:de:c8:2b:0d:0a:28:ff:f7:db:
|
||||||
|
e2:15:42:d4:22:d0:27:5d:e1:79:fe:18:e7:70:88:
|
||||||
|
ad:4e:e6:d9:8b:3a:c6:dd:27:51:6e:ff:bc:64:f5:
|
||||||
|
33:43:4f
|
||||||
182
SARA/SSL/old/full_test_HTTPS.py
Normal file
182
SARA/SSL/old/full_test_HTTPS.py
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
'''
|
||||||
|
Script to set the URL for a HTTP request and trigger the POST Request
|
||||||
|
Ex:
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/full_test_HTTPS.py ttyAMA2 aircarto.fr
|
||||||
|
To do: need to add profile id as parameter
|
||||||
|
|
||||||
|
First profile id:
|
||||||
|
AT+UHTTP=0,1,"data.nebuleair.fr"
|
||||||
|
Second profile id:
|
||||||
|
AT+UHTTP=1,1,"api-prod.uspot.probesys.net"
|
||||||
|
Third profile id:
|
||||||
|
AT+UHTTP=2,1,"aircarto.fr"
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
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)
|
||||||
|
|
||||||
|
def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2, wait_for_line=None):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
start_time = time.time()
|
||||||
|
|
||||||
|
while True:
|
||||||
|
elapsed_time = time.time() - start_time # Time since function start
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
|
||||||
|
# Decode and check for the specific line
|
||||||
|
if wait_for_line:
|
||||||
|
decoded_response = response.decode('utf-8', errors='replace')
|
||||||
|
if wait_for_line in decoded_response:
|
||||||
|
print(f"[DEBUG] 🔎Found target line: {wait_for_line}")
|
||||||
|
break
|
||||||
|
elif time.time() > end_time:
|
||||||
|
print(f"[DEBUG] Timeout reached. No more data received.")
|
||||||
|
break
|
||||||
|
time.sleep(0.1) # Short sleep to prevent busy waiting
|
||||||
|
# Final response and debug output
|
||||||
|
total_elapsed_time = time.time() - start_time
|
||||||
|
print(f"[DEBUG] ⏱️ elapsed time: {total_elapsed_time:.2f}s. ⏱️")
|
||||||
|
return response.decode('utf-8', errors='replace')
|
||||||
|
|
||||||
|
ser_sara = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
#step 1: import the certificate
|
||||||
|
print("****")
|
||||||
|
print("Add certificate")
|
||||||
|
with open("/var/www/nebuleair_pro_4g/SARA/SSL/isrgrootx1.der", "rb") as cert_file:
|
||||||
|
certificate = cert_file.read()
|
||||||
|
|
||||||
|
size_of_string = len(certificate)
|
||||||
|
|
||||||
|
command = f'AT+USECMNG=0,0,"myCertificate2",{size_of_string}\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_1 = read_complete_response(ser_sara)
|
||||||
|
print("Write certificate metadata")
|
||||||
|
print(response_SARA_1)
|
||||||
|
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
ser_sara.write(certificate)
|
||||||
|
response_SARA_2 = read_complete_response(ser_sara)
|
||||||
|
print("Write certificate data")
|
||||||
|
print(response_SARA_2)
|
||||||
|
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 2: set the security profile 2 to trusted root
|
||||||
|
|
||||||
|
print("****")
|
||||||
|
print("SET security profile")
|
||||||
|
command = f'AT+USECPRF=2,0,1\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_3 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_3)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 3: set the security profile 2 to the imported certificate
|
||||||
|
|
||||||
|
print("****")
|
||||||
|
print("SET certificate")
|
||||||
|
command = f'AT+USECPRF=2,3,"myCertificate2"\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_4 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_4)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 4: set url
|
||||||
|
print("****")
|
||||||
|
print("SET URL")
|
||||||
|
command = f'AT+UHTTP=1,1,"{url}"\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_5)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 4: set url
|
||||||
|
print("****")
|
||||||
|
print("SET PORT")
|
||||||
|
command = f'AT+UHTTP=1,5,443\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_55 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_55)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
#step 4: set url to SSL
|
||||||
|
print("****")
|
||||||
|
print("SET SSL")
|
||||||
|
command = f'AT+UHTTP=1,6,1,2\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_5)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 4: trigger the request
|
||||||
|
print("****")
|
||||||
|
print("Trigger POST REQUEST")
|
||||||
|
command = f'AT+UHTTPC=1,1,"/tests/test.php","https.resp"\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_6 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_6)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#READ REPLY
|
||||||
|
print("****")
|
||||||
|
print("Read reply from server")
|
||||||
|
ser_sara.write(b'AT+URDFILE="https.resp"\r')
|
||||||
|
response_SARA_7 = read_complete_response(ser_sara)
|
||||||
|
print("Reply from server:")
|
||||||
|
print(response_SARA_7)
|
||||||
|
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser_sara.is_open:
|
||||||
|
ser_sara.close()
|
||||||
|
print("****")
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
83
SARA/SSL/old/sara_add_certif.py
Normal file
83
SARA/SSL/old/sara_add_certif.py
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
'''
|
||||||
|
Script to add the SSL certificate
|
||||||
|
ex:
|
||||||
|
python3 /var/www/nebuleair_pro_4g/SARA/SSL/sara_add_certif.py ttyAMA2 2
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0] # ex: ttyAMA2
|
||||||
|
timeout = float(parameter[1]) # 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)
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = timeout
|
||||||
|
)
|
||||||
|
def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
elif time.time() > end_time:
|
||||||
|
break
|
||||||
|
time.sleep(0.1) # Short sleep to prevent busy waiting
|
||||||
|
|
||||||
|
return response.decode('utf-8')
|
||||||
|
|
||||||
|
try:
|
||||||
|
certificate='00:ad:e8:24:73:f4:14:37:f3:9b:9e:2b:57:28:1c:87:be:dc:b7:df:38:90:8c:6e:3c:e6:57:a0:78:f7:75:c2:a2:fe:f5:6a:6e:f6:00:4f:28:db:de:68:86:6c:44:93:b6:b1:63:fd:14:12:6b:bf:1f:d2:ea:31:9b:21:7e:d1:33:3c:ba:48:f5:dd:79:df:b3:b8:ff:12:f1:21:9a:4b:c1:8a:86:71:69:4a:66:66:6c:8f:7e:3c:70:bf:ad:29:22:06:f3:e4:c0:e6:80:ae:e2:4b:8f:b7:99:7e:94:03:9f:d3:47:97:7c:99:48:23:53:e8:38:ae:4f:0a:6f:83:2e:d1:49:57:8c:80:74:b6:da:2f:d0:38:8d:7b:03:70:21:1b:75:f2:30:3c:fa:8f:ae:dd:da:63:ab:eb:16:4f:c2:8e:11:4b:7e:cf:0b:e8:ff:b5:77:2e:f4:b2:7b:4a:e0:4c:12:25:0c:70:8d:03:29:a0:e1:53:24:ec:13:d9:ee:19:bf:10:b3:4a:8c:3f:89:a3:61:51:de:ac:87:07:94:f4:63:71:ec:2e:e2:6f:5b:98:81:e1:89:5c:34:79:6c:76:ef:3b:90:62:79:e6:db:a4:9a:2f:26:c5:d0:10:e1:0e:de:d9:10:8e:16:fb:b7:f7:a8:f7:c7:e5:02:07:98:8f:36:08:95:e7:e2:37:96:0d:36:75:9e:fb:0e:72:b1:1d:9b:bc:03:f9:49:05:d8:81:dd:05:b4:2a:d6:41:e9:ac:01:76:95:0a:0f:d8:df:d5:bd:12:1f:35:2f:28:17:6c:d2:98:c1:a8:09:64:77:6e:47:37:ba:ce:ac:59:5e:68:9d:7f:72:d6:89:c5:06:41:29:3e:59:3e:dd:26:f5:24:c9:11:a7:5a:a3:4c:40:1f:46:a1:99:b5:a7:3a:51:6e:86:3b:9e:7d:72:a7:12:05:78:59:ed:3e:51:78:15:0b:03:8f:8d:d0:2f:05:b2:3e:7b:4a:1c:4b:73:05:12:fc:c6:ea:e0:50:13:7c:43:93:74:b3:ca:74:e7:8e:1f:01:08:d0:30:d4:5b:71:36:b4:07:ba:c1:30:30:5c:48:b7:82:3b:98:a6:7d:60:8a:a2:a3:29:82:cc:ba:bd:83:04:1b:a2:83:03:41:a1:d6:05:f1:1b:c2:b6:f0:a8:7c:86:3b:46:a8:48:2a:88:dc:76:9a:76:bf:1f:6a:a5:3d:19:8f:eb:38:f3:64:de:c8:2b:0d:0a:28:ff:f7:db:e2:15:42:d4:22:d0:27:5d:e1:79:fe:18:e7:70:88:ad:4e:e6:d9:8b:3a:c6:dd:27:51:6e:ff:bc:64:f5:33:43:4f'
|
||||||
|
size_of_string = len(certificate)
|
||||||
|
|
||||||
|
command = f'AT+USECMNG=0,0,"myCertificate",{size_of_string}\r'
|
||||||
|
ser.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_1 = read_complete_response(ser)
|
||||||
|
print("Write certificate")
|
||||||
|
print(response_SARA_1)
|
||||||
|
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
ser.write(certificate.encode())
|
||||||
|
response_SARA_2 = read_complete_response(ser)
|
||||||
|
print("Write to memory:")
|
||||||
|
print(response_SARA_2)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser.is_open:
|
||||||
|
ser.close()
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
74
SARA/SSL/old/sara_read_certif.py
Normal file
74
SARA/SSL/old/sara_read_certif.py
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
'''
|
||||||
|
Script to add the SSL certificate
|
||||||
|
ex:
|
||||||
|
python3 /var/www/nebuleair_pro_4g/SARA/SSL/sara_read_certif.py ttyAMA2 2
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0] # ex: ttyAMA2
|
||||||
|
timeout = float(parameter[1]) # 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)
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = timeout
|
||||||
|
)
|
||||||
|
def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
elif time.time() > end_time:
|
||||||
|
break
|
||||||
|
time.sleep(0.1) # Short sleep to prevent busy waiting
|
||||||
|
|
||||||
|
return response.decode('utf-8')
|
||||||
|
|
||||||
|
ser.write(b'AT+USECMNG=3')
|
||||||
|
|
||||||
|
try:
|
||||||
|
response2 = read_complete_response(ser)
|
||||||
|
print("Response:")
|
||||||
|
print(response2)
|
||||||
|
print("<----")
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser.is_open:
|
||||||
|
ser.close()
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
5
SARA/SSL/open_ssl_script.sh
Normal file
5
SARA/SSL/open_ssl_script.sh
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
openssl s_client -connect aircarto.fr:443 -cipher TLS_AES_256_GCM_SHA384
|
||||||
|
openssl s_client -connect aircarto.fr:443 -tls1_3 -ciphersuites TLS_AES_256_GCM_SHA384
|
||||||
|
openssl s_client -connect api-prod.uspot.probesys.net:443 -tls1_2 -ciphersuites TLS_AES_256_GCM_SHA384 -CAfile /var/www/nebuleair_pro_4g/SARA/SSL/certificate/isrgrootx1.pem
|
||||||
|
openssl s_client -connect aircarto.fr:443 -tls1_2 -ciphersuites TLS_AES_256_GCM_SHA384 -CAfile /var/www/nebuleair_pro_4g/SARA/SSL/certificate/isrgrootx1.pem
|
||||||
149
SARA/SSL/prepareUspotProfile.py
Normal file
149
SARA/SSL/prepareUspotProfile.py
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
'''
|
||||||
|
Script to set the URL for a HTTP request
|
||||||
|
Ex:
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/prepareUspotProfile.py ttyAMA2 api-prod.uspot.probesys.net
|
||||||
|
To do: need to add profile id as parameter
|
||||||
|
|
||||||
|
First profile id:
|
||||||
|
AT+UHTTP=0,1,"data.nebuleair.fr"
|
||||||
|
Second profile id:
|
||||||
|
AT+UHTTP=1,1,"api-prod.uspot.probesys.net"
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
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)
|
||||||
|
|
||||||
|
def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
elif time.time() > end_time:
|
||||||
|
break
|
||||||
|
time.sleep(0.1) # Short sleep to prevent busy waiting
|
||||||
|
|
||||||
|
return response.decode('utf-8', errors='replace')
|
||||||
|
|
||||||
|
ser_sara = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
#step 1: import the certificate
|
||||||
|
print("****")
|
||||||
|
print("Add certificate")
|
||||||
|
with open("/var/www/nebuleair_pro_4g/SARA/SSL/isrgrootx1.der", "rb") as cert_file:
|
||||||
|
certificate = cert_file.read()
|
||||||
|
|
||||||
|
size_of_string = len(certificate)
|
||||||
|
|
||||||
|
command = f'AT+USECMNG=0,0,"myCertificate2",{size_of_string}\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_1 = read_complete_response(ser_sara)
|
||||||
|
print("Write certificate metadata")
|
||||||
|
print(response_SARA_1)
|
||||||
|
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
ser_sara.write(certificate)
|
||||||
|
response_SARA_2 = read_complete_response(ser_sara)
|
||||||
|
print("Write certificate data")
|
||||||
|
print(response_SARA_2)
|
||||||
|
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 2: set the security profile 2 to trusted root
|
||||||
|
|
||||||
|
print("****")
|
||||||
|
print("SET security profile")
|
||||||
|
command = f'AT+USECPRF=2,0,1\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_3 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_3)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 3: set the security profile 2 to the imported certificate
|
||||||
|
|
||||||
|
print("****")
|
||||||
|
print("SET certificate")
|
||||||
|
command = f'AT+USECPRF=2,3,"myCertificate2"\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_4 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_4)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 4: set url
|
||||||
|
print("****")
|
||||||
|
print("SET URL")
|
||||||
|
command = f'AT+UHTTP=1,1,"{url}"\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_5)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 4: set url
|
||||||
|
print("****")
|
||||||
|
print("SET PORT")
|
||||||
|
command = f'AT+UHTTP=1,5,443\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_55 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_55)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
#step 4: set url to SSL
|
||||||
|
print("****")
|
||||||
|
print("SET SSL")
|
||||||
|
command = f'AT+UHTTP=1,6,1,2\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_5)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser_sara.is_open:
|
||||||
|
ser_sara.close()
|
||||||
|
print("****")
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
133
SARA/SSL/prepareUspotProfile_V2.py
Normal file
133
SARA/SSL/prepareUspotProfile_V2.py
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
'''
|
||||||
|
Script to set the URL for a HTTP request
|
||||||
|
Ex:
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/prepareUspotProfile_V2.py ttyAMA2 api-prod.uspot.probesys.net
|
||||||
|
To do: need to add profile id as parameter
|
||||||
|
|
||||||
|
First profile id:
|
||||||
|
AT+UHTTP=0,1,"data.nebuleair.fr"
|
||||||
|
Second profile id:
|
||||||
|
AT+UHTTP=1,1,"api-prod.uspot.probesys.net"
|
||||||
|
Third profile id:
|
||||||
|
AT+UHTTP=2,1,"aircarto.fr"
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
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)
|
||||||
|
|
||||||
|
def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
elif time.time() > end_time:
|
||||||
|
break
|
||||||
|
time.sleep(0.1) # Short sleep to prevent busy waiting
|
||||||
|
|
||||||
|
return response.decode('utf-8', errors='replace')
|
||||||
|
|
||||||
|
ser_sara = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
#step 1: import the certificate
|
||||||
|
print("****")
|
||||||
|
print("Add certificate")
|
||||||
|
with open("/var/www/nebuleair_pro_4g/SARA/SSL/isrgrootx1.der", "rb") as cert_file:
|
||||||
|
certificate = cert_file.read()
|
||||||
|
|
||||||
|
size_of_string = len(certificate)
|
||||||
|
|
||||||
|
command = f'AT+USECMNG=0,0,"myCertificate2",{size_of_string}\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_1 = read_complete_response(ser_sara)
|
||||||
|
print("Write certificate metadata")
|
||||||
|
print(response_SARA_1)
|
||||||
|
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
ser_sara.write(certificate)
|
||||||
|
response_SARA_2 = read_complete_response(ser_sara)
|
||||||
|
print("Write certificate data")
|
||||||
|
print(response_SARA_2)
|
||||||
|
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
#step 4: set url
|
||||||
|
print("****")
|
||||||
|
print("SET URL")
|
||||||
|
command = f'AT+UHTTP=1,1,"{url}"\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_5)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 4: set PORT
|
||||||
|
print("****")
|
||||||
|
print("SET PORT")
|
||||||
|
command = f'AT+UHTTP=1,5,443\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_55 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_55)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
#step 4: set url to SSL
|
||||||
|
print("****")
|
||||||
|
print("SET SSL")
|
||||||
|
command = f'AT+UHTTP=1,6,1,2\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_5)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser_sara.is_open:
|
||||||
|
ser_sara.close()
|
||||||
|
print("****")
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
45
SARA/SSL/request.py
Normal file
45
SARA/SSL/request.py
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
'''
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/request.py
|
||||||
|
|
||||||
|
'''
|
||||||
|
import requests
|
||||||
|
import logging
|
||||||
|
import http.client as http_client
|
||||||
|
|
||||||
|
# Enable HTTP and HTTPS verbose logging
|
||||||
|
http_client.HTTPConnection.debuglevel = 1
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
logging.getLogger("http.client").setLevel(logging.DEBUG)
|
||||||
|
logging.getLogger("urllib3").setLevel(logging.DEBUG)
|
||||||
|
logging.getLogger("requests").setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
# Suppress logging from unrelated libraries
|
||||||
|
logging.getLogger("chardet").setLevel(logging.INFO)
|
||||||
|
logging.getLogger("urllib3.connectionpool").setLevel(logging.INFO)
|
||||||
|
|
||||||
|
url_microSpot = "https://api-prod.uspot.probesys.net/nebuleair?token=2AFF6dQk68daFZ"
|
||||||
|
url_aircarto = "https://aircarto.fr/tests/test.php"
|
||||||
|
|
||||||
|
payload = {
|
||||||
|
"nebuleairid": "C04F8B8D3A08",
|
||||||
|
"software_version": "ModuleAir-V1-012023",
|
||||||
|
"sensordatavalues": [
|
||||||
|
{"value_type": "NPM_P0", "value": "2.3"},
|
||||||
|
{"value_type": "NPM_P0", "value": "3.30"},
|
||||||
|
{"value_type": "NPM_P1", "value": "9.05"},
|
||||||
|
{"value_type": "NPM_P2", "value": "20.60"},
|
||||||
|
{"value_type": "NPM_N1", "value": "49.00"},
|
||||||
|
{"value_type": "NPM_N10", "value": "49.00"},
|
||||||
|
{"value_type": "NPM_N25", "value": "49.00"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
cert_path = "/var/www/nebuleair_pro_4g/SARA/SSL/isrgrootx1.pem"
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = requests.post(url_aircarto, json=payload, verify=cert_path)
|
||||||
|
print("Response Status Code:", response.status_code)
|
||||||
|
print("Response Text:", response.text)
|
||||||
|
except requests.exceptions.RequestException as e:
|
||||||
|
print("An error occurred:", e)
|
||||||
75
SARA/SSL/sara_add_certif_v2.py
Normal file
75
SARA/SSL/sara_add_certif_v2.py
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
'''
|
||||||
|
Script to add the SSL certificate
|
||||||
|
ex:
|
||||||
|
python3 /var/www/nebuleair_pro_4g/SARA/SSL/sara_add_certif_v2.py ttyAMA2 2
|
||||||
|
|
||||||
|
'''
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
elif time.time() > end_time:
|
||||||
|
break
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
return response.decode('utf-8', errors='replace')
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open("/var/www/nebuleair_pro_4g/SARA/SSL/isrgrootx1.der", "rb") as cert_file:
|
||||||
|
certificate = cert_file.read()
|
||||||
|
|
||||||
|
size_of_string = len(certificate)
|
||||||
|
|
||||||
|
ser = serial.Serial(port=port, baudrate=baudrate, timeout=timeout)
|
||||||
|
command = f'AT+USECMNG=0,0,"myCertificate2",{size_of_string}\r'
|
||||||
|
ser.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_1 = read_complete_response(ser)
|
||||||
|
print("Write certificate metadata")
|
||||||
|
print(response_SARA_1)
|
||||||
|
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
ser.write(certificate)
|
||||||
|
response_SARA_2 = read_complete_response(ser)
|
||||||
|
print("Write certificate data")
|
||||||
|
print(response_SARA_2)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Serial Error: {e}")
|
||||||
|
except FileNotFoundError as e:
|
||||||
|
print(f"File Error: {e}")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Unexpected Error: {e}")
|
||||||
|
finally:
|
||||||
|
if 'ser' in locals() and ser.is_open:
|
||||||
|
ser.close()
|
||||||
325
SARA/SSL/test_22.py
Normal file
325
SARA/SSL/test_22.py
Normal file
@@ -0,0 +1,325 @@
|
|||||||
|
'''
|
||||||
|
Script to set the URL for a HTTP request and trigger the POST Request
|
||||||
|
Ex:
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/test_22.py ttyAMA2 api-prod.uspot.probesys.net /nebuleair?token=2AFF6dQk68daFZ
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/test_22.py ttyAMA2 webhook.site /6bee2237-099a-4ff4-8452-9f4126df7151
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/test_22.py ttyAMA2 aircarto.fr /tests/test.php
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/test_22.py ttyAMA2 ssl.aircarto.fr /test.php
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/test_22.py ttyAMA2 vps.aircarto.fr /test.php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
First profile id:
|
||||||
|
AT+UHTTP=0,1,"data.nebuleair.fr"
|
||||||
|
Second profile id:
|
||||||
|
AT+UHTTP=1,1,"api-prod.uspot.probesys.net"
|
||||||
|
Third profile id:
|
||||||
|
AT+UHTTP=2,1,"aircarto.fr"
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0] # ex: ttyAMA2
|
||||||
|
url = parameter[1] # ex: data.mobileair.fr
|
||||||
|
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)
|
||||||
|
|
||||||
|
def color_text(text, color):
|
||||||
|
colors = {
|
||||||
|
"red": "\033[31m",
|
||||||
|
"green": "\033[32m",
|
||||||
|
"yellow": "\033[33m",
|
||||||
|
"blue": "\033[34m",
|
||||||
|
"magenta": "\033[35m",
|
||||||
|
"cyan": "\033[36m",
|
||||||
|
"white": "\033[37m",
|
||||||
|
}
|
||||||
|
reset = "\033[0m"
|
||||||
|
return f"{colors.get(color, '')}{text}{reset}"
|
||||||
|
|
||||||
|
def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2, wait_for_line=None):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
start_time = time.time()
|
||||||
|
|
||||||
|
while True:
|
||||||
|
elapsed_time = time.time() - start_time # Time since function start
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
|
||||||
|
# Decode and check for the specific line
|
||||||
|
if wait_for_line:
|
||||||
|
decoded_response = response.decode('utf-8', errors='replace')
|
||||||
|
if wait_for_line in decoded_response:
|
||||||
|
print(f"[DEBUG] 🔎Found target line: {wait_for_line}")
|
||||||
|
break
|
||||||
|
elif time.time() > end_time:
|
||||||
|
print(f"[DEBUG] Timeout reached. No more data received.")
|
||||||
|
break
|
||||||
|
time.sleep(0.1) # Short sleep to prevent busy waiting
|
||||||
|
# Final response and debug output
|
||||||
|
total_elapsed_time = time.time() - start_time
|
||||||
|
print(f"[DEBUG] ⏱️ elapsed time: {total_elapsed_time:.2f}s. ⏱️")
|
||||||
|
return response.decode('utf-8', errors='replace')
|
||||||
|
|
||||||
|
ser_sara = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
#step 1: import the certificate
|
||||||
|
print("****")
|
||||||
|
with open("/var/www/nebuleair_pro_4g/SARA/SSL/certificate/isrgrootx1.der", "rb") as cert_file:
|
||||||
|
certificate = cert_file.read()
|
||||||
|
|
||||||
|
size_of_string = len(certificate)
|
||||||
|
|
||||||
|
print("\033[0;33m Import certificate\033[0m")
|
||||||
|
# AT+USECMNG=0,<type>,<internal_name>,<data_size>
|
||||||
|
# type-> 0 -> trusted root CA
|
||||||
|
command = f'AT+USECMNG=0,0,"isrgrootx1",{size_of_string}\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_1 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_1)
|
||||||
|
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
print("\033[0;33mAdd certificate\033[0m")
|
||||||
|
ser_sara.write(certificate)
|
||||||
|
response_SARA_2 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_2)
|
||||||
|
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
#check certificate (List all available certificates and private keys)
|
||||||
|
print("\033[0;33mCheck certificate\033[0m")
|
||||||
|
command = f'AT+USECMNG=3\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5b = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_5b)
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
# *******************************
|
||||||
|
# SECURITY PROFILE
|
||||||
|
# AT+USECPRF=<profile_id>[,<op_code>[,<param_val>]]
|
||||||
|
security_profile_id = 2
|
||||||
|
|
||||||
|
|
||||||
|
# op_code: 0 -> certificate validation level
|
||||||
|
# param_val : 0 -> Level 0 No validation; 1-> Level 1 Root certificate validation
|
||||||
|
print("\033[0;33mSet the security profile (params)\033[0m")
|
||||||
|
certification_level=1
|
||||||
|
command = f'AT+USECPRF={security_profile_id},0,{certification_level}\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5b = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_5b)
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
# op_code: 3 -> trusted root certificate internal name
|
||||||
|
print("\033[0;33mSet the security profile (choose cert)\033[0m")
|
||||||
|
command = f'AT+USECPRF={security_profile_id},3,"isrgrootx1"\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5c = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_5c)
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# *************************
|
||||||
|
# *************************
|
||||||
|
|
||||||
|
|
||||||
|
#step 4: set url (op_code = 1)
|
||||||
|
print("\033[0;33mSET URL\033[0m")
|
||||||
|
command = f'AT+UHTTP={profile_id},1,"{url}"\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_5)
|
||||||
|
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")
|
||||||
|
http_secure = 1
|
||||||
|
command = f'AT+UHTTP={profile_id},6,{http_secure},{security_profile_id}\r'
|
||||||
|
#command = f'AT+UHTTP={profile_id},6,{http_secure}\r'
|
||||||
|
|
||||||
|
ser_sara.write(command.encode('utf-8'))
|
||||||
|
response_SARA_5 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_5)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
# Write Data to saraR4
|
||||||
|
payload_json = {
|
||||||
|
"nebuleairid": "C04F8B8D3A08",
|
||||||
|
"software_version": "ModuleAir-V1-012023",
|
||||||
|
"sensordatavalues": [
|
||||||
|
{
|
||||||
|
"value_type": "NPM_P0",
|
||||||
|
"value": "2.3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_P0",
|
||||||
|
"value": "3.30"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_P1",
|
||||||
|
"value": "9.05"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_P2",
|
||||||
|
"value": "20.60"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_N1",
|
||||||
|
"value": "49.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_N10",
|
||||||
|
"value": "49.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "NPM_N25",
|
||||||
|
"value": "49.00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"value_type": "BME280_temperature",
|
||||||
|
"value": "25.82"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
# 1. Open sensordata_csv.json (with correct data size)
|
||||||
|
payload_string = json.dumps(payload_json) # Convert dict to JSON string
|
||||||
|
size_of_string = len(payload_string)
|
||||||
|
print("\033[0;33mOPEN JSON\033[0m")
|
||||||
|
command = f'AT+UDWNFILE="sensordata_json.json",{size_of_string}\r'
|
||||||
|
ser_sara.write(command.encode('utf-8'))
|
||||||
|
response_SARA_1 = read_complete_response(ser_sara, wait_for_line=">")
|
||||||
|
print(response_SARA_1)
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
#2. Write to shell
|
||||||
|
print("\033[0;33mWrite to Memory\033[0m")
|
||||||
|
ser_sara.write(payload_string.encode())
|
||||||
|
response_SARA_2 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_2)
|
||||||
|
|
||||||
|
#step 4: trigger the request (http_command=1 for GET and http_command=1 for POST)
|
||||||
|
print("****")
|
||||||
|
print("\033[0;33mPOST REQUEST\033[0m")
|
||||||
|
#parameter (POST)
|
||||||
|
command = f'AT+UHTTPC={profile_id},4,"{endpoint}","https.resp","sensordata_json.json",4\r'
|
||||||
|
#AIRCARTO
|
||||||
|
#command = f'AT+UHTTPC={profile_id},4,"/tests/test.php","https.resp","sensordata_json.json",4\r'
|
||||||
|
#uSPOT
|
||||||
|
#command = f'AT+UHTTPC={profile_id},4,"/nebuleair?token=2AFF6dQk68daFZ","https.resp","sensordata_json.json",4\r'
|
||||||
|
#AtmoSud
|
||||||
|
#command = f'AT+UHTTPC={profile_id},1,"/","https.resp"\r'
|
||||||
|
#Webhook
|
||||||
|
#command = f'AT+UHTTPC={profile_id},4,"/6bee2237-099a-4ff4-8452-9f4126df7151","https.resp","sensordata_json.json",4\r'
|
||||||
|
|
||||||
|
|
||||||
|
ser_sara.write(command.encode('utf-8'))
|
||||||
|
|
||||||
|
# Wait for the +UUHTTPCR response
|
||||||
|
print("Waiting for +UUHTTPCR response...")
|
||||||
|
|
||||||
|
response_SARA_3 = read_complete_response(ser_sara, timeout=5, end_of_response_timeout=30, wait_for_line="+UUHTTPCR")
|
||||||
|
|
||||||
|
print("\033[0;34m")
|
||||||
|
print(response_SARA_3)
|
||||||
|
print("\033[0m")
|
||||||
|
|
||||||
|
if "+UUHTTPCR" in response_SARA_3:
|
||||||
|
print("✅ Received +UUHTTPCR response.")
|
||||||
|
lines = response_SARA_3.strip().splitlines()
|
||||||
|
http_response = lines[-1] # "+UUHTTPCR: 0,4,0"
|
||||||
|
parts = http_response.split(',')
|
||||||
|
# code 0 (HTTP failed)
|
||||||
|
if len(parts) == 3 and parts[-1] == '0': # The third value indicates success
|
||||||
|
print("\033[0;31mATTENTION: HTTP operation failed\033[0m")
|
||||||
|
else:
|
||||||
|
print("\033[0;32m HTTP operation successful!!!\033[0m")
|
||||||
|
|
||||||
|
|
||||||
|
#READ REPLY
|
||||||
|
print("****")
|
||||||
|
print("\033[0;33mREPLY SERVER\033[0m")
|
||||||
|
ser_sara.write(b'AT+URDFILE="https.resp"\r')
|
||||||
|
response_SARA_7 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print("Reply from server:")
|
||||||
|
|
||||||
|
print("\033[0;32m")
|
||||||
|
print(response_SARA_7)
|
||||||
|
print("\033[0m")
|
||||||
|
|
||||||
|
#5. empty json
|
||||||
|
print("\033[0;33mEmpty Memory\033[0m")
|
||||||
|
ser_sara.write(b'AT+UDELFILE="sensordata_json.json"\r')
|
||||||
|
response_SARA_8 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_8)
|
||||||
|
|
||||||
|
# Get error code
|
||||||
|
print("\033[0;33mEmpty Memory\033[0m")
|
||||||
|
command = f'AT+UHTTPER={profile_id}\r'
|
||||||
|
ser_sara.write(command.encode('utf-8'))
|
||||||
|
response_SARA_9 = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_9)
|
||||||
|
|
||||||
|
'''
|
||||||
|
+UHTTPER: profile_id,error_class,error_code
|
||||||
|
|
||||||
|
error_class
|
||||||
|
0 OK, no error
|
||||||
|
3 HTTP Protocol error class
|
||||||
|
10 Wrong HTTP API USAGE
|
||||||
|
|
||||||
|
error_code (for error_class 3)
|
||||||
|
0 No error
|
||||||
|
11 Server connection error
|
||||||
|
73 Secure socket connect error
|
||||||
|
'''
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser_sara.is_open:
|
||||||
|
ser_sara.close()
|
||||||
|
print("****")
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
133
SARA/SSL/test_33.py
Normal file
133
SARA/SSL/test_33.py
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
'''
|
||||||
|
Script to set the URL for a HTTP request and trigger the POST Request
|
||||||
|
Ex:
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/test_22.py ttyAMA2 api-prod.uspot.probesys.net /nebuleair?token=2AFF6dQk68daFZ
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/test_22.py ttyAMA2 webhook.site /6bee2237-099a-4ff4-8452-9f4126df7151
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/test_22.py ttyAMA2 aircarto.fr /tests/test.php
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/test_22.py ttyAMA2 ssl.aircarto.fr /test.php
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/SSL/test_22.py ttyAMA2 vps.aircarto.fr /test.php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
First profile id:
|
||||||
|
AT+UHTTP=0,1,"data.nebuleair.fr"
|
||||||
|
Second profile id:
|
||||||
|
AT+UHTTP=1,1,"api-prod.uspot.probesys.net"
|
||||||
|
Third profile id:
|
||||||
|
AT+UHTTP=2,1,"aircarto.fr"
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0] # ex: ttyAMA2
|
||||||
|
url = parameter[1] # ex: data.mobileair.fr
|
||||||
|
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)
|
||||||
|
|
||||||
|
def color_text(text, color):
|
||||||
|
colors = {
|
||||||
|
"red": "\033[31m",
|
||||||
|
"green": "\033[32m",
|
||||||
|
"yellow": "\033[33m",
|
||||||
|
"blue": "\033[34m",
|
||||||
|
"magenta": "\033[35m",
|
||||||
|
"cyan": "\033[36m",
|
||||||
|
"white": "\033[37m",
|
||||||
|
}
|
||||||
|
reset = "\033[0m"
|
||||||
|
return f"{colors.get(color, '')}{text}{reset}"
|
||||||
|
|
||||||
|
def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2, wait_for_line=None):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
start_time = time.time()
|
||||||
|
|
||||||
|
while True:
|
||||||
|
elapsed_time = time.time() - start_time # Time since function start
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
|
||||||
|
# Decode and check for the specific line
|
||||||
|
if wait_for_line:
|
||||||
|
decoded_response = response.decode('utf-8', errors='replace')
|
||||||
|
if wait_for_line in decoded_response:
|
||||||
|
print(f"[DEBUG] 🔎Found target line: {wait_for_line}")
|
||||||
|
break
|
||||||
|
elif time.time() > end_time:
|
||||||
|
print(f"[DEBUG] Timeout reached. No more data received.")
|
||||||
|
break
|
||||||
|
time.sleep(0.1) # Short sleep to prevent busy waiting
|
||||||
|
# Final response and debug output
|
||||||
|
total_elapsed_time = time.time() - start_time
|
||||||
|
print(f"[DEBUG] ⏱️ elapsed time: {total_elapsed_time:.2f}s. ⏱️")
|
||||||
|
return response.decode('utf-8', errors='replace')
|
||||||
|
|
||||||
|
ser_sara = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
|
||||||
|
#check certificate (List all available certificates and private keys)
|
||||||
|
print("\033[0;33mCheck certificate\033[0m")
|
||||||
|
command = f'AT+USECMNG=3\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5b = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_5b)
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
#security layer
|
||||||
|
|
||||||
|
#1
|
||||||
|
print("\033[0;33mCheck certificate\033[0m")
|
||||||
|
command = f'AT+USECPRF=<profile_id>,<op_code>\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5b = read_complete_response(ser_sara, wait_for_line="OK")
|
||||||
|
print(response_SARA_5b)
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser_sara.is_open:
|
||||||
|
ser_sara.close()
|
||||||
|
print("****")
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
27
SARA/check_running.py
Normal file
27
SARA/check_running.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
'''
|
||||||
|
Check if the main loop is running
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/tests/check_running.py
|
||||||
|
'''
|
||||||
|
import psutil
|
||||||
|
import json
|
||||||
|
|
||||||
|
def is_script_running(script_name):
|
||||||
|
"""Check if a given Python script is currently running."""
|
||||||
|
for process in psutil.process_iter(['pid', 'cmdline']):
|
||||||
|
if process.info['cmdline'] and script_name in " ".join(process.info['cmdline']):
|
||||||
|
return True # Script is running
|
||||||
|
return False # Script is not running
|
||||||
|
|
||||||
|
script_to_check = "/var/www/nebuleair_pro_4g/loop/SARA_send_data_v2.py"
|
||||||
|
|
||||||
|
# Determine script status
|
||||||
|
is_running = is_script_running(script_to_check)
|
||||||
|
|
||||||
|
# Create JSON response
|
||||||
|
response = {
|
||||||
|
"message": "The script is still running.❌❌❌" if is_running else "The script is NOT running.✅✅✅",
|
||||||
|
"running": is_running
|
||||||
|
}
|
||||||
|
|
||||||
|
# Print JSON output
|
||||||
|
print(json.dumps(response, indent=4)) # Pretty print for readability
|
||||||
89
SARA/sara.py
Normal file
89
SARA/sara.py
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
'''
|
||||||
|
Script to see if the SARA-R410 is running
|
||||||
|
ex:
|
||||||
|
python3 /var/www/nebuleair_pro_4g/SARA/sara.py ttyAMA2 AT+CCID? 2
|
||||||
|
ex 2 (turn on blue light):
|
||||||
|
python3 /var/www/nebuleair_pro_4g/SARA/sara.py ttyAMA2 AT+UGPIOC=16,2 2
|
||||||
|
ex 3 (reconnect network)
|
||||||
|
python3 /var/www/nebuleair_pro_4g/SARA/sara.py ttyAMA2 AT+COPS=1,2,20801 20
|
||||||
|
ex 4 (get HTTP Profiles)
|
||||||
|
python3 /var/www/nebuleair_pro_4g/SARA/sara.py ttyAMA2 AT+UHTTP? 2
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
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/nebuleair_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
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = timeout
|
||||||
|
)
|
||||||
|
|
||||||
|
ser.write((command + '\r').encode('utf-8'))
|
||||||
|
|
||||||
|
#ser.write(b'ATI\r') #General Information
|
||||||
|
#ser.write(b'AT+CCID?\r') #SIM card number
|
||||||
|
#ser.write(b'AT+CPIN?\r') #Check the status of the SIM card
|
||||||
|
#ser.write(b'AT+CIND?\r') #Indication state (last number is SIM detection: 0 no SIM detection, 1 SIM detected, 2 not available)
|
||||||
|
#ser.write(b'AT+UGPIOR=?\r') #Reads the current value of the specified GPIO pin
|
||||||
|
#ser.write(b'AT+UGPIOC?\r') #GPIO select configuration
|
||||||
|
#ser.write(b'AT+COPS=?\r') #Check the network and cellular technology the modem is currently using
|
||||||
|
#ser.write(b'AT+COPS=1,2,20801') #connext to orange
|
||||||
|
#ser.write(b'AT+CFUN=?\r') #Selects/read the level of functionality
|
||||||
|
#ser.write(b'AT+URAT=?\r') #Radio Access Technology
|
||||||
|
#ser.write(b'AT+USIMSTAT?')
|
||||||
|
#ser.write(b'AT+IPR=115200') #Check/Define baud rate
|
||||||
|
#ser.write(b'AT+CMUX=?')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Read lines until a timeout occurs
|
||||||
|
response_lines = []
|
||||||
|
while True:
|
||||||
|
line = ser.readline().decode('utf-8').strip()
|
||||||
|
if not line:
|
||||||
|
break # Break the loop if an empty line is encountered
|
||||||
|
response_lines.append(line)
|
||||||
|
|
||||||
|
# Print the response
|
||||||
|
for line in response_lines:
|
||||||
|
print(line)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser.is_open:
|
||||||
|
ser.close()
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
72
SARA/sara_connectNetwork.py
Normal file
72
SARA/sara_connectNetwork.py
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
'''
|
||||||
|
Script to connect SARA-R410 to network SARA-R410
|
||||||
|
python3 /var/www/nebuleair_pro_4g/SARA/sara_connectNetwork.py ttyAMA2 20801 10
|
||||||
|
|
||||||
|
AT+COPS=1,2,20801
|
||||||
|
mode->1 pour manual
|
||||||
|
format->2 pour numeric
|
||||||
|
operator->20801 pour orange
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
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/nebuleair_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
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = timeout
|
||||||
|
)
|
||||||
|
|
||||||
|
command = f'AT+COPS=1,2,"{networkID}"\r'
|
||||||
|
ser.write((command + '\r').encode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Read lines until a timeout occurs
|
||||||
|
response_lines = []
|
||||||
|
while True:
|
||||||
|
line = ser.readline().decode('utf-8').strip()
|
||||||
|
if not line:
|
||||||
|
break # Break the loop if an empty line is encountered
|
||||||
|
response_lines.append(line)
|
||||||
|
|
||||||
|
# Print the response
|
||||||
|
for line in response_lines:
|
||||||
|
print(line)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser.is_open:
|
||||||
|
ser.close()
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
65
SARA/sara_eraseMessage.py
Normal file
65
SARA/sara_eraseMessage.py
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
'''
|
||||||
|
Script to erase memory to SARA-R410 memory
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
#0. empty file
|
||||||
|
ser.write(b'AT+UDELFILE="sensordata.json"\r')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Read lines until a timeout occurs
|
||||||
|
response_lines = []
|
||||||
|
while True:
|
||||||
|
line = ser.readline().decode('utf-8').strip()
|
||||||
|
if not line:
|
||||||
|
break # Break the loop if an empty line is encountered
|
||||||
|
response_lines.append(line)
|
||||||
|
|
||||||
|
# Print the response
|
||||||
|
for line in response_lines:
|
||||||
|
print(line)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser.is_open:
|
||||||
|
ser.close()
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
62
SARA/sara_readMessage.py
Normal file
62
SARA/sara_readMessage.py
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
'''
|
||||||
|
Script to read memory to SARA-R410 memory
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
ser.write(b'AT+URDFILE="sensordata.json"\r')
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Read lines until a timeout occurs
|
||||||
|
response_lines = []
|
||||||
|
while True:
|
||||||
|
line = ser.readline().decode('utf-8').strip()
|
||||||
|
if not line:
|
||||||
|
break # Break the loop if an empty line is encountered
|
||||||
|
response_lines.append(line)
|
||||||
|
|
||||||
|
# Print the response
|
||||||
|
for line in response_lines:
|
||||||
|
print(line)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser.is_open:
|
||||||
|
ser.close()
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
64
SARA/sara_sendMessage.py
Normal file
64
SARA/sara_sendMessage.py
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
'''
|
||||||
|
Script to send message to URL with SARA-R410
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
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)
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
command= f'AT+UHTTPC={profile_id},4,"{endpoint}","data.txt","sensordata.json",4\r'
|
||||||
|
ser.write((command + '\r').encode('utf-8'))
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Read lines until a timeout occurs
|
||||||
|
response_lines = []
|
||||||
|
while True:
|
||||||
|
line = ser.readline().decode('utf-8').strip()
|
||||||
|
if not line:
|
||||||
|
break # Break the loop if an empty line is encountered
|
||||||
|
response_lines.append(line)
|
||||||
|
|
||||||
|
# Print the response
|
||||||
|
for line in response_lines:
|
||||||
|
print(line)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser.is_open:
|
||||||
|
ser.close()
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
68
SARA/sara_setAPN.py
Normal file
68
SARA/sara_setAPN.py
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
'''
|
||||||
|
Script to connect SARA-R410 to APN
|
||||||
|
AT+CGDCONT=1,"IP","data.mono"
|
||||||
|
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_setAPN.py ttyAMA2 data.mono 2
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
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)
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = timeout
|
||||||
|
)
|
||||||
|
|
||||||
|
command = f'AT+CGDCONT=1,"IP","{apn_address}"\r'
|
||||||
|
ser.write((command + '\r').encode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Read lines until a timeout occurs
|
||||||
|
response_lines = []
|
||||||
|
while True:
|
||||||
|
line = ser.readline().decode('utf-8').strip()
|
||||||
|
if not line:
|
||||||
|
break # Break the loop if an empty line is encountered
|
||||||
|
response_lines.append(line)
|
||||||
|
|
||||||
|
# Print the response
|
||||||
|
for line in response_lines:
|
||||||
|
print(line)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser.is_open:
|
||||||
|
ser.close()
|
||||||
|
#print("Serial closed")
|
||||||
78
SARA/sara_setURL.py
Normal file
78
SARA/sara_setURL.py
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
'''
|
||||||
|
Script to set the URL for a HTTP request
|
||||||
|
Ex:
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_setURL.py ttyAMA2 data.nebuleair.fr 0
|
||||||
|
To do: need to add profile id as parameter
|
||||||
|
|
||||||
|
First profile id:
|
||||||
|
AT+UHTTP=0,1,"data.nebuleair.fr"
|
||||||
|
Second profile id:
|
||||||
|
AT+UHTTP=1,1,"api-prod.uspot.probesys.net"
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0] # ex: ttyAMA2
|
||||||
|
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)
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
command = f'AT+UHTTP={profile_id},1,"{url}"\r'
|
||||||
|
ser.write((command + '\r').encode('utf-8'))
|
||||||
|
|
||||||
|
print("****")
|
||||||
|
print("SET URL (SARA)")
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Read lines until a timeout occurs
|
||||||
|
response_lines = []
|
||||||
|
while True:
|
||||||
|
line = ser.readline().decode('utf-8').strip()
|
||||||
|
if not line:
|
||||||
|
break # Break the loop if an empty line is encountered
|
||||||
|
response_lines.append(line)
|
||||||
|
|
||||||
|
# Print the response
|
||||||
|
for line in response_lines:
|
||||||
|
print(line)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser.is_open:
|
||||||
|
ser.close()
|
||||||
|
print("****")
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
110
SARA/sara_setURL_uSpot_noSSL.py
Normal file
110
SARA/sara_setURL_uSpot_noSSL.py
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
'''
|
||||||
|
Script to set the URL for a HTTP request
|
||||||
|
Ex:
|
||||||
|
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/sara_setURL_uSpot_noSSL.py ttyAMA2 api-prod.uspot.probesys.net
|
||||||
|
To do: need to add profile id as parameter
|
||||||
|
|
||||||
|
First profile id:
|
||||||
|
AT+UHTTP=0,1,"data.nebuleair.fr"
|
||||||
|
Second profile id:
|
||||||
|
AT+UHTTP=1,1,"api-prod.uspot.probesys.net"
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
parameter = sys.argv[1:] # Exclude the script name
|
||||||
|
#print("Parameters received:")
|
||||||
|
port='/dev/'+parameter[0] # ex: ttyAMA2
|
||||||
|
url = parameter[1] # ex: data.mobileair.fr
|
||||||
|
|
||||||
|
|
||||||
|
profile_id = 1
|
||||||
|
|
||||||
|
|
||||||
|
def read_complete_response(serial_connection, timeout=2, end_of_response_timeout=2):
|
||||||
|
response = bytearray()
|
||||||
|
serial_connection.timeout = timeout
|
||||||
|
end_time = time.time() + end_of_response_timeout
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if serial_connection.in_waiting > 0:
|
||||||
|
data = serial_connection.read(serial_connection.in_waiting)
|
||||||
|
response.extend(data)
|
||||||
|
end_time = time.time() + end_of_response_timeout # Reset timeout on new data
|
||||||
|
elif time.time() > end_time:
|
||||||
|
break
|
||||||
|
time.sleep(0.1) # Short sleep to prevent busy waiting
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
ser_sara = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print("****")
|
||||||
|
print("SET URL (SARA)")
|
||||||
|
|
||||||
|
try:
|
||||||
|
#step 1: set url (op_code = 1)
|
||||||
|
print("****")
|
||||||
|
print("SET URL")
|
||||||
|
command = f'AT+UHTTP={profile_id},1,"{url}"\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_5 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_5)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 2: set url to SSL (op_code = 6) (http_secure = 1 for HTTPS and 0 for HTTP)(USECMNG_PROFILE = 2)
|
||||||
|
print("****")
|
||||||
|
print("SET SSL")
|
||||||
|
command = f'AT+UHTTP={profile_id},6,0\r'
|
||||||
|
ser_sara.write(command.encode('utf-8'))
|
||||||
|
response_SARA_5 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_5)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
#step 3: set PORT (op_code = 5)
|
||||||
|
print("****")
|
||||||
|
print("SET PORT")
|
||||||
|
command = f'AT+UHTTP={profile_id},5,81\r'
|
||||||
|
ser_sara.write((command + '\r').encode('utf-8'))
|
||||||
|
response_SARA_55 = read_complete_response(ser_sara)
|
||||||
|
print(response_SARA_55)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser_sara.is_open:
|
||||||
|
ser_sara.close()
|
||||||
|
print("****")
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
71
SARA/sara_writeMessage.py
Normal file
71
SARA/sara_writeMessage.py
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
'''
|
||||||
|
Script to write message to SARA-R410 memory
|
||||||
|
'''
|
||||||
|
|
||||||
|
import serial
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
ser = serial.Serial(
|
||||||
|
port=port, #USB0 or ttyS0
|
||||||
|
baudrate=baudrate, #115200 ou 9600
|
||||||
|
parity=serial.PARITY_NONE, #PARITY_NONE, PARITY_EVEN or PARITY_ODD
|
||||||
|
stopbits=serial.STOPBITS_ONE,
|
||||||
|
bytesize=serial.EIGHTBITS,
|
||||||
|
timeout = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
#0. empty file
|
||||||
|
#ser.write(b'AT+UDELFILE="sensordata.json"\r')
|
||||||
|
|
||||||
|
#1. Open sensordata.json (with correct data size)
|
||||||
|
size_of_string = len(message)
|
||||||
|
command = f'AT+UDWNFILE="sensordata.json",{size_of_string}\r'
|
||||||
|
ser.write((command + '\r').encode('utf-8'))
|
||||||
|
time.sleep(1)
|
||||||
|
#2. Write to shell
|
||||||
|
ser.write(message.encode())
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Read lines until a timeout occurs
|
||||||
|
response_lines = []
|
||||||
|
while True:
|
||||||
|
line = ser.readline().decode('utf-8').strip()
|
||||||
|
if not line:
|
||||||
|
break # Break the loop if an empty line is encountered
|
||||||
|
response_lines.append(line)
|
||||||
|
|
||||||
|
# Print the response
|
||||||
|
for line in response_lines:
|
||||||
|
print(line)
|
||||||
|
|
||||||
|
except serial.SerialException as e:
|
||||||
|
print(f"Error: {e}")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if ser.is_open:
|
||||||
|
ser.close()
|
||||||
|
#print("Serial closed")
|
||||||
|
|
||||||
4085
assets/css/bootstrap-grid.css
vendored
Normal file
4085
assets/css/bootstrap-grid.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/css/bootstrap-grid.css.map
Normal file
1
assets/css/bootstrap-grid.css.map
Normal file
File diff suppressed because one or more lines are too long
6
assets/css/bootstrap-grid.min.css
vendored
Normal file
6
assets/css/bootstrap-grid.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/css/bootstrap-grid.min.css.map
Normal file
1
assets/css/bootstrap-grid.min.css.map
Normal file
File diff suppressed because one or more lines are too long
4084
assets/css/bootstrap-grid.rtl.css
vendored
Normal file
4084
assets/css/bootstrap-grid.rtl.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/css/bootstrap-grid.rtl.css.map
Normal file
1
assets/css/bootstrap-grid.rtl.css.map
Normal file
File diff suppressed because one or more lines are too long
6
assets/css/bootstrap-grid.rtl.min.css
vendored
Normal file
6
assets/css/bootstrap-grid.rtl.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/css/bootstrap-grid.rtl.min.css.map
Normal file
1
assets/css/bootstrap-grid.rtl.min.css.map
Normal file
File diff suppressed because one or more lines are too long
597
assets/css/bootstrap-reboot.css
vendored
Normal file
597
assets/css/bootstrap-reboot.css
vendored
Normal file
@@ -0,0 +1,597 @@
|
|||||||
|
/*!
|
||||||
|
* Bootstrap Reboot v5.3.3 (https://getbootstrap.com/)
|
||||||
|
* Copyright 2011-2024 The Bootstrap Authors
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
*/
|
||||||
|
:root,
|
||||||
|
[data-bs-theme=light] {
|
||||||
|
--bs-blue: #0d6efd;
|
||||||
|
--bs-indigo: #6610f2;
|
||||||
|
--bs-purple: #6f42c1;
|
||||||
|
--bs-pink: #d63384;
|
||||||
|
--bs-red: #dc3545;
|
||||||
|
--bs-orange: #fd7e14;
|
||||||
|
--bs-yellow: #ffc107;
|
||||||
|
--bs-green: #198754;
|
||||||
|
--bs-teal: #20c997;
|
||||||
|
--bs-cyan: #0dcaf0;
|
||||||
|
--bs-black: #000;
|
||||||
|
--bs-white: #fff;
|
||||||
|
--bs-gray: #6c757d;
|
||||||
|
--bs-gray-dark: #343a40;
|
||||||
|
--bs-gray-100: #f8f9fa;
|
||||||
|
--bs-gray-200: #e9ecef;
|
||||||
|
--bs-gray-300: #dee2e6;
|
||||||
|
--bs-gray-400: #ced4da;
|
||||||
|
--bs-gray-500: #adb5bd;
|
||||||
|
--bs-gray-600: #6c757d;
|
||||||
|
--bs-gray-700: #495057;
|
||||||
|
--bs-gray-800: #343a40;
|
||||||
|
--bs-gray-900: #212529;
|
||||||
|
--bs-primary: #0d6efd;
|
||||||
|
--bs-secondary: #6c757d;
|
||||||
|
--bs-success: #198754;
|
||||||
|
--bs-info: #0dcaf0;
|
||||||
|
--bs-warning: #ffc107;
|
||||||
|
--bs-danger: #dc3545;
|
||||||
|
--bs-light: #f8f9fa;
|
||||||
|
--bs-dark: #212529;
|
||||||
|
--bs-primary-rgb: 13, 110, 253;
|
||||||
|
--bs-secondary-rgb: 108, 117, 125;
|
||||||
|
--bs-success-rgb: 25, 135, 84;
|
||||||
|
--bs-info-rgb: 13, 202, 240;
|
||||||
|
--bs-warning-rgb: 255, 193, 7;
|
||||||
|
--bs-danger-rgb: 220, 53, 69;
|
||||||
|
--bs-light-rgb: 248, 249, 250;
|
||||||
|
--bs-dark-rgb: 33, 37, 41;
|
||||||
|
--bs-primary-text-emphasis: #052c65;
|
||||||
|
--bs-secondary-text-emphasis: #2b2f32;
|
||||||
|
--bs-success-text-emphasis: #0a3622;
|
||||||
|
--bs-info-text-emphasis: #055160;
|
||||||
|
--bs-warning-text-emphasis: #664d03;
|
||||||
|
--bs-danger-text-emphasis: #58151c;
|
||||||
|
--bs-light-text-emphasis: #495057;
|
||||||
|
--bs-dark-text-emphasis: #495057;
|
||||||
|
--bs-primary-bg-subtle: #cfe2ff;
|
||||||
|
--bs-secondary-bg-subtle: #e2e3e5;
|
||||||
|
--bs-success-bg-subtle: #d1e7dd;
|
||||||
|
--bs-info-bg-subtle: #cff4fc;
|
||||||
|
--bs-warning-bg-subtle: #fff3cd;
|
||||||
|
--bs-danger-bg-subtle: #f8d7da;
|
||||||
|
--bs-light-bg-subtle: #fcfcfd;
|
||||||
|
--bs-dark-bg-subtle: #ced4da;
|
||||||
|
--bs-primary-border-subtle: #9ec5fe;
|
||||||
|
--bs-secondary-border-subtle: #c4c8cb;
|
||||||
|
--bs-success-border-subtle: #a3cfbb;
|
||||||
|
--bs-info-border-subtle: #9eeaf9;
|
||||||
|
--bs-warning-border-subtle: #ffe69c;
|
||||||
|
--bs-danger-border-subtle: #f1aeb5;
|
||||||
|
--bs-light-border-subtle: #e9ecef;
|
||||||
|
--bs-dark-border-subtle: #adb5bd;
|
||||||
|
--bs-white-rgb: 255, 255, 255;
|
||||||
|
--bs-black-rgb: 0, 0, 0;
|
||||||
|
--bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||||
|
--bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||||
|
--bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
|
||||||
|
--bs-body-font-family: var(--bs-font-sans-serif);
|
||||||
|
--bs-body-font-size: 1rem;
|
||||||
|
--bs-body-font-weight: 400;
|
||||||
|
--bs-body-line-height: 1.5;
|
||||||
|
--bs-body-color: #212529;
|
||||||
|
--bs-body-color-rgb: 33, 37, 41;
|
||||||
|
--bs-body-bg: #fff;
|
||||||
|
--bs-body-bg-rgb: 255, 255, 255;
|
||||||
|
--bs-emphasis-color: #000;
|
||||||
|
--bs-emphasis-color-rgb: 0, 0, 0;
|
||||||
|
--bs-secondary-color: rgba(33, 37, 41, 0.75);
|
||||||
|
--bs-secondary-color-rgb: 33, 37, 41;
|
||||||
|
--bs-secondary-bg: #e9ecef;
|
||||||
|
--bs-secondary-bg-rgb: 233, 236, 239;
|
||||||
|
--bs-tertiary-color: rgba(33, 37, 41, 0.5);
|
||||||
|
--bs-tertiary-color-rgb: 33, 37, 41;
|
||||||
|
--bs-tertiary-bg: #f8f9fa;
|
||||||
|
--bs-tertiary-bg-rgb: 248, 249, 250;
|
||||||
|
--bs-heading-color: inherit;
|
||||||
|
--bs-link-color: #0d6efd;
|
||||||
|
--bs-link-color-rgb: 13, 110, 253;
|
||||||
|
--bs-link-decoration: underline;
|
||||||
|
--bs-link-hover-color: #0a58ca;
|
||||||
|
--bs-link-hover-color-rgb: 10, 88, 202;
|
||||||
|
--bs-code-color: #d63384;
|
||||||
|
--bs-highlight-color: #212529;
|
||||||
|
--bs-highlight-bg: #fff3cd;
|
||||||
|
--bs-border-width: 1px;
|
||||||
|
--bs-border-style: solid;
|
||||||
|
--bs-border-color: #dee2e6;
|
||||||
|
--bs-border-color-translucent: rgba(0, 0, 0, 0.175);
|
||||||
|
--bs-border-radius: 0.375rem;
|
||||||
|
--bs-border-radius-sm: 0.25rem;
|
||||||
|
--bs-border-radius-lg: 0.5rem;
|
||||||
|
--bs-border-radius-xl: 1rem;
|
||||||
|
--bs-border-radius-xxl: 2rem;
|
||||||
|
--bs-border-radius-2xl: var(--bs-border-radius-xxl);
|
||||||
|
--bs-border-radius-pill: 50rem;
|
||||||
|
--bs-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
|
||||||
|
--bs-box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
|
||||||
|
--bs-box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
|
||||||
|
--bs-box-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.075);
|
||||||
|
--bs-focus-ring-width: 0.25rem;
|
||||||
|
--bs-focus-ring-opacity: 0.25;
|
||||||
|
--bs-focus-ring-color: rgba(13, 110, 253, 0.25);
|
||||||
|
--bs-form-valid-color: #198754;
|
||||||
|
--bs-form-valid-border-color: #198754;
|
||||||
|
--bs-form-invalid-color: #dc3545;
|
||||||
|
--bs-form-invalid-border-color: #dc3545;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-bs-theme=dark] {
|
||||||
|
color-scheme: dark;
|
||||||
|
--bs-body-color: #dee2e6;
|
||||||
|
--bs-body-color-rgb: 222, 226, 230;
|
||||||
|
--bs-body-bg: #212529;
|
||||||
|
--bs-body-bg-rgb: 33, 37, 41;
|
||||||
|
--bs-emphasis-color: #fff;
|
||||||
|
--bs-emphasis-color-rgb: 255, 255, 255;
|
||||||
|
--bs-secondary-color: rgba(222, 226, 230, 0.75);
|
||||||
|
--bs-secondary-color-rgb: 222, 226, 230;
|
||||||
|
--bs-secondary-bg: #343a40;
|
||||||
|
--bs-secondary-bg-rgb: 52, 58, 64;
|
||||||
|
--bs-tertiary-color: rgba(222, 226, 230, 0.5);
|
||||||
|
--bs-tertiary-color-rgb: 222, 226, 230;
|
||||||
|
--bs-tertiary-bg: #2b3035;
|
||||||
|
--bs-tertiary-bg-rgb: 43, 48, 53;
|
||||||
|
--bs-primary-text-emphasis: #6ea8fe;
|
||||||
|
--bs-secondary-text-emphasis: #a7acb1;
|
||||||
|
--bs-success-text-emphasis: #75b798;
|
||||||
|
--bs-info-text-emphasis: #6edff6;
|
||||||
|
--bs-warning-text-emphasis: #ffda6a;
|
||||||
|
--bs-danger-text-emphasis: #ea868f;
|
||||||
|
--bs-light-text-emphasis: #f8f9fa;
|
||||||
|
--bs-dark-text-emphasis: #dee2e6;
|
||||||
|
--bs-primary-bg-subtle: #031633;
|
||||||
|
--bs-secondary-bg-subtle: #161719;
|
||||||
|
--bs-success-bg-subtle: #051b11;
|
||||||
|
--bs-info-bg-subtle: #032830;
|
||||||
|
--bs-warning-bg-subtle: #332701;
|
||||||
|
--bs-danger-bg-subtle: #2c0b0e;
|
||||||
|
--bs-light-bg-subtle: #343a40;
|
||||||
|
--bs-dark-bg-subtle: #1a1d20;
|
||||||
|
--bs-primary-border-subtle: #084298;
|
||||||
|
--bs-secondary-border-subtle: #41464b;
|
||||||
|
--bs-success-border-subtle: #0f5132;
|
||||||
|
--bs-info-border-subtle: #087990;
|
||||||
|
--bs-warning-border-subtle: #997404;
|
||||||
|
--bs-danger-border-subtle: #842029;
|
||||||
|
--bs-light-border-subtle: #495057;
|
||||||
|
--bs-dark-border-subtle: #343a40;
|
||||||
|
--bs-heading-color: inherit;
|
||||||
|
--bs-link-color: #6ea8fe;
|
||||||
|
--bs-link-hover-color: #8bb9fe;
|
||||||
|
--bs-link-color-rgb: 110, 168, 254;
|
||||||
|
--bs-link-hover-color-rgb: 139, 185, 254;
|
||||||
|
--bs-code-color: #e685b5;
|
||||||
|
--bs-highlight-color: #dee2e6;
|
||||||
|
--bs-highlight-bg: #664d03;
|
||||||
|
--bs-border-color: #495057;
|
||||||
|
--bs-border-color-translucent: rgba(255, 255, 255, 0.15);
|
||||||
|
--bs-form-valid-color: #75b798;
|
||||||
|
--bs-form-valid-border-color: #75b798;
|
||||||
|
--bs-form-invalid-color: #ea868f;
|
||||||
|
--bs-form-invalid-border-color: #ea868f;
|
||||||
|
}
|
||||||
|
|
||||||
|
*,
|
||||||
|
*::before,
|
||||||
|
*::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: no-preference) {
|
||||||
|
:root {
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: var(--bs-body-font-family);
|
||||||
|
font-size: var(--bs-body-font-size);
|
||||||
|
font-weight: var(--bs-body-font-weight);
|
||||||
|
line-height: var(--bs-body-line-height);
|
||||||
|
color: var(--bs-body-color);
|
||||||
|
text-align: var(--bs-body-text-align);
|
||||||
|
background-color: var(--bs-body-bg);
|
||||||
|
-webkit-text-size-adjust: 100%;
|
||||||
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
margin: 1rem 0;
|
||||||
|
color: inherit;
|
||||||
|
border: 0;
|
||||||
|
border-top: var(--bs-border-width) solid;
|
||||||
|
opacity: 0.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
h6, h5, h4, h3, h2, h1 {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.2;
|
||||||
|
color: var(--bs-heading-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: calc(1.375rem + 1.5vw);
|
||||||
|
}
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
h1 {
|
||||||
|
font-size: 2.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: calc(1.325rem + 0.9vw);
|
||||||
|
}
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
h2 {
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: calc(1.3rem + 0.6vw);
|
||||||
|
}
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
h3 {
|
||||||
|
font-size: 1.75rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
font-size: calc(1.275rem + 0.3vw);
|
||||||
|
}
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
h4 {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h5 {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h6 {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
abbr[title] {
|
||||||
|
-webkit-text-decoration: underline dotted;
|
||||||
|
text-decoration: underline dotted;
|
||||||
|
cursor: help;
|
||||||
|
-webkit-text-decoration-skip-ink: none;
|
||||||
|
text-decoration-skip-ink: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
address {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
font-style: normal;
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol,
|
||||||
|
ul {
|
||||||
|
padding-left: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol,
|
||||||
|
ul,
|
||||||
|
dl {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol ol,
|
||||||
|
ul ul,
|
||||||
|
ol ul,
|
||||||
|
ul ol {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dt {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
dd {
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote {
|
||||||
|
margin: 0 0 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
b,
|
||||||
|
strong {
|
||||||
|
font-weight: bolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
small {
|
||||||
|
font-size: 0.875em;
|
||||||
|
}
|
||||||
|
|
||||||
|
mark {
|
||||||
|
padding: 0.1875em;
|
||||||
|
color: var(--bs-highlight-color);
|
||||||
|
background-color: var(--bs-highlight-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub,
|
||||||
|
sup {
|
||||||
|
position: relative;
|
||||||
|
font-size: 0.75em;
|
||||||
|
line-height: 0;
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub {
|
||||||
|
bottom: -0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
sup {
|
||||||
|
top: -0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: rgba(var(--bs-link-color-rgb), var(--bs-link-opacity, 1));
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
--bs-link-color-rgb: var(--bs-link-hover-color-rgb);
|
||||||
|
}
|
||||||
|
|
||||||
|
a:not([href]):not([class]), a:not([href]):not([class]):hover {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre,
|
||||||
|
code,
|
||||||
|
kbd,
|
||||||
|
samp {
|
||||||
|
font-family: var(--bs-font-monospace);
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
display: block;
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
overflow: auto;
|
||||||
|
font-size: 0.875em;
|
||||||
|
}
|
||||||
|
pre code {
|
||||||
|
font-size: inherit;
|
||||||
|
color: inherit;
|
||||||
|
word-break: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-size: 0.875em;
|
||||||
|
color: var(--bs-code-color);
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
a > code {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
kbd {
|
||||||
|
padding: 0.1875rem 0.375rem;
|
||||||
|
font-size: 0.875em;
|
||||||
|
color: var(--bs-body-bg);
|
||||||
|
background-color: var(--bs-body-color);
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
}
|
||||||
|
kbd kbd {
|
||||||
|
padding: 0;
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
figure {
|
||||||
|
margin: 0 0 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
img,
|
||||||
|
svg {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
caption-side: bottom;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
caption {
|
||||||
|
padding-top: 0.5rem;
|
||||||
|
padding-bottom: 0.5rem;
|
||||||
|
color: var(--bs-secondary-color);
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
text-align: inherit;
|
||||||
|
text-align: -webkit-match-parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
thead,
|
||||||
|
tbody,
|
||||||
|
tfoot,
|
||||||
|
tr,
|
||||||
|
td,
|
||||||
|
th {
|
||||||
|
border-color: inherit;
|
||||||
|
border-style: solid;
|
||||||
|
border-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:focus:not(:focus-visible) {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
input,
|
||||||
|
button,
|
||||||
|
select,
|
||||||
|
optgroup,
|
||||||
|
textarea {
|
||||||
|
margin: 0;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
button,
|
||||||
|
select {
|
||||||
|
text-transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
[role=button] {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
word-wrap: normal;
|
||||||
|
}
|
||||||
|
select:disabled {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
[list]:not([type=date]):not([type=datetime-local]):not([type=month]):not([type=week]):not([type=time])::-webkit-calendar-picker-indicator {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
button,
|
||||||
|
[type=button],
|
||||||
|
[type=reset],
|
||||||
|
[type=submit] {
|
||||||
|
-webkit-appearance: button;
|
||||||
|
}
|
||||||
|
button:not(:disabled),
|
||||||
|
[type=button]:not(:disabled),
|
||||||
|
[type=reset]:not(:disabled),
|
||||||
|
[type=submit]:not(:disabled) {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-moz-focus-inner {
|
||||||
|
padding: 0;
|
||||||
|
border-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
min-width: 0;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
legend {
|
||||||
|
float: left;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
font-size: calc(1.275rem + 0.3vw);
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
legend {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
legend + * {
|
||||||
|
clear: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-datetime-edit-fields-wrapper,
|
||||||
|
::-webkit-datetime-edit-text,
|
||||||
|
::-webkit-datetime-edit-minute,
|
||||||
|
::-webkit-datetime-edit-hour-field,
|
||||||
|
::-webkit-datetime-edit-day-field,
|
||||||
|
::-webkit-datetime-edit-month-field,
|
||||||
|
::-webkit-datetime-edit-year-field {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-inner-spin-button {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
[type=search] {
|
||||||
|
-webkit-appearance: textfield;
|
||||||
|
outline-offset: -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* rtl:raw:
|
||||||
|
[type="tel"],
|
||||||
|
[type="url"],
|
||||||
|
[type="email"],
|
||||||
|
[type="number"] {
|
||||||
|
direction: ltr;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
::-webkit-search-decoration {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-color-swatch-wrapper {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-file-upload-button {
|
||||||
|
font: inherit;
|
||||||
|
-webkit-appearance: button;
|
||||||
|
}
|
||||||
|
|
||||||
|
::file-selector-button {
|
||||||
|
font: inherit;
|
||||||
|
-webkit-appearance: button;
|
||||||
|
}
|
||||||
|
|
||||||
|
output {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
iframe {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
summary {
|
||||||
|
display: list-item;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
progress {
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
[hidden] {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*# sourceMappingURL=bootstrap-reboot.css.map */
|
||||||
1
assets/css/bootstrap-reboot.css.map
Normal file
1
assets/css/bootstrap-reboot.css.map
Normal file
File diff suppressed because one or more lines are too long
6
assets/css/bootstrap-reboot.min.css
vendored
Normal file
6
assets/css/bootstrap-reboot.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/css/bootstrap-reboot.min.css.map
Normal file
1
assets/css/bootstrap-reboot.min.css.map
Normal file
File diff suppressed because one or more lines are too long
594
assets/css/bootstrap-reboot.rtl.css
vendored
Normal file
594
assets/css/bootstrap-reboot.rtl.css
vendored
Normal file
@@ -0,0 +1,594 @@
|
|||||||
|
/*!
|
||||||
|
* Bootstrap Reboot v5.3.3 (https://getbootstrap.com/)
|
||||||
|
* Copyright 2011-2024 The Bootstrap Authors
|
||||||
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||||
|
*/
|
||||||
|
:root,
|
||||||
|
[data-bs-theme=light] {
|
||||||
|
--bs-blue: #0d6efd;
|
||||||
|
--bs-indigo: #6610f2;
|
||||||
|
--bs-purple: #6f42c1;
|
||||||
|
--bs-pink: #d63384;
|
||||||
|
--bs-red: #dc3545;
|
||||||
|
--bs-orange: #fd7e14;
|
||||||
|
--bs-yellow: #ffc107;
|
||||||
|
--bs-green: #198754;
|
||||||
|
--bs-teal: #20c997;
|
||||||
|
--bs-cyan: #0dcaf0;
|
||||||
|
--bs-black: #000;
|
||||||
|
--bs-white: #fff;
|
||||||
|
--bs-gray: #6c757d;
|
||||||
|
--bs-gray-dark: #343a40;
|
||||||
|
--bs-gray-100: #f8f9fa;
|
||||||
|
--bs-gray-200: #e9ecef;
|
||||||
|
--bs-gray-300: #dee2e6;
|
||||||
|
--bs-gray-400: #ced4da;
|
||||||
|
--bs-gray-500: #adb5bd;
|
||||||
|
--bs-gray-600: #6c757d;
|
||||||
|
--bs-gray-700: #495057;
|
||||||
|
--bs-gray-800: #343a40;
|
||||||
|
--bs-gray-900: #212529;
|
||||||
|
--bs-primary: #0d6efd;
|
||||||
|
--bs-secondary: #6c757d;
|
||||||
|
--bs-success: #198754;
|
||||||
|
--bs-info: #0dcaf0;
|
||||||
|
--bs-warning: #ffc107;
|
||||||
|
--bs-danger: #dc3545;
|
||||||
|
--bs-light: #f8f9fa;
|
||||||
|
--bs-dark: #212529;
|
||||||
|
--bs-primary-rgb: 13, 110, 253;
|
||||||
|
--bs-secondary-rgb: 108, 117, 125;
|
||||||
|
--bs-success-rgb: 25, 135, 84;
|
||||||
|
--bs-info-rgb: 13, 202, 240;
|
||||||
|
--bs-warning-rgb: 255, 193, 7;
|
||||||
|
--bs-danger-rgb: 220, 53, 69;
|
||||||
|
--bs-light-rgb: 248, 249, 250;
|
||||||
|
--bs-dark-rgb: 33, 37, 41;
|
||||||
|
--bs-primary-text-emphasis: #052c65;
|
||||||
|
--bs-secondary-text-emphasis: #2b2f32;
|
||||||
|
--bs-success-text-emphasis: #0a3622;
|
||||||
|
--bs-info-text-emphasis: #055160;
|
||||||
|
--bs-warning-text-emphasis: #664d03;
|
||||||
|
--bs-danger-text-emphasis: #58151c;
|
||||||
|
--bs-light-text-emphasis: #495057;
|
||||||
|
--bs-dark-text-emphasis: #495057;
|
||||||
|
--bs-primary-bg-subtle: #cfe2ff;
|
||||||
|
--bs-secondary-bg-subtle: #e2e3e5;
|
||||||
|
--bs-success-bg-subtle: #d1e7dd;
|
||||||
|
--bs-info-bg-subtle: #cff4fc;
|
||||||
|
--bs-warning-bg-subtle: #fff3cd;
|
||||||
|
--bs-danger-bg-subtle: #f8d7da;
|
||||||
|
--bs-light-bg-subtle: #fcfcfd;
|
||||||
|
--bs-dark-bg-subtle: #ced4da;
|
||||||
|
--bs-primary-border-subtle: #9ec5fe;
|
||||||
|
--bs-secondary-border-subtle: #c4c8cb;
|
||||||
|
--bs-success-border-subtle: #a3cfbb;
|
||||||
|
--bs-info-border-subtle: #9eeaf9;
|
||||||
|
--bs-warning-border-subtle: #ffe69c;
|
||||||
|
--bs-danger-border-subtle: #f1aeb5;
|
||||||
|
--bs-light-border-subtle: #e9ecef;
|
||||||
|
--bs-dark-border-subtle: #adb5bd;
|
||||||
|
--bs-white-rgb: 255, 255, 255;
|
||||||
|
--bs-black-rgb: 0, 0, 0;
|
||||||
|
--bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||||
|
--bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||||
|
--bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
|
||||||
|
--bs-body-font-family: var(--bs-font-sans-serif);
|
||||||
|
--bs-body-font-size: 1rem;
|
||||||
|
--bs-body-font-weight: 400;
|
||||||
|
--bs-body-line-height: 1.5;
|
||||||
|
--bs-body-color: #212529;
|
||||||
|
--bs-body-color-rgb: 33, 37, 41;
|
||||||
|
--bs-body-bg: #fff;
|
||||||
|
--bs-body-bg-rgb: 255, 255, 255;
|
||||||
|
--bs-emphasis-color: #000;
|
||||||
|
--bs-emphasis-color-rgb: 0, 0, 0;
|
||||||
|
--bs-secondary-color: rgba(33, 37, 41, 0.75);
|
||||||
|
--bs-secondary-color-rgb: 33, 37, 41;
|
||||||
|
--bs-secondary-bg: #e9ecef;
|
||||||
|
--bs-secondary-bg-rgb: 233, 236, 239;
|
||||||
|
--bs-tertiary-color: rgba(33, 37, 41, 0.5);
|
||||||
|
--bs-tertiary-color-rgb: 33, 37, 41;
|
||||||
|
--bs-tertiary-bg: #f8f9fa;
|
||||||
|
--bs-tertiary-bg-rgb: 248, 249, 250;
|
||||||
|
--bs-heading-color: inherit;
|
||||||
|
--bs-link-color: #0d6efd;
|
||||||
|
--bs-link-color-rgb: 13, 110, 253;
|
||||||
|
--bs-link-decoration: underline;
|
||||||
|
--bs-link-hover-color: #0a58ca;
|
||||||
|
--bs-link-hover-color-rgb: 10, 88, 202;
|
||||||
|
--bs-code-color: #d63384;
|
||||||
|
--bs-highlight-color: #212529;
|
||||||
|
--bs-highlight-bg: #fff3cd;
|
||||||
|
--bs-border-width: 1px;
|
||||||
|
--bs-border-style: solid;
|
||||||
|
--bs-border-color: #dee2e6;
|
||||||
|
--bs-border-color-translucent: rgba(0, 0, 0, 0.175);
|
||||||
|
--bs-border-radius: 0.375rem;
|
||||||
|
--bs-border-radius-sm: 0.25rem;
|
||||||
|
--bs-border-radius-lg: 0.5rem;
|
||||||
|
--bs-border-radius-xl: 1rem;
|
||||||
|
--bs-border-radius-xxl: 2rem;
|
||||||
|
--bs-border-radius-2xl: var(--bs-border-radius-xxl);
|
||||||
|
--bs-border-radius-pill: 50rem;
|
||||||
|
--bs-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
|
||||||
|
--bs-box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
|
||||||
|
--bs-box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
|
||||||
|
--bs-box-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.075);
|
||||||
|
--bs-focus-ring-width: 0.25rem;
|
||||||
|
--bs-focus-ring-opacity: 0.25;
|
||||||
|
--bs-focus-ring-color: rgba(13, 110, 253, 0.25);
|
||||||
|
--bs-form-valid-color: #198754;
|
||||||
|
--bs-form-valid-border-color: #198754;
|
||||||
|
--bs-form-invalid-color: #dc3545;
|
||||||
|
--bs-form-invalid-border-color: #dc3545;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-bs-theme=dark] {
|
||||||
|
color-scheme: dark;
|
||||||
|
--bs-body-color: #dee2e6;
|
||||||
|
--bs-body-color-rgb: 222, 226, 230;
|
||||||
|
--bs-body-bg: #212529;
|
||||||
|
--bs-body-bg-rgb: 33, 37, 41;
|
||||||
|
--bs-emphasis-color: #fff;
|
||||||
|
--bs-emphasis-color-rgb: 255, 255, 255;
|
||||||
|
--bs-secondary-color: rgba(222, 226, 230, 0.75);
|
||||||
|
--bs-secondary-color-rgb: 222, 226, 230;
|
||||||
|
--bs-secondary-bg: #343a40;
|
||||||
|
--bs-secondary-bg-rgb: 52, 58, 64;
|
||||||
|
--bs-tertiary-color: rgba(222, 226, 230, 0.5);
|
||||||
|
--bs-tertiary-color-rgb: 222, 226, 230;
|
||||||
|
--bs-tertiary-bg: #2b3035;
|
||||||
|
--bs-tertiary-bg-rgb: 43, 48, 53;
|
||||||
|
--bs-primary-text-emphasis: #6ea8fe;
|
||||||
|
--bs-secondary-text-emphasis: #a7acb1;
|
||||||
|
--bs-success-text-emphasis: #75b798;
|
||||||
|
--bs-info-text-emphasis: #6edff6;
|
||||||
|
--bs-warning-text-emphasis: #ffda6a;
|
||||||
|
--bs-danger-text-emphasis: #ea868f;
|
||||||
|
--bs-light-text-emphasis: #f8f9fa;
|
||||||
|
--bs-dark-text-emphasis: #dee2e6;
|
||||||
|
--bs-primary-bg-subtle: #031633;
|
||||||
|
--bs-secondary-bg-subtle: #161719;
|
||||||
|
--bs-success-bg-subtle: #051b11;
|
||||||
|
--bs-info-bg-subtle: #032830;
|
||||||
|
--bs-warning-bg-subtle: #332701;
|
||||||
|
--bs-danger-bg-subtle: #2c0b0e;
|
||||||
|
--bs-light-bg-subtle: #343a40;
|
||||||
|
--bs-dark-bg-subtle: #1a1d20;
|
||||||
|
--bs-primary-border-subtle: #084298;
|
||||||
|
--bs-secondary-border-subtle: #41464b;
|
||||||
|
--bs-success-border-subtle: #0f5132;
|
||||||
|
--bs-info-border-subtle: #087990;
|
||||||
|
--bs-warning-border-subtle: #997404;
|
||||||
|
--bs-danger-border-subtle: #842029;
|
||||||
|
--bs-light-border-subtle: #495057;
|
||||||
|
--bs-dark-border-subtle: #343a40;
|
||||||
|
--bs-heading-color: inherit;
|
||||||
|
--bs-link-color: #6ea8fe;
|
||||||
|
--bs-link-hover-color: #8bb9fe;
|
||||||
|
--bs-link-color-rgb: 110, 168, 254;
|
||||||
|
--bs-link-hover-color-rgb: 139, 185, 254;
|
||||||
|
--bs-code-color: #e685b5;
|
||||||
|
--bs-highlight-color: #dee2e6;
|
||||||
|
--bs-highlight-bg: #664d03;
|
||||||
|
--bs-border-color: #495057;
|
||||||
|
--bs-border-color-translucent: rgba(255, 255, 255, 0.15);
|
||||||
|
--bs-form-valid-color: #75b798;
|
||||||
|
--bs-form-valid-border-color: #75b798;
|
||||||
|
--bs-form-invalid-color: #ea868f;
|
||||||
|
--bs-form-invalid-border-color: #ea868f;
|
||||||
|
}
|
||||||
|
|
||||||
|
*,
|
||||||
|
*::before,
|
||||||
|
*::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: no-preference) {
|
||||||
|
:root {
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: var(--bs-body-font-family);
|
||||||
|
font-size: var(--bs-body-font-size);
|
||||||
|
font-weight: var(--bs-body-font-weight);
|
||||||
|
line-height: var(--bs-body-line-height);
|
||||||
|
color: var(--bs-body-color);
|
||||||
|
text-align: var(--bs-body-text-align);
|
||||||
|
background-color: var(--bs-body-bg);
|
||||||
|
-webkit-text-size-adjust: 100%;
|
||||||
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
margin: 1rem 0;
|
||||||
|
color: inherit;
|
||||||
|
border: 0;
|
||||||
|
border-top: var(--bs-border-width) solid;
|
||||||
|
opacity: 0.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
h6, h5, h4, h3, h2, h1 {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.2;
|
||||||
|
color: var(--bs-heading-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: calc(1.375rem + 1.5vw);
|
||||||
|
}
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
h1 {
|
||||||
|
font-size: 2.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: calc(1.325rem + 0.9vw);
|
||||||
|
}
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
h2 {
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: calc(1.3rem + 0.6vw);
|
||||||
|
}
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
h3 {
|
||||||
|
font-size: 1.75rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
font-size: calc(1.275rem + 0.3vw);
|
||||||
|
}
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
h4 {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h5 {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h6 {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
abbr[title] {
|
||||||
|
-webkit-text-decoration: underline dotted;
|
||||||
|
text-decoration: underline dotted;
|
||||||
|
cursor: help;
|
||||||
|
-webkit-text-decoration-skip-ink: none;
|
||||||
|
text-decoration-skip-ink: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
address {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
font-style: normal;
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol,
|
||||||
|
ul {
|
||||||
|
padding-right: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol,
|
||||||
|
ul,
|
||||||
|
dl {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol ol,
|
||||||
|
ul ul,
|
||||||
|
ol ul,
|
||||||
|
ul ol {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dt {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
dd {
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote {
|
||||||
|
margin: 0 0 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
b,
|
||||||
|
strong {
|
||||||
|
font-weight: bolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
small {
|
||||||
|
font-size: 0.875em;
|
||||||
|
}
|
||||||
|
|
||||||
|
mark {
|
||||||
|
padding: 0.1875em;
|
||||||
|
color: var(--bs-highlight-color);
|
||||||
|
background-color: var(--bs-highlight-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub,
|
||||||
|
sup {
|
||||||
|
position: relative;
|
||||||
|
font-size: 0.75em;
|
||||||
|
line-height: 0;
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub {
|
||||||
|
bottom: -0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
sup {
|
||||||
|
top: -0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: rgba(var(--bs-link-color-rgb), var(--bs-link-opacity, 1));
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
--bs-link-color-rgb: var(--bs-link-hover-color-rgb);
|
||||||
|
}
|
||||||
|
|
||||||
|
a:not([href]):not([class]), a:not([href]):not([class]):hover {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre,
|
||||||
|
code,
|
||||||
|
kbd,
|
||||||
|
samp {
|
||||||
|
font-family: var(--bs-font-monospace);
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
display: block;
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
overflow: auto;
|
||||||
|
font-size: 0.875em;
|
||||||
|
}
|
||||||
|
pre code {
|
||||||
|
font-size: inherit;
|
||||||
|
color: inherit;
|
||||||
|
word-break: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-size: 0.875em;
|
||||||
|
color: var(--bs-code-color);
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
a > code {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
kbd {
|
||||||
|
padding: 0.1875rem 0.375rem;
|
||||||
|
font-size: 0.875em;
|
||||||
|
color: var(--bs-body-bg);
|
||||||
|
background-color: var(--bs-body-color);
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
}
|
||||||
|
kbd kbd {
|
||||||
|
padding: 0;
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
figure {
|
||||||
|
margin: 0 0 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
img,
|
||||||
|
svg {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
caption-side: bottom;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
caption {
|
||||||
|
padding-top: 0.5rem;
|
||||||
|
padding-bottom: 0.5rem;
|
||||||
|
color: var(--bs-secondary-color);
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
text-align: inherit;
|
||||||
|
text-align: -webkit-match-parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
thead,
|
||||||
|
tbody,
|
||||||
|
tfoot,
|
||||||
|
tr,
|
||||||
|
td,
|
||||||
|
th {
|
||||||
|
border-color: inherit;
|
||||||
|
border-style: solid;
|
||||||
|
border-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:focus:not(:focus-visible) {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
input,
|
||||||
|
button,
|
||||||
|
select,
|
||||||
|
optgroup,
|
||||||
|
textarea {
|
||||||
|
margin: 0;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
button,
|
||||||
|
select {
|
||||||
|
text-transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
[role=button] {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
word-wrap: normal;
|
||||||
|
}
|
||||||
|
select:disabled {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
[list]:not([type=date]):not([type=datetime-local]):not([type=month]):not([type=week]):not([type=time])::-webkit-calendar-picker-indicator {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
button,
|
||||||
|
[type=button],
|
||||||
|
[type=reset],
|
||||||
|
[type=submit] {
|
||||||
|
-webkit-appearance: button;
|
||||||
|
}
|
||||||
|
button:not(:disabled),
|
||||||
|
[type=button]:not(:disabled),
|
||||||
|
[type=reset]:not(:disabled),
|
||||||
|
[type=submit]:not(:disabled) {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-moz-focus-inner {
|
||||||
|
padding: 0;
|
||||||
|
border-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
min-width: 0;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
legend {
|
||||||
|
float: right;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
font-size: calc(1.275rem + 0.3vw);
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
legend {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
legend + * {
|
||||||
|
clear: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-datetime-edit-fields-wrapper,
|
||||||
|
::-webkit-datetime-edit-text,
|
||||||
|
::-webkit-datetime-edit-minute,
|
||||||
|
::-webkit-datetime-edit-hour-field,
|
||||||
|
::-webkit-datetime-edit-day-field,
|
||||||
|
::-webkit-datetime-edit-month-field,
|
||||||
|
::-webkit-datetime-edit-year-field {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-inner-spin-button {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
[type=search] {
|
||||||
|
-webkit-appearance: textfield;
|
||||||
|
outline-offset: -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
[type="tel"],
|
||||||
|
[type="url"],
|
||||||
|
[type="email"],
|
||||||
|
[type="number"] {
|
||||||
|
direction: ltr;
|
||||||
|
}
|
||||||
|
::-webkit-search-decoration {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-color-swatch-wrapper {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-file-upload-button {
|
||||||
|
font: inherit;
|
||||||
|
-webkit-appearance: button;
|
||||||
|
}
|
||||||
|
|
||||||
|
::file-selector-button {
|
||||||
|
font: inherit;
|
||||||
|
-webkit-appearance: button;
|
||||||
|
}
|
||||||
|
|
||||||
|
output {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
iframe {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
summary {
|
||||||
|
display: list-item;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
progress {
|
||||||
|
vertical-align: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
[hidden] {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
/*# sourceMappingURL=bootstrap-reboot.rtl.css.map */
|
||||||
1
assets/css/bootstrap-reboot.rtl.css.map
Normal file
1
assets/css/bootstrap-reboot.rtl.css.map
Normal file
File diff suppressed because one or more lines are too long
6
assets/css/bootstrap-reboot.rtl.min.css
vendored
Normal file
6
assets/css/bootstrap-reboot.rtl.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/css/bootstrap-reboot.rtl.min.css.map
Normal file
1
assets/css/bootstrap-reboot.rtl.min.css.map
Normal file
File diff suppressed because one or more lines are too long
5402
assets/css/bootstrap-utilities.css
vendored
Normal file
5402
assets/css/bootstrap-utilities.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/css/bootstrap-utilities.css.map
Normal file
1
assets/css/bootstrap-utilities.css.map
Normal file
File diff suppressed because one or more lines are too long
6
assets/css/bootstrap-utilities.min.css
vendored
Normal file
6
assets/css/bootstrap-utilities.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/css/bootstrap-utilities.min.css.map
Normal file
1
assets/css/bootstrap-utilities.min.css.map
Normal file
File diff suppressed because one or more lines are too long
5393
assets/css/bootstrap-utilities.rtl.css
vendored
Normal file
5393
assets/css/bootstrap-utilities.rtl.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/css/bootstrap-utilities.rtl.css.map
Normal file
1
assets/css/bootstrap-utilities.rtl.css.map
Normal file
File diff suppressed because one or more lines are too long
6
assets/css/bootstrap-utilities.rtl.min.css
vendored
Normal file
6
assets/css/bootstrap-utilities.rtl.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/css/bootstrap-utilities.rtl.min.css.map
Normal file
1
assets/css/bootstrap-utilities.rtl.min.css.map
Normal file
File diff suppressed because one or more lines are too long
12057
assets/css/bootstrap.css
vendored
Normal file
12057
assets/css/bootstrap.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/css/bootstrap.css.map
Normal file
1
assets/css/bootstrap.css.map
Normal file
File diff suppressed because one or more lines are too long
6
assets/css/bootstrap.min.css
vendored
Normal file
6
assets/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/css/bootstrap.min.css.map
Normal file
1
assets/css/bootstrap.min.css.map
Normal file
File diff suppressed because one or more lines are too long
12030
assets/css/bootstrap.rtl.css
vendored
Normal file
12030
assets/css/bootstrap.rtl.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/css/bootstrap.rtl.css.map
Normal file
1
assets/css/bootstrap.rtl.css.map
Normal file
File diff suppressed because one or more lines are too long
6
assets/css/bootstrap.rtl.min.css
vendored
Normal file
6
assets/css/bootstrap.rtl.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/css/bootstrap.rtl.min.css.map
Normal file
1
assets/css/bootstrap.rtl.min.css.map
Normal file
File diff suppressed because one or more lines are too long
BIN
assets/img/logoModuleAirColor.png
Normal file
BIN
assets/img/logoModuleAirColor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 281 KiB |
BIN
assets/img/logoModuleAirColor_long.png
Normal file
BIN
assets/img/logoModuleAirColor_long.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 233 KiB |
2
assets/jquery/jquery-3.7.1.min.js
vendored
Normal file
2
assets/jquery/jquery-3.7.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6314
assets/js/bootstrap.bundle.js
vendored
Normal file
6314
assets/js/bootstrap.bundle.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/js/bootstrap.bundle.js.map
Normal file
1
assets/js/bootstrap.bundle.js.map
Normal file
File diff suppressed because one or more lines are too long
7
assets/js/bootstrap.bundle.min.js
vendored
Normal file
7
assets/js/bootstrap.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/js/bootstrap.bundle.min.js.map
Normal file
1
assets/js/bootstrap.bundle.min.js.map
Normal file
File diff suppressed because one or more lines are too long
4447
assets/js/bootstrap.esm.js
vendored
Normal file
4447
assets/js/bootstrap.esm.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/js/bootstrap.esm.js.map
Normal file
1
assets/js/bootstrap.esm.js.map
Normal file
File diff suppressed because one or more lines are too long
7
assets/js/bootstrap.esm.min.js
vendored
Normal file
7
assets/js/bootstrap.esm.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/js/bootstrap.esm.min.js.map
Normal file
1
assets/js/bootstrap.esm.min.js.map
Normal file
File diff suppressed because one or more lines are too long
4494
assets/js/bootstrap.js
vendored
Normal file
4494
assets/js/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
assets/js/bootstrap.js.map
Normal file
1
assets/js/bootstrap.js.map
Normal file
File diff suppressed because one or more lines are too long
7
assets/js/bootstrap.min.js
vendored
Normal file
7
assets/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
assets/js/bootstrap.min.js.map
Normal file
1
assets/js/bootstrap.min.js.map
Normal file
File diff suppressed because one or more lines are too long
17
config.json.dist
Normal file
17
config.json.dist
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"loop_log": true,
|
||||||
|
"boot_log": true,
|
||||||
|
"deviceID": "XXXXX",
|
||||||
|
"SaraR4_baudrate": 115200,
|
||||||
|
"NextPM_ports": ["ttyAMA3"],
|
||||||
|
"CO2_serial": true,
|
||||||
|
"sensirion_SFA30": false,
|
||||||
|
"i2C_sound": false,
|
||||||
|
"i2c_BME": false,
|
||||||
|
"sshTunnel_port": 51221,
|
||||||
|
"npm1_status" : "connected",
|
||||||
|
"SARA_R4_general_status" : "connected",
|
||||||
|
"SARA_R4_SIM_status" : "connected",
|
||||||
|
"SARA_R4_network_status": "connected",
|
||||||
|
"WIFI_status": "connected"
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user