Add README for nymea-modbus-cli
parent
2d102156d0
commit
1d38c317ce
|
|
@ -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 <contact@nymea.io>
|
||||||
|
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Displays this help.
|
||||||
|
-v, --version Displays version information.
|
||||||
|
-a, --address <address> The IP address of the modbus
|
||||||
|
TCP server.
|
||||||
|
-p, --port <port> The port of the modbus TCP
|
||||||
|
server. Default is 502.
|
||||||
|
-m, --modbus-address <id> The modbus server address on
|
||||||
|
the bus (slave ID). Default is
|
||||||
|
1.
|
||||||
|
-t, --type <input, holding, discrete, coils> The type of the modbus
|
||||||
|
register. Default is holding.
|
||||||
|
-r, --register <register> The number of the modbus
|
||||||
|
register.
|
||||||
|
-l, --length <length> The number of registers to
|
||||||
|
read. Default is 1.
|
||||||
|
-d, --debug Print more information.
|
||||||
|
|
||||||
|
|
@ -169,6 +169,8 @@ int main(int argc, char *argv[])
|
||||||
quint16 registerNumber = unit.startAddress() + i;
|
quint16 registerNumber = unit.startAddress() + i;
|
||||||
qInfo() << "-->" << registerNumber << ":" << QString("0x%1").arg(registerValue, 4, 16, QLatin1Char('0')) << registerValue;
|
qInfo() << "-->" << registerNumber << ":" << QString("0x%1").arg(registerValue, 4, 16, QLatin1Char('0')) << registerValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(reply, &QModbusReply::errorOccurred, client, [=] (QModbusDevice::Error error){
|
QObject::connect(reply, &QModbusReply::errorOccurred, client, [=] (QModbusDevice::Error error){
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue