Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make the callback binding clear
Browse files Browse the repository at this point in the history
rex-schilasky committed Dec 5, 2024
1 parent 668b0d2 commit 174699e
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions app/mon/mon_plugins/raw_data_reflection/src/plugin_widget.cpp
Original file line number Diff line number Diff line change
@@ -59,15 +59,15 @@ 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::_3));
subscriber_.AddReceiveCallback(std::bind(&PluginWidget::ecalMessageReceivedCallback, this, std::placeholders::_1, std::placeholders::_3));
}

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

void PluginWidget::ecalMessageReceivedCallback(const struct eCAL::SReceiveCallbackData& callback_data)
void PluginWidget::ecalMessageReceivedCallback(const eCAL::Registration::STopicId& /*topic_id*/, 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);
@@ -128,7 +128,7 @@ void PluginWidget::onUpdate()

void PluginWidget::onResume()
{
subscriber_.AddReceiveCallback(std::bind(&PluginWidget::ecalMessageReceivedCallback, this, std::placeholders::_3));
subscriber_.AddReceiveCallback(std::bind(&PluginWidget::ecalMessageReceivedCallback, this, std::placeholders::_1, std::placeholders::_3));
}

void PluginWidget::onPause()
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ private slots:
bool new_msg_available_;
int received_message_counter_;

void ecalMessageReceivedCallback(const eCAL::SReceiveCallbackData& callback_data);
void ecalMessageReceivedCallback(const eCAL::Registration::STopicId& topic_id, const eCAL::SReceiveCallbackData& callback_data);

#if QT_VERSION < QT_VERSION_CHECK(5, 9, 0)
static QString bytesToHex(const QByteArray& byte_array, char separator = '\0');
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.
@@ -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 ecal/core/include/ecal/ecal_callback.h
Original file line number Diff line number Diff line change
@@ -138,7 +138,7 @@ namespace eCAL
* @param topic_id_ The topic id struct of the received message.
* @param data_ Data struct containing payload, timestamp and publication clock.
**/
using ReceiveIDCallbackT = std::function<void(const struct Registration::STopicId&, const struct SDataTypeInformation&, const struct SReceiveCallbackData&)>;
using ReceiveIDCallbackT = std::function<void(const Registration::STopicId&, const SDataTypeInformation&, const SReceiveCallbackData&)>;

/**
* @brief Timer callback function type.

0 comments on commit 174699e

Please sign in to comment.