gtjoseph / mt3339-utils

MIT License
62 stars 21 forks source link

Implement pynmea2 #2

Closed dschaper closed 8 years ago

dschaper commented 9 years ago

I'm trying to rewrite some of the code using the pynmea2 library, it may be something to take a look at... The talkers are already classed, and decoding and generating is implemented. (Same with auto-checksumming)

import pynmea2

data = "$PMTK000*32"
msg = pynmea2.parse(data) 
print msg.manufacturer
print msg.data
print msg.render()

msg2 = pynmea2.ProprietarySentence('MTK',['000'])
print str(msg2)

MTK
['000']
$PMTK000*32
$PMTK000*32

And <class 'pynmea2.types.talker.GGA'> $GPGGA,070434.000,XXXX.YYYY,N,XXXXX.YYYY,W,1,10,0.94,115.6,M,-33.9,M,,*52

dschaper commented 9 years ago

Example: in send_string, you can reduce the function down:

Sending speed:

data2 = "PMTK251,9600" 
print pynmea2.parse(data2).render()

$PMTK251,9600*17