2 #include <marnav/ais/message_01.hpp>
3 #include <marnav/ais/ais.hpp>
4 #include <marnav/nmea/vdm.hpp>
8 using namespace marnav
;
11 ais::message_01 pos_report
;
12 pos_report
.set_sog(82);
13 // ... most data not shown here
16 auto payload
= ais::encode_message(pos_report
);
18 // create NMEA sentences
19 for (uint32_t fragment
= 0; fragment
< payload
.size(); ++fragment
) {
21 vdm
.set_n_fragments(payload
.size());
22 vdm
.set_fragment(fragment
+ 1);
23 vdm
.set_radio_channel(nmea::ais_channel::B
);
24 vdm
.set_payload(payload
[fragment
]);
26 // collect, send or do something with the sentence...
27 std::string s
= nmea::to_string(vdm
);
28 std::cout
<< s
<< "\n";