etsi_its_messages 1.0.0
Loading...
Searching...
No Matches
denm_setters.h File Reference

Setter functions for the ETSI ITS DENM (EN) More...

Go to the source code of this file.

Functions

template<typename T1 , typename T2 >
void etsi_its_denm_msgs::access::throwIfOutOfRange (const T1 &val, const T2 &min, const T2 &max, const std::string val_desc)
 
uint16_t etsi_its_denm_msgs::access::etsi_its_msgs::getLeapSecondInsertionsSince2004 (const uint64_t unix_seconds)
 Get the leap second insertions since 2004 for given unix seconds.
 
void etsi_its_denm_msgs::access::setTimestampITS (TimestampIts &timestamp_its, const uint64_t unix_nanosecs, const uint16_t n_leap_seconds=etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end() ->second)
 Set the TimestampITS object.
 
void etsi_its_denm_msgs::access::setLatitude (Latitude &latitude, const double deg)
 Set the Latitude object.
 
void etsi_its_denm_msgs::access::setLongitude (Longitude &longitude, const double deg)
 Set the Longitude object.
 
void etsi_its_denm_msgs::access::setAltitudeValue (AltitudeValue &altitude, const double value)
 Set the AltitudeValue object.
 
void etsi_its_denm_msgs::access::setAltitude (Altitude &altitude, const double value)
 Set the Altitude object.
 
void etsi_its_denm_msgs::access::setSpeedValue (SpeedValue &speed, const double value)
 Set the SpeedValue object.
 
void etsi_its_denm_msgs::access::setSpeed (Speed &speed, const double value)
 Set the Speed object.
 
template<typename T >
void etsi_its_denm_msgs::access::setReferencePosition (T &ref_position, const double latitude, const double longitude, const double altitude=AltitudeValue::UNAVAILABLE)
 Sets the reference position in the given ReferencePostion object.
 
template<typename T >
void etsi_its_denm_msgs::access::setFromUTMPosition (T &reference_position, const gm::PointStamped &utm_position, const int zone, const bool northp)
 Set the ReferencePosition from a given UTM-Position.
 
template<typename T >
void etsi_its_denm_msgs::access::setBitString (T &bitstring, const std::vector< bool > &bits)
 Set a Bit String by a vector of bools.
 
void etsi_its_denm_msgs::access::setStationId (StationID &station_id, const uint32_t id_value)
 Set the Station Id object.
 
void etsi_its_denm_msgs::access::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 etsi_its_denm_msgs::access::setStationType (StationType &station_type, const uint8_t value)
 Set the Station Type.
 
void etsi_its_denm_msgs::access::setItsPduHeader (DENM &denm, const uint32_t station_id, const uint8_t protocol_version=0)
 Set the ItsPduHeader-object for a DENM.
 
void etsi_its_denm_msgs::access::setReferenceTime (DENM &denm, const uint64_t unix_nanosecs, const uint16_t n_leap_seconds=etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end() ->second)
 Set the ReferenceTime-value.
 
void etsi_its_denm_msgs::access::setStationType (DENM &denm, const int value)
 Set the StationType for a DENM.
 
void etsi_its_denm_msgs::access::setReferencePosition (DENM &denm, const double latitude, const double longitude, const double altitude=AltitudeValue::UNAVAILABLE)
 Set the ReferencePositionWithConfidence for a DENM.
 
void etsi_its_denm_msgs::access::setHeadingValue (HeadingValue &heading, const double value)
 Set the HeadingValue object.
 
void etsi_its_denm_msgs::access::setHeading (Heading &heading, const double value)
 Set the Heading object.
 
void etsi_its_denm_msgs::access::setIsHeadingPresent (DENM &denm, bool presence_of_heading)
 Set the IsHeadingPresent object for DENM.
 
void etsi_its_denm_msgs::access::setHeading (DENM &denm, const double heading_val)
 Set the Heading for a DENM.
 
void etsi_its_denm_msgs::access::setIsSpeedPresent (DENM &denm, bool presence_of_speed)
 Set the IsSpeedPresent object for DENM.
 
