diff --git a/src/v2i-hub/CARMAStreetsPlugin/src/CARMAStreetsPlugin.cpp b/src/v2i-hub/CARMAStreetsPlugin/src/CARMAStreetsPlugin.cpp index 22c1425c9..c577c0127 100755 --- a/src/v2i-hub/CARMAStreetsPlugin/src/CARMAStreetsPlugin.cpp +++ b/src/v2i-hub/CARMAStreetsPlugin/src/CARMAStreetsPlugin.cpp @@ -668,7 +668,7 @@ void CARMAStreetsPlugin::SubscribeSDSMKafkaTopic(){ SetStatus(Key_SDSMMessageSkipped, ++_sdsmMessageSkipped); continue; } - //Convert the SSM JSON string into J3224 SDSM message and encode it. + //Convert the SDSM JSON string into J3224 SDSM message and encode it. auto sdsm_ptr = std::make_shared(); sdsm_convertor.convertJsonToSDSM(sdsmDoc, sdsm_ptr); tmx::messages::SdsmEncodedMessage sdsmEncodedMsg; @@ -689,7 +689,7 @@ void CARMAStreetsPlugin::SubscribeSDSMKafkaTopic(){ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_SensorDataSharingMessage, sdsm_ptr.get()); // same as above PLOG(logDEBUG) << "sdsmEncodedMsg: " << sdsmEncodedMsg; - //Broadcast the encoded SSM message + //Broadcast the encoded SDSM message sdsmEncodedMsg.set_flags(IvpMsgFlags_RouteDSRC); sdsmEncodedMsg.addDsrcMetadata(0x8002); BroadcastMessage(static_cast(sdsmEncodedMsg)); diff --git a/src/v2i-hub/CARMAStreetsPlugin/src/J3224ToSDSMJsonConverter.cpp b/src/v2i-hub/CARMAStreetsPlugin/src/J3224ToSDSMJsonConverter.cpp index ba8f4570b..da1aad6e9 100644 --- a/src/v2i-hub/CARMAStreetsPlugin/src/J3224ToSDSMJsonConverter.cpp +++ b/src/v2i-hub/CARMAStreetsPlugin/src/J3224ToSDSMJsonConverter.cpp @@ -173,7 +173,5 @@ namespace CARMAStreetsPlugin } } - - //std::cout << SDSMDataJson.toStyledString() << std::endl; } } \ No newline at end of file diff --git a/src/v2i-hub/CARMAStreetsPlugin/src/JsonToJ3224SDSMConverter.cpp b/src/v2i-hub/CARMAStreetsPlugin/src/JsonToJ3224SDSMConverter.cpp index 0dd47c2b1..1115715a5 100644 --- a/src/v2i-hub/CARMAStreetsPlugin/src/JsonToJ3224SDSMConverter.cpp +++ b/src/v2i-hub/CARMAStreetsPlugin/src/JsonToJ3224SDSMConverter.cpp @@ -2,7 +2,7 @@ namespace CARMAStreetsPlugin { - + // TODO: Move these template functions to a more central location such as in a utility file // Template to use when created shared pointer objects for optional data template T *create_store_shared(std::vector> &shared_pointers) @@ -21,7 +21,7 @@ namespace CARMAStreetsPlugin return array_shared.get(); } - + // TODO: Consolidate parseJsonString into a more central location since it is being used verbatim in other converters bool JsonToJ3224SDSMConverter::parseJsonString(const std::string &consumedMsg, Json::Value &sdsmJsonOut) const { const auto jsonLen = static_cast(consumedMsg.length()); @@ -55,8 +55,8 @@ namespace CARMAStreetsPlugin sdsm->sourceID = tempID; sdsm->equipmentType = sdsm_json["equipment_type"].asInt64(); - + // sDSMTimeStamp auto sdsm_time_stamp_ptr = CARMAStreetsPlugin::create_store_shared(shared_ptrs); @@ -201,17 +201,17 @@ namespace CARMAStreetsPlugin // set presence val to veh optional_data_ptr->present = DetectedObjectOptionalData_PR_detVeh; - // TODO: find a better way to convert lights val - // lights - auto lights_ptr = CARMAStreetsPlugin::create_store_shared(shared_ptrs); - auto lights = static_cast((*itr)["detected_object_data"]["detected_object_optional_data"]["detected_vehicle_data"]["lights"].asInt()); - lights_ptr->buf = (uint8_t *)calloc(2, sizeof(uint8_t)); // TODO: find calloc alternative if possible, causes a memory leak - lights_ptr->size = 2 * sizeof(uint8_t); - lights_ptr->bits_unused = 0; - lights_ptr->buf[1] = static_cast(lights); - lights_ptr->buf[0] = (lights >> 8); - - optional_data_ptr->choice.detVeh.lights = lights_ptr; + // TODO: find a better way to convert/test lights val without calloc + // // lights + // auto lights_ptr = CARMAStreetsPlugin::create_store_shared(shared_ptrs); + // auto lights = static_cast((*itr)["detected_object_data"]["detected_object_optional_data"]["detected_vehicle_data"]["lights"].asInt()); + // lights_ptr->buf = (uint8_t *)calloc(2, sizeof(uint8_t)); // TODO: find calloc alternative if possible, causes a memory leak + // lights_ptr->size = 2 * sizeof(uint8_t); + // lights_ptr->bits_unused = 0; + // lights_ptr->buf[1] = static_cast(lights); + // lights_ptr->buf[0] = (lights >> 8); + + // optional_data_ptr->choice.detVeh.lights = lights_ptr; // vehAttitude diff --git a/src/v2i-hub/CARMAStreetsPlugin/test/test_JsonToJ3224SDSMConverter.cpp b/src/v2i-hub/CARMAStreetsPlugin/test/test_JsonToJ3224SDSMConverter.cpp index 8be840b84..c916fd5ba 100644 --- a/src/v2i-hub/CARMAStreetsPlugin/test/test_JsonToJ3224SDSMConverter.cpp +++ b/src/v2i-hub/CARMAStreetsPlugin/test/test_JsonToJ3224SDSMConverter.cpp @@ -114,9 +114,10 @@ namespace CARMAStreetsPlugin auto sdsmPtr = std::make_shared(); converter.convertJsonToSDSM(root, sdsmPtr); - // Similar to sourceID, need a better way to compare retrieved ASN.1 values (in this case bit strings) to verify conversion - size_t test_size = 2; - ASSERT_EQ(test_size, sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.lights->size); + // TODO: Find a better way to test light data following an updated implementation + // // Similar to sourceID, need a better way to compare retrieved ASN.1 values (in this case bit strings) to verify conversion + // size_t test_size = 2; + // ASSERT_EQ(test_size, sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.lights->size); ASSERT_EQ(2400, sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.vehAttitude->pitch); ASSERT_EQ(-12000, sdsmPtr->objects.list.array[0]->detObjOptData->choice.detVeh.vehAttitude->roll);