Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cdar 756 remove json regex manipulation #578

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/v2i-hub/CARMAStreetsPlugin/src/CARMAStreetsPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,10 @@ void CARMAStreetsPlugin::HandleSimulatedSensorDetectedMessage(simulation::Sensor
// and from json. This temporary fix simply using regex to look for numeric,
// null, and bool values and removes the quotations around them.
PLOG(logDEBUG) << "Produce sensor detected message in JSON format: " << msg.to_string() <<std::endl;
boost::regex exp("\"(null|true|false|-?[0-9]+(\\.[0-9]+)?)\"");
std::stringstream ss;
std::string rv = boost::regex_replace(msg.to_string(), exp, "$1");
produce_kafka_msg( rv, _transmitSimSensorDetectedObjTopic);
// boost::regex exp("\"(null|true|false|-?[0-9]+(\\.[0-9]+)?)\"");
// std::stringstream ss;
// std::string rv = boost::regex_replace(msg.to_string(), exp, "$1");
produce_kafka_msg( msg.to_string() , _transmitSimSensorDetectedObjTopic);
}

bool CARMAStreetsPlugin::getEncodedtsm3( tsm3EncodedMessage *tsm3EncodedMsg, Json::Value metadata, Json::Value payload_json )
Expand Down
14 changes: 7 additions & 7 deletions src/v2i-hub/CDASimAdapter/src/CDASimAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,27 +126,27 @@ namespace CDASimAdapter{

void CDASimAdapter::start_immediate_forward_thread() {
if ( !immediate_forward_timer ) {
immediate_forward_timer = std::make_unique<tmx::utils::ThreadTimer>();
immediate_forward_timer = std::make_unique<tmx::utils::ThreadTimer>(std::chrono::milliseconds(5));
}
immediate_forward_tick_id = immediate_forward_timer->AddPeriodicTick([this]() {
this->attempt_message_from_v2xhub();

} // end of lambda expression
, std::chrono::milliseconds(100) );
, std::chrono::milliseconds(5) );

immediate_forward_timer->Start();

}

void CDASimAdapter::start_message_receiver_thread() {
if ( !message_receiver_timer ) {
message_receiver_timer = std::make_unique<tmx::utils::ThreadTimer>();
message_receiver_timer = std::make_unique<tmx::utils::ThreadTimer>(std::chrono::milliseconds(5));
}

message_receiver_tick_id = message_receiver_timer->AddPeriodicTick([this]() {
this->attempt_message_from_simulation();
} // end of lambda expression
, std::chrono::milliseconds(100) );
, std::chrono::milliseconds(5) );
message_receiver_timer->Start();

}
Expand Down Expand Up @@ -174,7 +174,7 @@ namespace CDASimAdapter{
{
if(!external_object_detection_thread_timer)
{
external_object_detection_thread_timer = std::make_unique<tmx::utils::ThreadTimer>();
external_object_detection_thread_timer = std::make_unique<tmx::utils::ThreadTimer>(std::chrono::milliseconds(5));
}
external_object_detection_thread_timer->AddPeriodicTick([this](){
PLOG(logDEBUG1) << "Listening for Sensor Detected Message from CDASim." << std::endl;
Expand All @@ -187,7 +187,7 @@ namespace CDASimAdapter{
PLOG(logDEBUG1) << "CDASim connection has not yet received an simulated sensor detected message!" << std::endl;
}
}//End lambda
, std::chrono::milliseconds(100));
, std::chrono::milliseconds(5));
external_object_detection_thread_timer->Start();
}
catch ( const UdpServerRuntimeError &e )
Expand Down Expand Up @@ -222,7 +222,7 @@ namespace CDASimAdapter{
PLOG(logDEBUG1) << "Listening for time sync messages from CDASim." << std::endl;
this->attempt_time_sync();
} // end of lambda expression
, std::chrono::milliseconds(100));
, std::chrono::milliseconds(5));
time_sync_timer->Start();
}

Expand Down
Loading