void etsi_its_denm_msgs::access::setSpeed (DENM &denm, const double speed_val)
 Set the vehicle speed.
 
void etsi_its_denm_msgs::access::setFromUTMPosition (DENM &denm, const gm::PointStamped &utm_position, const int &zone, const bool &northp)
 Set the ReferencePosition of a DENM from a given UTM-Position.
 
void etsi_its_denm_msgs::access::setDrivingLaneStatus (DrivingLaneStatus &driving_lane_status, const std::vector< bool > &bits)
 Set the Driving Lane Status by a vector of bools.
 
void etsi_its_denm_msgs::access::setLightBarSirenInUse (LightBarSirenInUse &light_bar_siren_in_use, const std::vector< bool > &bits)
 Set the Lightbar Siren In Use by a vector of bools.
 

Detailed Description

Setter functions for the ETSI ITS DENM (EN)

Definition in file denm_setters.h.

Function Documentation

◆ getLeapSecondInsertionsSince2004()

uint16_t etsi_its_denm_msgs::access::etsi_its_msgs::getLeapSecondInsertionsSince2004 ( const uint64_t unix_seconds)
inline

Get the leap second insertions since 2004 for given unix seconds.

Parameters
unix_secondsthe current unix seconds for that the leap second insertions since 2004 shall be provided
Returns
uint16_t the number of leap second insertions since 2004 for unix_seconds

Definition at line 61 of file denm_access.h.

111 {
113}
Utility functions for the ETSI ITS DENM (EN)

◆ setAltitude()

void etsi_its_denm_msgs::access::setAltitude ( Altitude & altitude,
const double value )
inline

Set the Altitude object.

AltitudeConfidence is set to UNAVAILABLE

Parameters
altitudeobject to set
valueAltitude value (above the reference ellipsoid surface) in meter as decimal number

Definition at line 140 of file denm_setters.h.

