modbus-tools: Add missing convert methods for int64 and uint64 and fix typos
This commit is contained in:
parent
13832f5599
commit
0e9ecd9d36
@ -9,7 +9,7 @@ The basic workflow looks like this:
|
||||
* Include the modbus library project include file *after* the connections definition: `include(../modbus.pri)`
|
||||
* Run qmake on your project. The generated connection classes can be found in the build directory and will be included automatically into your project.
|
||||
|
||||
The easiest way to see how to use the generated connection classes is to look at existing implemntations.
|
||||
The easiest way to see how to use the generated connection classes is to look at existing implementations.
|
||||
|
||||
# JSON format
|
||||
|
||||
@ -101,7 +101,7 @@ The class will be defined as
|
||||
|
||||
* `<ClassName><Protocol>Connection`.
|
||||
|
||||
The source code files will be calld:
|
||||
The source code files will be called:
|
||||
|
||||
* `classnameprotocolconnection.h`
|
||||
* `classnameprotocolconnection.cpp`
|
||||
@ -124,9 +124,9 @@ If the modbus device supports both protocols and you want to generate a class fo
|
||||
|
||||
# RTU reachable
|
||||
|
||||
For modbus RTU it can be the case that the hardware resource is connected, but the target device is not connected on the serial line or does not respond. For those situations a mechanis has been introduce which will mark a device as not reachable if a certain amount of error occurred in a row without any successfull communication. Both, the RTU hardware resource `connected` state and the communication working state get represented by the `reachable` property of the RTU connection class.
|
||||
For modbus RTU it can be the case that the hardware resource is connected, but the target device is not connected on the serial line or does not respond. For those situations a mechanism, has been introduce which will mark a device as not reachable if a certain amount of error occurred in a row without any successful communication. Both, the RTU hardware resource `connected` state and the communication working state get represented by the `reachable` property of the RTU connection class.
|
||||
|
||||
Depending on your device the amount of errors in a row can vary and can be specified using the `errorLimitUntilNotReachable` property. If not specified, a default of `10` will be assumend.
|
||||
Depending on your device the amount of errors in a row can vary and can be specified using the `errorLimitUntilNotReachable` property. If not specified, a default of `10` will be assumed.
|
||||
|
||||
In order to check if the device is reachable, a register can be defined by the developer as a test register.
|
||||
For this purpose the `checkReachableRegister` property has been introduced. The property describes the `id` of the register which will be used for testing the communication. The register should be mandatory on the device
|
||||
@ -144,26 +144,26 @@ There are 2 possibilities:
|
||||
|
||||
## String endianness
|
||||
|
||||
When converting multiple registers to a string, some modbus devices use a different endianess within a register.
|
||||
One register contains 2 bytes, miltiple registers in a row build up a string. The string endianess tells the generated class how to parse those strings.
|
||||
When converting multiple registers to a string, some modbus devices use a different endianness within a register.
|
||||
One register contains 2 bytes, multiple registers in a row build up a string. The string endianness tells the generated class how to parse those strings.
|
||||
|
||||
There are 2 possibilities:
|
||||
|
||||
* `BigEndian`: default if not specified: register bytes come in following order `[0, 1], [2, 3]`: `ABCD`
|
||||
* `LittleEndian`: register bytes come in following order `[1, 0] [3, 2]`: `BADC`
|
||||
|
||||
Please not that the overall endianess of the device does not change the order of the register regarding strings since in modbus a normal register is definded as big endian. Only multiple registers combined to a numeric data type will be taken into account by the `endianess` property.
|
||||
Please not that the overall endianness of the device does not change the order of the register regarding strings since in modbus a normal register is defined as big endian. Only multiple registers combined to a numeric data type will be taken into account by the `endianness` property.
|
||||
|
||||
## Enums
|
||||
|
||||
Many modbus devices provide inforation using `Enums`, indicating a special state trough a defined list of values. If a register implements an enum, you can define it in the `enums` section. The `name` property defines the name of the enum, and the script will generate a c++ enum definition from this section. Each enum value will then be generated using `<EnumName><EnumValueName> = <value>`.
|
||||
Many modbus devices provide information using `Enums`, indicating a special state trough a defined list of values. If a register implements an enum, you can define it in the `enums` section. The `name` property defines the name of the enum, and the script will generate a c++ enum definition from this section. Each enum value will then be generated using `<EnumName><EnumValueName> = <value>`.
|
||||
|
||||
If a register represets an enum, you simply add the property `"enum": "NameOfEnum"` in the register map and the property will be defined using the resulting enum type. All convertion between enum and resulting modbus register value will be done automatically.
|
||||
If a register represents an enum, you simply add the property `"enum": "NameOfEnum"` in the register map and the property will be defined using the resulting enum type. All conversion between enum and resulting modbus register value will be done automatically.
|
||||
|
||||
|
||||
## Queued requests
|
||||
|
||||
Some modbus devices can process only one request at the time, and sometimes even require a delay between requests. For this purpose the boolean property `queuedRequests` and integer property `queuedRequestsDelay` (milliseconds) property hase been introdiced. By default, requests are not queued and the delay 0 ms.
|
||||
Some modbus devices can process only one request at the time, and sometimes even require a delay between requests. For this purpose the boolean property `queuedRequests` and integer property `queuedRequestsDelay` (milliseconds) property has been introduced. By default, requests are not queued and the delay 0 ms.
|
||||
|
||||
```
|
||||
{
|
||||
@ -178,15 +178,15 @@ Some modbus devices can process only one request at the time, and sometimes even
|
||||
|
||||
### init
|
||||
|
||||
In most plugins you have the situation where you need to read some registers only once like serialnumbers or product identifiers right after beeing connected or even before you set up the thing in the plugin.
|
||||
In most plugins you have the situation where you need to read some registers only once like serial numbers or product identifiers right after being connected or even before you set up the thing in the plugin.
|
||||
|
||||
For this purpose the `initialize()` method has been provided. If you call `initialize()` the connection will start reading all registers and blocks with `"readSchedule": "init"` defined and emits the signal `initializationFinished(bool success)` once all registers and blocks have been read successfully or on the first occured error. If the `success` parameter is `false`, something went wrong during intialization. Since any error will make the initialization process fail, it is important that the `init` registers are *mandatory* on the device.
|
||||
For this purpose the `initialize()` method has been provided. If you call `initialize()` the connection will start reading all registers and blocks with `"readSchedule": "init"` defined and emits the signal `initializationFinished(bool success)` once all registers and blocks have been read successfully or on the first occurred error. If the `success` parameter is `false`, something went wrong during initialization. Since any error will make the initialization process fail, it is important that the `init` registers are *mandatory* on the device.
|
||||
|
||||
This method can also be used to identify the device if implemented properly, or to check if the device has the expected registers available with the given datatype.
|
||||
|
||||
### update
|
||||
|
||||
In order to make the poll process as easy as possible, you can define the `readSchedule` as `update` for all registers and blocks you requier a preiodical update. If you call the `update()` method the connection will start reading all registers and blocks with `"readSchedule": "update"` and the properties will be updated internally. If a property value has changed, the `<propertyName>Changed()` signal will be emitted. If the property has been read (independet if changed or not) the `<propertyName>ReadFinished()` signal will be emitted.
|
||||
In order to make the poll process as easy as possible, you can define the `readSchedule` as `update` for all registers and blocks you require a periodical update. If you call the `update()` method the connection will start reading all registers and blocks with `"readSchedule": "update"` and the properties will be updated internally. If a property value has changed, the `<propertyName>Changed()` signal will be emitted. If the property has been read (independent if changed or not) the `<propertyName>ReadFinished()` signal will be emitted.
|
||||
|
||||
|
||||
## Registers
|
||||
@ -208,8 +208,8 @@ Earch register will be defined as a property in the resulting class modbus TCP c
|
||||
* `string` : will be converted to `QString`
|
||||
* `readSchedule`: Optional. Defines when the register needs to be fetched. If no read schedule has been defined, the class will provide only the default access methods, but will not read the value during `initialize()` or `update()` calls. See [#read-schedules](Read schedules) for more information. Possible values are:
|
||||
* `init`: The register will be fetched during initialization.
|
||||
* `update`: The register will be feched each time the `update()` method will be called.
|
||||
* `enum`: Optional: If the given data type represents an enum value, this propery can be set to the name of the used enum from the `enum` definition. The class will take care internally about the data convertion from and to the enum values.
|
||||
* `update`: The register will be fetched each time the `update()` method will be called.
|
||||
* `enum`: Optional: If the given data type represents an enum value, this property can be set to the name of the used enum from the `enum` definition. The class will take care internally about the data conversion from and to the enum values.
|
||||
* `description`: Mandatory. A clear description of the register.
|
||||
* `unit`: Optional. Represents the unit of this register value.
|
||||
* `registerType`: Optional. Represents the type of the register and how to read/write it. Default is `holdingRegister`. Possible values are:
|
||||
@ -217,9 +217,9 @@ Earch register will be defined as a property in the resulting class modbus TCP c
|
||||
* `inputRegister`
|
||||
* `coils`
|
||||
* `discreteInputs`
|
||||
* `access`: Mandatory. Describes the access to this register. Possible valies are:
|
||||
* `RO`: Read only access. Only the get method and the changed singal will be defined.
|
||||
* `RW`: Read and write access. Also a set mehtod will be defined.
|
||||
* `access`: Mandatory. Describes the access to this register. Possible values are:
|
||||
* `RO`: Read only access. Only the get method and the changed signal will be defined.
|
||||
* `RW`: Read and write access. Also a set method will be defined.
|
||||
* `WO`: Write only. Only the set method will be defined.
|
||||
* `scaleFactor`: Optional. The name of the scale factor register to convert this value to float. `floatValue = intValue * 10^scaleFactor value`. The scale factor value is normally a `int16` value, i.e. -10 or 10
|
||||
* `staticScaleFactor`: Optional. Use this static scale factor to convert this register value to float. `floatValue = registerValue * 10^staticScaleFactor`. The scale factor value is normally a `int16` value, i.e. -10 or 10
|
||||
@ -229,14 +229,14 @@ Earch register will be defined as a property in the resulting class modbus TCP c
|
||||
|
||||
On many device it is possible to read multiple registers in one modbus call. This can improve speed significantly when reading many register addresses which are in a row.
|
||||
|
||||
> Important: all registers within the block must exist, be in a row with no gaps inbetween and from the same function type!
|
||||
> Important: all registers within the block must exist, be in a row with no gaps in between and from the same function type!
|
||||
|
||||
A block sequence looks like this and will define a read method for reading the entwire block. Writing multiple blocks is currently not supported since not needed so far, but could be added too. In any case, all registers must be read or written, never have combinations.
|
||||
A block sequence looks like this and will define a read method for reading the entire block. Writing multiple blocks is currently not supported since not needed so far, but could be added too. In any case, all registers must be read or written, never have combinations.
|
||||
|
||||
* `id`: Mandatory. The id defines the name of the block used in the resulting class.
|
||||
* `readSchedule`: Optional. Defines when the register needs to be fetched. If no read schedule has been defined, the class will provide only the update methods, but will not read the value during `initialize()` or `update()` calls. Possible values are:
|
||||
* `init`: The register will be fetched during initialization. Once all `init `registers have been fetched, the `initializationFinished()` signal will be emitted.
|
||||
* `update`: The register will be feched each time the `update()` method will be called.
|
||||
* `update`: The register will be fetched each time the `update()` method will be called.
|
||||
* `registers`: Mandatory. The list of registers within the block. Please see the [Registers](#register) definition for more details about registers. The must be from the same register type, the same access type and there are no gaps allowed.
|
||||
|
||||
Example block:
|
||||
@ -279,6 +279,6 @@ Assuming you have defined the registers in the `my-registers.json` within your p
|
||||
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.
|
||||
If you want to get information about the autogenerate 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.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Copyright 2021 - 2024, nymea GmbH
|
||||
# Copyright 2021 - 2025, nymea GmbH
|
||||
# Contact: contact@nymea.io
|
||||
#
|
||||
# This file is part of nymea.
|
||||
@ -236,7 +236,7 @@ def writeInternalBlockReadMethodDeclarationsRtu(fileDescriptor, blockDefinitions
|
||||
registerCount += 1
|
||||
blockSize += blockRegister['size']
|
||||
|
||||
writeLine(fileDescriptor, ' /* Read block from start addess %s with size of %s registers containing following %s properties:' % (blockStartAddress, blockSize, registerCount))
|
||||
writeLine(fileDescriptor, ' /* Read block from start address %s with size of %s registers containing following %s properties:' % (blockStartAddress, blockSize, registerCount))
|
||||
for i, registerDefinition in enumerate(blockRegisters):
|
||||
if 'unit' in registerDefinition and registerDefinition['unit'] != '':
|
||||
writeLine(fileDescriptor, ' - %s [%s] - Address: %s, Size: %s' % (registerDefinition['description'], registerDefinition['unit'], registerDefinition['address'], registerDefinition['size']))
|
||||
@ -291,35 +291,35 @@ def writeTestReachabilityImplementationsRtu(fileDescriptor, className, registerD
|
||||
|
||||
writeLine(fileDescriptor, 'void %s::testReachability()' % (className))
|
||||
writeLine(fileDescriptor, '{')
|
||||
writeLine(fileDescriptor, ' if (m_checkRechableReply)')
|
||||
writeLine(fileDescriptor, ' if (m_checkReachableReply)')
|
||||
writeLine(fileDescriptor, ' return;')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' // Try to read the check reachability register %s in order to verify if the communication is working or not.' % checkReachableRegister['id'])
|
||||
writeLine(fileDescriptor, ' qCDebug(dc%s()) << "--> Test reachability by reading \\"%s\\" register:" << %s << "size:" << %s;' % (className, checkReachableRegister['description'], checkReachableRegister['address'], checkReachableRegister['size']))
|
||||
writeLine(fileDescriptor, ' m_checkRechableReply = read%s();' % (propertyName[0].upper() + propertyName[1:]))
|
||||
writeLine(fileDescriptor, ' if (!m_checkRechableReply) {')
|
||||
writeLine(fileDescriptor, ' m_checkReachableReply = read%s();' % (propertyName[0].upper() + propertyName[1:]))
|
||||
writeLine(fileDescriptor, ' if (!m_checkReachableReply) {')
|
||||
writeLine(fileDescriptor, ' qCDebug(dc%s()) << "Error occurred verifying reachability by reading \\"%s\\" register";' % (className, checkReachableRegister['description']))
|
||||
writeLine(fileDescriptor, ' onReachabilityCheckFailed();')
|
||||
writeLine(fileDescriptor, ' return;')
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' if (m_checkRechableReply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' m_checkRechableReply = nullptr;')
|
||||
writeLine(fileDescriptor, ' if (m_checkReachableReply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' m_checkReachableReply = nullptr;')
|
||||
writeLine(fileDescriptor, ' onReachabilityCheckFailed();')
|
||||
writeLine(fileDescriptor, ' return;')
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' connect(m_checkRechableReply, &ModbusRtuReply::finished, this, [this](){')
|
||||
writeLine(fileDescriptor, ' connect(m_checkReachableReply, &ModbusRtuReply::finished, this, [this](){')
|
||||
writeLine(fileDescriptor, ' // Note: we don\'t care about the result here, only the error')
|
||||
writeLine(fileDescriptor, ' handleModbusError(m_checkRechableReply->error());')
|
||||
writeLine(fileDescriptor, ' if (m_checkRechableReply->error() != ModbusRtuReply::NoError)')
|
||||
writeLine(fileDescriptor, ' handleModbusError(m_checkReachableReply->error());')
|
||||
writeLine(fileDescriptor, ' if (m_checkReachableReply->error() != ModbusRtuReply::NoError)')
|
||||
writeLine(fileDescriptor, ' onReachabilityCheckFailed();')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' m_checkRechableReply = nullptr;')
|
||||
writeLine(fileDescriptor, ' m_checkReachableReply = nullptr;')
|
||||
writeLine(fileDescriptor, ' });')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' connect(m_checkRechableReply, &ModbusRtuReply::errorOccurred, this, [this] (ModbusRtuReply::Error error){')
|
||||
writeLine(fileDescriptor, ' qCDebug(dc%s()) << "ModbusRtu reply error occurred while verifying reachability by reading \\"%s\\" register" << error << m_checkRechableReply->errorString();' % (className, checkReachableRegister['description']))
|
||||
writeLine(fileDescriptor, ' connect(m_checkReachableReply, &ModbusRtuReply::errorOccurred, this, [this] (ModbusRtuReply::Error error){')
|
||||
writeLine(fileDescriptor, ' qCDebug(dc%s()) << "ModbusRtu reply error occurred while verifying reachability by reading \\"%s\\" register" << error << m_checkReachableReply->errorString();' % (className, checkReachableRegister['description']))
|
||||
writeLine(fileDescriptor, ' });')
|
||||
writeLine(fileDescriptor, '}')
|
||||
writeLine(fileDescriptor)
|
||||
@ -374,7 +374,7 @@ def writeInitMethodImplementationRtu(fileDescriptor, className, registerDefiniti
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' if (reply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' finishInitialization(false); // Broadcast reply returns immediatly')
|
||||
writeLine(fileDescriptor, ' finishInitialization(false); // Broadcast reply returns immediately')
|
||||
writeLine(fileDescriptor, ' return false;')
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
@ -427,7 +427,7 @@ def writeInitMethodImplementationRtu(fileDescriptor, className, registerDefiniti
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' if (reply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' finishInitialization(false); // Broadcast reply returns immediatly')
|
||||
writeLine(fileDescriptor, ' finishInitialization(false); // Broadcast reply returns immediately')
|
||||
writeLine(fileDescriptor, ' return false;')
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
@ -502,7 +502,7 @@ def writeUpdateMethodRtu(fileDescriptor, className, registerDefinitions, blockDe
|
||||
writeLine(fileDescriptor)
|
||||
|
||||
writeLine(fileDescriptor, ' // Hardware resource available but communication not working. ')
|
||||
writeLine(fileDescriptor, ' // Try to read the check reachability register to re-evaluatoe the communication... ')
|
||||
writeLine(fileDescriptor, ' // Try to read the check reachability register to re-evaluate the communication... ')
|
||||
writeLine(fileDescriptor, ' if (m_modbusRtuMaster->connected() && !m_communicationWorking) {')
|
||||
writeLine(fileDescriptor, ' testReachability();')
|
||||
writeLine(fileDescriptor, ' return false;')
|
||||
@ -527,7 +527,7 @@ def writeUpdateMethodRtu(fileDescriptor, className, registerDefinitions, blockDe
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' if (reply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' return false; // Broadcast reply returns immediatly')
|
||||
writeLine(fileDescriptor, ' return false; // Broadcast reply returns immediately')
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' m_pendingUpdateReplies.append(reply);')
|
||||
@ -578,7 +578,7 @@ def writeUpdateMethodRtu(fileDescriptor, className, registerDefinitions, blockDe
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' if (reply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' return false; // Broadcast reply returns immediatly')
|
||||
writeLine(fileDescriptor, ' return false; // Broadcast reply returns immediately')
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' m_pendingUpdateReplies.append(reply);')
|
||||
|
||||
@ -180,7 +180,7 @@ def writeInternalBlockReadDataUnitDeclarationsTcp(fileDescriptor, blockDefinitio
|
||||
registerCount += 1
|
||||
blockSize += blockRegister['size']
|
||||
|
||||
writeLine(fileDescriptor, ' /* Data unit describing read block request from start addess %s with size of %s registers containing following %s properties:' % (blockStartAddress, blockSize, registerCount))
|
||||
writeLine(fileDescriptor, ' /* Data unit describing read block request from start address %s with size of %s registers containing following %s properties:' % (blockStartAddress, blockSize, registerCount))
|
||||
for i, registerDefinition in enumerate(blockRegisters):
|
||||
if 'unit' in registerDefinition and registerDefinition['unit'] != '':
|
||||
writeLine(fileDescriptor, ' - %s [%s] - Address: %s, Size: %s' % (registerDefinition['description'], registerDefinition['unit'], registerDefinition['address'], registerDefinition['size']))
|
||||
@ -247,7 +247,7 @@ def writeInternalBlockReadMethodDeclarationsTcp(fileDescriptor, blockDefinitions
|
||||
registerCount += 1
|
||||
blockSize += blockRegister['size']
|
||||
|
||||
writeLine(fileDescriptor, ' /* Read block from start addess %s with size of %s registers containing following %s properties:' % (blockStartAddress, blockSize, registerCount))
|
||||
writeLine(fileDescriptor, ' /* Read block from start address %s with size of %s registers containing following %s properties:' % (blockStartAddress, blockSize, registerCount))
|
||||
for i, registerDefinition in enumerate(blockRegisters):
|
||||
if 'unit' in registerDefinition and registerDefinition['unit'] != '':
|
||||
writeLine(fileDescriptor, ' - %s [%s] - Address: %s, Size: %s' % (registerDefinition['description'], registerDefinition['unit'], registerDefinition['address'], registerDefinition['size']))
|
||||
@ -299,7 +299,7 @@ def writePropertyUpdateMethodImplementationsTcp(fileDescriptor, className, regis
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' if (reply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediatly')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediately')
|
||||
writeLine(fileDescriptor, ' if (!verifyInitFinished())')
|
||||
writeLine(fileDescriptor, ' QTimer::singleShot(%s, this, &%s::sendNextQueuedInitRequest);' % (queuedRequestsDelay, className))
|
||||
writeLine(fileDescriptor)
|
||||
@ -351,7 +351,7 @@ def writePropertyUpdateMethodImplementationsTcp(fileDescriptor, className, regis
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' if (reply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediatly')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediately')
|
||||
writeLine(fileDescriptor, ' if (!verifyUpdateFinished())')
|
||||
writeLine(fileDescriptor, ' QTimer::singleShot(%s, this, &%s::sendNextQueuedRequest);' % (queuedRequestsDelay, className))
|
||||
writeLine(fileDescriptor)
|
||||
@ -395,7 +395,7 @@ def writePropertyUpdateMethodImplementationsTcp(fileDescriptor, className, regis
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' if (reply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediatly')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediately')
|
||||
writeLine(fileDescriptor, ' return;')
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
@ -456,7 +456,7 @@ def writeBlockUpdateMethodImplementationsTcp(fileDescriptor, className, blockDef
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' if (reply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediatly')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediately')
|
||||
writeLine(fileDescriptor, ' if (!verifyInitFinished())')
|
||||
writeLine(fileDescriptor, ' QTimer::singleShot(%s, this, &%s::sendNextQueuedInitRequest);' % (queuedRequestsDelay, className))
|
||||
writeLine(fileDescriptor)
|
||||
@ -507,7 +507,7 @@ def writeBlockUpdateMethodImplementationsTcp(fileDescriptor, className, blockDef
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' if (reply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediatly')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediately')
|
||||
writeLine(fileDescriptor, ' if (!verifyUpdateFinished())')
|
||||
writeLine(fileDescriptor, ' QTimer::singleShot(%s, this, &%s::sendNextQueuedRequest);' % (queuedRequestsDelay, className))
|
||||
writeLine(fileDescriptor)
|
||||
@ -551,7 +551,7 @@ def writeBlockUpdateMethodImplementationsTcp(fileDescriptor, className, blockDef
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' if (reply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediatly')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediately')
|
||||
writeLine(fileDescriptor, ' return;')
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
@ -585,43 +585,43 @@ def writeTestReachabilityImplementationsTcp(fileDescriptor, className, registerD
|
||||
|
||||
writeLine(fileDescriptor, 'void %s::testReachability()' % (className))
|
||||
writeLine(fileDescriptor, '{')
|
||||
writeLine(fileDescriptor, ' if (m_checkRechableReply)')
|
||||
writeLine(fileDescriptor, ' if (m_checkReachableReply)')
|
||||
writeLine(fileDescriptor, ' return;')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' // Try to read the check reachability register %s in order to verify if the communication is working or not.' % checkReachableRegister['id'])
|
||||
writeLine(fileDescriptor, ' qCDebug(dc%s()) << "--> Test reachability by reading \\"%s\\" register:" << %s << "size:" << %s;' % (className, checkReachableRegister['description'], checkReachableRegister['address'], checkReachableRegister['size']))
|
||||
writeLine(fileDescriptor, ' m_checkRechableReply = read%s();' % (propertyName[0].upper() + propertyName[1:]))
|
||||
writeLine(fileDescriptor, ' if (!m_checkRechableReply) {')
|
||||
writeLine(fileDescriptor, ' m_checkReachableReply = read%s();' % (propertyName[0].upper() + propertyName[1:]))
|
||||
writeLine(fileDescriptor, ' if (!m_checkReachableReply) {')
|
||||
writeLine(fileDescriptor, ' qCDebug(dc%s()) << "Error occurred verifying reachability by reading \\"%s\\" register";' % (className, checkReachableRegister['description']))
|
||||
writeLine(fileDescriptor, ' onReachabilityCheckFailed();')
|
||||
writeLine(fileDescriptor, ' return;')
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' if (m_checkRechableReply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' m_checkRechableReply->deleteLater(); // Broadcast reply returns immediatly')
|
||||
writeLine(fileDescriptor, ' m_checkRechableReply = nullptr;')
|
||||
writeLine(fileDescriptor, ' if (m_checkReachableReply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' m_checkReachableReply->deleteLater(); // Broadcast reply returns immediately')
|
||||
writeLine(fileDescriptor, ' m_checkReachableReply = nullptr;')
|
||||
writeLine(fileDescriptor, ' onReachabilityCheckFailed();')
|
||||
writeLine(fileDescriptor, ' return;')
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' connect(m_checkRechableReply, &QModbusReply::finished, this, [this](){')
|
||||
writeLine(fileDescriptor, ' handleModbusError(m_checkRechableReply->error());')
|
||||
writeLine(fileDescriptor, ' if (m_checkRechableReply->error() != QModbusDevice::NoError)')
|
||||
writeLine(fileDescriptor, ' connect(m_checkReachableReply, &QModbusReply::finished, this, [this](){')
|
||||
writeLine(fileDescriptor, ' handleModbusError(m_checkReachableReply->error());')
|
||||
writeLine(fileDescriptor, ' if (m_checkReachableReply->error() != QModbusDevice::NoError)')
|
||||
writeLine(fileDescriptor, ' onReachabilityCheckFailed();')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' m_checkRechableReply->deleteLater();')
|
||||
writeLine(fileDescriptor, ' m_checkRechableReply = nullptr;')
|
||||
writeLine(fileDescriptor, ' m_checkReachableReply->deleteLater();')
|
||||
writeLine(fileDescriptor, ' m_checkReachableReply = nullptr;')
|
||||
writeLine(fileDescriptor, ' });')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' connect(m_checkRechableReply, &QModbusReply::errorOccurred, this, [this] (QModbusDevice::Error error){')
|
||||
writeLine(fileDescriptor, ' QModbusResponse response = m_checkRechableReply->rawResult();')
|
||||
writeLine(fileDescriptor, ' if (m_checkRechableReply->error() == QModbusDevice::ProtocolError && response.isException()) {')
|
||||
writeLine(fileDescriptor, ' qCWarning(dc%s()) << "Modbus reply error occurred while verifying reachability by reading \\"%s\\" register" << error << m_checkRechableReply->errorString() << ModbusDataUtils::exceptionCodeToString(response.exceptionCode());' % (className, checkReachableRegister['description']))
|
||||
writeLine(fileDescriptor, ' connect(m_checkReachableReply, &QModbusReply::errorOccurred, this, [this] (QModbusDevice::Error error){')
|
||||
writeLine(fileDescriptor, ' QModbusResponse response = m_checkReachableReply->rawResult();')
|
||||
writeLine(fileDescriptor, ' if (m_checkReachableReply->error() == QModbusDevice::ProtocolError && response.isException()) {')
|
||||
writeLine(fileDescriptor, ' qCWarning(dc%s()) << "Modbus reply error occurred while verifying reachability by reading \\"%s\\" register" << error << m_checkReachableReply->errorString() << ModbusDataUtils::exceptionCodeToString(response.exceptionCode());' % (className, checkReachableRegister['description']))
|
||||
writeLine(fileDescriptor, ' // Note: if we get an exception on the reachability register, the modbus server is probably not ready')
|
||||
writeLine(fileDescriptor, ' // For some reasons on some devices the reply will never be finished on exception response. A reconnect might fix it.')
|
||||
writeLine(fileDescriptor, ' QTimer::singleShot(2000, m_modbusTcpMaster, &ModbusTcpMaster::reconnectDevice);')
|
||||
writeLine(fileDescriptor, ' } else {')
|
||||
writeLine(fileDescriptor, ' qCDebug(dc%s()) << "Modbus reply error occurred while verifying reachability by reading \\"%s\\" register" << error << m_checkRechableReply->errorString();' % (className, checkReachableRegister['description']))
|
||||
writeLine(fileDescriptor, ' qCDebug(dc%s()) << "Modbus reply error occurred while verifying reachability by reading \\"%s\\" register" << error << m_checkReachableReply->errorString();' % (className, checkReachableRegister['description']))
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor, ' });')
|
||||
writeLine(fileDescriptor, '}')
|
||||
@ -707,7 +707,7 @@ def writeInitMethodImplementationTcp(fileDescriptor, className, registerDefiniti
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' if (reply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediatly')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediately')
|
||||
writeLine(fileDescriptor, ' return false;')
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
@ -765,7 +765,7 @@ def writeInitMethodImplementationTcp(fileDescriptor, className, registerDefiniti
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' if (reply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediatly')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediately')
|
||||
writeLine(fileDescriptor, ' return false;')
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
@ -880,7 +880,7 @@ def writeUpdateMethodTcp(fileDescriptor, className, registerDefinitions, blockDe
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' if (reply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediatly')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediately')
|
||||
writeLine(fileDescriptor, ' return false;')
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
@ -937,7 +937,7 @@ def writeUpdateMethodTcp(fileDescriptor, className, registerDefinitions, blockDe
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
writeLine(fileDescriptor, ' if (reply->isFinished()) {')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediatly')
|
||||
writeLine(fileDescriptor, ' reply->deleteLater(); // Broadcast reply returns immediately')
|
||||
writeLine(fileDescriptor, ' return false;')
|
||||
writeLine(fileDescriptor, ' }')
|
||||
writeLine(fileDescriptor)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Copyright 2021 - 2024, nymea GmbH
|
||||
# Copyright 2021 - 2025, nymea GmbH
|
||||
# Contact: contact@nymea.io
|
||||
#
|
||||
# This file is part of nymea.
|
||||
@ -57,7 +57,7 @@ def convertToCamelCase(text, capitalize = False):
|
||||
if len(camelCaseSplit) == 0:
|
||||
finalWords.append(words[i])
|
||||
else:
|
||||
logging.debug('Camel calse split words', camelCaseSplit)
|
||||
logging.debug('Camel case split words', camelCaseSplit)
|
||||
for j in range(len(camelCaseSplit)):
|
||||
finalWords.append(camelCaseSplit[j])
|
||||
|
||||
@ -260,6 +260,11 @@ def getConversionToValueMethod(registerDefinition):
|
||||
return ('ModbusDataUtils::convertFromUInt32(static_cast<%s>(%s * 1.0 / pow(10, %s)), m_endianness)' % (propertyTyp, propertyName, scaleFactorProperty))
|
||||
elif registerDefinition['type'] == 'int32':
|
||||
return ('ModbusDataUtils::convertFromInt32(static_cast<%s>(%s * 1.0 / pow(10, %s)), m_endianness)' % (propertyTyp, propertyName, scaleFactorProperty))
|
||||
elif registerDefinition['type'] == 'uint64':
|
||||
return ('ModbusDataUtils::convertFromUInt64(static_cast<%s>(%s * 1.0 / pow(10, %s)), m_endianness)' % (propertyTyp, propertyName, scaleFactorProperty))
|
||||
elif registerDefinition['type'] == 'int64':
|
||||
return ('ModbusDataUtils::convertFromInt64(static_cast<%s>(%s * 1.0 / pow(10, %s)), m_endianness)' % (propertyTyp, propertyName, scaleFactorProperty))
|
||||
|
||||
|
||||
elif 'staticScaleFactor' in registerDefinition:
|
||||
scaleFactor = registerDefinition['staticScaleFactor']
|
||||
@ -271,6 +276,11 @@ def getConversionToValueMethod(registerDefinition):
|
||||
return ('ModbusDataUtils::convertFromUInt32(static_cast<%s>(%s * 1.0 / pow(10, %s)), m_endianness)' % (propertyTyp, propertyName, scaleFactor))
|
||||
elif registerDefinition['type'] == 'int32':
|
||||
return ('ModbusDataUtils::convertFromInt32(static_cast<%s>(%s * 1.0 / pow(10, %s)), m_endianness)' % (propertyTyp, propertyName, scaleFactor))
|
||||
elif registerDefinition['type'] == 'uint64':
|
||||
return ('ModbusDataUtils::convertFromUInt64(static_cast<%s>(%s * 1.0 / pow(10, %s)), m_endianness)' % (propertyTyp, propertyName, scaleFactor))
|
||||
elif registerDefinition['type'] == 'int64':
|
||||
return ('ModbusDataUtils::convertFromInt64(static_cast<%s>(%s * 1.0 / pow(10, %s)), m_endianness)' % (propertyTyp, propertyName, scaleFactor))
|
||||
|
||||
|
||||
# Handle default types
|
||||
elif registerDefinition['type'] == 'uint16':
|
||||
@ -317,6 +327,10 @@ def getValueConversionMethod(registerDefinition):
|
||||
return ('ModbusDataUtils::convertToUInt32(values, m_endianness) * 1.0 * pow(10, %s)' % (scaleFactorProperty))
|
||||
elif registerDefinition['type'] == 'int32':
|
||||
return ('ModbusDataUtils::convertToInt32(values, m_endianness) * 1.0 * pow(10, %s)' % (scaleFactorProperty))
|
||||
elif registerDefinition['type'] == 'uint64':
|
||||
return ('ModbusDataUtils::convertToUInt64(values, m_endianness) * 1.0 * pow(10, %s)' % (scaleFactorProperty))
|
||||
elif registerDefinition['type'] == 'int64':
|
||||
return ('ModbusDataUtils::convertToInt64(values, m_endianness) * 1.0 * pow(10, %s)' % (scaleFactorProperty))
|
||||
|
||||
elif 'staticScaleFactor' in registerDefinition:
|
||||
scaleFactor = registerDefinition['staticScaleFactor']
|
||||
@ -328,6 +342,11 @@ def getValueConversionMethod(registerDefinition):
|
||||
return ('ModbusDataUtils::convertToUInt32(values, m_endianness) * 1.0 * pow(10, %s)' % (scaleFactor))
|
||||
elif registerDefinition['type'] == 'int32':
|
||||
return ('ModbusDataUtils::convertToInt32(values, m_endianness) * 1.0 * pow(10, %s)' % (scaleFactor))
|
||||
elif registerDefinition['type'] == 'uint64':
|
||||
return ('ModbusDataUtils::convertToUInt64(values, m_endianness) * 1.0 * pow(10, %s)' % (scaleFactor))
|
||||
elif registerDefinition['type'] == 'int64':
|
||||
return ('ModbusDataUtils::convertToInt64(values, m_endianness) * 1.0 * pow(10, %s)' % (scaleFactor))
|
||||
|
||||
|
||||
# Handle default types
|
||||
elif registerDefinition['type'] == 'uint16':
|
||||
@ -394,10 +413,10 @@ def validateBlocks(blockDefinitions):
|
||||
registerAccess = blockRegister['access']
|
||||
registerType = blockRegister['registerType']
|
||||
else:
|
||||
previouseRegisterAddress = blockRegisters[i - 1]['address']
|
||||
previouseRegisterSize = blockRegisters[i - 1]['size']
|
||||
previouseRegisterType = blockRegisters[i - 1]['registerType']
|
||||
if previouseRegisterAddress + previouseRegisterSize != blockRegister['address']:
|
||||
previousRegisterAddress = blockRegisters[i - 1]['address']
|
||||
previousRegisterSize = blockRegisters[i - 1]['size']
|
||||
#previousRegisterType = blockRegisters[i - 1]['registerType']
|
||||
if previousRegisterAddress + previousRegisterSize != blockRegister['address']:
|
||||
logger.warning('Error: block %s has invalid register order in register %s. There seems to be a gap between the registers.' % (blockName, blockRegister['id']))
|
||||
exit(1)
|
||||
|
||||
@ -431,7 +450,7 @@ def writeBlocksUpdateMethodDeclarations(fileDescriptor, blockDefinitions):
|
||||
blockSize += blockRegister['size']
|
||||
|
||||
# Write the block update method
|
||||
writeLine(fileDescriptor, ' /* Read block from start addess %s with size of %s registers containing following %s properties:' % (blockStartAddress, blockSize, registerCount))
|
||||
writeLine(fileDescriptor, ' /* Read block from start address %s with size of %s registers containing following %s properties:' % (blockStartAddress, blockSize, registerCount))
|
||||
for i, registerDefinition in enumerate(blockRegisters):
|
||||
if 'unit' in registerDefinition and registerDefinition['unit'] != '':
|
||||
writeLine(fileDescriptor, ' - %s [%s] - Address: %s, Size: %s' % (registerDefinition['description'], registerDefinition['unit'], registerDefinition['address'], registerDefinition['size']))
|
||||
@ -546,7 +565,7 @@ def writeBlockPropertiesProcessMethodDeclaration(fileDescriptor, blockDefinition
|
||||
blockSize = 0
|
||||
registerCount = 0
|
||||
|
||||
writeLine(fileDescriptor, ' /* Process block data from start addess %s with size of %s registers containing following %s properties:' % (blockStartAddress, blockSize, registerCount))
|
||||
writeLine(fileDescriptor, ' /* Process block data from start address %s with size of %s registers containing following %s properties:' % (blockStartAddress, blockSize, registerCount))
|
||||
for i, registerDefinition in enumerate(blockRegisters):
|
||||
if 'unit' in registerDefinition and registerDefinition['unit'] != '':
|
||||
writeLine(fileDescriptor, ' - %s [%s] - Address: %s, Size: %s' % (registerDefinition['description'], registerDefinition['unit'], registerDefinition['address'], registerDefinition['size']))
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright 2021 - 2024, nymea GmbH
|
||||
# Copyright 2021 - 2025, nymea GmbH
|
||||
# Contact: contact@nymea.io
|
||||
#
|
||||
# This file is part of nymea.
|
||||
@ -208,7 +208,7 @@ def writeTcpHeaderFile():
|
||||
|
||||
writeLine(headerFile, ' bool m_reachable = false;')
|
||||
writeLine(headerFile, ' bool m_initializing = false;')
|
||||
writeLine(headerFile, ' QModbusReply *m_checkRechableReply = nullptr;')
|
||||
writeLine(headerFile, ' QModbusReply *m_checkReachableReply = nullptr;')
|
||||
writeLine(headerFile, ' uint m_checkReachableRetries = 0;')
|
||||
writeLine(headerFile, ' uint m_checkReachableRetriesCount = 0;')
|
||||
writeLine(headerFile, ' bool m_communicationWorking = false;')
|
||||
@ -255,12 +255,13 @@ def writeTcpSourceFile():
|
||||
writeLine(sourceFile)
|
||||
writeLine(sourceFile, '#include "%s"' % headerFileName)
|
||||
writeLine(sourceFile)
|
||||
writeLine(sourceFile, '#include <loggingcategories.h>')
|
||||
writeLine(sourceFile, '#include <math.h>')
|
||||
writeLine(sourceFile, '#include <QTimer>')
|
||||
writeLine(sourceFile, '#include <QModbusDevice>')
|
||||
writeLine(sourceFile, '#include <QModbusResponse>')
|
||||
writeLine(sourceFile)
|
||||
writeLine(sourceFile, '#include <loggingcategories.h>')
|
||||
writeLine(sourceFile)
|
||||
writeLine(sourceFile, 'NYMEA_LOGGING_CATEGORY(dc%s, "%s")' % (className, className))
|
||||
writeLine(sourceFile)
|
||||
|
||||
@ -508,7 +509,7 @@ def writeTcpSourceFile():
|
||||
writeLine(sourceFile, ' m_checkReachableRetriesCount = 0;')
|
||||
writeLine(sourceFile, ' testReachability();')
|
||||
writeLine(sourceFile, ' } else {')
|
||||
writeLine(sourceFile, ' qCWarning(dc%s()) << "Modbus TCP connection diconnected from" << m_modbusTcpMaster->hostAddress().toString() << ". The connection is not reachable any more.";' % (className))
|
||||
writeLine(sourceFile, ' qCWarning(dc%s()) << "Modbus TCP connection disconnected from" << m_modbusTcpMaster->hostAddress().toString() << ". The connection is not reachable any more.";' % (className))
|
||||
writeLine(sourceFile, ' m_communicationWorking = false;')
|
||||
writeLine(sourceFile, ' m_communicationFailedCounter = 0;')
|
||||
writeLine(sourceFile, ' m_checkReachableRetriesCount = 0;')
|
||||
@ -605,7 +606,6 @@ def writeRtuHeaderFile():
|
||||
writeLine(headerFile)
|
||||
writeLine(headerFile, '#include <modbusdatautils.h>')
|
||||
writeLine(headerFile, '#include <hardware/modbus/modbusrtumaster.h>')
|
||||
|
||||
writeLine(headerFile)
|
||||
|
||||
# Begin of class
|
||||
@ -720,7 +720,7 @@ def writeRtuHeaderFile():
|
||||
writeLine(headerFile, ' quint16 m_slaveId = 1;')
|
||||
writeLine(headerFile)
|
||||
writeLine(headerFile, ' bool m_reachable = false;')
|
||||
writeLine(headerFile, ' ModbusRtuReply *m_checkRechableReply = nullptr;')
|
||||
writeLine(headerFile, ' ModbusRtuReply *m_checkReachableReply = nullptr;')
|
||||
writeLine(headerFile, ' uint m_checkReachableRetries = 0;')
|
||||
writeLine(headerFile, ' uint m_checkReachableRetriesCount = 0;')
|
||||
writeLine(headerFile, ' bool m_communicationWorking = false;')
|
||||
@ -758,10 +758,11 @@ def writeRtuSourceFile():
|
||||
|
||||
writeLine(sourceFile, '#include "%s"' % headerFileName)
|
||||
writeLine(sourceFile)
|
||||
writeLine(sourceFile, '#include <loggingcategories.h>')
|
||||
writeLine(sourceFile, '#include <math.h>')
|
||||
writeLine(sourceFile, '#include <QTimer>')
|
||||
writeLine(sourceFile)
|
||||
writeLine(sourceFile, '#include <loggingcategories.h>')
|
||||
writeLine(sourceFile)
|
||||
writeLine(sourceFile, 'NYMEA_LOGGING_CATEGORY(dc%s, "%s")' % (className, className))
|
||||
writeLine(sourceFile)
|
||||
|
||||
@ -1075,7 +1076,7 @@ registerExists = False
|
||||
for registerDefinition in registerJson['registers']:
|
||||
if registerDefinition['id'] == checkReachableRegister:
|
||||
if not 'R' in registerDefinition['access']:
|
||||
logger.warning('Error: The specified \"checkReachableRegister\" is not readable. Please select a manadtory readable register as checkReachableRegister.')
|
||||
logger.warning('Error: The specified \"checkReachableRegister\" is not readable. Please select a mandatory readable register as checkReachableRegister.')
|
||||
exit(1)
|
||||
|
||||
checkReachableRegister = registerDefinition
|
||||
@ -1087,7 +1088,7 @@ if 'blocks' in registerJson:
|
||||
for registerDefinition in blockDefinition['registers']:
|
||||
if registerDefinition['id'] == checkReachableRegister:
|
||||
if not 'R' in registerDefinition['access']:
|
||||
logger.warning('Error: The specified \"checkReachableRegister\" is not readable. Please select a manadtory readable register as checkReachableRegister.')
|
||||
logger.warning('Error: The specified \"checkReachableRegister\" is not readable. Please select a mandatory readable register as checkReachableRegister.')
|
||||
exit(1)
|
||||
|
||||
checkReachableRegister = registerDefinition
|
||||
|
||||
Reference in New Issue
Block a user