Support yet another SAEM mod
This commit is contained in:
parent
8070a4c11b
commit
b3b2e15d93
|
|
@ -537,6 +537,7 @@ int main() {
|
||||||
pthread_create(&facilities.cp_service, NULL, cp_service, (void*) &facilities);
|
pthread_create(&facilities.cp_service, NULL, cp_service, (void*) &facilities);
|
||||||
|
|
||||||
// SA
|
// SA
|
||||||
|
//bulletin_init(&facilities.bulletin);
|
||||||
//pthread_create(&facilities.sa_service, NULL, sa_service, (void*) &facilities);
|
//pthread_create(&facilities.sa_service, NULL, sa_service, (void*) &facilities);
|
||||||
|
|
||||||
uint8_t buffer[PACKET_MAX_LEN];
|
uint8_t buffer[PACKET_MAX_LEN];
|
||||||
|
|
|
||||||
19
src/sa.c
19
src/sa.c
|
|
@ -23,7 +23,7 @@ SAEM_CODE_R saem_check(void* fc, bulletin_t* bulletin, SAEM_t* saem) {
|
||||||
|
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
if (saem->header.messageID != ItsPduHeader__messageID_saem) {
|
if (saem->header.messageID != messageID_saem) {
|
||||||
return SAEM_INVALID_HEADER_MESSAGE_ID;
|
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) {
|
for (int i = 0; i < saem->sam.body.serviceInfos->list.count; ++i) {
|
||||||
ServiceInfo_t* si = saem->sam.body.serviceInfos->list.array[i];
|
ServiceInfo_t* si = saem->sam.body.serviceInfos->list.array[i];
|
||||||
|
|
||||||
uint16_t its_aid = 0;
|
uint16_t its_aid = si->serviceID;
|
||||||
switch (si->serviceID.present) {
|
|
||||||
case VarLengthNumber_PR_content:
|
|
||||||
its_aid = si->serviceID.choice.content;
|
|
||||||
break;
|
|
||||||
case VarLengthNumber_PR_extension:
|
|
||||||
// TODO
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!its_aid) {
|
if (!its_aid) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -121,7 +111,7 @@ int mk_saem(facilities_t* facilities, uint8_t* b_saem, uint32_t* b_saem_len) {
|
||||||
|
|
||||||
/* header */
|
/* header */
|
||||||
saem->header.protocolVersion = 2;
|
saem->header.protocolVersion = 2;
|
||||||
saem->header.messageID = ItsPduHeader__messageID_saem;
|
saem->header.messageID = messageID_saem;
|
||||||
|
|
||||||
pthread_mutex_lock(&facilities->id.lock);
|
pthread_mutex_lock(&facilities->id.lock);
|
||||||
saem->header.stationID = facilities->id.value;
|
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];
|
uint8_t buf[1024];
|
||||||
for (int i = 0; i < facilities->bulletin.to_provide_len; ++i) {
|
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] = 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 = facilities->bulletin.to_provide[i]->its_aid;
|
||||||
saem->sam.body.serviceInfos->list.array[i]->serviceID.choice.content = facilities->bulletin.to_provide[i]->its_aid;
|
|
||||||
|
|
||||||
saem->sam.body.serviceInfos->list.array[i]->chOptions.extensions = calloc(1, sizeof(ServiceInfoExts_t));
|
saem->sam.body.serviceInfos->list.array[i]->chOptions.extensions = calloc(1, sizeof(ServiceInfoExts_t));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue