Skip to content

Commit

Permalink
use SDataTypeInfo for service/client registration
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-schilasky committed Jan 7, 2025
1 parent 379e75a commit d225e45
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
9 changes: 8 additions & 1 deletion ecal/core/src/service/ecal_service_client_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,18 @@ namespace eCAL
const auto& method_information = method_information_pair.second;

Service::Method method;
method.mname = method_name;
method.mname = method_name;

// old type and descriptor fields
method.req_type = method_information.request_type.name;
method.req_desc = method_information.request_type.descriptor;
method.resp_type = method_information.response_type.name;
method.resp_desc = method_information.response_type.descriptor;

// new type and descriptor fields
method.req_datatype = method_information.request_type;
method.resp_datatype = method_information.response_type;

{
const auto& call_count_iter = m_method_call_count_map.find(method_name);
if (call_count_iter != m_method_call_count_map.end())
Expand Down
30 changes: 27 additions & 3 deletions ecal/core/src/service/ecal_service_server_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,18 @@ namespace eCAL
if (iter != m_method_map.end())
{
Logging::Log(log_level_warning, "CServiceServerImpl::AddMethodCallback: Method already exists, updating callback: " + method_);

// old type and descriptor fields
iter->second.method.req_type = method_info_.request_type.name;
iter->second.method.req_desc = method_info_.request_type.descriptor;
iter->second.method.resp_type = method_info_.response_type.name;
iter->second.method.resp_desc = method_info_.response_type.descriptor;

// new type and descriptor fields
iter->second.method.req_datatype = method_info_.request_type;
iter->second.method.resp_datatype = method_info_.response_type;

// callback
iter->second.callback = callback_;
}
else
Expand All @@ -89,12 +97,21 @@ namespace eCAL
Logging::Log(log_level_debug1, "CServiceServerImpl::AddMethodCallback: Registering new method: " + method_);
#endif
SMethod method;
method.method.mname = method_;
// method name
method.method.mname = method_;

// old type and descriptor fields
method.method.req_type = method_info_.request_type.name;
method.method.req_desc = method_info_.request_type.descriptor;
method.method.resp_type = method_info_.response_type.name;
method.method.resp_desc = method_info_.response_type.descriptor;
method.callback = callback_;

// new type and descriptor fields
method.method.req_datatype = method_info_.request_type;
method.method.resp_datatype = method_info_.response_type;

// callback
method.callback = callback_;
m_method_map[method_] = method;
}

Expand Down Expand Up @@ -295,11 +312,18 @@ namespace eCAL
for (const auto& iter : m_method_map)
{
Service::Method method;
method.mname = iter.first;
method.mname = iter.first;

// old type and descriptor fields
method.req_type = iter.second.method.req_type;
method.req_desc = iter.second.method.req_desc;
method.resp_type = iter.second.method.resp_type;
method.resp_desc = iter.second.method.resp_desc;

// new type and descriptor fields
method.req_datatype = iter.second.method.req_datatype;
method.resp_datatype = iter.second.method.resp_datatype;

method.call_count = iter.second.method.call_count;
service.methods.push_back(method);
}
Expand Down

0 comments on commit d225e45

Please sign in to comment.