diff --git a/src/facilities.c b/src/facilities.c index eab2587..3305ff0 100644 --- a/src/facilities.c +++ b/src/facilities.c @@ -113,6 +113,12 @@ static int transport_indication(facilities_t *facilities, void* responder, void* handled_msg = true; break; + case 7011: /* tolling */ + its_msg_descriptor = &asn_DEF_TollingPaymentMessage; + its_msg = calloc(1, sizeof(TollingPaymentMessage_t)); + handled_msg = true; + break; + default: syslog_debug("[facilities] messsage with unhandled BTP port received, ignoring"); goto cleanup; @@ -194,6 +200,10 @@ static int transport_indication(facilities_t *facilities, void* responder, void* saem_check(facilities, &facilities->bulletin, its_msg); break; + case 7011: + tpm_recv(facilities, its_msg); + break; + default: break; } diff --git a/src/tpm.c b/src/tpm.c index 3536af0..aa3081f 100644 --- a/src/tpm.c +++ b/src/tpm.c @@ -36,6 +36,7 @@ int tpm_pay(void* fc) { tpm->tollingFlow.choice.request.transactionNonce = tolling->nonce; + // encode TPM asn_enc_rval_t enc = uper_encode_to_buffer(&asn_DEF_TollingPaymentMessage, NULL, &tpm, buf, buf_len); if (enc.encoded == -1) { @@ -95,6 +96,8 @@ static void rsu_handle_recv(facilities_t* facilities, TollRequest_t* req) { tpm = calloc(1, sizeof(TollingPaymentMessage_t)); asn_ulong2INTEGER(&tpm->timestamp, it2s_tender_get_clock(&facilities->epv)); + // TODO check clientId + // TODO dlt: check transaction // encode TPM asn_enc_rval_t enc = uper_encode_to_buffer(&asn_DEF_TollingPaymentMessage, NULL, &tpm, buf, buf_len); @@ -137,10 +140,6 @@ static void rsu_handle_recv(facilities_t* facilities, TollRequest_t* req) { cleanup: ASN_STRUCT_FREE(asn_DEF_TollingPaymentMessage, tpm); ASN_STRUCT_FREE(asn_DEF_TransportRequest, tr); - - // TODO check clientId - // TODO dlt: check balance - // TODO dlt: check transaction } static void veh_handle_recv(tolling_s* tolling, TollReply_t* rep) { @@ -155,8 +154,6 @@ static void veh_handle_recv(tolling_s* tolling, TollReply_t* rep) { return; } - - tolling->active = false; }