1 #ifndef __MARNAV__NMEA__NMEA__HPP__
2 #define __MARNAV__NMEA__NMEA__HPP__
7 #include <marnav/nmea/sentence_id.hpp>
11 /// @brief Contains everything to encode and decode NMEA sentences.
13 /// This is provides all NMEA sentences and supporting functions.
15 /// **Example:** list all supported NMEA sentences
17 /// using namespace marnav;
19 /// for (auto const & s : nmea::get_supported_sentences_str()) {
20 /// std::cout << s << "\n";
24 /// **Example:** create a sentence from a given string
26 /// using namespace marnav;
28 /// auto s = nmea::make_sentence("$GPBOD,099.3,T,105.6,M,POINTB,*01");
30 /// if (s->id() == nmea::sentence_id::BOD) {
31 /// auto bod = nmea::sentence_cast<nmea::bod>(s);
32 /// std::cout << bod->get_waypoint_from() << " -> " << bod->get_waypoint_to() << "\n";
36 /// **Example:** create a specific sentence from a given string
38 /// using namespace marnav;
40 /// const auto bod = nmea::create_sentence<nmea::bod>("$GPBOD,099.3,T,105.6,M,POINTB,*01");
41 /// std::cout << bod.get_waypoint_from() << " -> " << bod.get_waypoint_to() << "\n";
44 /// **Example:** create a sentence and encode it to a string
46 /// using namespace marnav;
49 /// bod.set_waypoint_from("POINT1");
50 /// bod.set_waypoint_to("POINT2");
52 /// std::cout << nmea::to_string(bod) << "\n";
57 /// @brief Exception to be thrown if a NMEA sentence is not known/supported.
58 class unknown_sentence
: public std::logic_error
61 using logic_error::logic_error
;
64 class sentence
; // forward declaration
66 std::unique_ptr
<sentence
> make_sentence(const std::string
& s
, bool ignore_checksum
= false);
68 sentence_id
extract_id(const std::string
& s
);
70 std::vector
<std::string
> get_supported_sentences_str();
71 std::vector
<sentence_id
> get_supported_sentences_id();
72 std::string
to_string(sentence_id id
);
73 sentence_id
tag_to_id(const std::string
& tag
);