142 {
143 if (denm.denm.location_is_present) {

◆ setAltitudeValue()

void etsi_its_denm_msgs::access::setAltitudeValue ( AltitudeValue & altitude,
const double value )
inline

Set the AltitudeValue object.

Parameters
altitudeobject to set
valueAltitudeValue value (above the reference ellipsoid surface) in meter as decimal number

Definition at line 121 of file denm_setters.h.

125 {
126 if (denm.denm.location_is_present) {
127 denm.denm.location.event_position_heading_is_present = presence_of_heading;
128 } else {
129 throw std::invalid_argument("LocationContainer is not present!");
130 }

◆ setBitString()

template<typename T >
void etsi_its_denm_msgs::access::setBitString ( T & bitstring,
const std::vector< bool > & bits )
inline

Set a Bit String by a vector of bools.

Template Parameters
T
Parameters
bitstringBitString to set
bitsvector of bools

Definition at line 232 of file denm_setters.h.

267 {
268
270
278inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
279 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
280}
281
289inline void setReferenceTime(
290 DENM& denm, const uint64_t unix_nanosecs,
291 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end()->second) {
292 TimestampIts t_its;
293 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
294 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
295 denm.denm.management.reference_time = t_its;
296}
297
304inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
305
317inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
318 const double altitude = AltitudeValue::UNAVAILABLE) {
319 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
320}
321
330inline void setHeadingValue(HeadingValue& heading, const double value) {
331 int64_t deg = (int64_t)std::round(value * 1e1);
332 throwIfOutOfRange(deg, HeadingValue::MIN, HeadingValue::MAX, "HeadingValue");
333 heading.value = deg;
334}
335
345inline void setHeading(Heading& heading, const double value) {
346 heading.heading_confidence.value = HeadingConfidence::UNAVAILABLE;
347 setHeadingValue(heading.heading_value, value);
348}
349
356inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
357 if (denm.denm.location_is_present) {
358 denm.denm.location.event_position_heading_is_present = presence_of_heading;
359 } else {
360 throw std::invalid_argument("LocationContainer is not present!");
361 }
362}
363
373inline void setHeading(DENM& denm, const double heading_val) {
374 if (denm.denm.location_is_present) {
375 setHeading(denm.denm.location.event_position_heading, heading_val);
376 setIsHeadingPresent(denm, true);
377 } else {
378 throw std::invalid_argument("LocationContainer is not present!");
379 }
380}
381
388inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
389 if (denm.denm.location_is_present) {
390 denm.denm.location.event_speed_is_present = presence_of_speed;
391 } else {
392 throw std::invalid_argument("LocationContainer is not present!");
393 }
394}
395
402inline void setSpeed(DENM& denm, const double speed_val) {
403 if (denm.denm.location_is_present) {
404 setSpeed(denm.denm.location.event_speed, speed_val);
405 setIsSpeedPresent(denm, true);
406 } else {
407 throw std::invalid_argument("LocationContainer is not present!");
408 }
409}
410
423inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
424 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
425}
426
433inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
434 setBitString(driving_lane_status, bits);
435}
436
443inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
444 setBitString(light_bar_siren_in_use, bits);
445}
446
447} // namespace etsi_its_denm_msgs::access
void setSpeed(CAM &cam, const double speed_val)
Set the vehicle speed.
void setLightBarSirenInUse(LightBarSirenInUse &light_bar_siren_in_use, const std::vector< bool > &bits)
Set the Lightbar Siren In Use by a vector of bools.
void setHeading(Heading &heading, const double value)
Set the Heading object.
void setStationType(CAM &cam, const uint8_t value)
Set the StationType for a CAM.
void setFromUTMPosition(CAM &cam, const gm::PointStamped &utm_position, const int &zone, const bool &northp)
Set the ReferencePosition of a CAM from a given UTM-Position.
void setHeadingValue(HeadingValue &heading, const double value)
Set the HeadingValue object.
void setReferencePosition(CAM &cam, const double latitude, const double longitude, const double altitude=AltitudeValue::UNAVAILABLE)
Set the ReferencePosition for a CAM.
void setDrivingLaneStatus(DrivingLaneStatus &driving_lane_status, const std::vector< bool > &bits)
Set the Driving Lane Status by a vector of bools.
void setTimestampITS(TimestampIts &timestamp_its, const uint64_t unix_nanosecs, const uint16_t n_leap_seconds=etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end() ->second)
Set the TimestampITS object.
void setBitString(T &bitstring, const std::vector< bool > &bits)
Set a Bit String by a vector of bools.
Setter functions for the ETSI ITS Common Data Dictionary (CDD) v1.3.1.
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 setReferenceTime(CollectivePerceptionMessage &cpm, const uint64_t unix_nanosecs, const uint16_t n_leap_seconds=etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end() ->second)
Sets the reference time in a CPM.
void setIsSpeedPresent(DENM &denm, bool presence_of_speed)
Set the IsSpeedPresent object for DENM.
void setIsHeadingPresent(DENM &denm, bool presence_of_heading)
Set the IsHeadingPresent object for DENM.

◆ setDrivingLaneStatus()

void etsi_its_denm_msgs::access::setDrivingLaneStatus ( DrivingLaneStatus & driving_lane_status,
const std::vector< bool > & bits )
inline

Set the Driving Lane Status by a vector of bools.

Parameters
driving_lane_status
bits

Definition at line 251 of file denm_setters.h.

