Simple tolling efforts
This commit is contained in:
parent
90e69c2239
commit
24d88ec84d
|
|
@ -113,6 +113,12 @@ static int transport_indication(facilities_t *facilities, void* responder, void*
|
||||||
handled_msg = true;
|
handled_msg = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 7011: /* tolling */
|
||||||
|
its_msg_descriptor = &asn_DEF_TollingPaymentMessage;
|
||||||
|
its_msg = calloc(1, sizeof(TollingPaymentMessage_t));
|
||||||
|
handled_msg = true;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
syslog_debug("[facilities] messsage with unhandled BTP port received, ignoring");
|
syslog_debug("[facilities] messsage with unhandled BTP port received, ignoring");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
@ -194,6 +200,10 @@ static int transport_indication(facilities_t *facilities, void* responder, void*
|
||||||
saem_check(facilities, &facilities->bulletin, its_msg);
|
saem_check(facilities, &facilities->bulletin, its_msg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 7011:
|
||||||
|
tpm_recv(facilities, its_msg);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ int tpm_pay(void* fc) {
|
||||||
tpm->tollingFlow.choice.request.transactionNonce = tolling->nonce;
|
tpm->tollingFlow.choice.request.transactionNonce = tolling->nonce;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// encode TPM
|
// encode TPM
|
||||||
asn_enc_rval_t enc = uper_encode_to_buffer(&asn_DEF_TollingPaymentMessage, NULL, &tpm, buf, buf_len);
|
asn_enc_rval_t enc = uper_encode_to_buffer(&asn_DEF_TollingPaymentMessage, NULL, &tpm, buf, buf_len);
|
||||||
if (enc.encoded == -1) {
|
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));
|
tpm = calloc(1, sizeof(TollingPaymentMessage_t));
|
||||||
asn_ulong2INTEGER(&tpm->timestamp, it2s_tender_get_clock(&facilities->epv));
|
asn_ulong2INTEGER(&tpm->timestamp, it2s_tender_get_clock(&facilities->epv));
|
||||||
|
|
||||||
|
// TODO check clientId
|
||||||
|
// TODO dlt: check transaction
|
||||||
|
|
||||||
// encode TPM
|
// encode TPM
|
||||||
asn_enc_rval_t enc = uper_encode_to_buffer(&asn_DEF_TollingPaymentMessage, NULL, &tpm, buf, buf_len);
|
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:
|
cleanup:
|
||||||
ASN_STRUCT_FREE(asn_DEF_TollingPaymentMessage, tpm);
|
ASN_STRUCT_FREE(asn_DEF_TollingPaymentMessage, tpm);
|
||||||
ASN_STRUCT_FREE(asn_DEF_TransportRequest, tr);
|
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) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tolling->active = false;
|
tolling->active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue