chrisdutz commented on code in PR #545:
URL: https://github.com/apache/plc4x/pull/545#discussion_r1064040882


##########
plc4go/protocols/modbus/readwrite/model/DataItem.go:
##########
@@ -24,30 +24,48 @@ import (
        "github.com/apache/plc4x/plc4go/spi/utils"
        "github.com/apache/plc4x/plc4go/spi/values"
        "github.com/pkg/errors"
+       "math"
 )
 
 // Code generated by code-generation. DO NOT EDIT.
 
-func DataItemParse(readBuffer utils.ReadBuffer, dataType ModbusDataType, 
numberOfValues uint16) (api.PlcValue, error) {
+func DataItemParse(readBuffer utils.ReadBuffer, dataType ModbusDataType, 
numberOfValues uint16, offset uint16) (api.PlcValue, error) {
        readBuffer.PullContext("DataItem")
        switch {
        case dataType == ModbusDataType_BOOL && numberOfValues == uint16(1): // 
BOOL
-               // Reserved Field (Just skip the bytes)
-               if _, _err := readBuffer.ReadUint16("reserved", 15); _err != 
nil {
-                       return nil, errors.Wrap(_err, "Error parsing reserved 
field")
-               }
-
-               // Simple Field (value)
-               value, _valueErr := readBuffer.ReadBit("value")
-               if _valueErr != nil {
-                       return nil, errors.Wrap(_valueErr, "Error parsing 
'value' field")
+               _numberOfValues := uint16(math.Ceil(float64((offset + 
numberOfValues)) / float64(16)))

Review Comment:
   In this branch "numberOfValues" is always 1



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to