Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions ecal/core/include/ecal/config/registration.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ namespace eCAL
{
struct Configuration
{
std::string domain { "ecal_mon" }; //!< Domain name for shared memory based registration (Default: ecal_mon)
size_t queue_size { 1024 }; //!< Queue size of registration events (Default: 1024)
std::string domain { "ecal_mon" }; //!< Domain name for shared memory based registration (Default: ecal_mon)
size_t queue_size { 1024 }; //!< Queue size of registration events (Default: 1024)
unsigned int receive_poll_ms { 15U }; //!< Polling period in ms for receiving shared memory registration events (Default: 15)
};
}

Expand Down Expand Up @@ -99,4 +100,4 @@ namespace eCAL
Network::Configuration network;
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace eCAL

attr.shm.domain = reg_config.local.shm.domain;
attr.shm.queue_size = reg_config.local.shm.queue_size;
attr.shm.receive_poll_ms = reg_config.local.shm.receive_poll_ms;

switch (config_.communication_mode)
{
Expand Down Expand Up @@ -78,4 +79,4 @@ namespace eCAL

return attr;
}
}
}
8 changes: 5 additions & 3 deletions ecal/core/src/config/configuration_to_yaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,17 @@ namespace YAML
Node convert<eCAL::Registration::Local::SHM::Configuration>::encode(const eCAL::Registration::Local::SHM::Configuration& config_)
{
Node node;
node["domain"] = config_.domain;
node["queue_size"] = config_.queue_size;
node["domain"] = config_.domain;
node["queue_size"] = config_.queue_size;
node["receive_poll_ms"] = config_.receive_poll_ms;
return node;
}

bool convert<eCAL::Registration::Local::SHM::Configuration>::decode(const Node& node_, eCAL::Registration::Local::SHM::Configuration& config_)
{
AssignValue<std::string>(config_.domain, node_, "domain");
AssignValue<size_t>(config_.queue_size, node_, "queue_size");
AssignValue<unsigned int>(config_.receive_poll_ms, node_, "receive_poll_ms");
return true;
}

Expand Down Expand Up @@ -707,4 +709,4 @@ namespace YAML

return true;
}
}
}
4 changes: 3 additions & 1 deletion ecal/core/src/config/default_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ namespace eCAL
ss << R"( domain: )" << quoteString(config_.registration.local.shm.domain) << "\n";
ss << R"( # Queue size of registration events)" << "\n";
ss << R"( queue_size: )" << config_.registration.local.shm.queue_size << "\n";
ss << R"( # Polling period in milliseconds for SHM registration receive loop)" << "\n";
ss << R"( receive_poll_ms: )" << config_.registration.local.shm.receive_poll_ms << "\n";
ss << R"( udp:)" << "\n";
ss << R"( # Specify port for local registration traffic)" << "\n";
ss << R"( port: )" << config_.registration.local.udp.port << "\n";
Expand Down Expand Up @@ -402,4 +404,4 @@ namespace eCAL
return ss;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace eCAL
{
std::string domain;
size_t queue_size;
unsigned int receive_poll_ms;
};

struct SAttributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ namespace eCAL

sender_attr.domain = provider_attr_.shm.domain;
sender_attr.queue_size = provider_attr_.shm.queue_size;
sender_attr.receive_poll_ms = provider_attr_.shm.receive_poll_ms;

