update
This commit is contained in:
@@ -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:")
|
||||
|
||||
Reference in New Issue
Block a user