286 {
287
289
297inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
298 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
299}
300
308inline void setReferenceTime(
309 DENM& denm, const uint64_t unix_nanosecs,
310 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end()->second) {
311 TimestampIts t_its;
312 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
313 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
314 denm.denm.management.reference_time = t_its;
315}
316
323inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
324
336inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
337 const double altitude = AltitudeValue::UNAVAILABLE) {
338 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
339}
340
349inline void setHeadingValue(HeadingValue& heading, const double value) {
350 int64_t deg = (int64_t)std::round(value * 1e1);
351 throwIfOutOfRange(deg, HeadingValue::MIN, HeadingValue::MAX, "HeadingValue");
352 heading.value = deg;
353}
354
364inline void setHeading(Heading& heading, const double value) {
365 heading.heading_confidence.value = HeadingConfidence::UNAVAILABLE;
366 setHeadingValue(heading.heading_value, value);
367}
368
375inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
376 if (denm.denm.location_is_present) {
377 denm.denm.location.event_position_heading_is_present = presence_of_heading;
378 } else {
379 throw std::invalid_argument("LocationContainer is not present!");
380 }
381}
382
392inline void setHeading(DENM& denm, const double heading_val) {
393 if (denm.denm.location_is_present) {
394 setHeading(denm.denm.location.event_position_heading, heading_val);
395 setIsHeadingPresent(denm, true);
396 } else {
397 throw std::invalid_argument("LocationContainer is not present!");
398 }
399}
400
407inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
408 if (denm.denm.location_is_present) {
409 denm.denm.location.event_speed_is_present = presence_of_speed;
410 } else {
411 throw std::invalid_argument("LocationContainer is not present!");
412 }
413}
414
421inline void setSpeed(DENM& denm, const double speed_val) {
422 if (denm.denm.location_is_present) {
423 setSpeed(denm.denm.location.event_speed, speed_val);
424 setIsSpeedPresent(denm, true);
425 } else {
426 throw std::invalid_argument("LocationContainer is not present!");
427 }
428}
429
442inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
443 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
444}
445
452inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
453 setBitString(driving_lane_status, bits);
454}
455
462inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
463 setBitString(light_bar_siren_in_use, bits);
464}
465
466} // namespace etsi_its_denm_msgs::access

◆ setFromUTMPosition() [1/2]

void etsi_its_denm_msgs::access::setFromUTMPosition ( DENM & denm,
const gm::PointStamped & utm_position,
const int & zone,
const bool & northp )
inline

Set the ReferencePosition of a DENM from a given UTM-Position.

The position is transformed to latitude and longitude by using GeographicLib::UTMUPS The z-Coordinate is directly used as altitude value The frame_id of the given utm_position must be set to 'utm_<zone><N/S>'

Parameters
[out]denmDENM for which to set the ReferencePosition
[in]utm_positiongeometry_msgs::PointStamped describing the given utm position
[in]zonethe UTM zone (zero means UPS) of the given position
[in]northphemisphere (true means north, false means south)

Definition at line 241 of file denm_setters.h.

276 {
277
279
287inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
288 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
289}
290
298inline void setReferenceTime(
299 DENM& denm, const uint64_t unix_nanosecs,
300 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end()->second) {
301 TimestampIts t_its;
302 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
303 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
304 denm.denm.management.reference_time = t_its;
305}
306
313inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
314
326inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
327 const double altitude = AltitudeValue::UNAVAILABLE) {
328 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
329}
330
339inline void setHeadingValue(HeadingValue& heading, const double value) {
340 int64_t deg = (int64_t)std::round(value * 1e1);
341 throwIfOutOfRange(deg, HeadingValue::MIN, HeadingValue::MAX, "HeadingValue");
342 heading.value = deg;
343}
344
354inline void setHeading(Heading& heading, const double value) {
355 heading.heading_confidence.value = HeadingConfidence::UNAVAILABLE;
356 setHeadingValue(heading.heading_value, value);
357}
358
365inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
366 if (denm.denm.location_is_present) {
367 denm.denm.location.event_position_heading_is_present = presence_of_heading;
368 } else {
369 throw std::invalid_argument("LocationContainer is not present!");
370 }
371}
372
382inline void setHeading(DENM& denm, const double heading_val) {
383 if (denm.denm.location_is_present) {
384 setHeading(denm.denm.location.event_position_heading, heading_val);
385 setIsHeadingPresent(denm, true);
386 } else {
387 throw std::invalid_argument("LocationContainer is not present!");
388 }
389}
390
397inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
398 if (denm.denm.location_is_present) {
399 denm.denm.location.event_speed_is_present = presence_of_speed;
400 } else {
401 throw std::invalid_argument("LocationContainer is not present!");
402 }
403}
404
411inline void setSpeed(DENM& denm, const double speed_val) {
412 if (denm.denm.location_is_present) {
413 setSpeed(denm.denm.location.event_speed, speed_val);
414 setIsSpeedPresent(denm, true);
415 } else {
416 throw std::invalid_argument("LocationContainer is not present!");
417 }
418}
419
432inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
433 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
434}
435
442inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
443 setBitString(driving_lane_status, bits);
444}
445
452inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
453 setBitString(light_bar_siren_in_use, bits);
454}
455
456} // namespace etsi_its_denm_msgs::access

