Increase VCM link size to 32

This commit is contained in:
emanuel 2022-06-27 19:00:31 +01:00
parent aef0d76ad4
commit 750ffe0601
3 changed files with 14 additions and 12 deletions

View File

@ -531,7 +531,7 @@ int facilities_request_chaininfo_set(facilities_t* facilities, void* responder,
pthread_mutex_lock(&facilities->coordination.lock); pthread_mutex_lock(&facilities->coordination.lock);
facilities->coordination.chain.id = cis->id; facilities->coordination.chain.id = cis->id;
memcpy(facilities->coordination.chain.link, cis->link.buf, 8); memcpy(facilities->coordination.chain.link, cis->link.buf, cis->link.size);
// TODO region // TODO region
pthread_mutex_unlock(&facilities->coordination.lock); pthread_mutex_unlock(&facilities->coordination.lock);

View File

@ -35,6 +35,8 @@ static int are_vehicles_intersecting(
// B2[1] = tB[b+1].longitude; // B2[1] = tB[b+1].longitude;
// if (it2s_tender_do_segments_intersect(A1, A2, B1, B2)) { // if (it2s_tender_do_segments_intersect(A1, A2, B1, B2)) {
// printf("tA[a].lat=%d tA[a].lon=%d tB[b].lat=%d tB[b].lon=%d tA[a].ts=%ld tB[b].ts=%ld\n",
// tA[a].latitude, tA[a].longitude, tB[b].latitude, tB[b].longitude, tA[a].timestamp, tB[b].timestamp); fflush(stdout);
if (it2s_tender_is_inside_circle(tA[a].latitude, tA[a].longitude, tB[b].latitude, tB[b].longitude, 8, DCM_HAVERSINE)) { if (it2s_tender_is_inside_circle(tA[a].latitude, tA[a].longitude, tB[b].latitude, tB[b].longitude, 8, DCM_HAVERSINE)) {
if (tA[a].timestamp < tB[b].timestamp + 2000 && if (tA[a].timestamp < tB[b].timestamp + 2000 &&
tA[a].timestamp > tB[b].timestamp - 2000) { tA[a].timestamp > tB[b].timestamp - 2000) {
@ -103,9 +105,9 @@ static int vcm_check_handle_request(facilities_t* facilities, VCM_t* vcm, mc_nei
if (coordination->chain.id) { if (coordination->chain.id) {
vcm_rep->vcm.chain = calloc(1, sizeof(ChainInformation_t)); vcm_rep->vcm.chain = calloc(1, sizeof(ChainInformation_t));
vcm_rep->vcm.chain->id = coordination->chain.id; vcm_rep->vcm.chain->id = coordination->chain.id;
vcm_rep->vcm.chain->link.buf = malloc(8); vcm_rep->vcm.chain->link.buf = malloc(32);
vcm_rep->vcm.chain->link.size = 8; vcm_rep->vcm.chain->link.size = 32;
memcpy(vcm_rep->vcm.chain->link.buf, coordination->chain.link, 8); memcpy(vcm_rep->vcm.chain->link.buf, coordination->chain.link, 32);
vcm_rep->vcm.chain->area.present = ChainGeoRegion_PR_circle; vcm_rep->vcm.chain->area.present = ChainGeoRegion_PR_circle;
} }
@ -302,9 +304,9 @@ static int vcm_check_intersection_detected(facilities_t* facilities, VCM_t* vcm,
if (coordination->chain.id) { if (coordination->chain.id) {
vcm_req->vcm.chain = calloc(1, sizeof(ChainInformation_t)); vcm_req->vcm.chain = calloc(1, sizeof(ChainInformation_t));
vcm_req->vcm.chain->id = coordination->chain.id; vcm_req->vcm.chain->id = coordination->chain.id;
vcm_req->vcm.chain->link.buf = malloc(8); vcm_req->vcm.chain->link.buf = malloc(32);
vcm_req->vcm.chain->link.size = 8; vcm_req->vcm.chain->link.size = 32;
memcpy(vcm_req->vcm.chain->link.buf, coordination->chain.link, 8); memcpy(vcm_req->vcm.chain->link.buf, coordination->chain.link, 32);
vcm_req->vcm.chain->area.present = ChainGeoRegion_PR_circle; vcm_req->vcm.chain->area.present = ChainGeoRegion_PR_circle;
} }
@ -514,7 +516,7 @@ int vcm_check(void* fc, VCM_t* vcm) {
} }
if (intersecting) { if (intersecting) {
syslog_info("[facilities] [vc] intersection danger with %ld @ (%f, %f) in %ld ms", syslog_info("[facilities] [vc] intersection danger with %lld @ (%f, %f) in %ld ms",
vcm->header.stationID, vcm->header.stationID,
trajectoryA[index].latitude/1.0e7, trajectoryA[index].latitude/1.0e7,
trajectoryA[index].longitude/1.0e7, trajectoryA[index].longitude/1.0e7,
@ -572,9 +574,9 @@ static int mk_vcm(facilities_t* facilities, uint8_t* vcm_uper, uint16_t* vcm_upe
if (coordination->chain.id) { if (coordination->chain.id) {
vcm->vcm.chain = calloc(1, sizeof(ChainInformation_t)); vcm->vcm.chain = calloc(1, sizeof(ChainInformation_t));
vcm->vcm.chain->id = coordination->chain.id; vcm->vcm.chain->id = coordination->chain.id;
vcm->vcm.chain->link.buf = malloc(8); vcm->vcm.chain->link.buf = malloc(32);
vcm->vcm.chain->link.size = 8; vcm->vcm.chain->link.size = 32;
memcpy(vcm->vcm.chain->link.buf, coordination->chain.link, 8); memcpy(vcm->vcm.chain->link.buf, coordination->chain.link, 32);
vcm->vcm.chain->area.present = ChainGeoRegion_PR_circle; vcm->vcm.chain->area.present = ChainGeoRegion_PR_circle;
} }

View File

@ -32,7 +32,7 @@ typedef struct coordination {
struct { struct {
uint64_t id; uint64_t id;
uint8_t link[8]; uint8_t link[32];
it2s_tender_region_t region; it2s_tender_region_t region;
} chain; } chain;