Config the several station types, CAM vehicle dimensions

This commit is contained in:
emanuel 2021-05-10 17:50:40 +01:00
parent 79a66dd0de
commit 80f5ed829a
3 changed files with 38 additions and 4 deletions

View File

@ -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); it2s_tender_unlock_space(&facilities->epv);
bvc_hf->vehicleWidth = 20; bvc_hf->vehicleWidth = facilities->vehicle.width;
bvc_hf->vehicleLength.vehicleLengthValue = 46; bvc_hf->vehicleLength.vehicleLengthValue = facilities->vehicle.length;
bvc_hf->vehicleLength.vehicleLengthConfidenceIndication = VehicleLengthConfidenceIndication_unavailable; bvc_hf->vehicleLength.vehicleLengthConfidenceIndication = VehicleLengthConfidenceIndication_unavailable;
bvc_hf->longitudinalAcceleration.longitudinalAccelerationValue = LongitudinalAccelerationValue_unavailable; bvc_hf->longitudinalAcceleration.longitudinalAccelerationValue = LongitudinalAccelerationValue_unavailable;
bvc_hf->longitudinalAcceleration.longitudinalAccelerationConfidence = AccelerationConfidence_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.yawRateValue = YawRateValue_unavailable;
bvc_hf->yawRate.yawRateConfidence = YawRateConfidence_unavailable; bvc_hf->yawRate.yawRateConfidence = YawRateConfidence_unavailable;
// Save current values // Save current values
if (lightship->pos_history_len == POS_HISTORY_MAX_LEN) { if (lightship->pos_history_len == POS_HISTORY_MAX_LEN) {
free(lightship->pos_history[POS_HISTORY_MAX_LEN-1]); free(lightship->pos_history[POS_HISTORY_MAX_LEN-1]);

View File

@ -169,6 +169,32 @@ int facilities_config(void* facilities_s) {
facilities->station_type = 5; facilities->station_type = 5;
} else if (!strcmp("rsu", config->general.itss_type)) { } else if (!strcmp("rsu", config->general.itss_type)) {
facilities->station_type = 15; 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 { } else {
syslog_err("[facilities] [config] unrecognized ITSS type, running as OBU"); syslog_err("[facilities] [config] unrecognized ITSS type, running as OBU");
facilities->station_type = 5; facilities->station_type = 5;
@ -203,7 +229,6 @@ int facilities_config(void* facilities_s) {
} }
ASN_STRUCT_FREE(asn_DEF_ManagementRequest, mreq_set); ASN_STRUCT_FREE(asn_DEF_ManagementRequest, mreq_set);
// DENM // DENM
facilities->den->default_event_duration = config->facilities.denm.default_event_duration; facilities->den->default_event_duration = config->facilities.denm.default_event_duration;
facilities->den->n_max_events = config->facilities.denm.nmax_active_events; 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); ASN_STRUCT_FREE(asn_DEF_ManagementReply, mrep);
zmq_close(management_socket); 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: cleanup:
it2s_config_free(config); it2s_config_free(config);

View File

@ -57,6 +57,12 @@ typedef struct facilities {
bool use_security; bool use_security;
bool replay; bool replay;
struct {
uint16_t width;
uint16_t length;
uint8_t role;
} vehicle;
struct { struct {
pthread_mutex_t lock; pthread_mutex_t lock;
uint64_t value; uint64_t value;