Last active
August 29, 2015 14:23
-
-
Save harrik/0b82cfecd6e35b543bc2 to your computer and use it in GitHub Desktop.
Read DMK Box output stream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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