Skip to content

Commit

Permalink
Merge branch 'master' into feature/ecal-core-api-v6
Browse files Browse the repository at this point in the history
  • Loading branch information
hannemn authored Dec 6, 2024
2 parents 30bd570 + c0eadc2 commit d6664ba
Show file tree
Hide file tree
Showing 59 changed files with 376 additions and 1,775 deletions.
4 changes: 2 additions & 2 deletions app/meas_cutter/src/config_file_parser.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 All @@ -21,7 +21,7 @@
#include <iostream>
#include <ecal_utils/filesystem.h>

#define YAML_CPP_STATIC_DEFINE
//#define YAML_CPP_STATIC_DEFINE // set by CMake
#include <yaml-cpp/yaml.h>

#include "utils.h"
Expand Down
4 changes: 2 additions & 2 deletions app/meas_cutter/src/utils.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 All @@ -26,7 +26,7 @@
#include <fstream>
#include <algorithm>

#define YAML_CPP_STATIC_DEFINE
//#define YAML_CPP_STATIC_DEFINE // set by CMake
#include "yaml-cpp/yaml.h"

#include <ecal_utils/str_convert.h>
Expand Down
9 changes: 0 additions & 9 deletions app/mon/mon_cli/src/ecal_mon_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,6 @@ void ProcProto(const std::string& topic_name, int msg_count)
// sleep 1000 ms
std::this_thread::sleep_for(std::chrono::milliseconds(1000));

// get topic type
eCAL::SDataTypeInformation topic_info;
eCAL::Registration::GetTopicDataTypeInformation(topic_name, topic_info);
if(topic_info.name.empty())
{
std::cout << "could not get type name for topic " << topic_name << std::endl;
return;
}

