OpenMarine

Full Version: need help sending nmea data to UDP port
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i am updating an app that i wrote that writes a nmea string to a udp port but can not seem to get the data to the port.
I setup kplex with a udp source
Code:
[udp]
name=wind
direction=in
optional=yes
address=
port=20220

but I cant seem to get data to the port?

this is the code snipit

Code:
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(string, ('127.0.0.1', 20220))
sock.close()

This is the output of the print statement

Code:
$ARMWV,7.97,R,0.00,N,A*27a?
$ARMWV,8.09,R,0.00,N,A*2fa?
$ARMWV,7.97,R,0.00,N,A*27a?
$ARMWV,8.00,R,0.00,N,A*26a?
$ARMWV,8.01,R,0.00,N,A*27a?
$ARMWV,7.97,R,0.00,N,A*27a?
there is a issue at the end with check sum would that be all that is messing it up?
Is there a way to just echo what ever is sent to the port?
Problem solved data is being sent to openplotter @ apx 100 ms/ reading..
Code:
radio.read(receivedMessage, radio.getDynamicPayloadSize())
   #print("Received: {}".format(receivedMessage))
   string = ""
   for n in receivedMessage:
       if (n >= 1 and n <= 126): #changed to allow \n\r but not \0
           string += chr(n)

   import socket
   sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
   sock.sendto(string.encode("ascii"), ('127.0.0.1', 10110))# changed to send as ascii
   sock.close()
   #print(string)
   radio.stopListening()


Cool