-
Notifications
You must be signed in to change notification settings - Fork 51
Description
Hi. Hope all is well.
I've encountered a parsing problem while trying to parse a GNS message from my u-blox SAM-M10Q module. I think I've narrowed it down, but some help will be appreciated.
The message received from the module (no gps fix): $GNGNS,,,,,,NNNNNN,00,99.99,,,,,V*07
The error I got while trying to parse the message:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParsingError(Failure(Error { input: "NNNN", code: Fail }))', src\main.rs:6:35
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\gpsdecoder.exe` (exit code: 101)Now from what I can gather, the NNNNNN is fix flags for each of the satellite constellations supported and being used by the u-blox module, parsed with the parse_faa_modes function.
However, the parse_faa_modes function checks the next character to parse (in this case the first GNSS's flag), parses it and builds a FaaModes struct, and since there is still characters to parse (the rest of the GNSS's flags), it adds a second system state to the same FaaModes struct it just created for the first one. Thereafter, the rest of the GNSS's flags are still there, the parse_faa_modes function doesn't know what to do and returns an error.
Now I think this can be solved by running the parse_faa_modes function on each character in this group and not on the group as a whole.
I am willing to create a PR for this, but I need some help.
Thanks for your assistance,
Stefan