Skip to content

Commit

Permalink
implement GetServiceId of CServiceClient and CServiceServer
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-schilasky committed Jan 7, 2025
1 parent 379e75a commit f499437
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 10 deletions.
3 changes: 0 additions & 3 deletions ecal/core/include/ecal/ecal_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ namespace eCAL
*
* @return The service id.
**/

// TODO: Implement this

ECAL_API_EXPORTED_MEMBER
Registration::SServiceMethodId GetServiceId() const;

Expand Down
3 changes: 0 additions & 3 deletions ecal/core/include/ecal/ecal_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ namespace eCAL
*
* @return The service id.
**/

// TODO: Implement this

ECAL_API_EXPORTED_MEMBER
Registration::SServiceMethodId GetServiceId() const;

Expand Down
4 changes: 2 additions & 2 deletions ecal/core/src/service/ecal_service_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ namespace eCAL

Registration::SServiceMethodId CServiceClient::GetServiceId() const
{
// TODO: Implement this
return Registration::SServiceMethodId();
if (m_service_client_impl == nullptr) return Registration::SServiceMethodId();
return m_service_client_impl->GetServiceId();
}

bool CServiceClient::IsConnected() const
Expand Down
14 changes: 14 additions & 0 deletions ecal/core/src/service/ecal_service_client_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,20 @@ namespace eCAL
return GetRegistrationSample();
}

Registration::SServiceMethodId CServiceClientImpl::GetServiceId() const
{
Registration::SServiceMethodId service_id;

service_id.service_id.entity_id = m_client_id;
service_id.service_id.entity_id = Process::GetProcessID();
service_id.service_id.host_name = Process::GetHostName();

service_id.service_name = m_service_name;
service_id.method_name = "";

return service_id;
}

std::string CServiceClientImpl::GetServiceName() const
{
return m_service_name;
Expand Down
3 changes: 3 additions & 0 deletions ecal/core/src/service/ecal_service_client_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ namespace eCAL
// Called by the registration provider to get a registration sample
Registration::Sample GetRegistration();

// Retrieves the service id
Registration::SServiceMethodId GetServiceId() const;

// Retrieves the service name
std::string GetServiceName() const;

Expand Down
4 changes: 2 additions & 2 deletions ecal/core/src/service/ecal_service_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ namespace eCAL

Registration::SServiceMethodId CServiceServer::GetServiceId() const
{
// TODO: Implement this
return Registration::SServiceMethodId();
if (m_service_server_impl == nullptr) return Registration::SServiceMethodId();
return m_service_server_impl->GetServiceId();
}

bool CServiceServer::IsConnected()
Expand Down
14 changes: 14 additions & 0 deletions ecal/core/src/service/ecal_service_server_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,20 @@ namespace eCAL
return GetRegistrationSample();
}

Registration::SServiceMethodId CServiceServerImpl::GetServiceId() const
{
Registration::SServiceMethodId service_id;

service_id.service_id.entity_id = m_service_id;
service_id.service_id.entity_id = Process::GetProcessID();
service_id.service_id.host_name = Process::GetHostName();

service_id.service_name = m_service_name;
service_id.method_name = "";

return service_id;
}

std::string CServiceServerImpl::GetServiceName() const
{
return m_service_name;
Expand Down
3 changes: 3 additions & 0 deletions ecal/core/src/service/ecal_service_server_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ namespace eCAL
// Called by the registration provider to get a registration sample
Registration::Sample GetRegistration();

// Retrieves the service id
Registration::SServiceMethodId GetServiceId() const;

// Retrieves the service name
std::string GetServiceName() const;

Expand Down

0 comments on commit f499437

Please sign in to comment.