let hexdigits = b"0123456789abcdef";
while let Some(received) = try_read() {
+ if received == b'$' {
+ self.state = ParseState::InPacket;
+ self.offset = 0;
+ self.checksum = 0x00;
+
+ continue;
+ }
+
match self.state {
ParseState::Start => {
- if received == b'$' {
- self.state = ParseState::InPacket;
- self.offset = 0;
- self.checksum = 0x00;
- }
+ // Empty.
},
ParseState::InPacket => {
if received == b'*' {
return false;
}
- if pos_fix_indicator != b"1" {
- return false;
+ match pos_fix_indicator {
+ b"1" => {
+ // Valid standard GPS fix (low resolution).
+ },
+ b"2" => {
+ // Valid differential GPS fix (high resolution).
+ },
+ _ => {
+ return false;
+ }
}
if utc_time.len() < 6 {