Skip to content

Commit

Permalink
resolve merge error
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-du-car committed Jul 21, 2023
1 parent d035cf8 commit d14b339
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
2 changes: 0 additions & 2 deletions src/v2i-hub/CDASimAdapter/src/CDASimAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ namespace CDASimAdapter{

if ( connection->is_connected() ) {
start_time_sync_thread_timer();
start_amf_msg_thread();
start_binary_msg_thread();
start_external_object_detection_thread();
start_immediate_forward_thread();
start_message_receiver_thread();
Expand Down
8 changes: 3 additions & 5 deletions src/v2i-hub/CDASimAdapter/src/CDASimConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
using namespace tmx::utils;

namespace CDASimAdapter{
CDASimConnection::CDASimConnection(const std::string &simulation_ip, const uint infrastructure_id, const uint simulation_registration_port, const uint sim_v2x_port,
CDASimConnection::CDASimConnection(const std::string &simulation_ip, const std::string &infrastructure_id, const uint simulation_registration_port, const uint sim_v2x_port,
const std::string &local_ip, const uint time_sync_port,const uint external_object_detection_port, const uint v2x_port,
const Point &location) :


_simulation_ip(simulation_ip), _infrastructure_id(infrastructure_id), _simulation_registration_port(simulation_registration_port),
_simulation_v2x_port(sim_v2x_port), _local_ip(local_ip), _time_sync_port(time_sync_port), _external_object_detection_port(external_object_detection_port),_v2x_port(v2x_port),
_location(location) {
Expand Down Expand Up @@ -36,7 +34,7 @@ namespace CDASimAdapter{
}


std::string CDASimConnection::get_handshake_json(const uint infrastructure_id, const std::string &local_ip, const uint time_sync_port, const uint external_object_detection_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 external_object_detection_port, const uint v2x_port,
const Point &location) const

{
Expand All @@ -56,7 +54,7 @@ namespace CDASimAdapter{
return message_str;
}

bool CDASimConnection::carma_simulation_handshake(const std::string &simulation_ip, const uint infrastructure_id, const uint simulation_registration_port,
bool CDASimConnection::carma_simulation_handshake(const std::string &simulation_ip, const std::string &infrastructure_id, const uint simulation_registration_port,
const std::string &local_ip, const uint time_sync_port, const uint external_object_detection_port, const uint v2x_port,
const Point &location)
{
Expand Down
6 changes: 3 additions & 3 deletions src/v2i-hub/CDASimAdapter/src/include/CDASimConnection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace CDASimAdapter {
* @param v2x_port Port on which connecction listens for incoming v2x messages.
* @param location Simulationed location of infrastructure.
*/
explicit CDASimConnection( const std::string &simulation_ip, const uint infrastructure_id, const uint simulation_registration_port,
explicit CDASimConnection( const std::string &simulation_ip, const std::string &infrastructure_id, const uint simulation_registration_port,
const uint sim_v2x_port, const std::string &local_ip, const uint time_sync_port, const uint external_object_detection_port, const uint v2x_port,
const tmx::utils::Point &location);
/**
Expand Down Expand Up @@ -101,7 +101,7 @@ namespace CDASimAdapter {
* @param location simulated location of infrastructure hardware.
* @return true if handshake successful and false if handshake unsuccessful.
*/
bool carma_simulation_handshake(const std::string &simulation_ip, const uint infrastructure_id, const uint simulation_registration_port,
bool carma_simulation_handshake(const std::string &simulation_ip, const std::string &infrastructure_id, const uint simulation_registration_port,
const std::string &local_ip, const uint time_sync_port, const uint external_object_detection_port, const uint v2x_port,
const tmx::utils::Point &location);

Expand Down Expand Up @@ -137,7 +137,7 @@ namespace CDASimAdapter {
* @param location simulated location of infrastructure hardware.
* @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, const uint external_object_detection_port,
std::string get_handshake_json(const std::string &infrastructure_id, const std::string &local_ip, const uint time_sync_port, const uint external_object_detection_port,
const uint v2x_port, const tmx::utils::Point &location) const;
std::string _simulation_ip;
uint _simulation_registration_port;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,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, 1215, location);
connection = std::make_shared<CDASimConnection>("127.0.0.1", "1212", 4567, 4678, "127.0.0.1", 1213, 1214, 1215, location);
}
void TearDown() override {

Expand Down Expand Up @@ -85,14 +85,14 @@ namespace CDASimAdapter {
location.X = 1000;
location.Y = 38.955;
location.Z = -77.149;
ASSERT_EQ(connection->get_handshake_json(4566, "127.0.0.1", 4567, 4568, 4569, location),
"{\n \"ExternalObjectDetectionPort\" : 4568,\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\" : 4569,\n \"timeSyncPort\" : 4567\n}\n");
ASSERT_EQ(connection->get_handshake_json("4566", "127.0.0.1", 4567, 4568, 4569, location),
"{\n \"ExternalObjectDetectionPort\" : 4568,\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\" : 4569,\n \"timeSyncPort\" : 4567\n}\n");
}

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

Expand Down

0 comments on commit d14b339

Please sign in to comment.