etsi_its_messages v3.4.0
Loading...
Searching...
No Matches
denm_getters_common.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
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24=============================================================================
25*/
26
31
32#ifndef ETSI_ITS_MSGS_UTILS_IMPL_DENM_DENM_GETTERS_COMMON_H
33#define ETSI_ITS_MSGS_UTILS_IMPL_DENM_DENM_GETTERS_COMMON_H
34
35#include <etsi_its_msgs_utils/impl/asn1_primitives/asn1_primitives_getters.h>
36
43inline uint32_t getStationID(const DENM& denm) { return getStationID(denm.header); }
44
51inline TimestampIts getReferenceTime(const DENM& denm) { return denm.denm.management.reference_time; }
52
59inline uint64_t getReferenceTimeValue(const DENM& denm) { return getReferenceTime(denm).value; }
60
67inline uint8_t getStationType(const DENM& denm) { return denm.denm.management.station_type.value; }
68
75inline double getLatitude(const DENM& denm) { return getLatitude(denm.denm.management.event_position.latitude); }
76
83inline double getLongitude(const DENM& denm) { return getLongitude(denm.denm.management.event_position.longitude); }
84
91inline double getAltitude(const DENM& denm) { return getAltitude(denm.denm.management.event_position.altitude); }
92
99inline bool getIsHeadingPresent(const DENM& denm) {
100 if (denm.denm.location_is_present) {
101 return denm.denm.location.event_position_heading_is_present;
102 } else {
103 throw std::invalid_argument("LocationContainer is not present!");
104 }
105}
106
113inline double getSpeed(const DENM& denm) {
114 if (denm.denm.location_is_present) {
115 if (denm.denm.location.event_speed_is_present) {
116 return getSpeed(denm.denm.location.event_speed);
117 } else {
118 throw std::invalid_argument("Speed is not present!");
119 }
120 } else {
121 throw std::invalid_argument("LocationContainer is not present!");
122 }
123}
124
131inline bool getIsSpeedPresent(const DENM& denm) {
132 if (denm.denm.location_is_present) {
133 return denm.denm.location.event_speed_is_present;
134 } else {
135 throw std::invalid_argument("LocationContainer is not present!");
136 }
137}
138
145inline double getSpeedConfidence(const DENM& denm) {
146 return getSpeedConfidence(
147 denm.denm.location.event_speed);
148}
149
158inline gm::PointStamped getUTMPosition(const DENM& denm, int& zone, bool& northp) {
159 return getUTMPosition(denm.denm.management.event_position, zone, northp);
160}
161
168inline gm::PointStamped getUTMPosition(const DENM& denm) {
169 int zone;
170 bool northp;
171 return getUTMPosition(denm.denm.management.event_position, zone, northp);
172}
173
180inline std::vector<bool> getDrivingLaneStatus(const DrivingLaneStatus& driving_lane_status) {
181 return getBitString(driving_lane_status.value, driving_lane_status.bits_unused);
182}
183
190inline std::vector<bool> getLightBarSirenInUse(const LightBarSirenInUse& light_bar_siren_in_use) {
191 return getBitString(light_bar_siren_in_use.value, light_bar_siren_in_use.bits_unused);
192}
193
194#endif // ETSI_ITS_MSGS_UTILS_IMPL_DENM_DENM_GETTERS_COMMON_H
bool getIsHeadingPresent(const DENM &denm)
Get the IsHeadingPresent object.
uint64_t getReferenceTimeValue(const DENM &denm)
Get the ReferenceTime-Value.
uint32_t getStationID(const DENM &denm)
Get the Station ID object.
std::vector< bool > getLightBarSirenInUse(const LightBarSirenInUse &light_bar_siren_in_use)
Get the Lightbar Siren In Use in form of bool vector.
double getAltitude(const DENM &denm)
Get the Altitude value of DENM.
double getLongitude(const DENM &denm)
Get the Longitude value of DENM.
double getSpeed(const DENM &denm)
Get the vehicle speed.
double getSpeedConfidence(const DENM &denm)
Get the Speed Confidence.
TimestampIts getReferenceTime(const DENM &denm)
Get the Reference Time object.
double getLatitude(const DENM &denm)
Get the Latitude value of DENM.
uint8_t getStationType(const DENM &denm)
Get the stationType object.
std::vector< bool > getDrivingLaneStatus(const DrivingLaneStatus &driving_lane_status)
Get the Driving Lane Status in form of bool vector.
gm::PointStamped getUTMPosition(const DENM &denm, int &zone, bool &northp)
Get the UTM Position defined within the ManagementContainer of the DENM.
bool getIsSpeedPresent(const DENM &denm)
Get the IsSpeedPresent object.