This is an automated email from the ASF dual-hosted git repository.
hutcheb pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/develop by this push:
new e1ae587ab3 feat(plc4y): Started to implement reading arrays
e1ae587ab3 is described below
commit e1ae587ab3ffeec5a93c2c1e23cdd68b6b26b717
Author: Ben Hutcheson <[email protected]>
AuthorDate: Sat Oct 21 18:07:42 2023 +0200
feat(plc4y): Started to implement reading arrays
---
.../templates/python/complex-type-template.python.ftlh | 10 ++++++----
.../modbus/readwrite/ModbusDeviceInformationObject.py | 2 +-
.../modbus/readwrite/ModbusPDUGetComEventLogResponse.py | 4 +++-
.../protocols/modbus/readwrite/ModbusPDUReadCoilsResponse.py | 2 +-
.../readwrite/ModbusPDUReadDeviceIdentificationResponse.py | 7 ++++---
.../modbus/readwrite/ModbusPDUReadDiscreteInputsResponse.py | 2 +-
.../modbus/readwrite/ModbusPDUReadFifoQueueResponse.py | 5 +++--
.../modbus/readwrite/ModbusPDUReadFileRecordRequest.py | 6 +++---
.../modbus/readwrite/ModbusPDUReadFileRecordResponse.py | 6 +++---
.../modbus/readwrite/ModbusPDUReadFileRecordResponseItem.py | 2 +-
.../modbus/readwrite/ModbusPDUReadHoldingRegistersResponse.py | 2 +-
.../modbus/readwrite/ModbusPDUReadInputRegistersResponse.py | 2 +-
.../ModbusPDUReadWriteMultipleHoldingRegistersRequest.py | 2 +-
.../ModbusPDUReadWriteMultipleHoldingRegistersResponse.py | 2 +-
.../modbus/readwrite/ModbusPDUReportServerIdResponse.py | 2 +-
.../modbus/readwrite/ModbusPDUWriteFileRecordRequest.py | 6 +++---
.../modbus/readwrite/ModbusPDUWriteFileRecordRequestItem.py | 2 +-
.../modbus/readwrite/ModbusPDUWriteFileRecordResponse.py | 6 +++---
.../modbus/readwrite/ModbusPDUWriteFileRecordResponseItem.py | 4 +++-
.../modbus/readwrite/ModbusPDUWriteMultipleCoilsRequest.py | 2 +-
.../ModbusPDUWriteMultipleHoldingRegistersRequest.py | 2 +-
sandbox/plc4py/plc4py/spi/generation/ReadBuffer.py | 11 +++++++++++
22 files changed, 54 insertions(+), 35 deletions(-)
diff --git
a/code-generation/language-python/src/main/resources/templates/python/complex-type-template.python.ftlh
b/code-generation/language-python/src/main/resources/templates/python/complex-type-template.python.ftlh
index 50bcbaa1a9..e74fa74721 100644
---
a/code-generation/language-python/src/main/resources/templates/python/complex-type-template.python.ftlh
+++
b/code-generation/language-python/src/main/resources/templates/python/complex-type-template.python.ftlh
@@ -588,19 +588,21 @@ class ${type.name}<#if
type.isDiscriminatedParentTypeDefinition()></#if>(<#if ty
raise ParseException("array fields of type byte only support 'count'
and 'length' loop-types.")
</#if>
<@emitImport import="from typing import List" />
- self.${helper.camelCaseToSnakeCase(namedField.name)} =
read_buffer.read_byte_array("${namedField.name}",
int(${helper.toParseExpression(arrayField, helper.intTypeReference,
arrayField.loopExpression,
parserArguments)})${helper.getFieldOptions(typedField, parserArguments)})
+ ${helper.camelCaseToSnakeCase(namedField.name)}: List[int] =
read_buffer.read_byte_array("${namedField.name}",
int(${helper.toParseExpression(arrayField, helper.intTypeReference,
arrayField.loopExpression,
parserArguments)})${helper.getFieldOptions(typedField, parserArguments)})
<#else>
<#-- If this is a count array, we can directly initialize an
array with the given size -->
<#if field.isCountArrayField()>
- self.${helper.camelCaseToSnakeCase(arrayField.name)} =
read_count_array_field("${arrayField.name}",
${helper.getDataReaderCall(arrayField.type)},
${helper.camelCaseToSnakeCase(helper.toParseExpression(arrayField,
helper.intTypeReference, arrayField.loopExpression,
parserArguments))}${helper.getFieldOptions(typedField, parserArguments)})
+ <@emitImport import="from typing import List" />
+ <@emitImport import="from typing import Any" />
+ ${helper.camelCaseToSnakeCase(arrayField.name)}: List[Any] =
read_buffer.read_array_field("${arrayField.name}",
read_buffer.${helper.getDataReaderCall(arrayField.type)},
count=${helper.camelCaseToSnakeCase(helper.toParseExpression(arrayField,
helper.intTypeReference, arrayField.loopExpression,
parserArguments))}${helper.getFieldOptions(typedField, parserArguments)})
<#-- In all other cases do we have to work with a list,
that is later converted to an array -->
<#else>
<#-- For a length array, we read data till the read
position of the buffer reaches a given position -->
<#if field.isLengthArrayField()>
- self.${helper.camelCaseToSnakeCase(arrayField.name)} =
read_length_array_field("${arrayField.name}",
${helper.getDataReaderCall(arrayField.type)},
${helper.camelCaseToSnakeCase(helper.toParseExpression(arrayField,
helper.intTypeReference, arrayField.loopExpression,
parserArguments))}${helper.getFieldOptions(typedField, parserArguments)})
+ ${helper.camelCaseToSnakeCase(arrayField.name)}: List[Any] =
read_buffer.read_array_field("${arrayField.name}",
read_buffer.${helper.getDataReaderCall(arrayField.type)},
length=${helper.camelCaseToSnakeCase(helper.toParseExpression(arrayField,
helper.intTypeReference, arrayField.loopExpression,
parserArguments))}${helper.getFieldOptions(typedField, parserArguments)})
<#-- A terminated array keeps on reading data as long
as the termination expression evaluates to false -->
<#elseif field.isTerminatedArrayField()>
- self.${helper.camelCaseToSnakeCase(arrayField.name)} =
read_terminated_array_field("${arrayField.name}",
${helper.getDataReaderCall(arrayField.type)}, lambda :
(c_bool(${helper.toParseExpression(arrayField, helper.intTypeReference,
arrayField.loopExpression,
parserArguments)}))${helper.getFieldOptions(typedField, parserArguments)})
+ ${helper.camelCaseToSnakeCase(arrayField.name)}: List[Any] =
read_buffer.read_array_field("${arrayField.name}",
read_buffer.${helper.getDataReaderCall(arrayField.type)}, terminated=lambda :
(c_bool(${helper.toParseExpression(arrayField, helper.intTypeReference,
arrayField.loopExpression,
parserArguments)}))${helper.getFieldOptions(typedField, parserArguments)})
</#if>
</#if>
</#if>
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusDeviceInformationObject.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusDeviceInformationObject.py
index 5d859b4766..1db6735655 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusDeviceInformationObject.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusDeviceInformationObject.py
@@ -79,7 +79,7 @@ class ModbusDeviceInformationObject(PlcMessage):
object_length: int = read_implicit_field("objectLength",
read_unsigned_short)
- self.data = read_buffer.read_byte_array("data", int(object_length))
+ data: List[int] = read_buffer.read_byte_array("data",
int(object_length))
read_buffer.pop_context("ModbusDeviceInformationObject")
# Create the instance
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUGetComEventLogResponse.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUGetComEventLogResponse.py
index 2a6564b757..3eca6e4924 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUGetComEventLogResponse.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUGetComEventLogResponse.py
@@ -102,7 +102,9 @@ class ModbusPDUGetComEventLogResponse(PlcMessage,
ModbusPDU):
self.message_count = read_simple_field("messageCount",
read_unsigned_int)
- self.events = read_buffer.read_byte_array("events", int(byte_count -
int(6)))
+ events: List[int] = read_buffer.read_byte_array(
+ "events", int(byte_count - int(6))
+ )
read_buffer.pop_context("ModbusPDUGetComEventLogResponse")
# Create the instance
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadCoilsResponse.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadCoilsResponse.py
index 5eca617021..9d16807fb6 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadCoilsResponse.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadCoilsResponse.py
@@ -73,7 +73,7 @@ class ModbusPDUReadCoilsResponse(PlcMessage, ModbusPDU):
byte_count: int = read_implicit_field("byteCount", read_unsigned_short)
- self.value = read_buffer.read_byte_array("value", int(byte_count))
+ value: List[int] = read_buffer.read_byte_array("value",
int(byte_count))
read_buffer.pop_context("ModbusPDUReadCoilsResponse")
# Create the instance
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadDeviceIdentificationResponse.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadDeviceIdentificationResponse.py
index c6b1423adc..2a7bb70919 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadDeviceIdentificationResponse.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadDeviceIdentificationResponse.py
@@ -36,6 +36,7 @@ from plc4py.protocols.modbus.readwrite.ModbusPDU import
ModbusPDU
from plc4py.protocols.modbus.readwrite.ModbusPDU import ModbusPDUBuilder
from plc4py.spi.generation.ReadBuffer import ReadBuffer
from plc4py.spi.generation.WriteBuffer import WriteBuffer
+from typing import Any
from typing import List
import math
@@ -184,12 +185,12 @@ class
ModbusPDUReadDeviceIdentificationResponse(PlcMessage, ModbusPDU):
"numberOfObjects", read_unsigned_short
)
- self.objects = read_count_array_field(
+ objects: List[Any] = read_buffer.read_array_field(
"objects",
- DataReaderComplexDefault(
+ read_buffer.DataReaderComplexDefault(
ModbusDeviceInformationObject.static_parse(read_buffer),
read_buffer
),
- number_of_objects,
+ count=number_of_objects,
)
read_buffer.pop_context("ModbusPDUReadDeviceIdentificationResponse")
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadDiscreteInputsResponse.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadDiscreteInputsResponse.py
index 5cbcbcc105..933e51403d 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadDiscreteInputsResponse.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadDiscreteInputsResponse.py
@@ -73,7 +73,7 @@ class ModbusPDUReadDiscreteInputsResponse(PlcMessage,
ModbusPDU):
byte_count: int = read_implicit_field("byteCount", read_unsigned_short)
- self.value = read_buffer.read_byte_array("value", int(byte_count))
+ value: List[int] = read_buffer.read_byte_array("value",
int(byte_count))
read_buffer.pop_context("ModbusPDUReadDiscreteInputsResponse")
# Create the instance
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadFifoQueueResponse.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadFifoQueueResponse.py
index 23d1b2bab8..d494bb3576 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadFifoQueueResponse.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadFifoQueueResponse.py
@@ -24,6 +24,7 @@ from plc4py.protocols.modbus.readwrite.ModbusPDU import
ModbusPDU
from plc4py.protocols.modbus.readwrite.ModbusPDU import ModbusPDUBuilder
from plc4py.spi.generation.ReadBuffer import ReadBuffer
from plc4py.spi.generation.WriteBuffer import WriteBuffer
+from typing import Any
from typing import List
import math
@@ -84,8 +85,8 @@ class ModbusPDUReadFifoQueueResponse(PlcMessage, ModbusPDU):
fifo_count: int = read_implicit_field("fifoCount", read_unsigned_int)
- self.fifo_value = read_count_array_field(
- "fifoValue", read_unsigned_int, fifo_count
+ fifo_value: List[Any] = read_buffer.read_array_field(
+ "fifoValue", read_buffer.read_unsigned_int, count=fifo_count
)
read_buffer.pop_context("ModbusPDUReadFifoQueueResponse")
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadFileRecordRequest.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadFileRecordRequest.py
index cbb736cd79..d4e8d93e5e 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadFileRecordRequest.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadFileRecordRequest.py
@@ -78,13 +78,13 @@ class ModbusPDUReadFileRecordRequest(PlcMessage, ModbusPDU):
byte_count: int = read_implicit_field("byteCount", read_unsigned_short)
- self.items = read_length_array_field(
+ items: List[Any] = read_buffer.read_array_field(
"items",
- DataReaderComplexDefault(
+ read_buffer.DataReaderComplexDefault(
ModbusPDUReadFileRecordRequestItem.static_parse(read_buffer),
read_buffer,
),
- byte_count,
+ length=byte_count,
)
read_buffer.pop_context("ModbusPDUReadFileRecordRequest")
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadFileRecordResponse.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadFileRecordResponse.py
index 396bbc89cb..98a36b7bce 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadFileRecordResponse.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadFileRecordResponse.py
@@ -78,13 +78,13 @@ class ModbusPDUReadFileRecordResponse(PlcMessage,
ModbusPDU):
byte_count: int = read_implicit_field("byteCount", read_unsigned_short)
- self.items = read_length_array_field(
+ items: List[Any] = read_buffer.read_array_field(
"items",
- DataReaderComplexDefault(
+ read_buffer.DataReaderComplexDefault(
ModbusPDUReadFileRecordResponseItem.static_parse(read_buffer),
read_buffer,
),
- byte_count,
+ length=byte_count,
)
read_buffer.pop_context("ModbusPDUReadFileRecordResponse")
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadFileRecordResponseItem.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadFileRecordResponseItem.py
index 4fb5e597fc..a962fafb6a 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadFileRecordResponseItem.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadFileRecordResponseItem.py
@@ -81,7 +81,7 @@ class ModbusPDUReadFileRecordResponseItem(PlcMessage):
self.reference_type = read_simple_field("referenceType",
read_unsigned_short)
- self.data = read_buffer.read_byte_array("data", int(data_length -
int(1)))
+ data: List[int] = read_buffer.read_byte_array("data", int(data_length
- int(1)))
read_buffer.pop_context("ModbusPDUReadFileRecordResponseItem")
# Create the instance
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadHoldingRegistersResponse.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadHoldingRegistersResponse.py
index 6afce7ae79..38ca927892 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadHoldingRegistersResponse.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadHoldingRegistersResponse.py
@@ -73,7 +73,7 @@ class ModbusPDUReadHoldingRegistersResponse(PlcMessage,
ModbusPDU):
byte_count: int = read_implicit_field("byteCount", read_unsigned_short)
- self.value = read_buffer.read_byte_array("value", int(byte_count))
+ value: List[int] = read_buffer.read_byte_array("value",
int(byte_count))
read_buffer.pop_context("ModbusPDUReadHoldingRegistersResponse")
# Create the instance
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadInputRegistersResponse.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadInputRegistersResponse.py
index dd4b92df02..17d11fbdba 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadInputRegistersResponse.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadInputRegistersResponse.py
@@ -73,7 +73,7 @@ class ModbusPDUReadInputRegistersResponse(PlcMessage,
ModbusPDU):
byte_count: int = read_implicit_field("byteCount", read_unsigned_short)
- self.value = read_buffer.read_byte_array("value", int(byte_count))
+ value: List[int] = read_buffer.read_byte_array("value",
int(byte_count))
read_buffer.pop_context("ModbusPDUReadInputRegistersResponse")
# Create the instance
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadWriteMultipleHoldingRegistersRequest.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadWriteMultipleHoldingRegistersRequest.py
index 5f546e699b..84b55d0efa 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadWriteMultipleHoldingRegistersRequest.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadWriteMultipleHoldingRegistersRequest.py
@@ -121,7 +121,7 @@ class
ModbusPDUReadWriteMultipleHoldingRegistersRequest(PlcMessage, ModbusPDU):
byte_count: int = read_implicit_field("byteCount", read_unsigned_short)
- self.value = read_buffer.read_byte_array("value", int(byte_count))
+ value: List[int] = read_buffer.read_byte_array("value",
int(byte_count))
read_buffer.pop_context("ModbusPDUReadWriteMultipleHoldingRegistersRequest")
# Create the instance
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadWriteMultipleHoldingRegistersResponse.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadWriteMultipleHoldingRegistersResponse.py
index b42263fd3d..3e833d0d0f 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadWriteMultipleHoldingRegistersResponse.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReadWriteMultipleHoldingRegistersResponse.py
@@ -73,7 +73,7 @@ class
ModbusPDUReadWriteMultipleHoldingRegistersResponse(PlcMessage, ModbusPDU):
byte_count: int = read_implicit_field("byteCount", read_unsigned_short)
- self.value = read_buffer.read_byte_array("value", int(byte_count))
+ value: List[int] = read_buffer.read_byte_array("value",
int(byte_count))
read_buffer.pop_context("ModbusPDUReadWriteMultipleHoldingRegistersResponse")
# Create the instance
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReportServerIdResponse.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReportServerIdResponse.py
index 39d88f5338..8494e44275 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReportServerIdResponse.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUReportServerIdResponse.py
@@ -73,7 +73,7 @@ class ModbusPDUReportServerIdResponse(PlcMessage, ModbusPDU):
byte_count: int = read_implicit_field("byteCount", read_unsigned_short)
- self.value = read_buffer.read_byte_array("value", int(byte_count))
+ value: List[int] = read_buffer.read_byte_array("value",
int(byte_count))
read_buffer.pop_context("ModbusPDUReportServerIdResponse")
# Create the instance
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteFileRecordRequest.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteFileRecordRequest.py
index cf6aaabe20..3440d2c870 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteFileRecordRequest.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteFileRecordRequest.py
@@ -78,13 +78,13 @@ class ModbusPDUWriteFileRecordRequest(PlcMessage,
ModbusPDU):
byte_count: int = read_implicit_field("byteCount", read_unsigned_short)
- self.items = read_length_array_field(
+ items: List[Any] = read_buffer.read_array_field(
"items",
- DataReaderComplexDefault(
+ read_buffer.DataReaderComplexDefault(
ModbusPDUWriteFileRecordRequestItem.static_parse(read_buffer),
read_buffer,
),
- byte_count,
+ length=byte_count,
)
read_buffer.pop_context("ModbusPDUWriteFileRecordRequest")
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteFileRecordRequestItem.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteFileRecordRequestItem.py
index d0a8e9722a..16fd0058d9 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteFileRecordRequestItem.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteFileRecordRequestItem.py
@@ -101,7 +101,7 @@ class ModbusPDUWriteFileRecordRequestItem(PlcMessage):
record_length: int = read_implicit_field("recordLength",
read_unsigned_int)
- self.record_data = read_buffer.read_byte_array(
+ record_data: List[int] = read_buffer.read_byte_array(
"recordData", int(record_length * int(2))
)
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteFileRecordResponse.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteFileRecordResponse.py
index 8dff17842d..d940c90e94 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteFileRecordResponse.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteFileRecordResponse.py
@@ -78,13 +78,13 @@ class ModbusPDUWriteFileRecordResponse(PlcMessage,
ModbusPDU):
byte_count: int = read_implicit_field("byteCount", read_unsigned_short)
- self.items = read_length_array_field(
+ items: List[Any] = read_buffer.read_array_field(
"items",
- DataReaderComplexDefault(
+ read_buffer.DataReaderComplexDefault(
ModbusPDUWriteFileRecordResponseItem.static_parse(read_buffer),
read_buffer,
),
- byte_count,
+ length=byte_count,
)
read_buffer.pop_context("ModbusPDUWriteFileRecordResponse")
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteFileRecordResponseItem.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteFileRecordResponseItem.py
index 985c37eea0..efc5288556 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteFileRecordResponseItem.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteFileRecordResponseItem.py
@@ -101,7 +101,9 @@ class ModbusPDUWriteFileRecordResponseItem(PlcMessage):
record_length: int = read_implicit_field("recordLength",
read_unsigned_int)
- self.record_data = read_buffer.read_byte_array("recordData",
int(record_length))
+ record_data: List[int] = read_buffer.read_byte_array(
+ "recordData", int(record_length)
+ )
read_buffer.pop_context("ModbusPDUWriteFileRecordResponseItem")
# Create the instance
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteMultipleCoilsRequest.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteMultipleCoilsRequest.py
index 1e86a86f18..cae30a2575 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteMultipleCoilsRequest.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteMultipleCoilsRequest.py
@@ -93,7 +93,7 @@ class ModbusPDUWriteMultipleCoilsRequest(PlcMessage,
ModbusPDU):
byte_count: int = read_implicit_field("byteCount", read_unsigned_short)
- self.value = read_buffer.read_byte_array("value", int(byte_count))
+ value: List[int] = read_buffer.read_byte_array("value",
int(byte_count))
read_buffer.pop_context("ModbusPDUWriteMultipleCoilsRequest")
# Create the instance
diff --git
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteMultipleHoldingRegistersRequest.py
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteMultipleHoldingRegistersRequest.py
index e605d16827..d54cd6e0e2 100644
---
a/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteMultipleHoldingRegistersRequest.py
+++
b/sandbox/plc4py/plc4py/protocols/modbus/readwrite/ModbusPDUWriteMultipleHoldingRegistersRequest.py
@@ -93,7 +93,7 @@ class
ModbusPDUWriteMultipleHoldingRegistersRequest(PlcMessage, ModbusPDU):
byte_count: int = read_implicit_field("byteCount", read_unsigned_short)
- self.value = read_buffer.read_byte_array("value", int(byte_count))
+ value: List[int] = read_buffer.read_byte_array("value",
int(byte_count))
read_buffer.pop_context("ModbusPDUWriteMultipleHoldingRegistersRequest")
# Create the instance
diff --git a/sandbox/plc4py/plc4py/spi/generation/ReadBuffer.py
b/sandbox/plc4py/plc4py/spi/generation/ReadBuffer.py
index 386ccfe934..7e46a51f58 100644
--- a/sandbox/plc4py/plc4py/spi/generation/ReadBuffer.py
+++ b/sandbox/plc4py/plc4py/spi/generation/ReadBuffer.py
@@ -122,6 +122,17 @@ class ReadBuffer(ByteOrderAware, PositionAware):
def read_complex_array(self, logical_name: str = "", **kwargs) ->
List[PlcMessage]:
raise NotImplementedError
+ def read_array_field(
+ self,
+ logical_name: str = "",
+ read_function=None,
+ count: int = None,
+ length: int = None,
+ terminated=None,
+ **kwargs
+ ) -> List[PlcMessage]:
+ raise NotImplementedError
+
class ReadBufferByteBased(ReadBuffer):
byte_order: ByteOrder