Update protocol parsing logic and warn on invalid protocol
parent
70dc99a33f
commit
e1d3593dbc
|
|
@ -533,19 +533,11 @@ if 'blocks' in registerJson:
|
||||||
validateBlocks(registerJson['blocks'])
|
validateBlocks(registerJson['blocks'])
|
||||||
|
|
||||||
# Create classes depending on the protocol
|
# Create classes depending on the protocol
|
||||||
writeTcp = True
|
writeTcp = protocol in ["TCP", "BOTH"]
|
||||||
writeRtu = False
|
writeRtu = protocol in ["RTU", "BOTH"]
|
||||||
|
if not writeTcp and not writeRtu:
|
||||||
if protocol == 'TCP':
|
logger.warning('Invalid protocol definition. Please use TCP, RTU or BOTH.')
|
||||||
writeTcp = True
|
exit(1)
|
||||||
writeRtu = False
|
|
||||||
elif protocol == 'RTU':
|
|
||||||
writeTcp = False
|
|
||||||
writeRtu = True
|
|
||||||
else:
|
|
||||||
# Any other value generates both classes
|
|
||||||
writeTcp = True
|
|
||||||
writeRtu = True
|
|
||||||
|
|
||||||
headerFiles = []
|
headerFiles = []
|
||||||
sourceFiles = []
|
sourceFiles = []
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue