Skip to content

Commit

Permalink
[core] new service client API with per-instance control (#1785)
Browse files Browse the repository at this point in the history
Refactor eCAL Client API to introduce CServiceClient and CClientInstance for per-instance service control and improved connectivity management.
  • Loading branch information
rex-schilasky authored Dec 6, 2024
1 parent a0ffc5a commit 88f7db8
Show file tree
Hide file tree
Showing 31 changed files with 3,049 additions and 1,378 deletions.
8 changes: 7 additions & 1 deletion ecal/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ if(ECAL_CORE_SERVICE)
src/service/ecal_service_client.cpp
src/service/ecal_service_client_impl.cpp
src/service/ecal_service_client_impl.h
src/service/ecal_service_client_instance.cpp
src/service/ecal_service_client_v5.cpp
src/service/ecal_service_client_v5_impl.cpp
src/service/ecal_service_client_v5_impl.h
src/service/ecal_service_server.cpp
src/service/ecal_service_server_impl.cpp
src/service/ecal_service_server_impl.h
Expand Down Expand Up @@ -515,8 +519,10 @@ set(ecal_header_cmn
include/ecal/types/monitoring.h
include/ecal/ecal.h
include/ecal/ecal_callback.h
include/ecal/ecal_config.h
include/ecal/ecal_client.h
include/ecal/ecal_client_instance.h
include/ecal/ecal_client_v5.h
include/ecal/ecal_config.h
include/ecal/ecal_core.h
include/ecal/ecal_deprecate.h
include/ecal/ecal_init.h
Expand Down
3 changes: 2 additions & 1 deletion ecal/core/include/ecal/cimpl/ecal_service_info_cimpl.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,6 +32,7 @@ enum eCallState
{
call_state_none = 0, //!< undefined
call_state_executed, //!< executed (successfully)
call_state_timeouted, //!< timeout
call_state_failed //!< failed
};

Expand Down
65 changes: 49 additions & 16 deletions ecal/core/include/ecal/ecal_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,22 @@ namespace eCAL
};

/**
* @brief Receive callback function type with topic name and data struct.
* @brief Receive callback function type with topic name and data struct. (deprecated)
*
* @param topic_name_ The topic name of the received message.
* @param data_ Data struct containing payload, timestamp and publication clock.
**/
using ReceiveCallbackT = std::function<void (const char *, const struct SReceiveCallbackData *)>;
using ReceiveCallbackT = std::function<void (const char* topic_name_, const struct SReceiveCallbackData* data_)>;

/**
* @brief Receive callback function type with topic id and data struct. The topic id contains the topic name, the process
* name, the host name and a uniques topic identifier.
*
* @param topic_id_ The topic id struct of the received message.
* @param data_ Data struct containing payload, timestamp and publication clock.
* @param topic_id_ The topic id struct of the received message.
* @param data_type_info_ Topic data type information (encoding, type, descriptor).
* @param data_ Data struct containing payload, timestamp and publication clock.
**/
using ReceiveIDCallbackT = std::function<void(const Registration::STopicId&, const SDataTypeInformation&, const SReceiveCallbackData&)>;
using ReceiveIDCallbackT = std::function<void(const Registration::STopicId& topic_id_, const SDataTypeInformation& data_type_info_, const SReceiveCallbackData& data_)>;

/**
* @brief Timer callback function type.
Expand All @@ -151,37 +152,69 @@ namespace eCAL
* @param sample_ The sample protocol buffer registration payload buffer.
* @param sample_size_ The payload buffer size.
**/
using RegistrationCallbackT = std::function<void (const char *, int)>;
using RegistrationCallbackT = std::function<void (const char* sample_, int sample_size_)>;

/**
* @brief Publisher event callback function type.
* @brief Publisher event callback function type. (deprecated)
*
* @param topic_name_ The topic name of the publisher that triggered the event.
* @param data_ Event callback data structure with the event specific information.
**/
using PubEventCallbackT = std::function<void (const char *, const struct SPubEventCallbackData *)>;
using PubEventCallbackT = std::function<void (const char* topic_name_, const struct SPubEventCallbackData* data_)>;

/**
* @brief Subscriber event callback function type.
* @brief Publisher event callback function type.
*
* @param topic_id_ The topic id struct of the received message.
* @param data_ Event callback data structure with the event specific information.
**/
using PubEventIDCallbackT = std::function<void(const Registration::STopicId& topic_id_, const struct SPubEventCallbackData& data_)>;

/**
* @brief Subscriber event callback function type. (deprecated)
*
* @param topic_name_ The topic name of the subscriber that triggered the event.
* @param data_ Event callback data structure with the event specific information.
**/
using SubEventCallbackT = std::function<void (const char *, const struct SSubEventCallbackData *)>;
using SubEventCallbackT = std::function<void (const char* topic_name_, const struct SSubEventCallbackData* data_)>;

/**
* @brief Subscriber event callback function type.
*
* @param topic_id_ The topic id struct of the received message.
* @param data_ Event callback data structure with the event specific information.
**/
using SubEventIDCallbackT = std::function<void(const Registration::STopicId& topic_id_, const struct SSubEventCallbackData& data_)>;

/**
* @brief Client event callback function type. (deprecated)
*
* @param service_name_ The service name of the connection that triggered the event.
* @param data_ Event callback data structure with the event specific information.
**/
using ClientEventCallbackT = std::function<void (const char* service_name_, const struct SClientEventCallbackData* data_)>;

/**
* @brief Client event callback function type.
*
* @param name_ The name of the connection that triggered the event.
* @param data_ Event callback data structure with the event specific information.
* @param service_id_ The service id struct of the connection that triggered the event.
* @param data_ Event callback data structure with the event specific information.
**/
using ClientEventCallbackT = std::function<void (const char *, const struct SClientEventCallbackData *)>;
using ClientEventIDCallbackT = std::function<void(const Registration::SServiceMethodId& service_id_, const struct SClientEventCallbackData& data_)>;

/**
* @brief Server event callback function type. (deprecated)
*
* @param service_name_ The service name of the connection that triggered the event.
* @param data_ Event callback data structure with the event specific information.
**/
using ServerEventCallbackT = std::function<void (const char* service_name_, const struct SServerEventCallbackData* data_)>;

/**
* @brief Server event callback function type.
*
* @param name_ The name of the connection that triggered the event.
* @param data_ Event callback data structure with the event specific information.
* @param service_id_ The service id struct of the connection that triggered the event.
* @param data_ Event callback data structure with the event specific information.
**/
using ServerEventCallbackT = std::function<void (const char *, const struct SServerEventCallbackData *)>;
using ServerEventIDCallbackT = std::function<void(const Registration::SServiceMethodId& service_id_, const struct SServerEventCallbackData& data_)>;
}
Loading

0 comments on commit 88f7db8

Please sign in to comment.