Skip to content

Commit

Permalink
On branch j2735-2024-upgrade
Browse files Browse the repository at this point in the history
Your branch is up to date with 'origin/j2735-2024-upgrade'.

Changes to be committed:
	modified:   src/tmx/Asn_J2735/include/asn_j2735_r2024/CooperativeControlMessage.h
	modified:   src/tmx/Asn_J2735/include/asn_j2735_r2024/RegionalExtension.h
	modified:   src/tmx/Asn_J2735/src/r2024/RegionalExtension.c
	modified:   src/v2i-hub/CARMAStreetsPlugin/src/JsonToJ3224SDSMConverter.cpp
	modified:   src/v2i-hub/CARMAStreetsPlugin/test/test_J3224ToSDSMJsonConverter.cpp
	modified:   src/v2i-hub/CswPlugin/src/DsrcBuilder.cpp
	modified:   src/v2i-hub/CswPlugin/src/DsrcBuilder.h
	modified:   src/v2i-hub/MessageLoggerPlugin/src/MessageLoggerPlugin.cpp
	modified:   src/v2i-hub/TimPlugin/src/DsrcBuilder.cpp
	modified:   src/v2i-hub/TimPlugin/src/DsrcBuilder.h
  • Loading branch information
jwillmartin committed Mar 19, 2024
1 parent 251c330 commit 4eee992
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extern asn_TYPE_member_t asn_MBR_CooperativeControlMessage_1[2];
#endif

/* Referred external types */
#include "PartIIcontent.h"
#include "CCMPartIIcontent.h"

#endif /* _CooperativeControlMessage_H_ */
#include "asn_internal.h"
7 changes: 5 additions & 2 deletions src/tmx/Asn_J2735/include/asn_j2735_r2024/RegionalExtension.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@
#include "ConnectionManeuverAssist-addGrpC.h"
#include "IntersectionState-addGrpC.h"
#include "MovementEvent-addGrpB.h"
#include "BasicSafetyMessage-addGrpCarma.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Dependencies */
typedef enum Reg_BasicSafetyMessage__regExtValue_PR {
Reg_BasicSafetyMessage__regExtValue_PR_NOTHING /* No components present */

Reg_BasicSafetyMessage__regExtValue_PR_NOTHING, /* No components present */
Reg_BasicSafetyMessage__regExtValue_PR_BasicSafetyMessage_addGrpCarma
} Reg_BasicSafetyMessage__regExtValue_PR;
typedef enum Reg_EventDescription__regExtValue_PR {
Reg_EventDescription__regExtValue_PR_NOTHING /* No components present */
Expand Down Expand Up @@ -285,6 +286,7 @@ typedef struct Reg_BasicSafetyMessage {
struct Reg_BasicSafetyMessage__regExtValue {
Reg_BasicSafetyMessage__regExtValue_PR present;
union Reg_BasicSafetyMessage__regExtValue_u {
BasicSafetyMessage_addGrpCarma_t BasicSafetyMessage_addGrpCarma;
} choice;

/* Context for parsing across buffer boundaries */
Expand Down Expand Up @@ -387,6 +389,7 @@ typedef struct Reg_Position3D {
union Reg_Position3D__regExtValue_u {
Position3D_addGrpB_t Position3D_addGrpB;
Position3D_addGrpC_t Position3D_addGrpC;
Position3D_addGrpCarma_t Position3D_addGrpCarma;
} choice;

/* Context for parsing across buffer boundaries */
Expand Down
67 changes: 63 additions & 4 deletions src/tmx/Asn_J2735/src/r2024/RegionalExtension.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ static const asn_ioc_cell_t asn_IOS_Reg_MovementEvent_1_rows[] = {
static const asn_ioc_set_t asn_IOS_Reg_MovementEvent_1[] = {
{ 1, 2, asn_IOS_Reg_MovementEvent_1_rows }
};
static const long asn_VAL_10_DSRC_addGrpCarma = 128;
static const asn_ioc_cell_t asn_IOS_Reg_BasicSafetyMessage_1_rows[] = {
{ "&id", aioc__value, &asn_DEF_RegionId, &asn_VAL_10_DSRC_addGrpCarma },
{ "&Type", aioc__type, &asn_DEF_BasicSafetyMessage_addGrpCarma }
};
static const asn_ioc_set_t asn_IOS_Reg_BasicSafetyMessage_1[] = {
{ 1, 2, asn_IOS_Reg_BasicSafetyMessage_1_rows }
};

static int
memb_regionId_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Expand Down Expand Up @@ -275,6 +284,33 @@ memb_regionId_constraint_13(const asn_TYPE_descriptor_t *td, const void *sptr,
}
}

static asn_type_selector_result_t
select_Reg_BasicSafetyMessage_regExtValue_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) {
asn_type_selector_result_t result = {0, 0};
const asn_ioc_set_t *itable = asn_IOS_Reg_BasicSafetyMessage_1;
size_t constraining_column = 0; /* &id */
size_t for_column = 1; /* &Type */
size_t row, presence_index = 0;
const long *constraining_value = (const long *)((const char *)parent_sptr + offsetof(struct Reg_BasicSafetyMessage, regionId));

for(row=0; row < itable->rows_count; row++) {
const asn_ioc_cell_t *constraining_cell = &itable->rows[row * itable->columns_count + constraining_column];
const asn_ioc_cell_t *type_cell = &itable->rows[row * itable->columns_count + for_column];

if(type_cell->cell_kind == aioc__undefined)
continue;

presence_index++;
if(constraining_cell->type_descriptor->op->compare_struct(constraining_cell->type_descriptor, constraining_value, constraining_cell->value_sptr) == 0) {
result.type_descriptor = type_cell->type_descriptor;
result.presence_index = presence_index;
break;
}
}

return result;
}

static asn_type_selector_result_t
select_Reg_LaneDataAttribute_regExtValue_type(const asn_TYPE_descriptor_t *parent_type, const void *parent_sptr) {
asn_type_selector_result_t result = {0, 0};
Expand Down Expand Up @@ -2998,6 +3034,28 @@ static asn_per_constraints_t asn_PER_memb_regExtValue_constr_3 CC_NOTUSED = {
0, 0 /* No PER value map */
};
#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
static asn_TYPE_member_t asn_MBR_regExtValue_3[] = {
{ ATF_NOFLAGS, 0, offsetof(struct Reg_BasicSafetyMessage__regExtValue, choice.BasicSafetyMessage_addGrpCarma),
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
0,
&asn_DEF_BasicSafetyMessage_addGrpCarma,
0,
{
#if !defined(ASN_DISABLE_OER_SUPPORT)
0,
#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
0,
#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */
0
},
0, 0, /* No default value */
"BasicSafetyMessage-addGrpCarma"
},
};
static const asn_TYPE_tag2member_t asn_MAP_regExtValue_tag2el_3[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* BasicSafetyMessage-addGrpCarma */
};
#if !defined(ASN_DISABLE_OER_SUPPORT)
static asn_oer_constraints_t asn_OER_memb_regionId_constr_5 CC_NOTUSED = {
{ 1, 1 } /* (0..255) */,
Expand Down Expand Up @@ -4443,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 @@ -4466,7 +4524,8 @@ 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_MBR_regExtValue_3,
1, /* Elements count */
&asn_SPC_regExtValue_specs_3 /* Additional specs */
};

Expand All @@ -4492,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
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ namespace CARMAStreetsPlugin
objectData->detObjCommon.pos.offsetY = (*itr)["detected_object_data"]["detected_object_common_data"]["pos"]["offset_y"].asInt64();
// Optional Z offset
if ( (*itr)["detected_object_data"]["detected_object_common_data"]["pos"].isMember("offset_z") ) {
#if SAEJ2735_SPEC < 2024
auto offset_z = (ObjectDistance_t*) calloc(1, sizeof(ObjectDistance_t));
#else
auto offset_z = (SensorDataSharingMessage_ObjectDistance_t*) calloc(1, sizeof(SensorDataSharingMessage_ObjectDistance_t));
#endif
*offset_z = (*itr)["detected_object_data"]["detected_object_common_data"]["pos"]["offset_z"].asInt64();
objectData->detObjCommon.pos.offsetZ = offset_z;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ namespace unit_test

test_obj1.detObjCommon.pos.offsetX = 1000;
test_obj1.detObjCommon.pos.offsetY = 750;
#if SAEJ2735_SPEC < 2024
auto offsetZ_ptr = CARMAStreetsPlugin::create_store_shared<ObjectDistance_t>(shared_ptrs);
#else
auto offsetZ_ptr = CARMAStreetsPlugin::create_store_shared<SensorDataSharingMessage_ObjectDistance_t>(shared_ptrs);
#endif
*offsetZ_ptr = 50;
test_obj1.detObjCommon.pos.offsetZ = offsetZ_ptr;

Expand Down Expand Up @@ -204,7 +208,11 @@ namespace unit_test

test_obj2.detObjCommon.pos.offsetX = 1000;
test_obj2.detObjCommon.pos.offsetY = 750;
#if SAEJ2735_SPEC < 2024
auto offsetZ_ptr2 = CARMAStreetsPlugin::create_store_shared<ObjectDistance_t>(shared_ptrs);
#else
auto offsetZ_ptr2 = CARMAStreetsPlugin::create_store_shared<SensorDataSharingMessage_ObjectDistance_t>(shared_ptrs);
#endif
*offsetZ_ptr2 = 50;
test_obj2.detObjCommon.pos.offsetZ = offsetZ_ptr2;

Expand Down Expand Up @@ -281,7 +289,11 @@ namespace unit_test

test_obj3.detObjCommon.pos.offsetX = 1000;
test_obj3.detObjCommon.pos.offsetY = 750;
#if SAEJ2537_SPEC < 2024
auto offsetZ_ptr3 = CARMAStreetsPlugin::create_store_shared<ObjectDistance_t>(shared_ptrs);
#else
auto offsetZ_ptr3 = CARMAStreetsPlugin::create_store_shared<SensorDataSharingMessage_ObjectDistance_t>(shared_ptrs);
#endif
*offsetZ_ptr3 = 50;
test_obj3.detObjCommon.pos.offsetZ = offsetZ_ptr3;

Expand Down
39 changes: 26 additions & 13 deletions src/v2i-hub/CswPlugin/src/DsrcBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@
* Author: ivp
*/

#include <string>
#include <sstream>
#include <OCTET_STRING.h>
#include <ITIScodesAndText.h>

#include "DsrcBuilder.h"
#include "Clock.h"

using namespace tmx::utils;

Expand All @@ -22,38 +16,57 @@ void DsrcBuilder::AddCurveSpeedAdvisory(TiDataFrame *frame, unsigned int speedLi
std::stringstream speedText;
speedText << speedLimit << " MPH";




AddItisCode(&frame->content.choice.advisory, 27); // "warning advice"
AddItisText(&frame->content.choice.advisory, "curve ahead");
AddItisCode(&frame->content.choice.advisory, 2564); // "speed restriction"
AddItisText(&frame->content.choice.advisory, std::to_string(speedLimit));
AddItisCode(&frame->content.choice.advisory, 8720); // "MPH"
}

#if SAEJ2735_SPEC < 2024
void DsrcBuilder::AddItisCode(ITIScodesAndText *advisory, long code)
#else
void DsrcBuilder::AddItisCode(ITIS_ITIScodesAndText *advisory, long code)
#endif
{
#if SAEJ2735_SPEC < 2024
ITIScodesAndText__Member* member = (ITIScodesAndText__Member*)malloc(sizeof(ITIScodesAndText__Member));
#if SAEJ2735_SPEC < 2020
member->item.present = ITIScodesAndText__Memberitem_PR_itis;
#else
ITIS_ITIScodesAndText__Member* member = (ITIS_ITIScodesAndText__Member*)malloc(sizeof(ITIS_ITIScodesAndText__Member));
#endif

#if SAEJ2735_SPEC < 2024
member->item.present = ITIScodesAndText__Member__item_PR_itis;
#elif SAEJ2735_SPEC < 2020
member->item.present = ITIScodesAndText__Memberitem_PR_itis;
#else
member->item.present = ITIS_ITIScodesAndText__Member__item_PR_itis;
#endif

member->item.choice.itis = code;
ASN_SEQUENCE_ADD(&advisory->list, member);
}

#if SAEJ2735_SPEC < 2024
void DsrcBuilder::AddItisText(ITIScodesAndText *advisory, std::string text)
#else
void DsrcBuilder::AddItisText(ITIS_ITIScodesAndText *advisory, std::string text)
#endif
{
int textLength = text.length();

#if SAEJ2735_SPEC < 2024
ITIScodesAndText__Member* member = (ITIScodesAndText__Member*)malloc(sizeof(ITIScodesAndText__Member));
#if SAEJ2735_SPEC < 2020
member->item.present = ITIScodesAndText__Memberitem_PR_text;
#else
ITIS_ITIScodesAndText__Member* member = (ITIS_ITIScodesAndText__Member*)malloc(sizeof(ITIS_ITIScodesAndText__Member));
#endif

#if SAEJ2735_SPEC < 2024
member->item.present = ITIScodesAndText__Member__item_PR_text;
#elif SAEJ2735_SPEC < 2020
member->item.present = ITIScodesAndText__Memberitem_PR_text;
#else
member->item.present = ITIS_ITIScodesAndText__Member__item_PR_text;
#endif

member->item.choice.text.buf = NULL;
Expand Down
4 changes: 4 additions & 0 deletions src/v2i-hub/CswPlugin/src/DsrcBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#define DSRCBUILDER_H_

#include <string>
#include <sstream>
#include <stdexcept>
#include <OCTET_STRING.h>

#include <TravelerInformation.h>
#if SAEJ2735_SPEC < 2024
Expand All @@ -18,6 +20,8 @@
#include <ITIS_ITIScodesAndText.h>
#endif

#include "Clock.h"

#if SAEJ2735_SPEC < 63
typedef TravelerInformation::TravelerInformation__dataFrames::TravelerInformation__dataFrames__List::TravelerInformation__dataFrames__Member TiDataFrame;
typedef ITIScodesAndText::ITIScodesAndText__List::ITIScodesAndText__Member ItisMember;
Expand Down
5 changes: 4 additions & 1 deletion src/v2i-hub/MessageLoggerPlugin/src/MessageLoggerPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,11 @@ void MessageLoggerPlugin::HandleBasicSafetyMessage(BsmMessage &msg, routeable_me

if(bsm->partII != NULL) {
if (bsm->partII[0].list.count >= BSMpartIIExtension__partII_Value_PR_SpecialVehicleExtensions ) {
// TrailerData is deprecated in SAE J2735 2024
#if SAEJ2735_SPEC < 2024
try
{
if(bsm->partII[0].list.array[1]->partII_Value.choice.SpecialVehicleExtensions.trailers !=NULL){
if(bsm->partII[0].list.array[1]->partII_Value.choice.SpecialVehicleExtensions.trailers != NULL){
cJSON_AddItemToObject(_BsmMessageContent, "trailerPivot", cJSON_CreateNumber(bsm->partII[0].list.array[1]->partII_Value.choice.SpecialVehicleExtensions.trailers->connection.pivotOffset));
cJSON_AddItemToObject(_BsmMessageContent, "trailreLength", cJSON_CreateNumber(bsm->partII[0].list.array[1]->partII_Value.choice.SpecialVehicleExtensions.trailers->units.list.array[0]->length));
cJSON_AddItemToObject(_BsmMessageContent, "trailerHeight", cJSON_CreateNumber(bsm->partII[0].list.array[1]->partII_Value.choice.SpecialVehicleExtensions.trailers->units.list.array[0]->height[0]));
Expand All @@ -329,6 +331,7 @@ void MessageLoggerPlugin::HandleBasicSafetyMessage(BsmMessage &msg, routeable_me
{
PLOG(logDEBUG)<<"Standard Exception:: Trailers unavailable "<<e.what();
}
#endif
try {
if(bsm->partII[0].list.array[1]->partII_Value.choice.SpecialVehicleExtensions.vehicleAlerts != NULL){
cJSON_AddItemToObject(_BsmMessageContent, "SirenState", cJSON_CreateNumber(bsm->partII[0].list.array[1]->partII_Value.choice.SpecialVehicleExtensions.vehicleAlerts->sirenUse));
Expand Down
Loading

0 comments on commit 4eee992

Please sign in to comment.