33 """Utilities for calculating and checking NMEA checksums.""" 37 """Calculate and compare the checksum of a NMEA string. 40 nmea_sentence (str): The NMEA sentence to check. 42 Return True if the calculated checksum of the sentence matches the one provided. 44 split_sentence = nmea_sentence.split(
'*')
45 if len(split_sentence) != 2:
48 transmitted_checksum = split_sentence[1].strip()
51 data_to_checksum = split_sentence[0][1:]
53 for c
in data_to_checksum:
56 return (
"%02X" % checksum) == transmitted_checksum.upper()
def check_nmea_checksum(nmea_sentence)