Skip to content

feat: Force I/O support for commissioning and diagnostics (#796) - #800

Open
gijzelaerr wants to merge 2 commits into
masterfrom
feat/796-force-io
Open

feat: Force I/O support for commissioning and diagnostics (#796)#800
gijzelaerr wants to merge 2 commits into
masterfrom
feat/796-force-io

Conversation

@gijzelaerr

Copy link
Copy Markdown
Owner

Summary

  • Add force_bit(area, byte_offset, bit, value) and cancel_force(area, byte_offset, bit) to both Client and AsyncClient for manipulating individual I/O bits in the process image (PE/PA areas) during commissioning and diagnostics
  • Add read_force_table() to read the PLC's CPU force table via SZL 0x0025
  • Add ForceEntry NamedTuple to snap7.type for structured force table results, exported from both snap7 and s7 packages

The 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

  • 10 sync client integration tests against emulated server (force/cancel on PE and PA, bit preservation, invalid area/bit rejection, read_force_table)
  • 4 async client integration tests (force, cancel, invalid area, read_force_table)
  • 4 unit tests for _parse_force_szl SZL 0x0025 parser (empty, single entry, multiple entries, truncated)
  • Full test suite passes (1513 passed, 17 skipped)
  • mypy clean, ruff clean, pre-commit passes

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Force I/O support (force/cancel/read forced bits)

1 participant