Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-du-car committed Jul 25, 2023
1 parent c96db25 commit c4474a8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/v2i-hub/CDASimAdapter/src/CDASimAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ namespace CDASimAdapter{
uint time_sync_port = std::stoul(sim::get_sim_config(sim::TIME_SYNC_PORT));
uint v2x_port = std::stoul(sim::get_sim_config(sim::V2X_PORT));
uint sim_v2x_port = std::stoul(sim::get_sim_config(sim::SIM_V2X_PORT));
uint infrastructure_id = std::stoul(sim::get_sim_config(sim::INFRASTRUCTURE_ID));
std::string infrastructure_id = sim::get_sim_config(sim::INFRASTRUCTURE_ID);
std::string sensor_json_file_path = sim::get_sim_config(sim::SENSOR_JSON_FILE_PATH);

PLOG(logINFO) << "CDASim connecting " << simulation_ip <<
Expand Down
2 changes: 1 addition & 1 deletion src/v2i-hub/CDASimAdapter/src/CDASimConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace CDASimAdapter{
return _connected;
}

std::string CDASimConnection::get_handshake_json(const uint infrastructure_id, const std::string &local_ip, const uint time_sync_port, const uint v2x_port,
std::string CDASimConnection::get_handshake_json(const std::string &infrastructure_id, const std::string &local_ip, const uint time_sync_port, const uint v2x_port,
const Point &location, const Json::Value& sensors_json_v) const

{
Expand Down
2 changes: 1 addition & 1 deletion src/v2i-hub/CDASimAdapter/src/include/CDASimConnection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ namespace CDASimAdapter {
* @param sensors_json_v A list of sensors sent to CARLA for sensor generation.
* @return true if handshake successful and false if handshake unsuccessful.
*/
std::string get_handshake_json(const uint infrastructure_id, const std::string &local_ip, const uint time_sync_port,
std::string get_handshake_json(const std::string &infrastructure_id, const std::string &local_ip, const uint time_sync_port,
const uint v2x_port, const tmx::utils::Point &location, const Json::Value& sensors_json_v) const;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace CDASimAdapter {
void SetUp() override {
// Initialize CARMA Simulation connection with (0,0,0) location and mock kafka producer.
Point location;
connection = std::make_shared<CDASimConnection>("127.0.0.1", 1212, 4567, 4678, "127.0.0.1", 1213, 1214, location, sensors_file_path);
connection = std::make_shared<CDASimConnection>("127.0.0.1", "1212", 4567, 4678, "127.0.0.1", 1213, 1214, location, sensors_file_path);
}
void TearDown() override {

Expand Down Expand Up @@ -88,15 +88,15 @@ namespace CDASimAdapter {
location.Y = 38.955;
location.Z = -77.149;
Json::Value sensorsJsonV;
ASSERT_EQ(connection->get_handshake_json(4566, "127.0.0.1", 4567, 4568, location, sensorsJsonV),
ASSERT_EQ(connection->get_handshake_json("4566", "127.0.0.1", 4567, 4568, location, sensorsJsonV),
"{\n \"infrastructureId\" : 4566,\n \"location\" : {\n \"x\" : 1000.0,\n \"y\" : 38.954999999999998,\n \"z\" : -77.149000000000001\n },\n \"rxMessageIpAddress\" : \"127.0.0.1\",\n \"rxMessagePort\" : 4568,\n \"sensors\" : null,\n \"timeSyncPort\" : 4567\n}\n");
}

TEST_F( TestCARMASimulationConnection, carma_simulation_handshake) {
WGS84Point location;
Point location;
Json::Value sensorsJsonV;
// UDP creation error
ASSERT_FALSE(connection->carma_simulation_handshake("", 45, NULL,
ASSERT_FALSE(connection->carma_simulation_handshake("", "45", NULL,
"", 45, 45, location, sensorsJsonV));
}

Expand Down

0 comments on commit c4474a8

Please sign in to comment.