source:
pacpussensors/trunk/NMEA0183/src/CHECKSUM.cpp@
110
Last change on this file since 110 was 59, checked in by , 10 years ago | |
---|---|
File size: 442 bytes |
Rev | Line | |
---|---|---|
[59] | 1 | #include "nmea0183.h" |
2 | ||
3 | unsigned char ComputeChecksum( const QString &line_to_parse ) | |
4 | { | |
5 | unsigned char checksum_value = 0; | |
6 | ||
7 | int string_length = line_to_parse.length(); | |
8 | int index = 1; // Skip over the $ at the begining of the sentence | |
9 | ||
10 | while( index < string_length && line_to_parse[ index ] != '*' ) | |
11 | { | |
12 | checksum_value ^= line_to_parse[ index ].toLatin1(); | |
13 | index++; | |
14 | } | |
15 | ||
16 | return( checksum_value ); | |
17 | } |
Note:
See TracBrowser
for help on using the repository browser.