Skip to content

Instantly share code, notes, and snippets.

@harrik

harrik/dmklisten.py

Last active Aug 29, 2015
Embed
What would you like to do?
Read DMK Box output stream
# Log the NMEA messages from DMK Box
# Harri Kinnunen 2015
# Works on OSX, not tested elsewhere
import socket
import codecs
# Check your DMK Box IP address using DMK app
DMK_IP = "192.168.1.124"
UDP_PORT = 1703
# hex a5 = 'StartConnection'
# 0123456789 is the factory default application password
MESSAGE = "\xa50123456789"
print "UDP target IP:", DMK_IP
print "UDP target port:", UDP_PORT
print "message:", MESSAGE
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(MESSAGE, (DMK_IP, UDP_PORT))
while True:
data, addr = sock.recvfrom(300) # 300 bytes buffer should be enough for anyone
#print "received message:", data.encode('hex')
print "received message:", data.strip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.