You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to interact with a proprietary GPS logger that sends sentences like:
$PMTK182,8,0001F800,FFFFFFFFFFFFFF…FFFFF*52
Now I could wrap the parse_sentence function and handle those proprietary functions in the wrapper but I would have to duplicate code like checksum verification.
Possible solutions:
Include the whole sentence as a struct field in ParseError::UnsupportedSentenceType so that wrapper can attempt to handle it after running parse_sentence.
Return Ok(ParsedMessage::Proprietary(String)) from parse_sentence instead of ParseError::UnsupportedSentenceType.
Factor out the verify_and_strip_checksum function and make it public.
Add NmeaParserFull<ProprietaryMessagesType> (NmeaParser would become NmeaParserFull<()>) and a method like NmeaParserFull::register_parser_for_prefix<H>(prefix: &str, handler: H) where H: Fn(&str) -> Option<ProprietaryMessagesType>
The text was updated successfully, but these errors were encountered:
I need to interact with a proprietary GPS logger that sends sentences like:
Now I could wrap the
parse_sentence
function and handle those proprietary functions in the wrapper but I would have to duplicate code like checksum verification.Possible solutions:
ParseError::UnsupportedSentenceType
so that wrapper can attempt to handle it after runningparse_sentence
.Ok(ParsedMessage::Proprietary(String))
fromparse_sentence
instead ofParseError::UnsupportedSentenceType
.verify_and_strip_checksum
function and make it public.NmeaParserFull<ProprietaryMessagesType>
(NmeaParser
would becomeNmeaParserFull<()>
) and a method likeNmeaParserFull::register_parser_for_prefix<H>(prefix: &str, handler: H) where H: Fn(&str) -> Option<ProprietaryMessagesType>
The text was updated successfully, but these errors were encountered: