From 1d38c317ce5d5b2c3a036988f1c0fe88dd5847a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Fri, 22 Jul 2022 14:07:53 +0200 Subject: [PATCH] Add README for nymea-modbus-cli --- nymea-modbus-cli/README.md | 33 +++++++++++++++++++++++++++++++++ nymea-modbus-cli/main.cpp | 2 ++ 2 files changed, 35 insertions(+) create mode 100644 nymea-modbus-cli/README.md diff --git a/nymea-modbus-cli/README.md b/nymea-modbus-cli/README.md new file mode 100644 index 0000000..ae1dea3 --- /dev/null +++ b/nymea-modbus-cli/README.md @@ -0,0 +1,33 @@ +# nymea-modbus-cli + +The nymea-modbus-cli tools is a command line tool for tsting modbus TCP communication in the local network. + +As of now, the tool allows to establish a modbus TCP connection to a server and read any type of register from the server. + +Following options are available: + + Usage: nymea-modbus-cli [options] + + Tool for testing and reading Modbus TCP registers. + + Copyright © 2016 - 2022 nymea GmbH + + + Options: + -h, --help Displays this help. + -v, --version Displays version information. + -a, --address
The IP address of the modbus + TCP server. + -p, --port The port of the modbus TCP + server. Default is 502. + -m, --modbus-address The modbus server address on + the bus (slave ID). Default is + 1. + -t, --type The type of the modbus + register. Default is holding. + -r, --register The number of the modbus + register. + -l, --length The number of registers to + read. Default is 1. + -d, --debug Print more information. + \ No newline at end of file diff --git a/nymea-modbus-cli/main.cpp b/nymea-modbus-cli/main.cpp index 4e58aa1..e826da8 100644 --- a/nymea-modbus-cli/main.cpp +++ b/nymea-modbus-cli/main.cpp @@ -169,6 +169,8 @@ int main(int argc, char *argv[]) quint16 registerNumber = unit.startAddress() + i; qInfo() << "-->" << registerNumber << ":" << QString("0x%1").arg(registerValue, 4, 16, QLatin1Char('0')) << registerValue; } + + exit(EXIT_SUCCESS); }); QObject::connect(reply, &QModbusReply::errorOccurred, client, [=] (QModbusDevice::Error error){