diff --git a/.vscode/settings.json b/.vscode/settings.json index 5ca74dd..23122f4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,6 +6,8 @@ "string_view": "c", "initializer_list": "c", "nativeenumerated.h": "c", - "asn_application.h": "c" + "asn_application.h": "c", + "timestamputc.h": "c", + "availabilitystatus.h": "c" } } \ No newline at end of file diff --git a/src/evm.c b/src/evm.c index 38e0226..e5844a1 100644 --- a/src/evm.c +++ b/src/evm.c @@ -104,7 +104,7 @@ static int mk_evcsnm(uint8_t *evcsnm_oer, uint32_t *evcsnm_len) { asn_enc_rval_t enc = uper_encode_to_buffer(&asn_DEF_EvcsnPdu, NULL, evcsnm, evcsnm_oer, 512); if (enc.encoded == -1) { - log_error("[ca] failed encoding evcsnm (%s)", enc.failed_type->name); + log_error("[ev] failed encoding evcsnm (%s)", enc.failed_type->name); rv = 1; goto cleanup; } @@ -213,9 +213,12 @@ static int evrsrm_pre_reservation_response(uint8_t *evrsrm_oer, uint32_t *evrsrm evrsr_response->messageBody.present = EV_RSR_MessageBody_PR_preReservationResponseMessage; PreReservationResponseMessage_t response = evrsr_response->messageBody.choice.preReservationResponseMessage; - char *pre_reservation_id_s = calloc(1, sizeof(char) * 10); - sprintf(pre_reservation_id_s, "%d", pre_reservation_id); - response.preReservation_ID = *create_utf8_from_string(pre_reservation_id_s, strlen(pre_reservation_id_s)); + response.preReservation_ID.buf = calloc(4, sizeof(uint8_t)); + response.preReservation_ID.size = 4; + response.preReservation_ID.buf[0] = (pre_reservation_id >> 24) & 0xff; + response.preReservation_ID.buf[1] = (pre_reservation_id >> 16) & 0xff; + response.preReservation_ID.buf[2] = (pre_reservation_id >> 8) & 0xff; + response.preReservation_ID.buf[3] = pre_reservation_id & 0xff; response.availabilityStatus = 0; @@ -227,7 +230,7 @@ static int evrsrm_pre_reservation_response(uint8_t *evrsrm_oer, uint32_t *evrsrm response.preReservationExpirationTime = 0; asn_enc_rval_t enc = uper_encode_to_buffer(&asn_DEF_EV_RSR, NULL, evrsr_response, evrsrm_oer, 512); if (enc.encoded == -1) { - log_error("[ca] failed encoding evrsrm (%s)", enc.failed_type->name); + log_error("[ev] failed encoding evrsrm (%s)", enc.failed_type->name); rv = 1; goto cleanup; }