class nmea_decode¶
The decoder object is able to interpret parsed nmea data and returns sentence specific parameters and data.
Constructor¶
-
class
nmea_decoder.
nmea_decode
¶ Create a decoder object associated with the nmea decoder.
Methods¶
-
nmea_decoder.
nmea_decode
(['field1', 'field2', 'field3', '', '']) → ((‘nmea sentence’), ‘(Datatype,unit,tag, value)’, ‘(Datatype,unit,tag, value)’, …]¶ The decoder accepts data from the nmea_parser. Because nmea consists of a wide variety of sentences not all sentences are suported. Depending on demand, more sentences can be added.
At the start of each sentence the original nmea sentence indicator is presented as: (nmea sentence, validity) Then following for eacht data field: data field is converted to a 4 item tuple which contains: (Datatype,unit,tag, value)
The following sentences are supported: GGA VTG RMC TXT
Example usage¶
The following code shows an example of using the decoder.
from nmea import parser
from nmea_decoder import nmea_decode
__nmea_parser = parser()
__nmea_decoder = nmea_decode()
nmea_string = '$GPGGA,172814.0,3723.46587704,N,12202.26957864,W,2,6,1.2,18.893,M,-25.669,M,2.0,0031*4F\r\n'
nmea_data = __nmea_parser.parse(nmea_string, True)
print (nmea_data)
nmea_decoded = __nmea_decoder.decode(nmea_data)
print (nmea_decoded)
nmea_string = '$GNVTG,,T,,M,0.034,N,0.063,K,A*3F\r\n'
nmea_data = __nmea_parser.parse(nmea_string, True)
print (nmea_data)
nmea_decoded = __nmea_decoder.decode(nmea_data)
print (nmea_decoded)
nmea_string = '$GNRMC,131335.00,A,5153.45401,N,00409.71775,E,0.113,,300720,,,A*65\r\n'
nmea_data = __nmea_parser.parse(nmea_string, True)
print (nmea_data)
nmea_decoded = __nmea_decoder.decode(nmea_data)
print (nmea_decoded)
nmea_string = '$GNTXT,01,01,02,GNSS OTP=GPS;GLO*37\r\n'
nmea_data = __nmea_parser.parse(nmea_string, True)
print (nmea_data)
nmea_decoded = __nmea_decoder.decode(nmea_data)
print (nmea_decoded)