From 80f5ed829a5b9fd462ee7f894acc6ada5fa2fc66 Mon Sep 17 00:00:00 2001 From: emanuel Date: Mon, 10 May 2021 17:50:40 +0100 Subject: [PATCH] Config the several station types, CAM vehicle dimensions --- src/cam.c | 5 ++--- src/config.c | 31 ++++++++++++++++++++++++++++++- src/facilities.h | 6 ++++++ 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/cam.c b/src/cam.c index 8815971..31e8cb5 100644 --- a/src/cam.c +++ b/src/cam.c @@ -122,8 +122,8 @@ static int mk_cam(facilities_t* facilities, uint8_t *cam_oer, uint32_t *cam_len) it2s_tender_unlock_space(&facilities->epv); - bvc_hf->vehicleWidth = 20; - bvc_hf->vehicleLength.vehicleLengthValue = 46; + bvc_hf->vehicleWidth = facilities->vehicle.width; + bvc_hf->vehicleLength.vehicleLengthValue = facilities->vehicle.length; bvc_hf->vehicleLength.vehicleLengthConfidenceIndication = VehicleLengthConfidenceIndication_unavailable; bvc_hf->longitudinalAcceleration.longitudinalAccelerationValue = LongitudinalAccelerationValue_unavailable; bvc_hf->longitudinalAcceleration.longitudinalAccelerationConfidence = AccelerationConfidence_unavailable; @@ -134,7 +134,6 @@ static int mk_cam(facilities_t* facilities, uint8_t *cam_oer, uint32_t *cam_len) bvc_hf->yawRate.yawRateValue = YawRateValue_unavailable; bvc_hf->yawRate.yawRateConfidence = YawRateConfidence_unavailable; - // Save current values if (lightship->pos_history_len == POS_HISTORY_MAX_LEN) { free(lightship->pos_history[POS_HISTORY_MAX_LEN-1]); diff --git a/src/config.c b/src/config.c index 61ccbc0..e3d1821 100644 --- a/src/config.c +++ b/src/config.c @@ -169,6 +169,32 @@ int facilities_config(void* facilities_s) { facilities->station_type = 5; } else if (!strcmp("rsu", config->general.itss_type)) { facilities->station_type = 15; + } else if (!strcmp("unknown", config->general.itss_type)) { + facilities->station_type = 0; + } else if (!strcmp("pedestrian", config->general.itss_type)) { + facilities->station_type = 1; + } else if (!strcmp("cyclist", config->general.itss_type)) { + facilities->station_type = 2; + } else if (!strcmp("moped", config->general.itss_type)) { + facilities->station_type = 3; + } else if (!strcmp("motorcycle", config->general.itss_type)) { + facilities->station_type = 4; + } else if (!strcmp("passengerCar", config->general.itss_type)) { + facilities->station_type = 5; + } else if (!strcmp("bus", config->general.itss_type)) { + facilities->station_type = 6; + } else if (!strcmp("lightTruck", config->general.itss_type)) { + facilities->station_type = 7; + } else if (!strcmp("heavyTruck", config->general.itss_type)) { + facilities->station_type = 8; + } else if (!strcmp("trailer", config->general.itss_type)) { + facilities->station_type = 9; + } else if (!strcmp("specialVehicles", config->general.itss_type)) { + facilities->station_type = 10; + } else if (!strcmp("tram", config->general.itss_type)) { + facilities->station_type = 11; + } else if (!strcmp("roadSideUnit", config->general.itss_type)) { + facilities->station_type = 15; } else { syslog_err("[facilities] [config] unrecognized ITSS type, running as OBU"); facilities->station_type = 5; @@ -203,7 +229,6 @@ int facilities_config(void* facilities_s) { } ASN_STRUCT_FREE(asn_DEF_ManagementRequest, mreq_set); - // DENM facilities->den->default_event_duration = config->facilities.denm.default_event_duration; facilities->den->n_max_events = config->facilities.denm.nmax_active_events; @@ -331,6 +356,10 @@ int facilities_config(void* facilities_s) { ASN_STRUCT_FREE(asn_DEF_ManagementReply, mrep); zmq_close(management_socket); + facilities->vehicle.length = config->facilities.vehicle.length; + facilities->vehicle.width = config->facilities.vehicle.width; + facilities->vehicle.role = config->facilities.vehicle.role; + cleanup: it2s_config_free(config); diff --git a/src/facilities.h b/src/facilities.h index 562c684..ec891a6 100644 --- a/src/facilities.h +++ b/src/facilities.h @@ -57,6 +57,12 @@ typedef struct facilities { bool use_security; bool replay; + struct { + uint16_t width; + uint16_t length; + uint8_t role; + } vehicle; + struct { pthread_mutex_t lock; uint64_t value;