class Parser

The parser object is able to check and parse a valid NMEA sentence into seperate fields.

Constructor

class nmea.parser

Create a parser object associated with the nmea parser.

Methods

parser.parse(sentence: string, checksum=True)[field1, field2, field3, , ]

Parse a valid nmea sentence into seperate fields, If checksum is True, the parser will check the checksum before parsing. If a sentence is invalid or contains an invalid checksum an empty list is returned.

Example usage

The following code shows an example of using the parser.

from nmea import parser

data = '$WIWMV,23,K,130,A\r\n'

nmea_parser = parser()
result = nmea_parser.parse(data)

if result[0].contains('WIWMV'):
    # ... do something