32#ifndef ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_1_1_SETTERS_H
33#define ETSI_ITS_MSGS_UTILS_IMPL_CDD_CDD_V2_1_1_SETTERS_H
38#include <GeographicLib/UTMUPS.hpp>
47inline void setStationId(StationId& station_id,
const uint32_t id_value) {
48 throwIfOutOfRange(id_value, StationId::MIN, StationId::MAX,
"StationId");
49 station_id.value = id_value;
60inline void setItsPduHeader(ItsPduHeader& header,
const uint8_t message_id,
const uint32_t station_id,
61 const uint8_t protocol_version = 0) {
63 throwIfOutOfRange(message_id, MessageId::MIN, MessageId::MAX,
"MessageID");
64 header.message_id.value = message_id;
65 throwIfOutOfRange(protocol_version, OrdinalNumber1B::MIN, OrdinalNumber1B::MAX,
"ProtocolVersion");
66 header.protocol_version.value = protocol_version;
75inline void setStationType(TrafficParticipantType& station_type,
const uint8_t value) {
76 throwIfOutOfRange(value, TrafficParticipantType::MIN, TrafficParticipantType::MAX,
"StationType");
77 station_type.value = value;
87 int64_t accel_val = (int64_t)std::round(value * 1e1);
88 if (accel_val >= AccelerationValue::MIN && accel_val <= AccelerationValue::MAX) {
89 accel.value = accel_val;
90 }
else if (accel_val < AccelerationValue::MIN) {
91 accel.value = AccelerationValue::MIN;
92 }
else if (accel_val > AccelerationValue::MAX) {
93 accel.value = AccelerationValue::MAX - 1;
106 accel.confidence.value = AccelerationConfidence::UNAVAILABLE;
117 int64_t accel_val = (int64_t)std::round(value * 1e1);
118 if (accel_val >= AccelerationValue::MIN && accel_val <= AccelerationValue::MAX) {
119 accel.value = accel_val;
120 }
else if (accel_val < AccelerationValue::MIN) {
121 accel.value = AccelerationValue::MIN;
122 }
else if (accel_val > AccelerationValue::MAX) {
123 accel.value = AccelerationValue::MAX - 1;
136 accel.confidence.value = AccelerationConfidence::UNAVAILABLE;
Sanity-check functions etc. for the ETSI ITS Common Data Dictionary (CDD)
Common setter functions for the ETSI ITS Common Data Dictionary (CDD) v1.3.1 and v2....
void setLongitudinalAcceleration(AccelerationComponent &accel, const double value)
Set the LongitudinalAcceleration object.
void setLateralAccelerationValue(AccelerationValue &accel, const double value)
Set the LateralAccelerationValue object.
void setStationId(StationId &station_id, const uint32_t id_value)
Set the Station Id object.
void setStationType(TrafficParticipantType &station_type, const uint8_t value)
Set the Station Type.
void setLateralAcceleration(AccelerationComponent &accel, const double value)
Set the LateralAcceleration object.
void setLongitudinalAccelerationValue(AccelerationValue &accel, const double value)
Set the LongitudinalAccelerationValue object.
void setItsPduHeader(ItsPduHeader &header, const uint8_t message_id, const uint32_t station_id, const uint8_t protocol_version=0)
Set the Its Pdu Header object.
File containing constants that are used in the context of ETIS ITS Messages.