6 Sep
2013
6 Sep
'13
2:27 a.m.
On 09/05/2013 07:00 PM, Michael Powell wrote:
On Thu, Sep 5, 2013 at 8:54 PM, Michael Caisse
wrote:
Hi Michael -
Parsing NMEA is about as easy as you have described in english.
rule = lit('$') >> ~char_('*') >> lit('$') >> hex >> lit("\r\n");
Pretty straightforward. How about the wrinkle of enforcing the NMEA 2-hex-digit checksum?
It ends up that the Spirit numeric parser is customizable. Simply create the parser you want. For example: qi::uint_parser< unsigned, 16, 2, 2 > nmea_hex_p; creates a parser that will synthesize unsigned values that are parsed as base 16 and must have exactly 2 digits. rule >> lit('$') >> ~char_('*') >> '*' >> nmea_hex_p >> "\r\n"; michael -- Michael Caisse ciere consulting ciere.com