Make block definition optional for register json file
This commit is contained in:
parent
1e34b07cf4
commit
4e9f98ddee
@ -914,6 +914,7 @@ def writeTcpHeaderFile():
|
|||||||
writePropertyGetSetMethodDeclarationsTcp(headerFile, registerJson['registers'])
|
writePropertyGetSetMethodDeclarationsTcp(headerFile, registerJson['registers'])
|
||||||
|
|
||||||
# Write block get/set method declarations
|
# Write block get/set method declarations
|
||||||
|
if 'blocks' in registerJson:
|
||||||
writeBlocksUpdateMethodDeclarations(headerFile, registerJson['blocks'])
|
writeBlocksUpdateMethodDeclarations(headerFile, registerJson['blocks'])
|
||||||
|
|
||||||
# Write init and update method declarations
|
# Write init and update method declarations
|
||||||
@ -929,8 +930,10 @@ def writeTcpHeaderFile():
|
|||||||
writeLine(headerFile, ' void initializationFinished();')
|
writeLine(headerFile, ' void initializationFinished();')
|
||||||
writeLine(headerFile)
|
writeLine(headerFile)
|
||||||
writePropertyChangedSignals(headerFile, registerJson['registers'])
|
writePropertyChangedSignals(headerFile, registerJson['registers'])
|
||||||
|
if 'blocks' in registerJson:
|
||||||
for blockDefinition in registerJson['blocks']:
|
for blockDefinition in registerJson['blocks']:
|
||||||
writePropertyChangedSignals(headerFile, blockDefinition['registers'])
|
writePropertyChangedSignals(headerFile, blockDefinition['registers'])
|
||||||
|
|
||||||
writeLine(headerFile)
|
writeLine(headerFile)
|
||||||
|
|
||||||
# Protected members
|
# Protected members
|
||||||
@ -944,8 +947,10 @@ def writeTcpHeaderFile():
|
|||||||
writeLine(headerFile, ' QVector<QModbusReply *> m_pendingInitReplies;')
|
writeLine(headerFile, ' QVector<QModbusReply *> m_pendingInitReplies;')
|
||||||
writeLine(headerFile)
|
writeLine(headerFile)
|
||||||
writePrivatePropertyMembers(headerFile, registerJson['registers'])
|
writePrivatePropertyMembers(headerFile, registerJson['registers'])
|
||||||
|
if 'blocks' in registerJson:
|
||||||
for blockDefinition in registerJson['blocks']:
|
for blockDefinition in registerJson['blocks']:
|
||||||
writePrivatePropertyMembers(headerFile, blockDefinition['registers'])
|
writePrivatePropertyMembers(headerFile, blockDefinition['registers'])
|
||||||
|
|
||||||
writeLine(headerFile)
|
writeLine(headerFile)
|
||||||
writeLine(headerFile, ' void verifyInitFinished();')
|
writeLine(headerFile, ' void verifyInitFinished();')
|
||||||
writeLine(headerFile)
|
writeLine(headerFile)
|
||||||
@ -986,6 +991,7 @@ def writeTcpSourceFile():
|
|||||||
writePropertyGetSetMethodImplementationsTcp(sourceFile, className, registerJson['registers'])
|
writePropertyGetSetMethodImplementationsTcp(sourceFile, className, registerJson['registers'])
|
||||||
|
|
||||||
# Block property get methods
|
# Block property get methods
|
||||||
|
if 'blocks' in registerJson:
|
||||||
for blockDefinition in registerJson['blocks']:
|
for blockDefinition in registerJson['blocks']:
|
||||||
writePropertyGetSetMethodImplementationsTcp(sourceFile, className, blockDefinition['registers'])
|
writePropertyGetSetMethodImplementationsTcp(sourceFile, className, blockDefinition['registers'])
|
||||||
|
|
||||||
@ -997,6 +1003,7 @@ def writeTcpSourceFile():
|
|||||||
writePropertyUpdateMethodImplementationsTcp(sourceFile, className, registerJson['registers'])
|
writePropertyUpdateMethodImplementationsTcp(sourceFile, className, registerJson['registers'])
|
||||||
|
|
||||||
# Write block update method
|
# Write block update method
|
||||||
|
if 'blocks' in registerJson:
|
||||||
writeBlockUpdateMethodImplementationsTcp(sourceFile, className, registerJson['blocks'])
|
writeBlockUpdateMethodImplementationsTcp(sourceFile, className, registerJson['blocks'])
|
||||||
|
|
||||||
# Write internal protected property read method implementations
|
# Write internal protected property read method implementations
|
||||||
@ -1018,6 +1025,7 @@ def writeTcpSourceFile():
|
|||||||
writeLine(sourceFile, ' debug.nospace().noquote() << "%s(" << %s->hostAddress().toString() << ":" << %s->port() << ")" << "\\n";' % (className, debugObjectParamName, debugObjectParamName))
|
writeLine(sourceFile, ' debug.nospace().noquote() << "%s(" << %s->hostAddress().toString() << ":" << %s->port() << ")" << "\\n";' % (className, debugObjectParamName, debugObjectParamName))
|
||||||
writeRegistersDebugLine(sourceFile, debugObjectParamName, registerJson['registers'])
|
writeRegistersDebugLine(sourceFile, debugObjectParamName, registerJson['registers'])
|
||||||
|
|
||||||
|
if 'blocks' in registerJson:
|
||||||
for blockDefinition in registerJson['blocks']:
|
for blockDefinition in registerJson['blocks']:
|
||||||
writeRegistersDebugLine(sourceFile, debugObjectParamName, blockDefinition['registers'])
|
writeRegistersDebugLine(sourceFile, debugObjectParamName, blockDefinition['registers'])
|
||||||
|
|
||||||
@ -1070,6 +1078,7 @@ def writeRtuHeaderFile():
|
|||||||
writePropertyGetSetMethodDeclarationsRtu(headerFile, registerJson['registers'])
|
writePropertyGetSetMethodDeclarationsRtu(headerFile, registerJson['registers'])
|
||||||
|
|
||||||
# Write block get/set method declarations
|
# Write block get/set method declarations
|
||||||
|
if 'blocks' in registerJson:
|
||||||
writeBlocksUpdateMethodDeclarations(headerFile, registerJson['blocks'])
|
writeBlocksUpdateMethodDeclarations(headerFile, registerJson['blocks'])
|
||||||
|
|
||||||
writePropertyUpdateMethodDeclarations(headerFile, registerJson['registers'])
|
writePropertyUpdateMethodDeclarations(headerFile, registerJson['registers'])
|
||||||
@ -1085,6 +1094,7 @@ def writeRtuHeaderFile():
|
|||||||
writeLine(headerFile, ' void initializationFinished();')
|
writeLine(headerFile, ' void initializationFinished();')
|
||||||
writeLine(headerFile)
|
writeLine(headerFile)
|
||||||
writePropertyChangedSignals(headerFile, registerJson['registers'])
|
writePropertyChangedSignals(headerFile, registerJson['registers'])
|
||||||
|
if 'blocks' in registerJson:
|
||||||
for blockDefinition in registerJson['blocks']:
|
for blockDefinition in registerJson['blocks']:
|
||||||
writePropertyChangedSignals(headerFile, blockDefinition['registers'])
|
writePropertyChangedSignals(headerFile, blockDefinition['registers'])
|
||||||
writeLine(headerFile)
|
writeLine(headerFile)
|
||||||
@ -1101,6 +1111,7 @@ def writeRtuHeaderFile():
|
|||||||
writeLine(headerFile, ' QVector<ModbusRtuReply *> m_pendingInitReplies;')
|
writeLine(headerFile, ' QVector<ModbusRtuReply *> m_pendingInitReplies;')
|
||||||
writeLine(headerFile)
|
writeLine(headerFile)
|
||||||
writePrivatePropertyMembers(headerFile, registerJson['registers'])
|
writePrivatePropertyMembers(headerFile, registerJson['registers'])
|
||||||
|
if 'blocks' in registerJson:
|
||||||
for blockDefinition in registerJson['blocks']:
|
for blockDefinition in registerJson['blocks']:
|
||||||
writePrivatePropertyMembers(headerFile, blockDefinition['registers'])
|
writePrivatePropertyMembers(headerFile, blockDefinition['registers'])
|
||||||
|
|
||||||
@ -1155,6 +1166,7 @@ def writeRtuSourceFile():
|
|||||||
writePropertyGetSetMethodImplementationsRtu(sourceFile, className, registerJson['registers'])
|
writePropertyGetSetMethodImplementationsRtu(sourceFile, className, registerJson['registers'])
|
||||||
|
|
||||||
# Block property get methods
|
# Block property get methods
|
||||||
|
if 'blocks' in registerJson:
|
||||||
for blockDefinition in registerJson['blocks']:
|
for blockDefinition in registerJson['blocks']:
|
||||||
writePropertyGetSetMethodImplementationsRtu(sourceFile, className, blockDefinition['registers'])
|
writePropertyGetSetMethodImplementationsRtu(sourceFile, className, blockDefinition['registers'])
|
||||||
|
|
||||||
@ -1166,6 +1178,7 @@ def writeRtuSourceFile():
|
|||||||
writePropertyUpdateMethodImplementationsRtu(sourceFile, className, registerJson['registers'])
|
writePropertyUpdateMethodImplementationsRtu(sourceFile, className, registerJson['registers'])
|
||||||
|
|
||||||
# Write block update method
|
# Write block update method
|
||||||
|
if 'blocks' in registerJson:
|
||||||
writeBlockUpdateMethodImplementationsRtu(sourceFile, className, registerJson['blocks'])
|
writeBlockUpdateMethodImplementationsRtu(sourceFile, className, registerJson['blocks'])
|
||||||
|
|
||||||
# Write internal protected property read method implementations
|
# Write internal protected property read method implementations
|
||||||
@ -1187,6 +1200,7 @@ def writeRtuSourceFile():
|
|||||||
writeLine(sourceFile, ' debug.nospace().noquote() << "%s(" << %s->modbusRtuMaster()->modbusUuid().toString() << ", " << %s->modbusRtuMaster()->serialPort() << ", slave ID:" << %s->slaveId() << ")" << "\\n";' % (className, debugObjectParamName, debugObjectParamName, debugObjectParamName))
|
writeLine(sourceFile, ' debug.nospace().noquote() << "%s(" << %s->modbusRtuMaster()->modbusUuid().toString() << ", " << %s->modbusRtuMaster()->serialPort() << ", slave ID:" << %s->slaveId() << ")" << "\\n";' % (className, debugObjectParamName, debugObjectParamName, debugObjectParamName))
|
||||||
writeRegistersDebugLine(sourceFile, debugObjectParamName, registerJson['registers'])
|
writeRegistersDebugLine(sourceFile, debugObjectParamName, registerJson['registers'])
|
||||||
|
|
||||||
|
if 'blocks' in registerJson:
|
||||||
for blockDefinition in registerJson['blocks']:
|
for blockDefinition in registerJson['blocks']:
|
||||||
writeRegistersDebugLine(sourceFile, debugObjectParamName, blockDefinition['registers'])
|
writeRegistersDebugLine(sourceFile, debugObjectParamName, blockDefinition['registers'])
|
||||||
|
|
||||||
@ -1234,6 +1248,7 @@ protocol = 'TCP'
|
|||||||
if 'protocol' in registerJson:
|
if 'protocol' in registerJson:
|
||||||
protocol = registerJson['protocol']
|
protocol = registerJson['protocol']
|
||||||
|
|
||||||
|
if 'blocks' in registerJson:
|
||||||
validateBlocks(registerJson['blocks'])
|
validateBlocks(registerJson['blocks'])
|
||||||
|
|
||||||
if protocol == 'TCP':
|
if protocol == 'TCP':
|
||||||
|
|||||||
Reference in New Issue
Block a user