From 74b514eff3c6ca46eff63a650e30eaf798e3737c Mon Sep 17 00:00:00 2001 From: emanuel Date: Wed, 10 Mar 2021 15:11:15 +0000 Subject: [PATCH] Disable CAMs option --- src/cam.c | 6 +++--- src/cam.h | 2 ++ src/config.c | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/cam.c b/src/cam.c index fa0752a..9317dd8 100644 --- a/src/cam.c +++ b/src/cam.c @@ -499,12 +499,12 @@ void *ca_service(void *fc) { *bdr->gnSecurityProfile = 1; } - uint8_t bdr_oer[512]; + uint8_t bdr_oer[1024]; bdr_oer[0] = 4; // Facilities while (!facilities->exit) { usleep(1000*50); - if (lightship_check(facilities->lightship)) { + if (lightship_check(facilities->lightship) && facilities->lightship->active) { rv = mk_cam(facilities, bdr->data.buf, (uint32_t *) &bdr->data.size); if (rv) { continue; @@ -514,7 +514,7 @@ void *ca_service(void *fc) { bdr->gnCommunicationProfile = 0; if (facilities->station_type != 15 && check_pz(facilities->lightship)) bdr->gnCommunicationProfile = 1; - asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_BTPDataRequest, NULL, bdr, bdr_oer+1, 511); + asn_enc_rval_t enc = oer_encode_to_buffer(&asn_DEF_BTPDataRequest, NULL, bdr, bdr_oer+1, 1023); if (enc.encoded == -1) { syslog_err("[facilities] encoding BTPDataRequest for cam failed"); continue; diff --git a/src/cam.h b/src/cam.h index 30dc19b..82026b4 100644 --- a/src/cam.h +++ b/src/cam.h @@ -34,6 +34,8 @@ typedef struct cid_ssp_bm { } cid_ssp_bm_t; typedef struct lightship { + bool active; + pthread_mutex_t lock; uint8_t type; diff --git a/src/config.c b/src/config.c index 06e08d0..ec40d4d 100644 --- a/src/config.c +++ b/src/config.c @@ -154,6 +154,10 @@ int itss_config(void* facilities_s, char* config_file) { facilities->den->n_max_events = denm_nmax_active_events; // CAM + int cam_activate = 1; + rv += extract_val_bool(&cam_activate, cam, "activate"); + facilities->lightship->active = cam_activate; + int64_t obu_cam_period_min; rv += extract_val_int(&obu_cam_period_min, cam, "obu-period-min"); facilities->lightship->vehicle_gen_min = obu_cam_period_min;