◆ setFromUTMPosition() [2/2]

template<typename T >
void etsi_its_denm_msgs::access::setFromUTMPosition ( T & reference_position,
const gm::PointStamped & utm_position,
const int zone,
const bool northp )
inline

Set the ReferencePosition from a given UTM-Position.

The position is transformed to latitude and longitude by using GeographicLib::UTMUPS The z-Coordinate is directly used as altitude value The frame_id of the given utm_position must be set to 'utm_<zone><N/S>'

Parameters
[out]reference_positionReferencePostion or ReferencePositionWithConfidence to set
[in]utm_positiongeometry_msgs::PointStamped describing the given utm position
[in]zonethe UTM zone (zero means UPS) of the given position
[in]northphemisphere (true means north, false means south)

Definition at line 208 of file denm_setters.h.

212 {
213 setBitString(light_bar_siren_in_use, bits);
214}
215
216} // namespace etsi_its_denm_msgs::access

◆ setHeading() [1/2]

void etsi_its_denm_msgs::access::setHeading ( DENM & denm,
const double heading_val )
inline

Set the Heading for a DENM.

0.0° equals WGS84 North, 90.0° equals WGS84 East, 180.0° equals WGS84 South and 270.0° equals WGS84 West HeadingConfidence is set to UNAVAILABLE

Parameters
denmDENM to set the ReferencePosition
valueHeading value in degree as decimal number

Definition at line 191 of file denm_setters.h.

192 {
193 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
194}
195

◆ setHeading() [2/2]

void etsi_its_denm_msgs::access::setHeading ( Heading & heading,
const double value )
inline

Set the Heading object.

0.0° equals WGS84 North, 90.0° equals WGS84 East, 180.0° equals WGS84 South and 270.0° equals WGS84 West HeadingConfidence is set to UNAVAILABLE

Parameters
headingobject to set
valueHeading value in degree as decimal number

Definition at line 163 of file denm_setters.h.

◆ setHeadingValue()

void etsi_its_denm_msgs::access::setHeadingValue ( HeadingValue & heading,
const double value )
inline

Set the HeadingValue object.

0.0° equals WGS84 North, 90.0° equals WGS84 East, 180.0° equals WGS84 South and 270.0° equals WGS84 West

Parameters
headingobject to set
valueHeading value in degree as decimal number

Definition at line 148 of file denm_setters.h.

◆ setIsHeadingPresent()

void etsi_its_denm_msgs::access::setIsHeadingPresent ( DENM & denm,
bool presence_of_heading )
inline

Set the IsHeadingPresent object for DENM.

Parameters
denmDENM to set IsHeadingPresent
presence_of_headingIsHeadingPresent-Value (true or false)

Definition at line 174 of file denm_setters.h.

175 {
176 throw std::invalid_argument("LocationContainer is not present!");
177 }
178}
179

◆ setIsSpeedPresent()

void etsi_its_denm_msgs::access::setIsSpeedPresent ( DENM & denm,
bool presence_of_speed )
inline

Set the IsSpeedPresent object for DENM.

Parameters
denmDENM to set IsSpeedPresent
presence_of_headingIsSpeedPresent-Value (true or false)

Definition at line 206 of file denm_setters.h.

