hutcheb commented on a change in pull request #174:
URL: https://github.com/apache/plc4x/pull/174#discussion_r462815778
##########
File path: protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec
##########
@@ -247,9 +247,9 @@
]
[type 'ModbusPDUReadFileRecordResponseItem'
- [implicit uint 8 'dataLength' '(COUNT(data) * 2) + 1']
+ [simple uint 8 'dataLength']
Review comment:
Hi Chris,
Maybe I'm confused by what implicit and simple mean. I take them to mean:-
Simple - Use the value that is included in the response.
Implicit - Attempt to calculated the value based on the other fields in the
response.
As the length of the ModbusPDUReadFileRecordResponseItems is included in the
response I changed it to simple instead of trying to calculate it from the data
field.
##########
File path: protocols/modbus/src/main/resources/protocols/modbus/modbus.mspec
##########
@@ -247,9 +247,9 @@
]
[type 'ModbusPDUReadFileRecordResponseItem'
- [implicit uint 8 'dataLength' '(COUNT(data) * 2) + 1']
+ [simple uint 8 'dataLength']
Review comment:
Also as the data field has a variable length if you try to infer the
length of it, it wouldn't know the length of the data field in the first
ModbusPDUReadFileRecordResponseItem.
So when it starts parsing the first ModbusPDUReadFileRecordResponseItem it
would receive:-
0x03 - It would then try to infer this field by using the rest of the
message. It would end up with 7 instead of 3.
0x06
0x00
0x01
0x03
0x06
0x00
0x01
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]