Skip to content

Commit

Permalink
Merge branch 'feature/sdsm-json-to-cstruct' of https://github.com/usd…
Browse files Browse the repository at this point in the history
…ot-fhwa-OPS/V2X-Hub into feature/sdsm-json-to-cstruct
  • Loading branch information
willjohnsonk committed Sep 11, 2023
2 parents a86cc09 + 2e5eb8d commit 35d1e25
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/v2i-hub/CARMAStreetsPlugin/src/CARMAStreetsPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,17 @@ void CARMAStreetsPlugin::OnConfigChanged(const char *key, const char *value) {
void CARMAStreetsPlugin::HandleTimeSyncMessage(tmx::messages::TimeSyncMessage &msg, routeable_message &routeableMsg ) {
PluginClientClockAware::HandleTimeSyncMessage(msg, routeableMsg);
if ( isSimulationMode()) {
PLOG(logINFO) << "Handling TimeSync messages!" << std::endl;
produce_kafka_msg(msg.to_string(), "time_sync");
// TODO: This is a temporary fix for tmx message container property tree
// serializing all attributes as strings. This issue needs to be fixed but
// is currently out of scope. TMX Messages should be correctly serialize to
// and from json. This temporary fix simply using regex to look for numeric,
// null, and bool values and removes the quotations around them.
boost::regex exp("\"(null|true|false|[0-9]+(\\.[0-9]+)?)\"");
std::stringstream ss;
std::string rv = boost::regex_replace(msg.to_string(), exp, "$1");
PLOG(logINFO) << "Sending Time Sync Message " << rv << std::endl;

produce_kafka_msg(rv, "time_sync");
}
}
void CARMAStreetsPlugin::HandleMobilityOperationMessage(tsm3Message &msg, routeable_message &routeableMsg ) {
Expand Down

0 comments on commit 35d1e25

Please sign in to comment.