feat: Force I/O support for commissioning and diagnostics (#796) - #800
Open
gijzelaerr wants to merge 2 commits into
Open
feat: Force I/O support for commissioning and diagnostics (#796)#800gijzelaerr wants to merge 2 commits into
gijzelaerr wants to merge 2 commits into
Conversation
Add force_bit(), cancel_force(), and read_force_table() to both Client and AsyncClient for manipulating I/O bits during PLC commissioning and diagnostics. force_bit/cancel_force perform read-modify-write on the process image (PE/PA areas), matching the approach used by rs-snap7. read_force_table reads SZL 0x0025 for the CPU's built-in force table. Includes ForceEntry NamedTuple for structured force table results, integration tests against the emulated server, and unit tests for the SZL parser.
Use per-field docstrings instead of a class-level Attributes section to avoid Sphinx generating duplicate object descriptions for the NamedTuple fields.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
force_bit(area, byte_offset, bit, value)andcancel_force(area, byte_offset, bit)to bothClientandAsyncClientfor manipulating individual I/O bits in the process image (PE/PA areas) during commissioning and diagnosticsread_force_table()to read the PLC's CPU force table via SZL 0x0025ForceEntryNamedTuple tosnap7.typefor structured force table results, exported from bothsnap7ands7packagesThe force/cancel operations perform read-modify-write on the process image, matching the approach used by rs-snap7. Only I/O areas (PE=inputs, PA=outputs) are accepted; other areas raise
ValueError.Closes #796
Test plan
_parse_force_szlSZL 0x0025 parser (empty, single entry, multiple entries, truncated)