return sender_attr;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ namespace eCAL
{
struct SAttributes
{
std::string domain;
size_t queue_size;
std::string domain;
size_t queue_size;
unsigned int receive_poll_ms;
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace eCAL
m_memfile_broadcast_reader->Bind(m_memfile_broadcast.get());

m_memfile_broadcast_reader_thread = std::make_unique<CCallbackThread>(std::bind(&CRegistrationReceiverSHM::Receive, this));
m_memfile_broadcast_reader_thread->start(std::chrono::milliseconds(Config::GetRegistrationRefreshMs() / 2));
m_memfile_broadcast_reader_thread->start(std::chrono::milliseconds(attr_.receive_poll_ms));
}

CRegistrationReceiverSHM::~CRegistrationReceiverSHM()
Expand Down
2 changes: 2 additions & 0 deletions ecal/tests/cpp/config_test/src/yaml_processing_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ TEST(core_cpp_config_yaml /*unused*/, yaml_processing_comparison /*unused*/)
config.registration.local.transport_type = eCAL::Registration::Local::eTransportType::shm;
config.registration.local.shm.domain = "ecal_don";
config.registration.local.shm.queue_size = 2048;
config.registration.local.shm.receive_poll_ms = 12;
config.registration.local.udp.port = 15000;
// There is unfortunately only one transport type
config.registration.network.transport_type = eCAL::Registration::Network::eTransportType::udp;
Expand Down Expand Up @@ -113,6 +114,7 @@ TEST(core_cpp_config_yaml /*unused*/, yaml_processing_comparison /*unused*/)
EXPECT_EQ(config.registration.local.transport_type, config_from_yaml.registration.local.transport_type);
EXPECT_EQ(config.registration.local.shm.domain, config_from_yaml.registration.local.shm.domain);
EXPECT_EQ(config.registration.local.shm.queue_size, config_from_yaml.registration.local.shm.queue_size);
EXPECT_EQ(config.registration.local.shm.receive_poll_ms, config_from_yaml.registration.local.shm.receive_poll_ms);
EXPECT_EQ(config.registration.local.udp.port, config_from_yaml.registration.local.udp.port);
EXPECT_EQ(config.registration.network.transport_type, config_from_yaml.registration.network.transport_type);
EXPECT_EQ(config.registration.network.udp.port, config_from_yaml.registration.network.udp.port);
Expand Down
3 changes: 2 additions & 1 deletion lang/c/core/include/ecal_c/config/registration.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct eCAL_Registration_Local_SHM_Configuration
{
const char* domain; //!< Domain name for shared memory based registration (Default: ecal_mon)
size_t queue_size; //!< Queue size of registration events (Default: 1024)
unsigned int receive_poll_ms; //!< Polling period in ms for receiving shared memory registration events (Default: 15)
};

struct eCAL_Registration_Local_UDP_Configuration
Expand Down Expand Up @@ -77,4 +78,4 @@ struct eCAL_Registration_Configuration
struct eCAL_Registration_Network_Configuration network;
};

#endif /* ecal_c_config_registration_h_included */
#endif /* ecal_c_config_registration_h_included */
4 changes: 3 additions & 1 deletion lang/c/core/src/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ void Assign_Registration_Configuration(struct eCAL_Registration_Configuration* c

configuration_c_->local.shm.domain = configuration_.local.shm.domain.c_str();
configuration_c_->local.shm.queue_size = configuration_.local.shm.queue_size;
configuration_c_->local.shm.receive_poll_ms = configuration_.local.shm.receive_poll_ms;

configuration_c_->local.udp.port = configuration_.local.udp.port;

Expand Down Expand Up @@ -409,6 +410,7 @@ void Assign_Registration_Configuration(eCAL::Registration::Configuration& config
configuration_.local.transport_type = Convert_Registration_Local_eTransportType(configuration_c_->local.transport_type);
configuration_.local.shm.domain = configuration_c_->local.shm.domain != NULL ? configuration_c_->local.shm.domain : "";
configuration_.local.shm.queue_size = configuration_c_->local.shm.queue_size;
configuration_.local.shm.receive_poll_ms = configuration_c_->local.shm.receive_poll_ms;
configuration_.local.udp.port = configuration_c_->local.udp.port;

// Assign Network::Configuration
Expand Down Expand Up @@ -528,4 +530,4 @@ extern "C"
assert(configuration_ != NULL);
return configuration_->_impl->handle.GetConfigurationFilePath().c_str();
}
}
}
3 changes: 2 additions & 1 deletion lang/c/tests/config_test/src/config_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ TEST_F(config_test_c, Registration)
EXPECT_STREQ(configuration0->registration.shm_transport_domain, eCAL_GetConfiguration()->registration.shm_transport_domain);
EXPECT_EQ(configuration0->registration.local.shm.queue_size, eCAL_Config_GetShmMonitoringQueueSize());
EXPECT_EQ(configuration0->registration.local.shm.queue_size, eCAL_GetConfiguration()->registration.local.shm.queue_size);
EXPECT_EQ(configuration0->registration.local.shm.receive_poll_ms, eCAL_GetConfiguration()->registration.local.shm.receive_poll_ms);
EXPECT_STREQ(configuration0->registration.local.shm.domain, eCAL_Config_GetShmMonitoringDomain());
EXPECT_STREQ(configuration0->registration.local.shm.domain, eCAL_GetConfiguration()->registration.local.shm.domain);

