Update readme for modbus tool
parent
62f78f5e90
commit
70dc99a33f
|
|
@ -24,7 +24,7 @@ The basic structure of the modbus register JSON looks like following example:
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
"className": "MyConnection",
|
"className": "MyConnection",
|
||||||
"protocols": [ "TCP" ],
|
"protocol": "BOTH",
|
||||||
"endianness": "BigEndian",
|
"endianness": "BigEndian",
|
||||||
"enums": [
|
"enums": [
|
||||||
{
|
{
|
||||||
|
|
@ -108,7 +108,6 @@ The source code files will be calld:
|
||||||
* `classnameprotocolconnection.cpp`
|
* `classnameprotocolconnection.cpp`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Protocol
|
## Protocol
|
||||||
|
|
||||||
Depending on the communication protocol, a different base class will be used for the resulting output class.
|
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.
|
In order to get always the latest generated code from this tool, the entire process can be automated.
|
||||||
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.
|
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue