Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#define GPS_NMEA_PARSER_H bool isSingleSentence(std: :string); #include #include /* A NMEA sentence stores a two-digit hexadecimal checksum at the #include end of the sentence * (after

image text in transcribedimage text in transcribed
#define GPS_NMEA_PARSER_H bool isSingleSentence(std: :string); #include #include /* A NMEA sentence stores a two-digit hexadecimal checksum at the #include end of the sentence * (after the '*' ). The checksum value should be the ASCII #include "position.h" character code (in hexadecimal) * of the bitwise XOR reduction of the character codes of all namespace GPS: : NMEA characters between the '$' * and the '*' (exclusive). /* Determine whether the parameter is the three-character code for a sentence format * This function verifies whether the checksum is correct for the * that is currently supported. sentence contents. * Currently the only supported sentence formats are "GLL", "WPL", Pre-condition: the argument string must conform to the "RMC", and "GGA". structure of a single NMEA sentence. * Non-conforming arguments cause undefined behaviour. bool isSupportedFormat (std: : string); * / bool hasCorrectChecksum(std: : string); /* Determine whether a string conforms to the structure of a single NMEA sentence. /* Stores the transmitter type, sentence format, and fields of a * A NMEA sentence contains the following contents: NMEA sentence ( the checksum - The first character is always the '$' symbol; * is not stored). - followed by two characters indicating the type of transmitting device, struct SentenceData which consist of an uppercase letter 'G' followed by any uppercase English letter; /* Stores the type of transmitting device. - followed by a sequence of three uppercase (English) * E.g. "GP" alphabet characters identifying * / the sentence format; std: :string transmitter; - followed by a sequence of one or more comma-prefixed data fields; /* Stores the NMEA sentence format. - followed by a '*' character; * E.g. "GLL". - followed by a two-character hexadecimal checksum. * / std: :string format; * Data fields may contain any characters except '$' or '*', and may be empty . /* Stores the data fields. * E.g. * For sentences that do not match this structure, this function * - the first element of the vector could be "5425.32", returns false. - the second element could be "N". * / * Note that this function does NOT check whether the type of std: :vector dataFields; transmitting device is * recognised, or whether the sentence format is supported.- the line conforms to the structure of a single NMEA /* Extracts the transmitter type, sentence format, and field sentence; contents from a NMEA sentence - the sentence stores the correct checksum value; * string. The '$', '*' and the checksum are ignored. - the sentence format is supported (currently GLL, GGA and RMC) ; Pre-condition: the argument string must conform to the - the sentence has the correct number of fields; structure of a single NMEA sentence. - the necessary fields contain valid data. * Non-conforming arguments cause undefined behaviour. std: :vector parseValidSentences(std: : istream &); SentenceData parseSingleSentence(std: : string); /* Check whether the sentence data contains the correct number of #endif fields for the sentence format. * Pre-condition: the sentence data contains a supported format. * Unsupported formats cause undefined behaviour. bool hasCorrectNumberOfFields (SentenceData); /* Interprets the data from a NMEA sentence and constructs a Position object. * Currently only supports the GLL, GGA and RMC sentence formats. * If the format does not include elevation data, then the elevation is set to zero. * Throws a std: : domain_error exception if the necessary data fields contain invalid data. * Pre-conditions : - the sentence data contains a supported format; - the sentence data contains the correct number of fields for that format. * Unsupported formats or incorrect numbers of fields cause undefined behaviour. $ / Position interpretSentenceData(SentenceData) ; /* Parses a stream of NMEA sentences (one sentence per line), and constructs a vector of * Position objects, ignoring any lines that do not contain valid sentences. * A line is a valid sentence if all of the following are true

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

How does artificial intelligence change store management?

Answered: 1 week ago