Expand Down Expand Up @@ -170,4 +171,4 @@ TEST_F(config_test_c, Publisher)
{
EXPECT_EQ(configuration0->publisher.layer_priority_remote[i], eCAL_GetConfiguration()->publisher.layer_priority_remote[i]);
}
}
}
2 changes: 2 additions & 0 deletions lang/csharp/Eclipse.eCAL.Core.Test/ConfigTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public void TestConfigPassing()
config.Registration.Local.TransportType = 0; // eCAL::Registration::Local::eTransportType::shm
config.Registration.Local.SHM.Domain = "ecal_don";
config.Registration.Local.SHM.QueueSize = 2048;
config.Registration.Local.SHM.ReceivePollMs = 12;
config.Registration.Local.UDP.Port = 15000;
config.Registration.Network.TransportType = 0; // eCAL::Registration::Network::eTransportType::udp
config.Registration.Network.UDP.Port = 16000;
Expand Down Expand Up @@ -128,6 +129,7 @@ public void TestConfigPassing()
Assert.AreEqual(config.Registration.Local.TransportType, ecalConfig.Registration.Local.TransportType, "Local.TransportType mismatch");
Assert.AreEqual(config.Registration.Local.SHM.Domain, ecalConfig.Registration.Local.SHM.Domain, "Local.SHM.Domain mismatch");
Assert.AreEqual(config.Registration.Local.SHM.QueueSize, ecalConfig.Registration.Local.SHM.QueueSize, "Local.SHM.QueueSize mismatch");
Assert.AreEqual(config.Registration.Local.SHM.ReceivePollMs, ecalConfig.Registration.Local.SHM.ReceivePollMs, "Local.SHM.ReceivePollMs mismatch");
Assert.AreEqual(config.Registration.Local.UDP.Port, ecalConfig.Registration.Local.UDP.Port, "Local.UDP.Port mismatch");
Assert.AreEqual(config.Registration.Network.TransportType, ecalConfig.Registration.Network.TransportType, "Network.TransportType mismatch");
Assert.AreEqual(config.Registration.Network.UDP.Port, ecalConfig.Registration.Network.UDP.Port, "Network.UDP.Port mismatch");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,27 @@ namespace Eclipse {
public:
property System::String^ Domain;
property size_t QueueSize;
property unsigned int ReceivePollMs;

RegistrationLocalSHMConfiguration() {
::eCAL::Registration::Local::SHM::Configuration native_config;
Domain = Internal::StlStringToString(native_config.domain);
QueueSize = native_config.queue_size;
ReceivePollMs = native_config.receive_poll_ms;
}

// Native struct constructor
RegistrationLocalSHMConfiguration(const ::eCAL::Registration::Local::SHM::Configuration& native_config) {
Domain = Internal::StlStringToString(native_config.domain);
QueueSize = native_config.queue_size;
ReceivePollMs = native_config.receive_poll_ms;
}

::eCAL::Registration::Local::SHM::Configuration ToNative() {
::eCAL::Registration::Local::SHM::Configuration native_config;
native_config.domain = Internal::StringToStlString(Domain);
native_config.queue_size = QueueSize;
native_config.receive_poll_ms = ReceivePollMs;
return native_config;
}
};
Expand Down Expand Up @@ -263,4 +267,4 @@ namespace Eclipse {
} // namespace Config
} // namespace Core
} // namespace eCAL
} // namespace Eclipse
} // namespace Eclipse
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ void AddConfigRegistration(nanobind::module_& module)
nb::class_<eCAL::Registration::Local::SHM::Configuration>(module, "LocalSHMConfig")
.def(nb::init<>())
.def_rw("domain", &eCAL::Registration::Local::SHM::Configuration::domain)
.def_rw("queue_size", &eCAL::Registration::Local::SHM::Configuration::queue_size);
.def_rw("queue_size", &eCAL::Registration::Local::SHM::Configuration::queue_size)
.def_rw("receive_poll_ms", &eCAL::Registration::Local::SHM::Configuration::receive_poll_ms);

// Local::UDP::Configuration
nb::class_<eCAL::Registration::Local::UDP::Configuration>(module, "LocalUDPConfig")
Expand Down Expand Up @@ -74,4 +75,4 @@ void AddConfigRegistration(nanobind::module_& module)
.def_rw("shm_transport_domain", &eCAL::Registration::Configuration::shm_transport_domain)
.def_rw("local", &eCAL::Registration::Configuration::local)
.def_rw("network", &eCAL::Registration::Configuration::network);
}
}
Loading