From b3b2e15d93f1d8b18b4d6cd9d87713053bdbddee Mon Sep 17 00:00:00 2001 From: emanuel Date: Thu, 15 Jul 2021 10:47:34 +0100 Subject: [PATCH] Support yet another SAEM mod --- src/facilities.c | 1 + src/sa.c | 19 ++++--------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/facilities.c b/src/facilities.c index fae4bcd..1397c68 100644 --- a/src/facilities.c +++ b/src/facilities.c @@ -537,6 +537,7 @@ int main() { pthread_create(&facilities.cp_service, NULL, cp_service, (void*) &facilities); // SA + //bulletin_init(&facilities.bulletin); //pthread_create(&facilities.sa_service, NULL, sa_service, (void*) &facilities); uint8_t buffer[PACKET_MAX_LEN]; diff --git a/src/sa.c b/src/sa.c index aea1b6a..ce99af4 100644 --- a/src/sa.c +++ b/src/sa.c @@ -23,7 +23,7 @@ SAEM_CODE_R saem_check(void* fc, bulletin_t* bulletin, SAEM_t* saem) { int rv = 0; - if (saem->header.messageID != ItsPduHeader__messageID_saem) { + if (saem->header.messageID != messageID_saem) { return SAEM_INVALID_HEADER_MESSAGE_ID; } @@ -36,17 +36,7 @@ SAEM_CODE_R saem_check(void* fc, bulletin_t* bulletin, SAEM_t* saem) { for (int i = 0; i < saem->sam.body.serviceInfos->list.count; ++i) { ServiceInfo_t* si = saem->sam.body.serviceInfos->list.array[i]; - uint16_t its_aid = 0; - switch (si->serviceID.present) { - case VarLengthNumber_PR_content: - its_aid = si->serviceID.choice.content; - break; - case VarLengthNumber_PR_extension: - // TODO - break; - default: - break; - } + uint16_t its_aid = si->serviceID; if (!its_aid) { continue; @@ -121,7 +111,7 @@ int mk_saem(facilities_t* facilities, uint8_t* b_saem, uint32_t* b_saem_len) { /* header */ saem->header.protocolVersion = 2; - saem->header.messageID = ItsPduHeader__messageID_saem; + saem->header.messageID = messageID_saem; pthread_mutex_lock(&facilities->id.lock); saem->header.stationID = facilities->id.value; @@ -140,8 +130,7 @@ int mk_saem(facilities_t* facilities, uint8_t* b_saem, uint32_t* b_saem_len) { uint8_t buf[1024]; for (int i = 0; i < facilities->bulletin.to_provide_len; ++i) { saem->sam.body.serviceInfos->list.array[i] = calloc(1, sizeof(ServiceInfo_t)); - saem->sam.body.serviceInfos->list.array[i]->serviceID.present = VarLengthNumber_PR_content; - saem->sam.body.serviceInfos->list.array[i]->serviceID.choice.content = facilities->bulletin.to_provide[i]->its_aid; + saem->sam.body.serviceInfos->list.array[i]->serviceID = facilities->bulletin.to_provide[i]->its_aid; saem->sam.body.serviceInfos->list.array[i]->chOptions.extensions = calloc(1, sizeof(ServiceInfoExts_t));