mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
node-modbus: Add details and improve description
Signed-off-by: Philipp Jungkamp <Philipp.Jungkamp@opal-rt.com>
This commit is contained in:
parent
132fe1c92d
commit
a95c4af822
1 changed files with 20 additions and 2 deletions
|
@ -904,10 +904,28 @@ std::vector<int> ModbusNode::getPollFDs()
|
|||
|
||||
const std::string & ModbusNode::getDetails()
|
||||
{
|
||||
details = fmt::format("");
|
||||
if (details.empty()) {
|
||||
if (auto tcp = std::get_if<Tcp>(&connection_settings)) {
|
||||
details = fmt::format("transport=tcp, remote={}, port={}", tcp->remote, tcp->port);
|
||||
|
||||
if (tcp->unit)
|
||||
details.append(fmt::format(", unit={}", *tcp->unit));
|
||||
}
|
||||
|
||||
if (auto rtu = std::get_if<Rtu>(&connection_settings)) {
|
||||
details = fmt::format("transport=rtu, device={}, baudrate={}, parity={}, data_bits={}, stop_bits={}, unit={}",
|
||||
rtu->device.c_str(),
|
||||
rtu->baudrate,
|
||||
static_cast<char>(rtu->parity),
|
||||
rtu->data_bits,
|
||||
rtu->stop_bits,
|
||||
rtu->unit);
|
||||
}
|
||||
}
|
||||
|
||||
return details;
|
||||
}
|
||||
|
||||
static char name[] = "modbus";
|
||||
static char description[] = "read and write Modbus registers as a client";
|
||||
static char description[] = "Read and write Modbus registers";
|
||||
static NodePlugin<ModbusNode, name, description, (int) NodeFactory::Flags::SUPPORTS_READ | (int) NodeFactory::Flags::SUPPORTS_WRITE | (int) NodeFactory::Flags::SUPPORTS_POLL> p;
|
||||
|
|
Loading…
Add table
Reference in a new issue