// create dynamic subscribers for receiving and decoding messages and assign callback
eCAL::protobuf::CDynamicSubscriber sub(topic_name);
std::atomic<int> cnt(msg_count);
Expand Down
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 @@ -59,7 +59,7 @@ PluginWidget::PluginWidget(const QString& topic_name, const QString& topic_type,

// Add eCAL Callbacks
subscriber_.AddReceiveCallback(std::bind(&PluginWidget::onProtoMessageCallback, this, std::placeholders::_2, std::placeholders::_3));
//subscriber_.AddErrorCallback(std::bind(&PluginWidget::onProtoErrorCallback, this, std::placeholders::_1));
subscriber_.AddErrorCallback(std::bind(&PluginWidget::onProtoErrorCallback, this, std::placeholders::_1));

// Button connections
connect(ui_.expand_button, &QPushButton::clicked, [this]() { tree_view_->expandAll(); });
Expand Down Expand Up @@ -323,13 +323,13 @@ void PluginWidget::onResume()
{
// Add eCAL Callbacks
subscriber_.AddReceiveCallback(std::bind(&PluginWidget::onProtoMessageCallback, this, std::placeholders::_2, std::placeholders::_3));
//subscriber_.AddErrorCallback(std::bind(&PluginWidget::onProtoErrorCallback, this, std::placeholders::_1));
subscriber_.AddErrorCallback(std::bind(&PluginWidget::onProtoErrorCallback, this, std::placeholders::_1));
}

void PluginWidget::onPause()
{
subscriber_.RemReceiveCallback();
//subscriber_.RemErrorCallback();
subscriber_.RemErrorCallback();
}

QWidget* PluginWidget::getWidget()
Expand Down
23 changes: 17 additions & 6 deletions app/mon/mon_plugins/raw_data_reflection/src/plugin_widget.cpp
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 @@ -59,20 +59,25 @@ PluginWidget::PluginWidget(const QString& topic_name, const QString&, QWidget* p
ui_.content_layout->addWidget(frame);

// Connect the eCAL Subscriber
subscriber_.AddReceiveCallback(std::bind(&PluginWidget::ecalMessageReceivedCallback, this, std::placeholders::_2));
subscriber_.AddReceiveCallback([this](const eCAL::Registration::STopicId& /*topic_id*/,
const eCAL::SDataTypeInformation& /*data_type_info*/,
const eCAL::SReceiveCallbackData& callback_data)
{
ecalMessageReceivedCallback(callback_data);
});
}

PluginWidget::~PluginWidget()
{
subscriber_.RemReceiveCallback();
}

void PluginWidget::ecalMessageReceivedCallback(const struct eCAL::SReceiveCallbackData* callback_data)
void PluginWidget::ecalMessageReceivedCallback(const eCAL::SReceiveCallbackData& callback_data)
{
std::lock_guard<std::mutex> message_lock(message_mutex_);
last_message_ = QByteArray(static_cast<char*>(callback_data->buf), callback_data->size);
last_message_ = QByteArray(static_cast<char*>(callback_data.buf), callback_data.size);

last_message_publish_timestamp_ = eCAL::Time::ecal_clock::time_point(std::chrono::microseconds(callback_data->time));
last_message_publish_timestamp_ = eCAL::Time::ecal_clock::time_point(std::chrono::microseconds(callback_data.time));

received_message_counter_++;
new_msg_available_ = true;
Expand Down Expand Up @@ -128,7 +133,13 @@ void PluginWidget::onUpdate()

void PluginWidget::onResume()
{
subscriber_.AddReceiveCallback(std::bind(&PluginWidget::ecalMessageReceivedCallback, this, std::placeholders::_2));
// (Re)Connect the eCAL Subscriber
subscriber_.AddReceiveCallback([this](const eCAL::Registration::STopicId& /*topic_id*/,
const eCAL::SDataTypeInformation& /*data_type_info*/,
const eCAL::SReceiveCallbackData& callback_data)
{
ecalMessageReceivedCallback(callback_data);
});
}

void PluginWidget::onPause()
Expand Down
4 changes: 2 additions & 2 deletions app/mon/mon_plugins/raw_data_reflection/src/plugin_widget.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 @@ -63,7 +63,7 @@ private slots:
bool new_msg_available_;
int received_message_counter_;

void ecalMessageReceivedCallback(const struct eCAL::SReceiveCallbackData* callback_data);
void ecalMessageReceivedCallback(const eCAL::SReceiveCallbackData& callback_data);

#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
static QString bytesToHex(const QByteArray& byte_array, char separator = '\0');
Expand Down
12 changes: 6 additions & 6 deletions app/mon/mon_plugins/string_reflection/src/plugin_widget.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 @@ -56,12 +56,12 @@ private slots:
QTextEdit* text_edit_;

eCAL::string::CSubscriber<std::string> subscriber_;
std::string last_message_;
eCAL::Time::ecal_clock::time_point last_message_publish_timestamp_;
std::mutex message_mutex_;
std::string last_message_;
eCAL::Time::ecal_clock::time_point last_message_publish_timestamp_;
std::mutex message_mutex_;

bool new_msg_available_;
int received_message_counter_;
bool new_msg_available_;
int received_message_counter_;

void ecalMessageReceivedCallback(const std::string& message, long long publish_timestamp_usecs);
};
2 changes: 1 addition & 1 deletion app/rec/rec_server_core/src/rec_server_impl.cpp
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
44 changes: 31 additions & 13 deletions app/util/stop/src/ecal_stop.cpp
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 @@ -46,19 +46,37 @@ int main()
}
eCAL::Process::SleepMS(500);

// shut down local user processes
std::cout << "--------------------------------------" << std::endl;
std::cout << "Shutdown local eCAL user processes." << std::endl;
std::cout << "--------------------------------------" << std::endl;
eCAL::Util::ShutdownProcesses();
std::cout << std::endl;
eCAL::Monitoring::SMonitoring monitoring;
eCAL::Monitoring::GetMonitoring(monitoring, eCAL::Monitoring::Entity::Process);
const std::string host_name(eCAL::Process::GetHostName());

// shut down local eCAL core
std::cout << "--------------------------------------" << std::endl;
std::cout << "Shutdown local eCAL core components." << std::endl;
std::cout << "--------------------------------------" << std::endl;
eCAL::Util::ShutdownCore();
std::cout << std::endl;
for (const auto& process : monitoring.processes)
{
// filter out eCAL system processes
const std::string uname = process.uname;
if ( (uname != "eCALConfig")
&& (uname != "eCALMon")
&& (uname != "eCALMon CLI")
&& (uname != "eCALMon TUI")
&& (uname != "eCALPlay")
&& (uname != "eCALPlayGUI")
&& (uname != "eCALRec")
&& (uname != "eCALRecGUI")
&& (uname != "eCALRecClient")
&& (uname != "eCALRec-Remote")
&& (uname != "eCALRec-Server")
&& (uname != "eCALSys")
&& (uname != "eCALSysGUI")
&& (uname != "eCALSysClient")
&& (uname != "eCALSys-Remote")
&& (uname != "eCALStop")
&& (process.hname == host_name)
)
{
std::cout << "Stopping process " << process.pname << " (" << process.pid << ")" << std::endl;
eCAL::Util::ShutdownProcess(process.pid);
}
}

