1 #include <marnav/nmea/alm.hpp>
2 #include <marnav/nmea/io.hpp>
9 constexpr sentence_id
alm::ID
;
10 constexpr const char * alm::TAG
;
13 : sentence(ID
, TAG
, talker::global_positioning_system
)
17 alm::alm(talker talk
, fields::const_iterator first
, fields::const_iterator last
)
18 : sentence(ID
, TAG
, talk
)
20 if (std::distance(first
, last
) != 15)
21 throw std::invalid_argument
{"invalid number of fields in alm"};
23 read(*(first
+ 0), number_of_messages_
);
24 read(*(first
+ 1), message_number_
);
25 read(*(first
+ 2), satellite_prn_
);
26 read(*(first
+ 3), gps_week_number_
);
27 read(*(first
+ 4), sv_health_
);
28 read(*(first
+ 5), eccentricity_
, data_format::hex
);
29 read(*(first
+ 6), almanac_reference_time_
, data_format::hex
);
30 read(*(first
+ 7), inclination_angle_
, data_format::hex
);
31 read(*(first
+ 8), rate_of_right_ascension_
, data_format::hex
);
32 read(*(first
+ 9), root_of_semimajor_axis_
, data_format::hex
);
33 read(*(first
+ 10), argument_of_perigee_
, data_format::hex
);
34 read(*(first
+ 11), longitude_of_ascension_node_
, data_format::hex
);
35 read(*(first
+ 12), mean_anomaly_
, data_format::hex
);
36 read(*(first
+ 13), f0_clock_parameter_
, data_format::hex
);
37 read(*(first
+ 14), f1_clock_parameter_
, data_format::hex
);
42 void alm::check() const
44 if ((satellite_prn_
< 1) || (satellite_prn_
> 32))
45 throw std::invalid_argument
{"invalid satellite PRN"};
48 void alm::append_data_to(std::string
& s
) const
50 append(s
, to_string(number_of_messages_
));
51 append(s
, to_string(message_number_
));
52 append(s
, format(satellite_prn_
, 2));
53 append(s
, to_string(gps_week_number_
));
54 append(s
, format(sv_health_
, 2));
55 append(s
, format(eccentricity_
, 1, data_format::hex
));
56 append(s
, format(almanac_reference_time_
, 1, data_format::hex
));
57 append(s
, format(inclination_angle_
, 1, data_format::hex
));
58 append(s
, format(rate_of_right_ascension_
, 1, data_format::hex
));
59 append(s
, format(root_of_semimajor_axis_
, 1, data_format::hex
));
60 append(s
, format(argument_of_perigee_
, 1, data_format::hex
));
61 append(s
, format(longitude_of_ascension_node_
, 1, data_format::hex
));
62 append(s
, format(mean_anomaly_
, 1, data_format::hex
));
63 append(s
, format(f0_clock_parameter_
, 1, data_format::hex
));
64 append(s
, format(f1_clock_parameter_
, 1, data_format::hex
));