212 {

◆ setItsPduHeader() [1/2]

void etsi_its_denm_msgs::access::setItsPduHeader ( DENM & denm,
const uint32_t station_id,
const uint8_t protocol_version = 0 )
inline

Set the ItsPduHeader-object for a DENM.

Parameters
denmDENM-Message to set the ItsPduHeader
station_id
protocol_version

Definition at line 96 of file denm_setters.h.

◆ setItsPduHeader() [2/2]

void etsi_its_denm_msgs::access::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 66 of file denm_setters.h.

73 { setStationType(denm.denm.management.station_type, value); }
74

◆ setLatitude()

void etsi_its_denm_msgs::access::setLatitude ( Latitude & latitude,
const double deg )
inline

Set the Latitude object.

Parameters
latitudeobject to set
degLatitude value in degree as decimal number

Definition at line 97 of file denm_setters.h.

99 {
100 int64_t deg = (int64_t)std::round(value * 1e1);
101 throwIfOutOfRange(deg, HeadingValue::MIN, HeadingValue::MAX, "HeadingValue");

◆ setLightBarSirenInUse()

void etsi_its_denm_msgs::access::setLightBarSirenInUse ( LightBarSirenInUse & light_bar_siren_in_use,
const std::vector< bool > & bits )
inline

Set the Lightbar Siren In Use by a vector of bools.

Parameters
light_bar_siren_in_use
bits

Definition at line 261 of file denm_setters.h.

296 {
297
299
307inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
308 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
309}
310
318inline void setReferenceTime(
319 DENM& denm, const uint64_t unix_nanosecs,
320 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end()->second) {
321 TimestampIts t_its;
322 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
323 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
324 denm.denm.management.reference_time = t_its;
325}
326
333inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
334
346inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
347 const double altitude = AltitudeValue::UNAVAILABLE) {
348 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
349}
350
359inline void setHeadingValue(HeadingValue& heading, const double value) {
360 int64_t deg = (int64_t)std::round(value * 1e1);
361 throwIfOutOfRange(deg, HeadingValue::MIN, HeadingValue::MAX, "HeadingValue");
362 heading.value = deg;
363}
364
374inline void setHeading(Heading& heading, const double value) {
375 heading.heading_confidence.value = HeadingConfidence::UNAVAILABLE;
376 setHeadingValue(heading.heading_value, value);
377}
378
385inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
386 if (denm.denm.location_is_present) {
387 denm.denm.location.event_position_heading_is_present = presence_of_heading;
388 } else {
389 throw std::invalid_argument("LocationContainer is not present!");
390 }
391}
392
402inline void setHeading(DENM& denm, const double heading_val) {
403 if (denm.denm.location_is_present) {
404 setHeading(denm.denm.location.event_position_heading, heading_val);
405 setIsHeadingPresent(denm, true);
406 } else {
407 throw std::invalid_argument("LocationContainer is not present!");
408 }
409}
410
417inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
418 if (denm.denm.location_is_present) {
419 denm.denm.location.event_speed_is_present = presence_of_speed;
420 } else {
421 throw std::invalid_argument("LocationContainer is not present!");
422 }
423}
424
431inline void setSpeed(DENM& denm, const double speed_val) {
432 if (denm.denm.location_is_present) {
433 setSpeed(denm.denm.location.event_speed, speed_val);
434 setIsSpeedPresent(denm, true);
435 } else {
436 throw std::invalid_argument("LocationContainer is not present!");
437 }
438}
439
452inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
453 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
454}
455
462inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
463 setBitString(driving_lane_status, bits);
464}
465
472inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
473 setBitString(light_bar_siren_in_use, bits);
474}
475
476} // namespace etsi_its_denm_msgs::access

◆ setLongitude()

void etsi_its_denm_msgs::access::setLongitude ( Longitude & longitude,
const double deg )
inline

Set the Longitude object.

Parameters
longitudeobject to set
degLongitude value in degree as decimal number

Definition at line 109 of file denm_setters.h.

◆ setReferencePosition() [1/2]

void etsi_its_denm_msgs::access::setReferencePosition ( DENM & denm,
const double latitude,
const double longitude,
const double altitude = AltitudeValue::UNAVAILABLE )
inline

Set the ReferencePositionWithConfidence for a DENM.

This function sets the latitude, longitude, and altitude of the DENMs reference position. If the altitude is not provided, it is set to AltitudeValue::UNAVAILABLE.

