From 860c13c2a5d378d3dde4a549dc5e82bc7a0d1c5b Mon Sep 17 00:00:00 2001 From: jwillmartin Date: Fri, 1 Dec 2023 14:41:36 -0500 Subject: [PATCH] new file: src/tmx/Asn_J2735/include/asn_j2735_r2023/DSRC_DayOfWeek.h modified: src/tmx/Asn_J2735/include/asn_j2735_r2023/TrafficControlSchedule.h new file: src/tmx/Asn_J2735/src/r2023/DSRC_DayOfWeek.c modified: src/tmx/Asn_J2735/src/r2023/RegionalExtension.c modified: src/tmx/Asn_J2735/src/r2023/TrafficControlSchedule.c modified: src/tmx/TmxUtils/test/J2735MessageTest.cpp --- .../include/asn_j2735_r2023/DSRC_DayOfWeek.h | 56 +++++++++++++++++++ .../asn_j2735_r2023/TrafficControlSchedule.h | 4 +- src/tmx/Asn_J2735/src/r2023/DSRC_DayOfWeek.c | 31 ++++++++++ .../Asn_J2735/src/r2023/RegionalExtension.c | 11 ++-- .../src/r2023/TrafficControlSchedule.c | 2 +- src/tmx/TmxUtils/test/J2735MessageTest.cpp | 17 +++--- 6 files changed, 106 insertions(+), 15 deletions(-) create mode 100644 src/tmx/Asn_J2735/include/asn_j2735_r2023/DSRC_DayOfWeek.h create mode 100644 src/tmx/Asn_J2735/src/r2023/DSRC_DayOfWeek.c diff --git a/src/tmx/Asn_J2735/include/asn_j2735_r2023/DSRC_DayOfWeek.h b/src/tmx/Asn_J2735/include/asn_j2735_r2023/DSRC_DayOfWeek.h new file mode 100644 index 000000000..d826b978d --- /dev/null +++ b/src/tmx/Asn_J2735/include/asn_j2735_r2023/DSRC_DayOfWeek.h @@ -0,0 +1,56 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "DSRC" + * found in "J2735_201603_ASN_CC.asn" + * `asn1c -gen-PER -fcompound-names -fincludes-quoted -fskeletons-copy` + */ + +#ifndef _DSRC_DayOfWeek_H_ +#define _DSRC_DayOfWeek_H_ + + +#include "asn_application.h" + +/* Including external dependencies */ +#include "BIT_STRING.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Dependencies */ +typedef enum DSRC_DayOfWeek { + DSRC_DayOfWeek_sun = 6, + DSRC_DayOfWeek_mon = 5, + DSRC_DayOfWeek_tue = 4, + DSRC_DayOfWeek_wed = 3, + DSRC_DayOfWeek_thu = 2, + DSRC_DayOfWeek_fri = 1, + DSRC_DayOfWeek_sat = 0 +} e_DSRC_DayOfWeek; + +/* DSRC_DayOfWeek */ +typedef BIT_STRING_t DSRC_DayOfWeek_t; + +/* Implementation */ +extern asn_TYPE_descriptor_t asn_DEF_DSRC_DayOfWeek; +asn_struct_free_f DSRC_DayOfWeek_free; +asn_struct_print_f DSRC_DayOfWeek_print; +asn_constr_check_f DSRC_DayOfWeek_constraint; +ber_type_decoder_f DSRC_DayOfWeek_decode_ber; +der_type_encoder_f DSRC_DayOfWeek_encode_der; +xer_type_decoder_f DSRC_DayOfWeek_decode_xer; +xer_type_encoder_f DSRC_DayOfWeek_encode_xer; +oer_type_decoder_f DSRC_DayOfWeek_decode_oer; +oer_type_encoder_f DSRC_DayOfWeek_encode_oer; +per_type_decoder_f DSRC_DayOfWeek_decode_uper; +per_type_encoder_f DSRC_DayOfWeek_encode_uper; +per_type_decoder_f DSRC_DayOfWeek_decode_aper; +per_type_encoder_f DSRC_DayOfWeek_encode_aper; + +#ifdef __cplusplus +} +#endif + +#endif /* _DSRC_DayOfWeek_H_ */ +#include "asn_internal.h" diff --git a/src/tmx/Asn_J2735/include/asn_j2735_r2023/TrafficControlSchedule.h b/src/tmx/Asn_J2735/include/asn_j2735_r2023/TrafficControlSchedule.h index d67837e49..1a985b63d 100644 --- a/src/tmx/Asn_J2735/include/asn_j2735_r2023/TrafficControlSchedule.h +++ b/src/tmx/Asn_J2735/include/asn_j2735_r2023/TrafficControlSchedule.h @@ -13,7 +13,7 @@ /* Including external dependencies */ #include "EpochMins.h" -#include "DayOfWeek.h" +#include "DSRC_DayOfWeek.h" #include "asn_SEQUENCE_OF.h" #include "constr_SEQUENCE_OF.h" #include "constr_SEQUENCE.h" @@ -30,7 +30,7 @@ struct DailySchedule; typedef struct TrafficControlSchedule { EpochMins_t start; EpochMins_t *end; /* OPTIONAL */ - DayOfWeek_t *dow; /* OPTIONAL */ + DSRC_DayOfWeek_t *dow; /* OPTIONAL */ struct TrafficControlSchedule__between { A_SEQUENCE_OF(struct DailySchedule) list; diff --git a/src/tmx/Asn_J2735/src/r2023/DSRC_DayOfWeek.c b/src/tmx/Asn_J2735/src/r2023/DSRC_DayOfWeek.c new file mode 100644 index 000000000..d2958927b --- /dev/null +++ b/src/tmx/Asn_J2735/src/r2023/DSRC_DayOfWeek.c @@ -0,0 +1,31 @@ +/* + * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) + * From ASN.1 module "DSRC" + * found in "J2735_201603_ASN_CC.asn" + * `asn1c -gen-PER -fcompound-names -fincludes-quoted -fskeletons-copy` + */ + +#include "DSRC_DayOfWeek.h" + +/* + * This type is implemented using BIT_STRING, + * so here we adjust the DEF accordingly. + */ +static const ber_tlv_tag_t asn_DEF_DSRC_DayOfWeek_tags_1[] = { + (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) +}; +asn_TYPE_descriptor_t asn_DEF_DSRC_DayOfWeek = { + "DayOfWeek", + "DayOfWeek", + &asn_OP_BIT_STRING, + asn_DEF_DSRC_DayOfWeek_tags_1, + sizeof(asn_DEF_DSRC_DayOfWeek_tags_1) + /sizeof(asn_DEF_DSRC_DayOfWeek_tags_1[0]), /* 1 */ + asn_DEF_DSRC_DayOfWeek_tags_1, /* Same as above */ + sizeof(asn_DEF_DSRC_DayOfWeek_tags_1) + /sizeof(asn_DEF_DSRC_DayOfWeek_tags_1[0]), /* 1 */ + { 0, 0, BIT_STRING_constraint }, + 0, 0, /* Defined elsewhere */ + &asn_SPC_BIT_STRING_specs /* Additional specs */ +}; + diff --git a/src/tmx/Asn_J2735/src/r2023/RegionalExtension.c b/src/tmx/Asn_J2735/src/r2023/RegionalExtension.c index 38f37eb5b..21c14704e 100644 --- a/src/tmx/Asn_J2735/src/r2023/RegionalExtension.c +++ b/src/tmx/Asn_J2735/src/r2023/RegionalExtension.c @@ -4501,8 +4501,8 @@ static asn_CHOICE_specifics_t asn_SPC_regExtValue_specs_3 = { offsetof(struct Reg_BasicSafetyMessage__regExtValue, _asn_ctx), offsetof(struct Reg_BasicSafetyMessage__regExtValue, present), sizeof(((struct Reg_BasicSafetyMessage__regExtValue *)0)->present), - 0, /* No top level tags */ - 0, /* No tags in the map */ + asn_MAP_regExtValue_tag2el_3, + 1, /* Count of tags in the map */ 0, 0, -1 /* Extensions start */ }; @@ -4524,8 +4524,9 @@ asn_TYPE_descriptor_t asn_DEF_regExtValue_3 = { #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ OPEN_TYPE_constraint }, - 0, 0, /* No members */ - &asn_SPC_regExtValue_specs_3 /* Additional specs */ + asn_MBR_regExtValue_3, + 1, /* Elements count */ +&asn_SPC_regExtValue_specs_3 /* Additional specs */ }; asn_TYPE_member_t asn_MBR_Reg_BasicSafetyMessage_1[] = { @@ -4550,7 +4551,7 @@ asn_TYPE_member_t asn_MBR_Reg_BasicSafetyMessage_1[] = { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), +1, /* EXPLICIT tag at current level */ &asn_DEF_regExtValue_3, - 0, + select_Reg_BasicSafetyMessage_regExtValue_type, { #if !defined(ASN_DISABLE_OER_SUPPORT) &asn_OER_memb_regExtValue_constr_3, diff --git a/src/tmx/Asn_J2735/src/r2023/TrafficControlSchedule.c b/src/tmx/Asn_J2735/src/r2023/TrafficControlSchedule.c index 62b00054f..9080cd190 100644 --- a/src/tmx/Asn_J2735/src/r2023/TrafficControlSchedule.c +++ b/src/tmx/Asn_J2735/src/r2023/TrafficControlSchedule.c @@ -108,7 +108,7 @@ asn_TYPE_member_t asn_MBR_TrafficControlSchedule_1[] = { { ATF_POINTER, 3, offsetof(struct TrafficControlSchedule, dow), (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ - &asn_DEF_DayOfWeek, + &asn_DEF_DSRC_DayOfWeek, 0, { 0, 0, 0 }, 0, 0, /* No default value */ diff --git a/src/tmx/TmxUtils/test/J2735MessageTest.cpp b/src/tmx/TmxUtils/test/J2735MessageTest.cpp index 5539ca428..f360d6156 100644 --- a/src/tmx/TmxUtils/test/J2735MessageTest.cpp +++ b/src/tmx/TmxUtils/test/J2735MessageTest.cpp @@ -542,19 +542,19 @@ TEST_F(J2735MessageTest, EncodeBasicSafetyMessage_PartII) // BSM regional extension auto regional = (BasicSafetyMessage::BasicSafetyMessage__regional*) calloc(1, sizeof(BasicSafetyMessage::BasicSafetyMessage__regional)); - auto reg_bsm = (Reg_BasicSafetyMessage_t*) calloc(1, sizeof(Reg_BasicSafetyMessage)); + auto reg_bsm = (Reg_BasicSafetyMessage_t*) calloc(1, sizeof(Reg_BasicSafetyMessage_t)); reg_bsm->regionId = 128; reg_bsm->regExtValue.present = Reg_BasicSafetyMessage__regExtValue_PR_BasicSafetyMessage_addGrpCarma; auto carma_bsm_data = (BasicSafetyMessage_addGrpCarma_t*) calloc(1, sizeof(BasicSafetyMessage_addGrpCarma_t)); auto carma_bsm_destination_points = (BasicSafetyMessage_addGrpCarma::BasicSafetyMessage_addGrpCarma__routeDestinationPoints*) calloc(1, sizeof(BasicSafetyMessage_addGrpCarma::BasicSafetyMessage_addGrpCarma__routeDestinationPoints)); - auto point = (Position3D_addGrpCarma_t*) calloc(1, sizeof(Position3D_addGrpCarma_t)); + auto point = (Position3D_t*) calloc(1, sizeof(Position3D_t)); auto dummy_lat = 12; auto dummy_long = 1312; point->lat = dummy_lat; point->Long = dummy_long; asn_sequence_add(&carma_bsm_destination_points->list.array, point); - auto point2 = (Position3D_addGrpCarma_t*) calloc(1, sizeof(Position3D_addGrpCarma_t)); + auto point2 = (Position3D_t*) calloc(1, sizeof(Position3D_t)); point2->lat = dummy_lat + 1000; point2->Long = dummy_long + 1000; asn_sequence_add(&carma_bsm_destination_points->list.array, point2); @@ -564,6 +564,8 @@ TEST_F(J2735MessageTest, EncodeBasicSafetyMessage_PartII) asn_sequence_add(®ional->list.array, reg_bsm); message->regional = regional; + xer_fprint(stdout, &asn_DEF_BasicSafetyMessage, message); + //Encode BSM tmx::messages::BsmEncodedMessage bsmEncodeMessage; tmx::messages::BsmMessage* _bsmMessage = new tmx::messages::BsmMessage(message); @@ -620,7 +622,7 @@ TEST_F(J2735MessageTest, EncodeTrafficControlRequest){ TEST_F(J2735MessageTest, EncodeTrafficControlMessage){ //Has tag in TCM - string tsm5str=" 30642B129B984162 0 9 9 0034b8d88d084ffdaf23837926031658 0 0034b8d88d084ffdaf23837926031658 27506547 153722867280912 1111111 epsg:3785 WGS84 27506547 -818331529 281182119 0 424 3403 000 -2037220 -2037220 -2037220 -2037210 -2037220 -2037220 -2047222 -2037220 -203722-2 -2037210 -2037220 -2037220 -2037220 -2037220 -13460 "; + string tsm5str="30642B129B9841620990034b8d88d084ffdaf2383792603165800034b8d88d084ffdaf23837926031658275065471537228672809121111111epsg:3785WGS8427506547-81833152928118211904243403000-2037220-2037220-2037220-2037210-2037220-2037220-2047222-2037220-203722-2-2037210-2037220-2037220-2037220-2037220-13460"; std::stringstream ss; tsm5Message tsm5msg; tsm5EncodedMessage tsm5Enc; @@ -780,8 +782,8 @@ TEST_F(J2735MessageTest, EncodeSDSM) sDSMTimeStamp->year = year; message->sDSMTimeStamp = *sDSMTimeStamp; - message->refPos.lat = 38.121212; - message->refPos.Long = -77.121212; + message->refPos.lat = 38121212; + message->refPos.Long = -77121212; message->refPosXYConf.orientation = 10; message->refPosXYConf.semiMajor = 12; @@ -791,6 +793,7 @@ TEST_F(J2735MessageTest, EncodeSDSM) auto objectData = (DetectedObjectData_t*) calloc(1, sizeof(DetectedObjectData_t)); objectData->detObjCommon.objType = ObjectType_unknown; objectData->detObjCommon.objTypeCfd = 1; + objectData->detObjCommon.objectID = 1; objectData->detObjCommon.measurementTime = 1; objectData->detObjCommon.timeConfidence = 1; objectData->detObjCommon.pos.offsetX = 1; @@ -813,7 +816,7 @@ TEST_F(J2735MessageTest, EncodeSDSM) free(message); free(frame_msg.get_j2735_data().get()); ASSERT_EQ(41, SdsmEncodeMessage.get_msgId()); - std::string expectedSDSMEncHex = "0029250a010c0c0a101f9c35a4e9266b49d1b20c34000a00000020000bba0a000200004400240009"; + std::string expectedSDSMEncHex = "0029250a010c0c0a101f9c37ea97fc66b10b430c34000a00000020002bba0a000200004400240009"; ASSERT_EQ(expectedSDSMEncHex, SdsmEncodeMessage.get_payload_str()); //Decode SDSM