Skip to content

Commit

Permalink
Merge branch 'master' into feature/redesign-service-api
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-schilasky committed Dec 11, 2024
2 parents 3f9de03 + 32f028f commit 8e9fa32
Show file tree
Hide file tree
Showing 53 changed files with 1,357 additions and 903 deletions.
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
Expand Up @@ -60,7 +60,7 @@ namespace eCAL
settings_.ClearHostFilter(); // There is no global host filter

// Initialize eCAL
eCAL::Initialize("", eCAL::Init::Default | eCAL::Init::Monitoring);
eCAL::Initialize("eCALRec-Server", eCAL::Init::Default | eCAL::Init::Monitoring);

// Start FTP Server
ftp_server_->start(5);
Expand Down
6 changes: 4 additions & 2 deletions ecal/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ endif()
######################################
set(ecal_logging_src
src/logging/ecal_log.cpp
src/logging/ecal_log_impl.cpp
src/logging/ecal_log_impl.h
src/logging/ecal_log_provider.cpp
src/logging/ecal_log_receiver.cpp
)

######################################
Expand Down Expand Up @@ -335,6 +335,8 @@ set(ecal_serialization_src
src/serialization/nanopb/pb_decode.h
src/serialization/nanopb/pb_encode.c
src/serialization/nanopb/pb_encode.h
src/serialization/nanopb/ecal/core/pb/datatype.npb.c
src/serialization/nanopb/ecal/core/pb/datatype.npb.h
src/serialization/nanopb/ecal/core/pb/ecal.npb.c
src/serialization/nanopb/ecal/core/pb/ecal.npb.h
src/serialization/nanopb/ecal/core/pb/host.npb.c
Expand Down
47 changes: 30 additions & 17 deletions ecal/core/include/ecal/config/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,50 +39,63 @@ namespace eCAL
{
namespace Logging
{
namespace Sinks
namespace Provider
{
namespace Console
struct Sink
{
bool enable; //!< Enable sink
eCAL_Logging_Filter filter_log; //!< Log messages logged (all, info, warning, error, fatal, debug1, debug2, debug3, debug4)
};

namespace File
{
struct Configuration
{
bool enable { true }; //!< Enable console logging (Default: true)
eCAL_Logging_Filter filter_log_con { log_level_error | log_level_fatal }; /*!< Log messages logged to console (all, info, warning, error, fatal, debug1, debug2, debug3, debug4)
(Default: info, warning, error, fatal)*/
std::string path { "" }; //!< Path to log file (Default: "")
};
}

namespace File
namespace UDP
{
struct Configuration
{
bool enable { false }; //!< Enable file logging (Default: false)
std::string path { "" }; //!< Path to log file (Default: "")
eCAL_Logging_Filter filter_log_file { log_level_none }; /*!< Log messages logged into file system (all, info, warning, error, fatal, debug1, debug2, debug3, debug4)
(Default: info, warning, error, fatal)*/
unsigned int port { 14001 }; //!< UDP port number (Default: 14001)
};
}

struct Configuration
{
Sink console { true, log_level_error | log_level_fatal}; //!< default: true, log_level_error
Sink file { false, log_level_none }; //!< default: false, log_level_none
Sink udp { true, log_filter_default }; //!< default: true, log_filter_default

File::Configuration file_config;
UDP::Configuration udp_config;

};
}

namespace Receiver
{
namespace UDP
{
struct Configuration
{
bool enable { true }; //!< Enable UDP logging (Default: false)
unsigned int port { 14001 }; //!< UDP port number (Default: 14001)
eCAL_Logging_Filter filter_log_udp { log_filter_default }; //!< Log messages logged via udp network (Default: info, warning, error, fatal)
unsigned int port { 14001 }; //!< UDP port number (Default: 14001)
};
}

struct Configuration
{
Console::Configuration console;
File::Configuration file;
UDP::Configuration udp;
bool enable { false }; //!< Enable UDP receiver (Default: false)
UDP::Configuration udp_config;
};
}

struct Configuration
{
Sinks::Configuration sinks;
Provider::Configuration provider;
Receiver::Configuration receiver;
};
}
}
2 changes: 1 addition & 1 deletion ecal/core/include/ecal/types/ecal_custom_data_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace eCAL
{
public:
ECAL_API IpAddressV4(const std::string& ip_address_);
ECAL_API IpAddressV4(const char* ip_address_);

ECAL_API std::string Get() const;

Expand All @@ -61,7 +62,6 @@ namespace eCAL

private:
ECAL_API void validateIpString(const std::string& ip_address_);
ECAL_API static void throwException(const std::string& ip_address_ = std::string(""));

std::string m_ip_address{};
};
Expand Down
17 changes: 11 additions & 6 deletions ecal/core/include/ecal/types/monitoring.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,17 @@ namespace eCAL

struct SMethodMon //<! eCAL Server Method struct
{
std::string mname; //<! method name
std::string req_type; //<! request type
std::string req_desc; //<! request descriptor
std::string resp_type; //<! response type
std::string resp_desc; //<! response descriptor
long long call_count{0}; //<! call counter
std::string mname; //<! method name

std::string req_type; //<! request type (deprecated use req_datatype)
std::string req_desc; //<! request descriptor (deprecated use req_datatype)
std::string resp_type; //<! response type (deprecated use resp_datatype)
std::string resp_desc; //<! response descriptor (deprecated use resp_datatype)

SDataTypeInformation req_datatype; //<! request datatype information (encoding & type & description)
SDataTypeInformation resp_datatype; //<! response datatype information (encoding & type & description)

long long call_count{0}; //<! call counter
};

struct SServerMon //<! eCAL Server struct
Expand Down
54 changes: 32 additions & 22 deletions ecal/core/src/config/builder/logging_attribute_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,60 +6,70 @@ namespace eCAL
{
namespace Logging
{
SAttributes BuildLoggingAttributes(const Logging::Configuration& log_config_, const Registration::Configuration& reg_config_, const TransportLayer::Configuration& tl_config_)
SProviderAttributes BuildLoggingProviderAttributes(const Logging::Configuration& log_config_, const Registration::Configuration& reg_config_, const TransportLayer::Configuration& tl_config_)
{
SAttributes attributes;
SProviderAttributes attributes;

attributes.network_enabled = reg_config_.network_enabled;
attributes.host_name = Process::GetHostName();
attributes.process_id = Process::GetProcessID();
attributes.process_name = Process::GetProcessName();
attributes.unit_name = Process::GetUnitName();
attributes.level = log_level_info;

attributes.udp.enabled = log_config_.sinks.udp.enable;
attributes.udp.port = log_config_.sinks.udp.port;
attributes.udp.filter_log = log_config_.sinks.udp.filter_log_udp;
attributes.udp_sink.enabled = log_config_.provider.udp.enable;
attributes.udp_sink.filter_log = log_config_.provider.udp.filter_log;

attributes.file.enabled = log_config_.sinks.file.enable;
attributes.file.filter_log = log_config_.sinks.file.filter_log_file;
attributes.file.path = log_config_.sinks.file.path;
if (attributes.file.path.empty())
attributes.file_sink.enabled = log_config_.provider.file.enable;
attributes.file_sink.filter_log = log_config_.provider.file.filter_log;
attributes.file_config.path = log_config_.provider.file_config.path;
if (attributes.file_config.path.empty())
{
// check ECAL_DATA
// Creates path if not exists
attributes.file.path = Util::GeteCALLogPath();
attributes.file_config.path = Util::GeteCALLogPath();
}

attributes.console.enabled = log_config_.sinks.console.enable;
attributes.console.filter_log = log_config_.sinks.console.filter_log_con;
attributes.console_sink.enabled = log_config_.provider.console.enable;
attributes.console_sink.filter_log = log_config_.provider.console.filter_log;

// UDP related configuration part
attributes.udp_sender.broadcast = !reg_config_.network_enabled;
attributes.udp_sender.loopback = reg_config_.loopback;
attributes.udp_config.broadcast = !reg_config_.network_enabled;
attributes.udp_config.loopback = reg_config_.loopback;

attributes.udp_sender.sndbuf = tl_config_.udp.send_buffer;
attributes.udp_sender.port = tl_config_.udp.port;
attributes.udp_config.sndbuf = tl_config_.udp.send_buffer;
attributes.udp_config.port = log_config_.provider.udp_config.port;

switch (tl_config_.udp.mode)
{
case Types::UDPMode::NETWORK:
attributes.udp_sender.address = tl_config_.udp.network.group;
attributes.udp_sender.ttl = tl_config_.udp.network.ttl;
attributes.udp_config.address = tl_config_.udp.network.group;
attributes.udp_config.ttl = tl_config_.udp.network.ttl;
break;
case Types::UDPMode::LOCAL:
attributes.udp_sender.address = tl_config_.udp.local.group;
attributes.udp_sender.ttl = tl_config_.udp.local.ttl;
attributes.udp_config.address = tl_config_.udp.local.group;
attributes.udp_config.ttl = tl_config_.udp.local.ttl;
break;
default:
break;
}

return attributes;
}

SReceiverAttributes BuildLoggingReceiverAttributes(const Logging::Configuration& log_config_, const Registration::Configuration& reg_config_, const TransportLayer::Configuration& tl_config_)
{
SReceiverAttributes attributes;

attributes.network_enabled = reg_config_.network_enabled;
attributes.host_name = Process::GetHostName();

attributes.receive_enabled = log_config_.receiver.enable;

attributes.udp_receiver.broadcast = !reg_config_.network_enabled;
attributes.udp_receiver.loopback = true;

attributes.udp_receiver.rcvbuf = tl_config_.udp.receive_buffer;
attributes.udp_receiver.port = tl_config_.udp.port;
attributes.udp_receiver.port = log_config_.receiver.udp_config.port;

switch (tl_config_.udp.mode)
{
Expand Down
6 changes: 4 additions & 2 deletions ecal/core/src/config/builder/logging_attribute_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

#pragma once

#include "logging/config/attributes/logging_attributes.h"
#include "logging/config/attributes/ecal_log_provider_attributes.h"
#include "logging/config/attributes/ecal_log_receiver_attributes.h"
#include "ecal/config/logging.h"
#include "ecal/config/registration.h"
#include "ecal/config/transport_layer.h"
Expand All @@ -28,6 +29,7 @@ namespace eCAL
{
namespace Logging
{
SAttributes BuildLoggingAttributes(const Logging::Configuration& log_config_, const Registration::Configuration& reg_config_, const TransportLayer::Configuration& tl_config_);
SProviderAttributes BuildLoggingProviderAttributes(const Logging::Configuration& log_config_, const Registration::Configuration& reg_config_, const TransportLayer::Configuration& tl_config_);
SReceiverAttributes BuildLoggingReceiverAttributes(const Logging::Configuration& log_config_, const Registration::Configuration& reg_config_, const TransportLayer::Configuration& tl_config_);
}
}
Loading

0 comments on commit 8e9fa32

Please sign in to comment.