Skip to content

Commit

Permalink
new file: src/tmx/Asn_J2735/include/asn_j2735_r2023/DSRC_DayOfWeek.h
Browse files Browse the repository at this point in the history
	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
  • Loading branch information
jwillmartin committed Dec 1, 2023
1 parent b55507a commit 860c13c
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 15 deletions.
56 changes: 56 additions & 0 deletions src/tmx/Asn_J2735/include/asn_j2735_r2023/DSRC_DayOfWeek.h
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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;

Expand Down
31 changes: 31 additions & 0 deletions src/tmx/Asn_J2735/src/r2023/DSRC_DayOfWeek.c
Original file line number Diff line number Diff line change
@@ -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 */
};

11 changes: 6 additions & 5 deletions src/tmx/Asn_J2735/src/r2023/RegionalExtension.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
};
Expand All @@ -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[] = {
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/tmx/Asn_J2735/src/r2023/TrafficControlSchedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
17 changes: 10 additions & 7 deletions src/tmx/TmxUtils/test/J2735MessageTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -564,6 +564,8 @@ TEST_F(J2735MessageTest, EncodeBasicSafetyMessage_PartII)
asn_sequence_add(&regional->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);
Expand Down Expand Up @@ -620,7 +622,7 @@ TEST_F(J2735MessageTest, EncodeTrafficControlRequest){

TEST_F(J2735MessageTest, EncodeTrafficControlMessage){
//Has <refwidth> tag in TCM
string tsm5str="<TestMessage05><body> <tcmV01> <reqid>30642B129B984162</reqid> <reqseq>0</reqseq> <msgtot>9</msgtot> <msgnum>9</msgnum> <id>0034b8d88d084ffdaf23837926031658</id> <updated>0</updated> <package> <label>workzone - lane closed</label> <tcids> <Id128b>0034b8d88d084ffdaf23837926031658</Id128b> </tcids> </package> <params> <vclasses> <micromobile/> <motorcycle/> <passenger-car/> <light-truck-van/> <bus/> <two-axle-six-tire-single-unit-truck/> <three-axle-single-unit-truck/> <four-or-more-axle-single-unit-truck/> <four-or-fewer-axle-single-trailer-truck/> <five-axle-single-trailer-truck/> <six-or-more-axle-single-trailer-truck/> <five-or-fewer-axle-multi-trailer-truck/> <six-axle-multi-trailer-truck/> <seven-or-more-axle-multi-trailer-truck/> </vclasses> <schedule> <start>27506547</start> <end>153722867280912</end> <dow>1111111</dow> </schedule> <regulatory><true/></regulatory> <detail> <closed><notopen/></closed> </detail> </params> <geometry> <proj>epsg:3785</proj> <datum>WGS84</datum> <reftime>27506547</reftime> <reflon>-818331529</reflon> <reflat>281182119</reflat> <refelv>0</refelv> <refwidth>424</refwidth> <heading>3403</heading> <nodes> <PathNode><x>0</x><y>0</y><width>0</width></PathNode> <PathNode><x>-203</x><y>722</y><width>0</width></PathNode> <PathNode><x>-203</x><y>722</y><width>0</width></PathNode> <PathNode><x>-203</x><y>722</y><width>0</width></PathNode> <PathNode><x>-203</x><y>721</y><width>0</width></PathNode> <PathNode><x>-203</x><y>722</y><width>0</width></PathNode> <PathNode><x>-203</x><y>722</y><width>0</width></PathNode> <PathNode><x>-204</x><y>722</y><width>2</width></PathNode> <PathNode><x>-203</x><y>722</y><width>0</width></PathNode> <PathNode><x>-203</x><y>722</y><width>-2</width></PathNode> <PathNode><x>-203</x><y>721</y><width>0</width></PathNode> <PathNode><x>-203</x><y>722</y><width>0</width></PathNode> <PathNode><x>-203</x><y>722</y><width>0</width></PathNode> <PathNode><x>-203</x><y>722</y><width>0</width></PathNode> <PathNode><x>-203</x><y>722</y><width>0</width></PathNode> <PathNode><x>-13</x><y>46</y><width>0</width></PathNode> </nodes> </geometry> </tcmV01> </body></TestMessage05>";
string tsm5str="<TestMessage05><body><tcmV01><reqid>30642B129B984162</reqid><reqseq>0</reqseq><msgtot>9</msgtot><msgnum>9</msgnum><id>0034b8d88d084ffdaf23837926031658</id><updated>0</updated><package><label>workzone-laneclosed</label><tcids><Id128b>0034b8d88d084ffdaf23837926031658</Id128b></tcids></package><params><vclasses><micromobile/><motorcycle/><passenger-car/><light-truck-van/><bus/><two-axle-six-tire-single-unit-truck/><three-axle-single-unit-truck/><four-or-more-axle-single-unit-truck/><four-or-fewer-axle-single-trailer-truck/><five-axle-single-trailer-truck/><six-or-more-axle-single-trailer-truck/><five-or-fewer-axle-multi-trailer-truck/><six-axle-multi-trailer-truck/><seven-or-more-axle-multi-trailer-truck/></vclasses><schedule><start>27506547</start><end>153722867280912</end><dow>1111111</dow></schedule><regulatory><true/></regulatory><detail><closed><notopen/></closed></detail></params><geometry><proj>epsg:3785</proj><datum>WGS84</datum><reftime>27506547</reftime><reflon>-818331529</reflon><reflat>281182119</reflat><refelv>0</refelv><refwidth>424</refwidth><heading>3403</heading><nodes><PathNode><x>0</x><y>0</y><width>0</width></PathNode><PathNode><x>-203</x><y>722</y><width>0</width></PathNode><PathNode><x>-203</x><y>722</y><width>0</width></PathNode><PathNode><x>-203</x><y>722</y><width>0</width></PathNode><PathNode><x>-203</x><y>721</y><width>0</width></PathNode><PathNode><x>-203</x><y>722</y><width>0</width></PathNode><PathNode><x>-203</x><y>722</y><width>0</width></PathNode><PathNode><x>-204</x><y>722</y><width>2</width></PathNode><PathNode><x>-203</x><y>722</y><width>0</width></PathNode><PathNode><x>-203</x><y>722</y><width>-2</width></PathNode><PathNode><x>-203</x><y>721</y><width>0</width></PathNode><PathNode><x>-203</x><y>722</y><width>0</width></PathNode><PathNode><x>-203</x><y>722</y><width>0</width></PathNode><PathNode><x>-203</x><y>722</y><width>0</width></PathNode><PathNode><x>-203</x><y>722</y><width>0</width></PathNode><PathNode><x>-13</x><y>46</y><width>0</width></PathNode></nodes></geometry></tcmV01></body></TestMessage05>";
std::stringstream ss;
tsm5Message tsm5msg;
tsm5EncodedMessage tsm5Enc;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 860c13c

Please sign in to comment.