Update readme for modbus tool

pull/65/head
Simon Stürz 2022-06-03 08:46:35 +02:00
parent 62f78f5e90
commit 70dc99a33f
1 changed files with 9 additions and 14 deletions

View File

@ -24,7 +24,7 @@ The basic structure of the modbus register JSON looks like following example:
```
{
"className": "MyConnection",
"protocols": [ "TCP" ],
"protocol": "BOTH",
"endianness": "BigEndian",
"enums": [
{
@ -108,7 +108,6 @@ The source code files will be calld:
* `classnameprotocolconnection.cpp`
## Protocol
Depending on the communication protocol, a different base class will be used for the resulting output class.
@ -220,20 +219,16 @@ Example block:
]
# Example
# Autogenerate modbus classes
Change into your plugin sub directory.
Assuming you wrote the registers.json file you can run now following command to generate your modbus class:
`$ python3 ../modbus/tools/generate-connection.py -j registers.json -o . -c MyModbus`
You the result will be a header and a source file called:
* `mymodbustcpconnection.h`
* `mymodbustcpconnection.cpp`
You can include this class in your project and provide one connection per thing.
In order to get always the latest generated code from this tool, the entire process can be automated.
Assuming you have defined the registers in the `my-registers.json` within your plugin directory, and following lines to your plugin project file and run `qmake`.
# Generate modbus connection
MODBUS_CONNECTIONS += my-registers.json
include(../modbus.pri)
If you want to get information about the autogenerating class process, you can add `MODBUS_TOOLS_CONFIG += VERBOSE` in order to get much more information of the process.
Once you run qmake, in the build directory the autogenerated classes can be found. Also in your project you can find the generated classes for inspection.