Skip to content

Commit

Permalink
merge issue: SServiceId -> SServiceMethodId, eCAL::Initialize, Enable…
Browse files Browse the repository at this point in the history
…Loopback
  • Loading branch information
rex-schilasky committed Dec 6, 2024
1 parent 44c7176 commit fa678b8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 36 deletions.
2 changes: 2 additions & 0 deletions ecal/core/include/ecal/msg/protobuf/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ namespace eCAL
return CallAsync(method_name_, request_.SerializeAsString(), timeout_);
}

using eCAL::v5::CServiceClient::Call;
using eCAL::v5::CServiceClient::CallAsync;
private:
ServiceMethodInformationMapT CreateMethodInformationMap()
{
Expand Down
2 changes: 1 addition & 1 deletion ecal/core/src/service/ecal_service_client_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ namespace eCAL
std::chrono::steady_clock::now().time_since_epoch()).count();
callback_data.attr = service_attr_;

Registration::SServiceId service_id;
Registration::SServiceMethodId service_id;
service_id.service_id = entity_id_;
service_id.service_name = m_service_name;
service_id.method_name = "";
Expand Down
2 changes: 1 addition & 1 deletion ecal/core/src/service/ecal_service_client_v5_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace eCAL
if (m_created) return false;

// Define the event callback to pass to CServiceClientNew
ClientEventIDCallbackT event_callback = [this](const Registration::SServiceId& service_id_, const struct SClientEventCallbackData& data_)
ClientEventIDCallbackT event_callback = [this](const Registration::SServiceMethodId& service_id_, const struct SClientEventCallbackData& data_)
{
// Lock the mutex to safely access m_event_callbacks
std::lock_guard<std::mutex> lock(m_event_callback_map_mutex);
Expand Down
4 changes: 2 additions & 2 deletions ecal/tests/cpp/clientserver_test/src/clientserver_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ TEST(core_cpp_clientserver, ClientConnectEvent)
// client event callback for connect events
atomic_signalable<int> event_connected_fired (0);
atomic_signalable<int> event_disconnected_fired(0);
auto event_callback = [&](const eCAL::Registration::SServiceId& /*service_id_*/, const struct eCAL::SClientEventCallbackData& data_)
auto event_callback = [&](const eCAL::Registration::SServiceMethodId& /*service_id_*/, const struct eCAL::SClientEventCallbackData& data_)
{
switch (data_.type)
{
Expand Down Expand Up @@ -390,7 +390,7 @@ TEST(core_cpp_clientserver, ClientServerBaseCallbackTimeout)

// event callback for timeout event
std::atomic<int> timeout_fired(0);
auto event_callback = [&](const eCAL::Registration::SServiceId& /*service_id_*/, const struct eCAL::SClientEventCallbackData& data_) -> void
auto event_callback = [&](const eCAL::Registration::SServiceMethodId& /*service_id_*/, const struct eCAL::SClientEventCallbackData& data_) -> void
{
if (data_.type == client_event_timeout)
{
Expand Down
40 changes: 8 additions & 32 deletions ecal/tests/cpp/clientserver_v5_test/src/clientserver_v5_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,7 @@ namespace
TEST(core_cpp_clientserver_v5, ClientConnectEvent)
{
// initialize eCAL API
eCAL::Initialize(0, nullptr, "clientserver base connect event callback");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);
eCAL::Initialize("clientserver base connect event callback");

// create client
eCAL::v5::CServiceClient client("service");
Expand Down Expand Up @@ -182,10 +179,7 @@ TEST(core_cpp_clientserver_v5, ClientConnectEvent)
TEST(core_cpp_clientserver_v5, ServerConnectEvent)
{
// initialize eCAL API
eCAL::Initialize(0, nullptr, "clientserver base connect event callback");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);
eCAL::Initialize("clientserver base connect event callback");

// create server
eCAL::CServiceServer server("service");
Expand Down Expand Up @@ -261,10 +255,7 @@ TEST(core_cpp_clientserver_v5, ClientServerBaseCallback)
const int calls(5);

// initialize eCAL API
eCAL::Initialize(0, nullptr, "clientserver base callback test");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);
eCAL::Initialize("clientserver base callback test");

// create service servers
ServiceVecT service_vec;
Expand Down Expand Up @@ -373,10 +364,7 @@ TEST(core_cpp_clientserver_v5, ClientServerBaseCallbackTimeout)
const int calls(1);

// initialize eCAL API
eCAL::Initialize(0, nullptr, "clientserver base callback test with timeout");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);
eCAL::Initialize("clientserver base callback test with timeout");

// create service servers
ServiceVecT service_vec;
Expand Down Expand Up @@ -540,10 +528,7 @@ TEST(core_cpp_clientserver_v5, ClientServerBaseAsyncCallback)
const int sleep(100);

// initialize eCAL API
eCAL::Initialize(0, nullptr, "clientserver base async callback test");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);
eCAL::Initialize("clientserver base async callback test");

// create service server
eCAL::CServiceServer server("service");
Expand Down Expand Up @@ -616,10 +601,7 @@ TEST(core_cpp_clientserver_v5, ClientServerBaseAsync)
const int calls(5);

// initialize eCAL API
eCAL::Initialize(0, nullptr, "clientserver base async callback test with timeout");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);
eCAL::Initialize("clientserver base async callback test with timeout");

// create service server
eCAL::CServiceServer server("service");
Expand Down Expand Up @@ -728,10 +710,7 @@ TEST(core_cpp_clientserver_v5, ClientServerBaseBlocking)
const int calls(1);

// initialize eCAL API
eCAL::Initialize(0, nullptr, "clientserver base blocking test");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);
eCAL::Initialize("clientserver base blocking test");

// create service servers
ServiceVecT service_vec;
Expand Down Expand Up @@ -829,10 +808,7 @@ TEST(core_cpp_clientserver_v5, NestedRPCCall)
const int calls(1);

// initialize eCAL API
eCAL::Initialize(0, nullptr, "nested rpc call test");

// enable loop back communication in the same thread
eCAL::Util::EnableLoopback(true);
eCAL::Initialize("nested rpc call test");

// create service server
eCAL::CServiceServer server("service");
Expand Down

0 comments on commit fa678b8

Please sign in to comment.