pyads icon indicating copy to clipboard operation
pyads copied to clipboard

Added feature for processing nested structures

Open msfur opened this issue 9 months ago • 4 comments

Enables processing for nested structures, as mentioned in and fixes #308 and on Stackoverflow. Takes into account nested structures in the following form:

    substructure_def = (
         ("iVar", pyads.PLCTYPE_INT, 1),
         ("sVar", pyads.PLCTYPE_STRING, 1)
     )

    structure_def = (
         ("iVar1", pyads.PLCTYPE_INT, 1),
         ("structVar", substructure_def, 2)
     )

or

    structure_def = (
        ("iVar1", pyads.PLCTYPE_INT, 1),
        ("structVar",
            (
                ("iVar", pyads.PLCTYPE_INT, 1),
                ("sVar", pyads.PLCTYPE_STRING, 1)
            ), 2
        )
    )

Contains adaptations to size_of_structure(), dict_from_bytes() and bytes_from_dict() and the associated tests.

msfur avatar May 07 '24 12:05 msfur