Parameters
denmDENM to set the ReferencePosition
latitudeThe latitude value position in degree as decimal number.
longitudeThe longitude value in degree as decimal number.
altitudeThe altitude value (above the reference ellipsoid surface) in meter as decimal number (optional).

Definition at line 135 of file denm_setters.h.

◆ setReferencePosition() [2/2]

template<typename T >
void etsi_its_denm_msgs::access::setReferencePosition ( T & ref_position,
const double latitude,
const double longitude,
const double altitude = AltitudeValue::UNAVAILABLE )
inline

Sets the reference position in the given ReferencePostion object.

This function sets the latitude, longitude, and altitude of the reference position. If the altitude is not provided, it is set to AltitudeValue::UNAVAILABLE.

Parameters
ref_positionReferencePostion or ReferencePositionWithConfidence object to set the reference position in.
latitudeThe latitude value position in degree as decimal number.
longitudeThe longitude value in degree as decimal number.
altitudeThe altitude value (above the reference ellipsoid surface) in meter as decimal number (optional).

Definition at line 182 of file denm_setters.h.

192 {
193 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);

◆ setReferenceTime()

void etsi_its_denm_msgs::access::setReferenceTime ( DENM & denm,
const uint64_t unix_nanosecs,
const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end()->second )
inline

Set the ReferenceTime-value.

Parameters
denmDENM to set the ReferenceTime-Value for
unix_nanosecsTimestamp in unix-nanoseconds to set the ReferenceTime-Value from
n_leap_secondsNumber of leap seconds since 2004 for the given timestamp (Default: etsi_its_msgs::N_LEAP_SECONDS)

Definition at line 107 of file denm_setters.h.

