etsi_its_messages v3.5.0
Loading...
Searching...
No Matches
rtcmem_ts_setters.h
Go to the documentation of this file.
1/*
2=============================================================================
3MIT License
4
5Copyright (c) 2023-2025 Institute for Automotive Engineering (ika), RWTH Aachen University
6Copyright (c) 2026 Virtual Vehicle Research GmbH
7
8Permission is hereby granted, free of charge, to any person obtaining a copy
9of this software and associated documentation files (the "Software"), to deal
10in the Software without restriction, including without limitation the rights
11to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12copies of the Software, and to permit persons to whom the Software is
13furnished to do so, subject to the following conditions:
14
15The above copyright notice and this permission notice shall be included in all
16copies or substantial portions of the Software.
17
18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24SOFTWARE.
25=============================================================================
26*/
27
32
33#pragma once
34
35#include <cmath>
36#include <vector>
37
38namespace etsi_its_rtcmem_ts_msgs {
39
40namespace access {
41
42#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_setters.h>
44
47
51 inline void setProtocolVersion(ItsPduHeader& header, const uint8_t value) {
52 throwIfOutOfRange(value, ItsPduHeader::PROTOCOL_VERSION_MIN, ItsPduHeader::PROTOCOL_VERSION_MAX,
53 "ItsPduHeader.protocol_version");
54 header.protocol_version = value;
55 }
56
63 inline void setMessageID(ItsPduHeader& header, const uint8_t value) {
64 throwIfOutOfRange(value, ItsPduHeader::MESSAGE_ID_MIN, ItsPduHeader::MESSAGE_ID_MAX,
65 "ItsPduHeader.message_id");
66 header.message_id = value;
67 }
68
74 inline void setMessageIDToRTCMEM(ItsPduHeader& header) {
75 header.message_id = ItsPduHeader::MESSAGE_ID_RTCMEM;
76 }
77
84 inline void setStationID(StationID& station_id, const uint32_t value) {
85 throwIfOutOfRange(value, StationID::MIN, StationID::MAX, "StationID");
86 station_id.value = value;
87 }
88
95 inline void setStationID(ItsPduHeader& header, const uint32_t value) {
96 setStationID(header.station_id, value);
97 }
98
105 inline void setHeader(RTCMEM& rtcmem, const ItsPduHeader& header) {
106 rtcmem.header = header;
107 }
108
115 inline void setProtocolVersion(RTCMEM& rtcmem, const uint8_t value) {
116 setProtocolVersion(rtcmem.header, value);
117 }
118
125 inline void setMessageID(RTCMEM& rtcmem, const uint8_t value) {
126 setMessageID(rtcmem.header, value);
127 }
128
134 inline void setMessageIDToRTCMEM(RTCMEM& rtcmem) {
135 setMessageIDToRTCMEM(rtcmem.header);
136 }
137
144 inline void setStationID(RTCMEM& rtcmem, const uint32_t value) {
145 setStationID(rtcmem.header, value);
146 }
147
154 inline void setRTCMcorrections(RTCMEM& rtcmem, const RTCMcorrections& rtcm) {
155 rtcmem.rtcmc = rtcm;
156 }
157
164 inline void setMsgCount(MsgCount& msg_cnt, const uint8_t value) {
165 throwIfOutOfRange(value, MsgCount::MIN, MsgCount::MAX, "MsgCount");
166 msg_cnt.value = value;
167 }
168
175 inline void setMsgCount(RTCMcorrections& rtcm, const uint8_t value) {
176 setMsgCount(rtcm.msg_cnt, value);
177 }
178
185 inline void setMsgCount(RTCMEM& rtcmem, const uint8_t value) {
186 setMsgCount(rtcmem.rtcmc, value);
187 }
188
195 inline void setRTCMRevision(RTCMRevision& rev, const uint8_t value) {
196 throwIfOutOfRange(value, RTCMRevision::UNKNOWN, RTCMRevision::RESERVED, "RTCMRevision");
197 rev.value = value;
198 }
199
206 inline void setRTCMRevision(RTCMcorrections& rtcm, const uint8_t value) {
207 setRTCMRevision(rtcm.rev, value);
208 }
209
216 inline void setRTCMRevision(RTCMEM& rtcmem, const uint8_t value) {
217 setRTCMRevision(rtcmem.rtcmc, value);
218 }
219
226 inline void setMinuteOfTheYear(MinuteOfTheYear& moy, const uint32_t value) {
227 throwIfOutOfRange(value, MinuteOfTheYear::MIN, MinuteOfTheYear::MAX, "MinuteOfTheYear");
228 moy.value = value;
229 }
230
237 inline void setMinuteOfTheYear(RTCMcorrections& rtcm, const uint32_t value) {
238 setMinuteOfTheYear(rtcm.time_stamp, value);
239 rtcm.time_stamp_is_present = true;
240 }
241
248 inline void setMinuteOfTheYear(RTCMEM& rtcmem, const uint32_t value) {
249 setMinuteOfTheYear(rtcmem.rtcmc, value);
250 }
251
257 inline void clearMinuteOfTheYear(RTCMcorrections& rtcm) {
258 rtcm.time_stamp_is_present = false;
259 }
260
266 inline void clearMinuteOfTheYear(RTCMEM& rtcmem) {
267 clearMinuteOfTheYear(rtcmem.rtcmc);
268 }
269
276 inline void setAnchorPoint(RTCMcorrections& rtcm, const FullPositionVector& anchor) {
277 rtcm.anchor_point = anchor;
278 rtcm.anchor_point_is_present = true;
279 }
280
287 inline void setAnchorPoint(RTCMEM& rtcmem, const FullPositionVector& anchor) {
288 setAnchorPoint(rtcmem.rtcmc, anchor);
289 }
290
296 inline void clearAnchorPoint(RTCMcorrections& rtcm) {
297 rtcm.anchor_point_is_present = false;
298 }
299
305 inline void clearAnchorPoint(RTCMEM& rtcmem) {
306 clearAnchorPoint(rtcmem.rtcmc);
307 }
308
315 inline void setRTCMHeader(RTCMcorrections& rtcm, const RTCMheader& header) {
316 rtcm.rtcm_header = header;
317 rtcm.rtcm_header_is_present = true;
318 }
319
326 inline void setRTCMHeader(RTCMEM& rtcmem, const RTCMheader& header) {
327 setRTCMHeader(rtcmem.rtcmc, header);
328 }
329
335 inline void clearRTCMHeader(RTCMcorrections& rtcm) {
336 rtcm.rtcm_header_is_present = false;
337 }
338
344 inline void clearRTCMHeader(RTCMEM& rtcmem) {
345 clearRTCMHeader(rtcmem.rtcmc);
346 }
347
354 inline void setRTCMmessageValue(RTCMmessage& msg, const std::vector<uint8_t>& data) {
355 throwIfOutOfRange(data.size(),
356 static_cast<std::size_t>(RTCMmessage::MIN_SIZE),
357 static_cast<std::size_t>(RTCMmessage::MAX_SIZE),
358 "RTCMmessage length");
359 msg.value = data;
360 }
361
368 inline void setRTCMmessageData(RTCMmessage& msg, const std::vector<uint8_t>& data) {
369 setRTCMmessageValue(msg, data);
370 }
371
378 inline void setRTCMmessageList(RTCMmessageList& msgs, const std::vector<RTCMmessage>& values) {
379 throwIfOutOfRange(values.size(),
380 static_cast<std::size_t>(RTCMmessageList::MIN_SIZE),
381 static_cast<std::size_t>(RTCMmessageList::MAX_SIZE),
382 "RTCMmessageList size");
383 msgs.array = values;
384 }
385
392 inline void setRTCMmessageList(RTCMcorrections& rtcm, const std::vector<RTCMmessage>& values) {
393 setRTCMmessageList(rtcm.msgs, values);
394 }
395
402 inline void setRTCMmessageList(RTCMEM& rtcmem, const std::vector<RTCMmessage>& values) {
403 setRTCMmessageList(rtcmem.rtcmc, values);
404 }
405
412 inline RTCMmessage& addRTCMmessage(RTCMmessageList& msgs) {
413 throwIfOutOfRange(msgs.array.size() + 1,
414 static_cast<std::size_t>(RTCMmessageList::MIN_SIZE),
415 static_cast<std::size_t>(RTCMmessageList::MAX_SIZE),
416 "RTCMmessageList size");
417 msgs.array.emplace_back();
418 return msgs.array.back();
419 }
420
427 inline RTCMmessage& addRTCMmessage(RTCMcorrections& rtcm) {
428 return addRTCMmessage(rtcm.msgs);
429 }
430
437 inline RTCMmessage& addRTCMmessage(RTCMEM& rtcmem) {
438 return addRTCMmessage(rtcmem.rtcmc);
439 }
440
448 inline RTCMmessage& addRTCMmessage(RTCMmessageList& msgs, const std::vector<uint8_t>& data) {
449 RTCMmessage& msg = addRTCMmessage(msgs);
450 setRTCMmessageValue(msg, data);
451 return msg;
452 }
453
461 inline RTCMmessage& addRTCMmessage(RTCMcorrections& rtcm, const std::vector<uint8_t>& data) {
462 return addRTCMmessage(rtcm.msgs, data);
463 }
464
472 inline RTCMmessage& addRTCMmessage(RTCMEM& rtcmem, const std::vector<uint8_t>& data) {
473 return addRTCMmessage(rtcmem.rtcmc, data);
474 }
475
481 inline void clearRTCMmessages(RTCMmessageList& msgs) {
482 msgs.array.clear();
483 }
484
490 inline void clearRTCMmessages(RTCMcorrections& rtcm) {
491 clearRTCMmessages(rtcm.msgs);
492 }
493
499 inline void clearRTCMmessages(RTCMEM& rtcmem) {
500 clearRTCMmessages(rtcmem.rtcmc);
501 }
502
509 inline void setGNSSstatus(RTCMheader& header, const GNSSstatus& status) {
510 header.status = status;
511 }
512
519 inline void setGNSSstatus(RTCMheader& header, const std::vector<bool>& status_bits) {
520 setBitString(header.status, status_bits);
521 }
522
529 inline void setAntennaOffsetSet(RTCMheader& header, const AntennaOffsetSet& offset_set) {
530 header.offset_set = offset_set;
531 }
532
538 inline void ensureGNSSstatusStorage(GNSSstatus& status) {
539 if (status.value.size() < 1) {
540 status.value.resize(1, 0u);
541 status.bits_unused = 0;
542 }
543 }
544
552 inline void setGNSSstatusBit(GNSSstatus& status, const uint8_t bit_index, const bool value) {
553 throwIfOutOfRange(bit_index, static_cast<uint8_t>(0), static_cast<uint8_t>(GNSSstatus::SIZE_BITS - 1), "GNSSstatus bit index");
554
556 const uint8_t mask = static_cast<uint8_t>(1u << bit_index);
557
558 if (value) {
559 status.value[0] = static_cast<uint8_t>(status.value[0] | mask);
560 } else {
561 status.value[0] = static_cast<uint8_t>(status.value[0] & ~mask);
562 }
563 }
564
571 inline void setUnavailableFlag(GNSSstatus& status, const bool value) {
572 setGNSSstatusBit(status, GNSSstatus::BIT_INDEX_UNAVAILABLE, value);
573 }
574
581 inline void setIsHealthyFlag(GNSSstatus& status, const bool value) {
582 setGNSSstatusBit(status, GNSSstatus::BIT_INDEX_IS_HEALTHY, value);
583 }
584
591 inline void setIsMonitoredFlag(GNSSstatus& status, const bool value) {
592 setGNSSstatusBit(status, GNSSstatus::BIT_INDEX_IS_MONITORED, value);
593 }
594
601 inline void setBaseStationTypeFlag(GNSSstatus& status, const bool value) {
602 setGNSSstatusBit(status, GNSSstatus::BIT_INDEX_BASE_STATION_TYPE, value);
603 }
604
611 inline void setAPDOPofUnder5Flag(GNSSstatus& status, const bool value) {
612 setGNSSstatusBit(status, GNSSstatus::BIT_INDEX_A_PDO_POF_UNDER5, value);
613 }
614
621 inline void setInViewOfUnder5Flag(GNSSstatus& status, const bool value) {
622 setGNSSstatusBit(status, GNSSstatus::BIT_INDEX_IN_VIEW_OF_UNDER5, value);
623 }
624
631 inline void setLocalCorrectionsPresentFlag(GNSSstatus& status, const bool value) {
632 setGNSSstatusBit(status, GNSSstatus::BIT_INDEX_LOCAL_CORRECTIONS_PRESENT, value);
633 }
634
641 inline void setNetworkCorrectionsPresentFlag(GNSSstatus& status, const bool value) {
642 setGNSSstatusBit(status, GNSSstatus::BIT_INDEX_NETWORK_CORRECTIONS_PRESENT, value);
643 }
644
651 inline void setAntennaOffsetX(OffsetB12& field, const int16_t value) {
652 throwIfOutOfRange(value, OffsetB12::MIN, OffsetB12::MAX, "OffsetB12");
653 field.value = value;
654 }
655
662 inline void setAntennaOffsetY(OffsetB09& field, const int16_t value) {
663 throwIfOutOfRange(value, OffsetB09::MIN, OffsetB09::MAX, "OffsetB09");
664 field.value = value;
665 }
666
673 inline void setAntennaOffsetZ(OffsetB10& field, const int16_t value) {
674 throwIfOutOfRange(value, OffsetB10::MIN, OffsetB10::MAX, "OffsetB10");
675 field.value = value;
676 }
677
684 inline void setAntennaOffsetX(AntennaOffsetSet& offset, const int16_t value) {
685 setAntennaOffsetX(offset.ant_offset_x, value);
686 }
687
694 inline void setAntennaOffsetY(AntennaOffsetSet& offset, const int16_t value) {
695 setAntennaOffsetY(offset.ant_offset_y, value);
696 }
697
704 inline void setAntennaOffsetZ(AntennaOffsetSet& offset, const int16_t value) {
705 setAntennaOffsetZ(offset.ant_offset_z, value);
706 }
707
714 inline void setLongitude(Longitude& longitude, const int32_t value) {
715 throwIfOutOfRange(value, Longitude::MIN, Longitude::MAX, "Longitude");
716 longitude.value = value;
717 }
718
725 inline void setLongitude(Longitude& longitude, const double value) {
726 int64_t longitude_value = static_cast<int64_t>(std::round(value * 1e7));
727 throwIfOutOfRange(longitude_value, Longitude::MIN, Longitude::MAX, "Longitude");
728 longitude.value = longitude_value;
729 }
730
737 inline void setLatitude(Latitude& latitude, const int32_t value) {
738 throwIfOutOfRange(value, Latitude::MIN, Latitude::MAX, "Latitude");
739 latitude.value = value;
740 }
741
748 inline void setLatitude(Latitude& latitude, const double value) {
749 int64_t latitude_value = static_cast<int64_t>(std::round(value * 1e7));
750 throwIfOutOfRange(latitude_value, Latitude::MIN, Latitude::MAX, "Latitude");
751 latitude.value = latitude_value;
752 }
753
760 inline void setElevation(Elevation& elevation, const int32_t value) {
761 throwIfOutOfRange(value, Elevation::MIN, Elevation::MAX, "Elevation");
762 elevation.value = value;
763 }
764
771 inline void setElevation(Elevation& elevation, const double value) {
772 int64_t elevation_value = static_cast<int64_t>(std::round(value * 1e1));
773 throwIfOutOfRange(elevation_value, Elevation::MIN, Elevation::MAX, "Elevation");
774 elevation.value = elevation_value;
775 }
776
783 inline void setHeading(HeadingDSRC& heading, const uint16_t value) {
784 throwIfOutOfRange(value, HeadingDSRC::MIN, HeadingDSRC::MAX, "HeadingDSRC");
785 heading.value = value;
786 }
787
794 inline void setUTCTime(FullPositionVector& pos, const DDateTime& utc_time) {
795 pos.utc_time = utc_time;
796 pos.utc_time_is_present = true;
797 }
798
804 inline void clearUTCTime(FullPositionVector& pos) {
805 pos.utc_time_is_present = false;
806 }
807
814 inline void setLongitude(FullPositionVector& pos, const int32_t value) {
815 setLongitude(pos.lon, value);
816 }
817
824 inline void setLongitude(FullPositionVector& pos, const double value) {
825 setLongitude(pos.lon, value);
826 }
827
834 inline void setLatitude(FullPositionVector& pos, const int32_t value) {
835 setLatitude(pos.lat, value);
836 }
837
844 inline void setLatitude(FullPositionVector& pos, const double value) {
845 setLatitude(pos.lat, value);
846 }
847
854 inline void setElevation(FullPositionVector& pos, const Elevation& elevation) {
855 pos.elevation = elevation;
856 pos.elevation_is_present = true;
857 }
858
865 inline void setElevation(FullPositionVector& pos, const int32_t value) {
866 setElevation(pos.elevation, value);
867 pos.elevation_is_present = true;
868 }
869
876 inline void setElevation(FullPositionVector& pos, const double value) {
877 setElevation(pos.elevation, value);
878 pos.elevation_is_present = true;
879 }
880
886 inline void clearElevation(FullPositionVector& pos) {
887 pos.elevation_is_present = false;
888 }
889
896 inline void setHeading(FullPositionVector& pos, const HeadingDSRC& heading) {
897 pos.heading = heading;
898 pos.heading_is_present = true;
899 }
900
907 inline void setHeading(FullPositionVector& pos, const uint16_t value) {
908 setHeading(pos.heading, value);
909 pos.heading_is_present = true;
910 }
911
917 inline void clearHeading(FullPositionVector& pos) {
918 pos.heading_is_present = false;
919 }
920
927 inline void setSpeed(FullPositionVector& pos, const TransmissionAndSpeed& speed) {
928 pos.speed = speed;
929 pos.speed_is_present = true;
930 }
931
937 inline void clearSpeed(FullPositionVector& pos) {
938 pos.speed_is_present = false;
939 }
940
947 inline void setPositionalAccuracy(FullPositionVector& pos, const PositionalAccuracy& accuracy) {
948 pos.pos_accuracy = accuracy;
949 pos.pos_accuracy_is_present = true;
950 }
951
957 inline void clearPositionalAccuracy(FullPositionVector& pos) {
958 pos.pos_accuracy_is_present = false;
959 }
960
967 inline void setTimeConfidence(TimeConfidence& time_confidence, const uint8_t value) {
968 throwIfOutOfRange(value, TimeConfidence::UNAVAILABLE, TimeConfidence::TIME_000_000_000_01,
969 "TimeConfidence");
970 time_confidence.value = value;
971 }
972
979 inline void setTimeConfidence(FullPositionVector& pos, const TimeConfidence& time_confidence) {
980 pos.time_confidence = time_confidence;
981 pos.time_confidence_is_present = true;
982 }
983
990 inline void setTimeConfidence(FullPositionVector& pos, const uint8_t value) {
991 setTimeConfidence(pos.time_confidence, value);
992 pos.time_confidence_is_present = true;
993 }
994
1000 inline void clearTimeConfidence(FullPositionVector& pos) {
1001 pos.time_confidence_is_present = false;
1002 }
1003
1010 inline void setPositionConfidence(FullPositionVector& pos, const PositionConfidenceSet& confidence) {
1011 pos.pos_confidence = confidence;
1012 pos.pos_confidence_is_present = true;
1013 }
1014
1020 inline void clearPositionConfidence(FullPositionVector& pos) {
1021 pos.pos_confidence_is_present = false;
1022 }
1023
1030 inline void setSpeedConfidence(FullPositionVector& pos,
1031 const SpeedandHeadingandThrottleConfidence& confidence) {
1032 pos.speed_confidence = confidence;
1033 pos.speed_confidence_is_present = true;
1034 }
1035
1041 inline void clearSpeedConfidence(FullPositionVector& pos) {
1042 pos.speed_confidence_is_present = false;
1043 }
1044
1051 inline void setTransmissionState(TransmissionState& transmission_state, const uint8_t value) {
1052 throwIfOutOfRange(value, TransmissionState::NEUTRAL, TransmissionState::UNAVAILABLE, "TransmissionState");
1053 transmission_state.value = value;
1054 }
1055
1062 inline void setTransmissionState(TransmissionAndSpeed& speed, const uint8_t value) {
1063 setTransmissionState(speed.transmisson, value);
1064 }
1065
1072 inline void setVelocity(Velocity& velocity, const uint16_t value) {
1073 throwIfOutOfRange(value, Velocity::MIN, Velocity::MAX, "Velocity");
1074 velocity.value = value;
1075 }
1076
1083 inline void setVelocity(TransmissionAndSpeed& speed, const uint16_t value) {
1084 setVelocity(speed.speed, value);
1085 }
1086
1094 inline void setTransmissionAndSpeed(TransmissionAndSpeed& speed, const uint8_t transmission_state,
1095 const uint16_t velocity) {
1096 setTransmissionState(speed, transmission_state);
1097 setVelocity(speed, velocity);
1098 }
1099
1106 inline void setSemiMajorAxisAccuracy(SemiMajorAxisAccuracy& accuracy, const uint8_t value) {
1107 throwIfOutOfRange(value, SemiMajorAxisAccuracy::MIN, SemiMajorAxisAccuracy::MAX, "SemiMajorAxisAccuracy");
1108 accuracy.value = value;
1109 }
1110
1117 inline void setSemiMajorAxisAccuracy(PositionalAccuracy& accuracy, const uint8_t value) {
1118 setSemiMajorAxisAccuracy(accuracy.semi_major, value);
1119 }
1120
1127 inline void setSemiMinorAxisAccuracy(SemiMinorAxisAccuracy& accuracy, const uint8_t value) {
1128 throwIfOutOfRange(value, SemiMinorAxisAccuracy::MIN, SemiMinorAxisAccuracy::MAX, "SemiMinorAxisAccuracy");
1129 accuracy.value = value;
1130 }
1131
1138 inline void setSemiMinorAxisAccuracy(PositionalAccuracy& accuracy, const uint8_t value) {
1139 setSemiMinorAxisAccuracy(accuracy.semi_minor, value);
1140 }
1141
1148 inline void setSemiMajorAxisOrientation(SemiMajorAxisOrientation& orientation, const uint16_t value) {
1149 throwIfOutOfRange(value, SemiMajorAxisOrientation::MIN, SemiMajorAxisOrientation::MAX,
1150 "SemiMajorAxisOrientation");
1151 orientation.value = value;
1152 }
1153
1160 inline void setSemiMajorAxisOrientation(PositionalAccuracy& accuracy, const uint16_t value) {
1161 setSemiMajorAxisOrientation(accuracy.orientation, value);
1162 }
1163
1170 inline void setPositionConfidence(PositionConfidence& confidence, const uint8_t value) {
1171 throwIfOutOfRange(value, PositionConfidence::UNAVAILABLE, PositionConfidence::A1CM, "PositionConfidence");
1172 confidence.value = value;
1173 }
1174
1181 inline void setPositionConfidence(PositionConfidenceSet& confidence, const uint8_t value) {
1182 setPositionConfidence(confidence.pos, value);
1183 }
1184
1191 inline void setElevationConfidence(ElevationConfidence& confidence, const uint8_t value) {
1192 throwIfOutOfRange(value, ElevationConfidence::UNAVAILABLE, ElevationConfidence::ELEV_000_01,
1193 "ElevationConfidence");
1194 confidence.value = value;
1195 }
1196
1203 inline void setElevationConfidence(PositionConfidenceSet& confidence, const uint8_t value) {
1204 setElevationConfidence(confidence.elevation, value);
1205 }
1206
1213 inline void setHeadingConfidence(HeadingConfidenceDSRC& confidence, const uint8_t value) {
1214 throwIfOutOfRange(value, HeadingConfidenceDSRC::UNAVAILABLE, HeadingConfidenceDSRC::PREC0_0125DEG,
1215 "HeadingConfidenceDSRC");
1216 confidence.value = value;
1217 }
1218
1225 inline void setHeadingConfidence(SpeedandHeadingandThrottleConfidence& confidence, const uint8_t value) {
1226 setHeadingConfidence(confidence.heading, value);
1227 }
1228
1235 inline void setSpeedConfidence(SpeedConfidenceDSRC& confidence, const uint8_t value) {
1236 throwIfOutOfRange(value, SpeedConfidenceDSRC::UNAVAILABLE, SpeedConfidenceDSRC::PREC0_01MS,
1237 "SpeedConfidenceDSRC");
1238 confidence.value = value;
1239 }
1240
1247 inline void setSpeedConfidence(SpeedandHeadingandThrottleConfidence& confidence, const uint8_t value) {
1248 setSpeedConfidence(confidence.speed, value);
1249 }
1250
1257 inline void setThrottleConfidence(ThrottleConfidence& confidence, const uint8_t value) {
1258 throwIfOutOfRange(value, ThrottleConfidence::UNAVAILABLE, ThrottleConfidence::PREC0_5PERCENT,
1259 "ThrottleConfidence");
1260 confidence.value = value;
1261 }
1262
1269 inline void setThrottleConfidence(SpeedandHeadingandThrottleConfidence& confidence, const uint8_t value) {
1270 setThrottleConfidence(confidence.throttle, value);
1271 }
1272
1279 inline void setYear(DYear& year, const uint16_t value) {
1280 throwIfOutOfRange(value, DYear::MIN, DYear::MAX, "DYear");
1281 year.value = value;
1282 }
1283
1290 inline void setYear(DDateTime& date_time, const uint16_t value) {
1291 setYear(date_time.year, value);
1292 date_time.year_is_present = true;
1293 }
1294
1300 inline void clearYear(DDateTime& date_time) {
1301 date_time.year_is_present = false;
1302 }
1303
1310 inline void setMonth(DMonth& month, const uint8_t value) {
1311 throwIfOutOfRange(value, DMonth::MIN, DMonth::MAX, "DMonth");
1312 month.value = value;
1313 }
1314
1321 inline void setMonth(DDateTime& date_time, const uint8_t value) {
1322 setMonth(date_time.month, value);
1323 date_time.month_is_present = true;
1324 }
1325
1331 inline void clearMonth(DDateTime& date_time) {
1332 date_time.month_is_present = false;
1333 }
1334
1341 inline void setDay(DDay& day, const uint8_t value) {
1342 throwIfOutOfRange(value, DDay::MIN, DDay::MAX, "DDay");
1343 day.value = value;
1344 }
1345
1352 inline void setDay(DDateTime& date_time, const uint8_t value) {
1353 setDay(date_time.day, value);
1354 date_time.day_is_present = true;
1355 }
1356
1362 inline void clearDay(DDateTime& date_time) {
1363 date_time.day_is_present = false;
1364 }
1365
1372 inline void setHour(DHour& hour, const uint8_t value) {
1373 throwIfOutOfRange(value, DHour::MIN, DHour::MAX, "DHour");
1374 hour.value = value;
1375 }
1376
1383 inline void setHour(DDateTime& date_time, const uint8_t value) {
1384 setHour(date_time.hour, value);
1385 date_time.hour_is_present = true;
1386 }
1387
1393 inline void clearHour(DDateTime& date_time) {
1394 date_time.hour_is_present = false;
1395 }
1396
1403 inline void setMinute(DMinute& minute, const uint8_t value) {
1404 throwIfOutOfRange(value, DMinute::MIN, DMinute::MAX, "DMinute");
1405 minute.value = value;
1406 }
1407
1414 inline void setMinute(DDateTime& date_time, const uint8_t value) {
1415 setMinute(date_time.minute, value);
1416 date_time.minute_is_present = true;
1417 }
1418
1424 inline void clearMinute(DDateTime& date_time) {
1425 date_time.minute_is_present = false;
1426 }
1427
1434 inline void setSecond(DSecond& second, const uint16_t value) {
1435 throwIfOutOfRange(value, DSecond::MIN, DSecond::MAX, "DSecond");
1436 second.value = value;
1437 }
1438
1445 inline void setSecond(DSecond& second, const double value) {
1446 setSecond(second, static_cast<uint16_t>(std::round(value * 1e3)));
1447 }
1448
1455 inline void setSecond(DDateTime& date_time, const uint16_t value) {
1456 setSecond(date_time.second, value);
1457 date_time.second_is_present = true;
1458 }
1459
1466 inline void setSecond(DDateTime& date_time, const double value) {
1467 setSecond(date_time.second, value);
1468 date_time.second_is_present = true;
1469 }
1470
1476 inline void clearSecond(DDateTime& date_time) {
1477 date_time.second_is_present = false;
1478 }
1479
1486 inline void setOffset(DOffset& offset, const int16_t value) {
1487 throwIfOutOfRange(value, DOffset::MIN, DOffset::MAX, "DOffset");
1488 offset.value = value;
1489 }
1490
1497 inline void setOffset(DDateTime& date_time, const int16_t value) {
1498 setOffset(date_time.offset, value);
1499 date_time.offset_is_present = true;
1500 }
1501
1507 inline void clearOffset(DDateTime& date_time) {
1508 date_time.offset_is_present = false;
1509 }
1510
1511} // namespace access
1512
1513} // namespace etsi_its_rtcmem_ts_msgs
Sanity-check functions etc.
void throwIfOutOfRange(const T1 &val, const T2 &min, const T2 &max, const std::string val_desc)
Throws an exception if a given value is out of a defined range.
void setMonth(DMonth &month, const uint8_t value)
Set the DMonth value.
void setUnavailableFlag(GNSSstatus &status, const bool value)
Set the unavailable flag of a GNSSstatus object.
void clearRTCMmessages(RTCMmessageList &msgs)
Clear all RTCM messages from a RTCMmessageList object.
void clearMonth(DDateTime &date_time)
Clear the optional month of a DDateTime object.
void setStationID(StationID &station_id, const uint32_t value)
Set the StationID object.
void setAntennaOffsetZ(OffsetB10 &field, const int16_t value)
Set the z antenna offset object.
void setIsMonitoredFlag(GNSSstatus &status, const bool value)
Set the isMonitored flag of a GNSSstatus object.
void setHour(DHour &hour, const uint8_t value)
Set the DHour value.
void clearUTCTime(FullPositionVector &pos)
Clear the optional utcTime of a FullPositionVector object.
void clearMinuteOfTheYear(RTCMcorrections &rtcm)
Clear the optional MinuteOfTheYear of a RTCMcorrections object.
void setRTCMmessageData(RTCMmessage &msg, const std::vector< uint8_t > &data)
Set the raw bytes of a RTCMmessage object.
void setPositionConfidence(FullPositionVector &pos, const PositionConfidenceSet &confidence)
Set the position confidence of a FullPositionVector object.
void clearHour(DDateTime &date_time)
Clear the optional hour of a DDateTime object.
void setSemiMajorAxisAccuracy(SemiMajorAxisAccuracy &accuracy, const uint8_t value)
Set the semi-major axis accuracy value.
RTCMmessage & addRTCMmessage(RTCMmessageList &msgs)
Add a new default-constructed RTCMmessage to a RTCMmessageList object.
void clearRTCMHeader(RTCMcorrections &rtcm)
Clear the optional RTCMheader of a RTCMcorrections object.
void setLatitude(Latitude &latitude, const int32_t value)
Set the raw latitude value of a Latitude object.
void setLongitude(Longitude &longitude, const int32_t value)
Set the raw longitude value of a Longitude object.
void setTransmissionAndSpeed(TransmissionAndSpeed &speed, const uint8_t transmission_state, const uint16_t velocity)
Set the transmission state and velocity of a TransmissionAndSpeed object.
void clearElevation(FullPositionVector &pos)
Clear the optional elevation of a FullPositionVector object.
void setBaseStationTypeFlag(GNSSstatus &status, const bool value)
Set the baseStationType flag of a GNSSstatus object.
void clearTimeConfidence(FullPositionVector &pos)
Clear the optional time confidence of a FullPositionVector object.
void clearOffset(DDateTime &date_time)
Clear the optional offset of a DDateTime object.
void setAntennaOffsetX(OffsetB12 &field, const int16_t value)
Set the x antenna offset object.
void setGNSSstatus(RTCMheader &header, const GNSSstatus &status)
Set the GNSSstatus object of a RTCMheader object.
void setSemiMajorAxisOrientation(SemiMajorAxisOrientation &orientation, const uint16_t value)
Set the semi-major axis orientation value.
void setInViewOfUnder5Flag(GNSSstatus &status, const bool value)
Set the inViewOfUnder5 flag of a GNSSstatus object.
void setRTCMHeader(RTCMcorrections &rtcm, const RTCMheader &header)
Set the RTCMheader of a RTCMcorrections object.
void setThrottleConfidence(ThrottleConfidence &confidence, const uint8_t value)
Set the throttle confidence value.
void setOffset(DOffset &offset, const int16_t value)
Set the DOffset value.
void setRTCMcorrections(RTCMEM &rtcmem, const RTCMcorrections &rtcm)
Set the RTCMcorrections container of a RTCMEM object.
void setMessageIDToRTCMEM(ItsPduHeader &header)
Set the message ID of an ItsPduHeader object to RTCMEM.
void clearSpeed(FullPositionVector &pos)
Clear the optional speed of a FullPositionVector object.
void clearYear(DDateTime &date_time)
Clear the optional year of a DDateTime object.
void setHeader(RTCMEM &rtcmem, const ItsPduHeader &header)
Set the ItsPduHeader of a RTCMEM object.
void setAntennaOffsetSet(RTCMheader &header, const AntennaOffsetSet &offset_set)
Set the AntennaOffsetSet object of a RTCMheader object.
void setBitString(T &bitstring, const std::vector< bool > &bits)
Set a Bit String by a vector of bools.
void setRTCMRevision(RTCMRevision &rev, const uint8_t value)
Set the RTCMRevision value.
void setNetworkCorrectionsPresentFlag(GNSSstatus &status, const bool value)
Set the networkCorrectionsPresent flag of a GNSSstatus object.
void setLocalCorrectionsPresentFlag(GNSSstatus &status, const bool value)
Set the localCorrectionsPresent flag of a GNSSstatus object.
void setProtocolVersion(ItsPduHeader &header, const uint8_t value)
Set the protocol version of an ItsPduHeader object.
void setSemiMinorAxisAccuracy(SemiMinorAxisAccuracy &accuracy, const uint8_t value)
Set the semi-minor axis accuracy value.
void ensureGNSSstatusStorage(GNSSstatus &status)
Ensure storage for a GNSSstatus object.
void clearMinute(DDateTime &date_time)
Clear the optional minute of a DDateTime object.
void setAnchorPoint(RTCMcorrections &rtcm, const FullPositionVector &anchor)
Set the anchor point of a RTCMcorrections object.
void setMinuteOfTheYear(MinuteOfTheYear &moy, const uint32_t value)
Set the MinuteOfTheYear object.
void setUTCTime(FullPositionVector &pos, const DDateTime &utc_time)
Set the utcTime of a FullPositionVector object.
void setRTCMmessageList(RTCMmessageList &msgs, const std::vector< RTCMmessage > &values)
Set the RTCMmessageList object.
void setIsHealthyFlag(GNSSstatus &status, const bool value)
Set the isHealthy flag of a GNSSstatus object.
void setSpeed(FullPositionVector &pos, const TransmissionAndSpeed &speed)
Set the speed of a FullPositionVector object.
void setElevationConfidence(ElevationConfidence &confidence, const uint8_t value)
Set the elevation confidence value.
void clearPositionConfidence(FullPositionVector &pos)
Clear the optional position confidence of a FullPositionVector object.
void clearSecond(DDateTime &date_time)
Clear the optional second of a DDateTime object.
void setSecond(DSecond &second, const uint16_t value)
Set the DSecond value.
void clearHeading(FullPositionVector &pos)
Clear the optional heading of a FullPositionVector object.
void setTimeConfidence(TimeConfidence &time_confidence, const uint8_t value)
Set the time confidence value.
void setElevation(Elevation &elevation, const int32_t value)
Set the raw elevation value of an Elevation object.
void setMessageID(ItsPduHeader &header, const uint8_t value)
Set the message ID of an ItsPduHeader object.
void clearDay(DDateTime &date_time)
Clear the optional day of a DDateTime object.
void clearAnchorPoint(RTCMcorrections &rtcm)
Clear the optional anchor point of a RTCMcorrections object.
void setAntennaOffsetY(OffsetB09 &field, const int16_t value)
Set the y antenna offset object.
void setYear(DYear &year, const uint16_t value)
Set the DYear value.
void setSpeedConfidence(FullPositionVector &pos, const SpeedandHeadingandThrottleConfidence &confidence)
Set the speed confidence of a FullPositionVector object.
void setMsgCount(MsgCount &msg_cnt, const uint8_t value)
Set the MsgCount object.
void setAPDOPofUnder5Flag(GNSSstatus &status, const bool value)
Set the aPDOPofUnder5 flag of a GNSSstatus object.
void setVelocity(Velocity &velocity, const uint16_t value)
Set the velocity value.
void clearSpeedConfidence(FullPositionVector &pos)
Clear the optional speed confidence of a FullPositionVector object.
void setHeadingConfidence(HeadingConfidenceDSRC &confidence, const uint8_t value)
Set the heading confidence value.
void setPositionalAccuracy(FullPositionVector &pos, const PositionalAccuracy &accuracy)
Set the positional accuracy of a FullPositionVector object.
void setRTCMmessageValue(RTCMmessage &msg, const std::vector< uint8_t > &data)
Set the raw bytes of a RTCMmessage object.
void setMinute(DMinute &minute, const uint8_t value)
Set the DMinute value.
void setHeading(HeadingDSRC &heading, const uint16_t value)
Set the heading of a HeadingDSRC object.
void setGNSSstatusBit(GNSSstatus &status, const uint8_t bit_index, const bool value)
Set a single GNSSstatus bit.
void setTransmissionState(TransmissionState &transmission_state, const uint8_t value)
Set the transmission state value.
void setDay(DDay &day, const uint8_t value)
Set the DDay value.
void clearPositionalAccuracy(FullPositionVector &pos)
Clear the optional positional accuracy of a FullPositionVector object.