// finalize eCAL API
eCAL::Finalize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace eCAL
{
namespace hdf5
{
class WriterImpl;
struct WriterImpl;

/**
* @brief Hdf5 based Writer implementation
Expand Down
13 changes: 1 addition & 12 deletions doc/rst/configuration/runtime_configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The corresponding structure reflects the configuration file (:ref:`configuration
Custom types
============

In order to rule out configuration errors, custom datatypes for IP addresses (IpAddressV4) and sizes (ConstrainedInteger) are introduced.
In order to rule out configuration errors, a custom datatype for IP addresses (IpAddressV4) is introduced.

**IpAddressV4:** For assigning an IP address simply assign a string with the desired address.
Decimal and hexadecimal format is supported.
Expand All @@ -25,17 +25,6 @@ The IP address can be used like a normal string object. For example:
eCAL::Types::IpAddressV4 ip_address = "192.168.7.1"; // in hex: "C0.A8.7.1"
std::cout << ip_address << "\n";

**ConstrainedInteger**: ConstrainedInteger are specified with a minimum (default: 0), step (default: 1) and maximum (default: maximum of int) value.
In case the assigned value does not fit into the specified limitation, the type will throw a std::invalid_argument exception.

The size object can be used like a normal integer.

.. code-block:: c++

eCAL::Types::ConstrainedInteger<1024, 512, 8192> size_4mb = 1024 + 6 * 512;
std::cout << size_4mb << "\n";

For specifying sizes in the ecal configuration object, refer to the .yaml file or "ecal/config/configuration.h" for the limitations.

Global configuration initialization
===================================
Expand Down
15 changes: 11 additions & 4 deletions ecal/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ set(ecal_c_src
src/cimpl/ecal_monitoring_cimpl.cpp
src/cimpl/ecal_process_cimpl.cpp
src/cimpl/ecal_publisher_cimpl.cpp
src/cimpl/ecal_registration_cimpl.cpp
src/cimpl/ecal_server_cimpl.cpp
src/cimpl/ecal_subscriber_cimpl.cpp
src/cimpl/ecal_time_cimpl.cpp
Expand All @@ -501,11 +500,19 @@ endif()
# public header
######################################
set(ecal_header_cmn
include/ecal/types/logging.h
include/ecal/types/monitoring.h
include/ecal/config/application.h
include/ecal/config/configuration.h
include/ecal/config/logging.h
include/ecal/config/monitoring.h
include/ecal/config/publisher.h
include/ecal/config/registration.h
include/ecal/config/service.h
include/ecal/config/subscriber.h
include/ecal/config/time.h
include/ecal/config/transport_layer.h
include/ecal/config/user_arguments.h
include/ecal/types/logging.h
include/ecal/types/monitoring.h
include/ecal/ecal.h
include/ecal/ecal_callback.h
include/ecal/ecal_config.h
Expand Down Expand Up @@ -541,7 +548,6 @@ set(ecal_header_cimpl
include/ecal/cimpl/ecal_monitoring_cimpl.h
include/ecal/cimpl/ecal_process_cimpl.h
include/ecal/cimpl/ecal_publisher_cimpl.h
include/ecal/cimpl/ecal_registration_cimpl.h
include/ecal/cimpl/ecal_server_cimpl.h
include/ecal/cimpl/ecal_service_info_cimpl.h
include/ecal/cimpl/ecal_subscriber_cimpl.h
Expand All @@ -554,6 +560,7 @@ set(ecal_header_cimpl

set(ecal_header_msg
include/ecal/msg/protobuf/client.h
include/ecal/msg/protobuf/dynamic_json_subscriber.h
include/ecal/msg/protobuf/dynamic_publisher.h
include/ecal/msg/protobuf/dynamic_subscriber.h
include/ecal/msg/protobuf/publisher.h
Expand Down
Loading

0 comments on commit d6664ba

Please sign in to comment.