This commit is contained in:
root
2025-07-22 16:38:41 +01:00
parent 25c5a7a65a
commit fe61b56b5b
3 changed files with 28 additions and 4 deletions

View File

@@ -0,0 +1,12 @@
'''
____ _ ____ _
/ ___| / \ | _ \ / \
\___ \ / _ \ | |_) | / _ \
___) / ___ \| _ < / ___ \
|____/_/ \_\_| \_\/_/ \_\
Script to read UDP message
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/UDP/receiveUDP_downlink.py
'''

View File

@@ -5,8 +5,7 @@
___) / ___ \| _ < / ___ \
|____/_/ \_\_| \_\/_/ \_\
Script to set the PDP context for the SARA R5
Script to send UDP message
/usr/bin/python3 /var/www/nebuleair_pro_4g/SARA/UDP/sendUDP_message.py

View File

@@ -944,7 +944,7 @@ try:
else:
print("Failed to extract socket ID")
#Connect to UDP server
#Connect to UDP server (USOCO)
print("Connect to server:")
command = f'AT+USOCO={socket_id},"192.168.0.20",4242\r'
ser_sara.write(command.encode('utf-8'))
@@ -957,17 +957,30 @@ try:
csv_udp_string = ','.join(str(value) if value is not None else '' for value in payload_udp)
size_of_udp_string = len(csv_udp_string)
# 4. Write data and send
# 4. Write data and send (USOWR)
print("Write data:")
print(csv_udp_string)
command = f'AT+USOWR={socket_id},{size_of_udp_string}\r'
ser_sara.write(command.encode('utf-8'))
response_SARA_2 = read_complete_response(ser_sara, wait_for_lines=["@","OK", "+CME ERROR", "ERROR"], debug=False)
print('<p class="text-danger-emphasis">')
print(response_SARA_2)
print("</p>", end="")
ser_sara.write(csv_udp_string.encode())
response_SARA_2 = read_complete_response(ser_sara, wait_for_lines=["@","OK", "+CME ERROR", "ERROR"], debug=False)
print('<p class="text-danger-emphasis">')
print(response_SARA_2)
print("</p>", end="")
#Read reply from server (USORD)
print("Read reply:")
command = f'AT+USORD=0,100\r'
ser_sara.write(command.encode('utf-8'))
response_SARA_2 = read_complete_response(ser_sara, wait_for_lines=["OK", "+CME ERROR", "ERROR"], debug=False)
print('<p class="text-danger-emphasis">')
print(response_SARA_2)
print("</p>", end="")
#Close socket
print("Close socket:")