114 {

◆ setSpeed() [1/2]

void etsi_its_denm_msgs::access::setSpeed ( DENM & denm,
const double speed_val )
inline

Set the vehicle speed.

Parameters
denmDENM to set the speed value
speed_valspeed value to set in m/s as decimal number

Definition at line 220 of file denm_setters.h.

255 {
256
258
266inline void setItsPduHeader(DENM& denm, const uint32_t station_id, const uint8_t protocol_version = 0) {
267 setItsPduHeader(denm.header, ItsPduHeader::MESSAGE_ID_DENM, station_id, protocol_version);
268}
269
277inline void setReferenceTime(
278 DENM& denm, const uint64_t unix_nanosecs,
279 const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end()->second) {
280 TimestampIts t_its;
281 setTimestampITS(t_its, unix_nanosecs, n_leap_seconds);
282 throwIfOutOfRange(t_its.value, TimestampIts::MIN, TimestampIts::MAX, "TimestampIts");
283 denm.denm.management.reference_time = t_its;
284}
285
292inline void setStationType(DENM& denm, const int value) { setStationType(denm.denm.management.station_type, value); }
293
305inline void setReferencePosition(DENM& denm, const double latitude, const double longitude,
306 const double altitude = AltitudeValue::UNAVAILABLE) {
307 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
308}
309
318inline void setHeadingValue(HeadingValue& heading, const double value) {
319 int64_t deg = (int64_t)std::round(value * 1e1);
320 throwIfOutOfRange(deg, HeadingValue::MIN, HeadingValue::MAX, "HeadingValue");
321 heading.value = deg;
322}
323
333inline void setHeading(Heading& heading, const double value) {
334 heading.heading_confidence.value = HeadingConfidence::UNAVAILABLE;
335 setHeadingValue(heading.heading_value, value);
336}
337
344inline void setIsHeadingPresent(DENM& denm, bool presence_of_heading) {
345 if (denm.denm.location_is_present) {
346 denm.denm.location.event_position_heading_is_present = presence_of_heading;
347 } else {
348 throw std::invalid_argument("LocationContainer is not present!");
349 }
350}
351
361inline void setHeading(DENM& denm, const double heading_val) {
362 if (denm.denm.location_is_present) {
363 setHeading(denm.denm.location.event_position_heading, heading_val);
364 setIsHeadingPresent(denm, true);
365 } else {
366 throw std::invalid_argument("LocationContainer is not present!");
367 }
368}
369
376inline void setIsSpeedPresent(DENM& denm, bool presence_of_speed) {
377 if (denm.denm.location_is_present) {
378 denm.denm.location.event_speed_is_present = presence_of_speed;
379 } else {
380 throw std::invalid_argument("LocationContainer is not present!");
381 }
382}
383
390inline void setSpeed(DENM& denm, const double speed_val) {
391 if (denm.denm.location_is_present) {
392 setSpeed(denm.denm.location.event_speed, speed_val);
393 setIsSpeedPresent(denm, true);
394 } else {
395 throw std::invalid_argument("LocationContainer is not present!");
396 }
397}
398
411inline void setFromUTMPosition(DENM& denm, const gm::PointStamped& utm_position, const int& zone, const bool& northp) {
412 setFromUTMPosition(denm.denm.management.event_position, utm_position, zone, northp);
413}
414
421inline void setDrivingLaneStatus(DrivingLaneStatus& driving_lane_status, const std::vector<bool>& bits) {
422 setBitString(driving_lane_status, bits);
423}
424
431inline void setLightBarSirenInUse(LightBarSirenInUse& light_bar_siren_in_use, const std::vector<bool>& bits) {
432 setBitString(light_bar_siren_in_use, bits);
433}
434
435} // namespace etsi_its_denm_msgs::access

◆ setSpeed() [2/2]

void etsi_its_denm_msgs::access::setSpeed ( Speed & speed,
const double value )
inline

Set the Speed object.

SpeedConfidence is set to UNAVAILABLE

Parameters
speedobject to set
valueSpeed in in m/s as decimal number

Definition at line 165 of file denm_setters.h.

◆ setSpeedValue()

void etsi_its_denm_msgs::access::setSpeedValue ( SpeedValue & speed,
const double value )
inline

Set the SpeedValue object.

Parameters
speedobject to set
valueSpeedValue in m/s as decimal number

Definition at line 151 of file denm_setters.h.

◆ setStationId()

void etsi_its_denm_msgs::access::setStationId ( StationID & station_id,
const uint32_t id_value )
inline

Set the Station Id object.

Parameters
station_id
id_value

Definition at line 53 of file denm_setters.h.

56 : etsi_its_msgs::N_LEAP_SECONDS)

◆ setStationType() [1/2]

void etsi_its_denm_msgs::access::setStationType ( DENM & denm,
const int value )
inline

Set the StationType for a DENM.

Parameters
denmDENM-Message to set the station_type value
valuestation_type value to set

Definition at line 122 of file denm_setters.h.

◆ setStationType() [2/2]

void etsi_its_denm_msgs::access::setStationType ( StationType & station_type,
const uint8_t value )
inline

Set the Station Type.

Parameters
station_type
value

Definition at line 82 of file denm_setters.h.

◆ setTimestampITS()

void etsi_its_denm_msgs::access::setTimestampITS ( TimestampIts & timestamp_its,
const uint64_t unix_nanosecs,
const uint16_t n_leap_seconds = etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end()->second )
inline

Set the TimestampITS object.

Parameters
[in]timestamp_itsTimestampITS object to set the timestamp
[in]unix_nanosecsUnix-Nanoseconds to set the timestamp for
[in]n_leap_secondsNumber of leap-seconds since 2004. (Default: etsi_its_msgs::LEAP_SECOND_INSERTIONS_SINCE_2004.end()->second)
[in]epoch_offsetUnix-Timestamp in seconds for the 01.01.2004 at 00:00:00

Definition at line 83 of file denm_setters.h.

87 {
88 setReferencePosition(denm.denm.management.event_position, latitude, longitude, altitude);
89}

◆ throwIfOutOfRange()

template<typename T1 , typename T2 >
void etsi_its_denm_msgs::access::throwIfOutOfRange ( const T1 & val,
const T2 & min,
const T2 & max,
const std::string val_desc )

Definition at line 37 of file denm_access.h.