34namespace etsi_its_denm_msgs::access {
44inline uint32_t getStationID(
const DENM& denm) {
return getStationID(denm.header); }
52inline TimestampIts getReferenceTime(
const DENM& denm) {
return denm.denm.management.reference_time; }
60inline uint64_t getReferenceTimeValue(
const DENM& denm) {
return getReferenceTime(denm).value; }
68inline uint8_t getStationType(
const DENM& denm) {
return denm.denm.management.station_type.value; }
76inline double getLatitude(
const DENM& denm) {
return getLatitude(denm.denm.management.event_position.latitude); }
84inline double getLongitude(
const DENM& denm) {
return getLongitude(denm.denm.management.event_position.longitude); }
92inline double getAltitude(
const DENM& denm) {
return getAltitude(denm.denm.management.event_position.altitude); }
102inline double getHeading(
const Heading& heading) {
return ((
double)heading.heading_value.value) * 1e-1; }
110inline double getHeading(
const DENM& denm) {
111 if (denm.denm.location_is_present) {
112 if (denm.denm.location.event_position_heading_is_present) {
113 return getHeading(denm.denm.location.event_position_heading);
115 throw std::invalid_argument(
"Heading is not present!");
118 throw std::invalid_argument(
"LocationContainer is not present!");
129 if (denm.denm.location_is_present) {
130 return denm.denm.location.event_position_heading_is_present;
132 throw std::invalid_argument(
"LocationContainer is not present!");
142inline double getSpeed(
const DENM& denm) {
143 if (denm.denm.location_is_present) {
144 if (denm.denm.location.event_speed_is_present) {
145 return getSpeed(denm.denm.location.event_speed);
147 throw std::invalid_argument(
"Speed is not present!");
150 throw std::invalid_argument(
"LocationContainer is not present!");
160inline bool getIsSpeedPresent(
const DENM& denm) {
161 if (denm.denm.location_is_present) {
162 return denm.denm.location.event_speed_is_present;
164 throw std::invalid_argument(
"LocationContainer is not present!");
176inline gm::PointStamped getUTMPosition(
const DENM& denm,
int& zone,
bool& northp) {
177 return getUTMPosition(denm.denm.management.event_position, zone, northp);
186inline gm::PointStamped getUTMPosition(
const DENM& denm) {
189 return getUTMPosition(denm.denm.management.event_position, zone, northp);
198inline uint8_t
getCauseCode(
const DENM& denm) {
return denm.denm.situation.event_type.cause_code.value; }
206inline uint8_t
getSubCauseCode(
const DENM& denm) {
return denm.denm.situation.event_type.sub_cause_code.value; }
216inline std::string getCauseCodeType(
const DENM& denm) {
217 if (denm.denm.situation_is_present) {
219 std::string cause_code_type =
"undefined";
221 if (cause_code == CauseCodeType().TRAFFIC_CONDITION)
222 cause_code_type =
"traffic condition";
223 else if (cause_code == CauseCodeType().ACCIDENT)
224 cause_code_type =
"accident";
225 else if (cause_code == CauseCodeType().ROADWORKS)
226 cause_code_type =
"roadworks";
227 else if (cause_code == CauseCodeType().IMPASSABILITY)
228 cause_code_type =
"impassibility";
229 else if (cause_code == CauseCodeType().ADVERSE_WEATHER_CONDITION_ADHESION)
230 cause_code_type =
"adverse weather condition - adhesion";
231 else if (cause_code == CauseCodeType().AQUAPLANNNING)
232 cause_code_type =
"aquaplanning";
233 else if (cause_code == CauseCodeType().HAZARDOUS_LOCATION_SURFACE_CONDITION)
234 cause_code_type =
"hazardous location - surface condition";
235 else if (cause_code == CauseCodeType().HAZARDOUS_LOCATION_OBSTACLE_ON_THE_ROAD)
236 cause_code_type =
"hazardous location - obstacle on the road";
237 else if (cause_code == CauseCodeType().HAZARDOUS_LOCATION_ANIMAL_ON_THE_ROAD)
238 cause_code_type =
"hazardous location - animal on the road";
239 else if (cause_code == CauseCodeType().HUMAN_PRESENCE_ON_THE_ROAD)
240 cause_code_type =
"human presence on the road";
241 else if (cause_code == CauseCodeType().WRONG_WAY_DRIVING)
242 cause_code_type =
"wrong way driving";
243 else if (cause_code == CauseCodeType().RESCUE_AND_RECOVERY_WORK_IN_PROGRESS)
244 cause_code_type =
"rescue and recovery in progress";
245 else if (cause_code == CauseCodeType().ADVERSE_WEATHER_CONDITION_EXTREME_WEATHER_CONDITION)
246 cause_code_type =
"adverse weather condition - extreme weather condition";
247 else if (cause_code == CauseCodeType().ADVERSE_WEATHER_CONDITION_VISIBILITY)
248 cause_code_type =
"adverse weather condition - visibility";
249 else if (cause_code == CauseCodeType().ADVERSE_WEATHER_CONDITION_PRECIPITATION)
250 cause_code_type =
"adverse weather condition - precipitation";
251 else if (cause_code == CauseCodeType().SLOW_VEHICLE)
252 cause_code_type =
"slow vehicle";
253 else if (cause_code == CauseCodeType().DANGEROUS_END_OF_QUEUE)
254 cause_code_type =
"dangerous end of queue";
255 else if (cause_code == CauseCodeType().VEHICLE_BREAKDOWN)
256 cause_code_type =
"vehicle breakdown";
257 else if (cause_code == CauseCodeType().POST_CRASH)
258 cause_code_type =
"post crash";
259 else if (cause_code == CauseCodeType().HUMAN_PROBLEM)
260 cause_code_type =
"human problem";
261 else if (cause_code == CauseCodeType().STATIONARY_VEHICLE)
262 cause_code_type =
"stationary vehicle";
263 else if (cause_code == CauseCodeType().EMERGENCY_VEHICLE_APPROACHING)
264 cause_code_type =
"emergency vehicle approaching";
265 else if (cause_code == CauseCodeType().HAZARDOUS_LOCATION_DANGEROUS_CURVE)
266 cause_code_type =
"hazardous location - dangerous curve";
267 else if (cause_code == CauseCodeType().COLLISION_RISK)
268 cause_code_type =
"collision risk";
269 else if (cause_code == CauseCodeType().SIGNAL_VIOLATION)
270 cause_code_type =
"signal violation";
271 else if (cause_code == CauseCodeType().DANGEROUS_SITUATION)
272 cause_code_type =
"dangerous situation";
274 return cause_code_type;
276 throw std::invalid_argument(
"SituationContainer is not present!");
289 if (denm.denm.situation_is_present) {
292 std::string sub_cause_code_type =
"undefined";
293 if (cause_code == CauseCodeType().TRAFFIC_CONDITION) {
294 if (sub_cause_code == 0)
295 sub_cause_code_type =
"unavailable";
296 else if (sub_cause_code == 1)
297 sub_cause_code_type =
"not defined";
298 else if (sub_cause_code == 2)
299 sub_cause_code_type =
"traffic jam slowly increasing";
300 else if (sub_cause_code == 3)
301 sub_cause_code_type =
"traffic jam increasing";
302 else if (sub_cause_code == 4)
303 sub_cause_code_type =
"traffic jam strongly increasing";
304 else if (sub_cause_code == 5)
305 sub_cause_code_type =
"traffic stationary";
306 else if (sub_cause_code == 6)
307 sub_cause_code_type =
"traffic jam slightly decreasing";
308 else if (sub_cause_code == 7)
309 sub_cause_code_type =
"traffic jam decreasing";
310 else if (sub_cause_code == 8)
311 sub_cause_code_type =
"traffic jam strongly decreasing";
312 }
else if (cause_code == CauseCodeType().ACCIDENT) {
313 if (sub_cause_code == 0)
314 sub_cause_code_type =
"unavailable";
315 else if (sub_cause_code >= 1 && sub_cause_code <= 7)
316 sub_cause_code_type =
"not defined";
317 else if (sub_cause_code == 8)
318 sub_cause_code_type =
"assistance requested (e-Call)";
319 }
else if (cause_code == CauseCodeType().ROADWORKS) {
320 if (sub_cause_code == 0)
321 sub_cause_code_type =
"unavailable";
322 else if (sub_cause_code >= 1 && sub_cause_code <= 3)
323 sub_cause_code_type =
"not defined";
324 else if (sub_cause_code == 4)
325 sub_cause_code_type =
"short-term stationary roadworks";
326 else if (sub_cause_code == 5)
327 sub_cause_code_type =
"street cleaning";
328 else if (sub_cause_code == 6)
329 sub_cause_code_type =
"winter service";
330 }
else if (cause_code == CauseCodeType().IMPASSABILITY)
331 sub_cause_code_type =
"not defined";
332 else if (cause_code == CauseCodeType().ADVERSE_WEATHER_CONDITION_ADHESION) {
333 if (sub_cause_code == 0)
334 sub_cause_code_type =
"unavailable";
335 else if (sub_cause_code >= 1 && sub_cause_code <= 10)
336 sub_cause_code_type =
"not defined";
337 }
else if (cause_code == CauseCodeType().AQUAPLANNNING)
338 sub_cause_code_type =
"not defined";
339 else if (cause_code == CauseCodeType().HAZARDOUS_LOCATION_SURFACE_CONDITION) {
340 if (sub_cause_code == 0)
341 sub_cause_code_type =
"unavailable";
342 else if (sub_cause_code >= 1 && sub_cause_code <= 9)
343 sub_cause_code_type =
"not defined";
344 }
else if (cause_code == CauseCodeType().HAZARDOUS_LOCATION_OBSTACLE_ON_THE_ROAD) {
345 if (sub_cause_code == 0)
346 sub_cause_code_type =
"unavailable";
347 else if (sub_cause_code >= 1 && sub_cause_code <= 7)
348 sub_cause_code_type =
"not defined";
349 }
else if (cause_code == CauseCodeType().HAZARDOUS_LOCATION_ANIMAL_ON_THE_ROAD) {
350 if (sub_cause_code == 0)
351 sub_cause_code_type =
"unavailable";
352 else if (sub_cause_code >= 1 && sub_cause_code <= 4)
353 sub_cause_code_type =
"not defined";
354 }
else if (cause_code == CauseCodeType().HUMAN_PRESENCE_ON_THE_ROAD) {
355 if (sub_cause_code == 0)
356 sub_cause_code_type =
"unavailable";
357 else if (sub_cause_code >= 1 && sub_cause_code <= 3)
358 sub_cause_code_type =
"not defined";
359 }
else if (cause_code == CauseCodeType().WRONG_WAY_DRIVING) {
360 if (sub_cause_code == 0)
361 sub_cause_code_type =
"unavailable";
362 else if (sub_cause_code == 1)
363 sub_cause_code_type =
"vehicle driving in wrong lane";
364 else if (sub_cause_code == 2)
365 sub_cause_code_type =
"vehicle driving in wrong driving direction";
366 }
else if (cause_code == CauseCodeType().RESCUE_AND_RECOVERY_WORK_IN_PROGRESS) {
367 if (sub_cause_code == 0)
368 sub_cause_code_type =
"unavailable";
369 else if (sub_cause_code >= 1 && sub_cause_code <= 5)
370 sub_cause_code_type =
"not defined";
371 }
else if (cause_code == CauseCodeType().ADVERSE_WEATHER_CONDITION_EXTREME_WEATHER_CONDITION) {
372 if (sub_cause_code == 0)
373 sub_cause_code_type =
"unavailable";
374 else if (sub_cause_code >= 1 && sub_cause_code <= 6)
375 sub_cause_code_type =
"not defined";
376 }
else if (cause_code == CauseCodeType().ADVERSE_WEATHER_CONDITION_VISIBILITY) {
377 if (sub_cause_code == 0)
378 sub_cause_code_type =
"unavailable";
379 else if (sub_cause_code >= 1 && sub_cause_code <= 8)
380 sub_cause_code_type =
"not defined";
381 }
else if (cause_code == CauseCodeType().ADVERSE_WEATHER_CONDITION_PRECIPITATION) {
382 if (sub_cause_code == 0)
383 sub_cause_code_type =
"unavailable";
384 else if (sub_cause_code >= 1 && sub_cause_code <= 3)
385 sub_cause_code_type =
"not defined";
386 }
else if (cause_code == CauseCodeType().SLOW_VEHICLE) {
387 if (sub_cause_code == 0)
388 sub_cause_code_type =
"unavailable";
389 else if (sub_cause_code >= 1 && sub_cause_code <= 8)
390 sub_cause_code_type =
"not defined";
391 }
else if (cause_code == CauseCodeType().DANGEROUS_END_OF_QUEUE) {
392 if (sub_cause_code == 0)
393 sub_cause_code_type =
"unavailable";
394 else if (sub_cause_code >= 1 && sub_cause_code <= 8)
395 sub_cause_code_type =
"not defined";
396 }
else if (cause_code == CauseCodeType().VEHICLE_BREAKDOWN) {
397 if (sub_cause_code == 0)
398 sub_cause_code_type =
"unavailable";
399 else if (sub_cause_code == 1)
400 sub_cause_code_type =
"lack of fuel";
401 else if (sub_cause_code == 2)
402 sub_cause_code_type =
"lack of battery";
403 else if (sub_cause_code == 3)
404 sub_cause_code_type =
"engine problem";
405 else if (sub_cause_code == 4)
406 sub_cause_code_type =
"transmission problem";
407 else if (sub_cause_code == 5)
408 sub_cause_code_type =
"engine cooling problem";
409 else if (sub_cause_code == 6)
410 sub_cause_code_type =
"braking system problem";
411 else if (sub_cause_code == 7)
412 sub_cause_code_type =
"steering problem";
413 else if (sub_cause_code == 8)
414 sub_cause_code_type =
"tyre puncture";
415 }
else if (cause_code == CauseCodeType().POST_CRASH) {
416 if (sub_cause_code == 0)
417 sub_cause_code_type =
"unavailable";
418 else if (sub_cause_code == 1)
419 sub_cause_code_type =
"accident without e-Call triggered";
420 else if (sub_cause_code == 2)
421 sub_cause_code_type =
"accident with e-Call manually triggered";
422 else if (sub_cause_code == 3)
423 sub_cause_code_type =
"accident with e-Call automatical triggered";
424 else if (sub_cause_code == 4)
425 sub_cause_code_type =
"accident with e-Call triggered without a possible access to a cell network";
426 }
else if (cause_code == CauseCodeType().HUMAN_PROBLEM) {
427 if (sub_cause_code == 0)
428 sub_cause_code_type =
"unavailable";
429 else if (sub_cause_code == 1)
430 sub_cause_code_type =
"glycaemia problem";
431 else if (sub_cause_code == 2)
432 sub_cause_code_type =
"heart problem";
433 }
else if (cause_code == CauseCodeType().STATIONARY_VEHICLE) {
434 if (sub_cause_code == 0)
435 sub_cause_code_type =
"unavailable";
436 else if (sub_cause_code == 1)
437 sub_cause_code_type =
"human problem";
438 else if (sub_cause_code == 2)
439 sub_cause_code_type =
"vehicle breakdown";
440 else if (sub_cause_code == 3)
441 sub_cause_code_type =
"post crash";
442 else if (sub_cause_code == 4)
443 sub_cause_code_type =
"public transport stop";
444 else if (sub_cause_code == 5)
445 sub_cause_code_type =
"carrying dangerous goods";
446 }
else if (cause_code == CauseCodeType().EMERGENCY_VEHICLE_APPROACHING) {
447 if (sub_cause_code == 0)
448 sub_cause_code_type =
"unavailable";
449 else if (sub_cause_code == 1)
450 sub_cause_code_type =
"emergency vehicle approaching";
451 else if (sub_cause_code == 2)
452 sub_cause_code_type =
"prioritized vehicle approaching";
453 }
else if (cause_code == CauseCodeType().HAZARDOUS_LOCATION_DANGEROUS_CURVE) {
454 if (sub_cause_code == 0)
455 sub_cause_code_type =
"unavailable";
456 else if (sub_cause_code == 1)
457 sub_cause_code_type =
"dangerous left turn curve";
458 else if (sub_cause_code == 2)
459 sub_cause_code_type =
"dangerous right turn curve";
460 else if (sub_cause_code == 3)
461 sub_cause_code_type =
"multiple curves starting with unknown turning direction";
462 else if (sub_cause_code == 4)
463 sub_cause_code_type =
"multiple curves starting with left turn";
464 else if (sub_cause_code == 5)
465 sub_cause_code_type =
"multiple curves starting with right turn";
466 }
else if (cause_code == CauseCodeType().COLLISION_RISK) {
467 if (sub_cause_code == 0)
468 sub_cause_code_type =
"unavailable";
469 else if (sub_cause_code == 1)
470 sub_cause_code_type =
"longitudinal collision risk";
471 else if (sub_cause_code == 2)
472 sub_cause_code_type =
"crossing collision risk";
473 else if (sub_cause_code == 3)
474 sub_cause_code_type =
"lateral collision risk";
475 else if (sub_cause_code == 4)
476 sub_cause_code_type =
"collision risk involving vulnerable road user";
477 }
else if (cause_code == CauseCodeType().SIGNAL_VIOLATION) {
478 if (sub_cause_code == 0)
479 sub_cause_code_type =
"unavailable";
480 else if (sub_cause_code == 1)
481 sub_cause_code_type =
"stop sign violation";
482 else if (sub_cause_code == 2)
483 sub_cause_code_type =
"traffic light violation";
484 else if (sub_cause_code == 3)
485 sub_cause_code_type =
"turning regulation violation";
486 }
else if (cause_code == CauseCodeType().DANGEROUS_SITUATION) {
487 if (sub_cause_code == 0)
488 sub_cause_code_type =
"unavailable";
489 else if (sub_cause_code == 1)
490 sub_cause_code_type =
"emergency electronic break lights";
491 else if (sub_cause_code == 2)
492 sub_cause_code_type =
"pre-crash system activated";
493 else if (sub_cause_code == 3)
494 sub_cause_code_type =
"ESP (electronic stability program) activated";
495 else if (sub_cause_code == 4)
496 sub_cause_code_type =
"ABS (anti-lock breaking system) activated";
497 else if (sub_cause_code == 5)
498 sub_cause_code_type =
"AEB (automatic emergency breaking) activated";
499 else if (sub_cause_code == 6)
500 sub_cause_code_type =
"break warning activated";
501 else if (sub_cause_code == 7)
502 sub_cause_code_type =
"collision risk warning activated";
504 return sub_cause_code_type;
506 throw std::invalid_argument(
"SituationContainer is not present!");
517 return getBitString(driving_lane_status.value, driving_lane_status.bits_unused);
527 return getBitString(light_bar_siren_in_use.value, light_bar_siren_in_use.bits_unused);
std::vector< bool > getLightBarSirenInUse(const LightBarSirenInUse &light_bar_siren_in_use)
Get the Lightbar Siren In Use in form of bool vector.
std::vector< bool > getDrivingLaneStatus(const DrivingLaneStatus &driving_lane_status)
Get the Driving Lane Status in form of bool vector.
std::vector< bool > getBitString(const std::vector< uint8_t > &buffer, const int bits_unused)
Get a Bit String in form of bool vector.
Getter functions for the ETSI ITS Common Data Dictionary (CDD) v1.3.1.
uint8_t getSubCauseCode(const DENM &denm)
Get the Sub Cause Code object.
std::string getSubCauseCodeType(const DENM &denm)
Get the Sub Cause Code Type object.
uint8_t getCauseCode(const DENM &denm)
Get the Cause Code object.
bool getIsHeadingPresent(const DENM &denm)
Get the IsHeadingPresent object.