diff --git a/include/villas/nodes/iec60870.hpp b/include/villas/nodes/iec60870.hpp index c0ffcabcf..a454b73d6 100644 --- a/include/villas/nodes/iec60870.hpp +++ b/include/villas/nodes/iec60870.hpp @@ -136,22 +136,22 @@ class SlaveNode : public Node { protected: struct Server { // slave state - enum { NONE, STOPPED, READY } state = NONE; + enum { NONE, STOPPED, READY } state; // config (use explicit defaults) - std::string local_address = "0.0.0.0"; - int local_port = 2404; - int common_address = 1; - int low_priority_queue = 100; - int high_priority_queue = 100; + std::string local_address; + int local_port; + int common_address; + int low_priority_queue; + int high_priority_queue; // config (use lib60870 defaults if std::nullopt) - std::optional apci_t0 = std::nullopt; - std::optional apci_t1 = std::nullopt; - std::optional apci_t2 = std::nullopt; - std::optional apci_t3 = std::nullopt; - std::optional apci_k = std::nullopt; - std::optional apci_w = std::nullopt; + std::optional apci_t0; + std::optional apci_t1; + std::optional apci_t2; + std::optional apci_t3; + std::optional apci_k; + std::optional apci_w; // lib60870 CS104_Slave slave; @@ -159,13 +159,12 @@ protected: } server; struct Output { - // config bool enabled = false; - std::vector mapping = {}; - std::vector asdu_types = {}; + std::vector mapping; + std::vector asdu_types; mutable std::mutex last_values_mutex; - std::vector last_values = {}; + std::vector last_values; } output; void createSlave() noexcept; diff --git a/lib/nodes/iec60870.cpp b/lib/nodes/iec60870.cpp index 3faf13c01..88d82ba15 100644 --- a/lib/nodes/iec60870.cpp +++ b/lib/nodes/iec60870.cpp @@ -311,7 +311,8 @@ bool ASDUData::addSampleToASDU(CS101_ASDU &asdu, ASDUData::Sample sample) const } ASDUData::ASDUData(ASDUData::Descriptor const *descriptor, int ioa, int ioa_sequence_start) : ioa(ioa), ioa_sequence_start(ioa_sequence_start), descriptor(descriptor) -{} +{ +} void SlaveNode::createSlave() noexcept { @@ -576,6 +577,28 @@ int SlaveNode::_write(Sample *samples[], unsigned sample_count) SlaveNode::SlaveNode(const std::string &name) : Node(name) { + server.state = SlaveNode::Server::NONE; + + // server config (use explicit defaults) + server.local_address = "0.0.0.0"; + server.local_port = 2404; + server.common_address = 1; + server.low_priority_queue = 100; + server.high_priority_queue = 100; + + // config (use lib60870 defaults if std::nullopt) + server.apci_t0 = std::nullopt; + server.apci_t1 = std::nullopt; + server.apci_t2 = std::nullopt; + server.apci_t3 = std::nullopt; + server.apci_k = std::nullopt; + server.apci_w = std::nullopt; + + // output config + output.enabled = false; + output.mapping = {}; + output.asdu_types = {}; + output.last_values = {}; } SlaveNode::~SlaveNode()