etsi_its_messages 2.4.0
Loading...
Searching...
No Matches
cdd_v2-1-1_setters.h File Reference

Setter functions for the ETSI ITS Common Data Dictionary (CDD) v2.1.1. More...

#include <etsi_its_msgs_utils/impl/cdd/cdd_setters_common.h>
#include <etsi_its_msgs_utils/impl/cdd/cdd_checks.h>
#include <etsi_its_msgs_utils/impl/constants.h>
#include <GeographicLib/UTMUPS.hpp>
#include <cstring>

Go to the source code of this file.

Functions

void setStationId (StationId &station_id, const uint32_t id_value)
 Set the Station Id 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.
 
void setStationType (TrafficParticipantType &station_type, const uint8_t value)
 Set the Station Type.
 
void setLongitudinalAccelerationValue (AccelerationValue &accel, const double value)
 Set the LongitudinalAccelerationValue object.
 
void setLongitudinalAcceleration (AccelerationComponent &accel, const double value)
 Set the LongitudinalAcceleration object.
 
void setLateralAccelerationValue (AccelerationValue &accel, const double value)
 Set the LateralAccelerationValue object.
 
void setLateralAcceleration (AccelerationComponent &accel, const double value)
 Set the LateralAcceleration object.
 

Detailed Description

Setter functions for the ETSI ITS Common Data Dictionary (CDD) v2.1.1.

Definition in file cdd_v2-1-1_setters.h.

Function Documentation

◆ setItsPduHeader()

void setItsPduHeader ( ItsPduHeader & header,
const uint8_t message_id,
const uint32_t station_id,
const uint8_t protocol_version = 0 )
inline

Set the Its Pdu Header object.

Parameters
headerItsPduHeader to be set
message_idID of the message
station_id
protocol_version

Definition at line 60 of file cdd_v2-1-1_setters.h.

61 {
62 setStationId(header.station_id, station_id);
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;
67}
void setStationId(StationId &station_id, const uint32_t id_value)
Set the Station Id object.

◆ setLateralAcceleration()

void setLateralAcceleration ( AccelerationComponent & accel,
const double value )
inline

Set the LateralAcceleration object.

AccelerationConfidence is set to UNAVAILABLE

Parameters
accelobject to set
valueLaterallAccelerationValue in m/s^2 as decimal number (left is positive)

Definition at line 135 of file cdd_v2-1-1_setters.h.

135 {
136 accel.confidence.value = AccelerationConfidence::UNAVAILABLE;
137 setLateralAccelerationValue(accel.value, value);
138}
void setLateralAccelerationValue(AccelerationValue &accel, const double value)
Set the LateralAccelerationValue object.

◆ setLateralAccelerationValue()

void setLateralAccelerationValue ( AccelerationValue & accel,
const double value )
inline

Set the LateralAccelerationValue object.

Parameters
accelobject to set
valueLateralAccelerationValue in m/s^2 as decimal number (left is positive)

Definition at line 116 of file cdd_v2-1-1_setters.h.

116 {
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;
124 }
125}

◆ setLongitudinalAcceleration()

void setLongitudinalAcceleration ( AccelerationComponent & accel,
const double value )
inline

Set the LongitudinalAcceleration object.

AccelerationConfidence is set to UNAVAILABLE

Parameters
accelobject to set
valueLongitudinalAccelerationValue in m/s^2 as decimal number (braking is negative)

Definition at line 105 of file cdd_v2-1-1_setters.h.

105 {
106 accel.confidence.value = AccelerationConfidence::UNAVAILABLE;
107 setLongitudinalAccelerationValue(accel.value, value);
108}
void setLongitudinalAccelerationValue(AccelerationValue &accel, const double value)
Set the LongitudinalAccelerationValue object.

◆ setLongitudinalAccelerationValue()

void setLongitudinalAccelerationValue ( AccelerationValue & accel,
const double value )
inline

Set the LongitudinalAccelerationValue object.

Parameters
accelobject to set
valueLongitudinalAccelerationValue in m/s^2 as decimal number (braking is negative)

Definition at line 86 of file cdd_v2-1-1_setters.h.

86 {
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;
94 }
95}

◆ setStationId()

void setStationId ( StationId & station_id,
const uint32_t id_value )
inline

Set the Station Id object.

Parameters
station_id
id_value

Definition at line 47 of file cdd_v2-1-1_setters.h.

47 {
48 throwIfOutOfRange(id_value, StationId::MIN, StationId::MAX, "StationId");
49 station_id.value = id_value;
50}

◆ setStationType()

void setStationType ( TrafficParticipantType & station_type,
const uint8_t value )
inline

Set the Station Type.

Parameters
station_type
value

Definition at line 75 of file cdd_v2-1-1_setters.h.

75 {
76 throwIfOutOfRange(value, TrafficParticipantType::MIN, TrafficParticipantType::MAX, "StationType");
77 station_type.value = value;
78}