Skip to content

Instantly share code, notes, and snippets.

@harrik
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harrik/0b82cfecd6e35b543bc2 to your computer and use it in GitHub Desktop.
Save harrik/0b82cfecd6e35b543bc2 to your computer and use it in GitHub Desktop.
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