[abcip] AbCip — STRINGnn variant decoding #318

Merged
dohertj2 merged 1 commits from auto/abcip/1.2 into auto/driver-gaps 2026-04-25 12:55:36 -04:00
Owner

Summary

Adds nullable int? StringLength to AbCipTagDefinition and AbCipStructureMember, threaded through a new StringMaxCapacity field on AbCipTagCreateParams, and forwarded to libplctag's Tag.StringMaxCapacity attribute in LibplctagTagRuntime's ctor.

  • AbCipDriver.EnsureTagRuntimeAsync gates on DataType == String so a stray length on a DINT tag won't reshape that buffer.
  • UDT member fan-out in InitializeAsync copies StringLength from the structure member onto the synthesised member tag.
  • Null preserves libplctag's default 82-byte STRING for back-compat.

Test plan

  • dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.AbCip — clean (0 / 0)
  • dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Tests237 / 237 passed (4 new tests for cap=40, null back-compat, non-String type gate, UDT member fan-out)
  • Integration tests — skipped (live PLC required)

🤖 Auto-generated by the Mode-B execution loop. Closes #226.

Closes #226

## Summary Adds nullable `int? StringLength` to `AbCipTagDefinition` and `AbCipStructureMember`, threaded through a new `StringMaxCapacity` field on `AbCipTagCreateParams`, and forwarded to libplctag's `Tag.StringMaxCapacity` attribute in `LibplctagTagRuntime`'s ctor. - `AbCipDriver.EnsureTagRuntimeAsync` gates on `DataType == String` so a stray length on a DINT tag won't reshape that buffer. - UDT member fan-out in `InitializeAsync` copies `StringLength` from the structure member onto the synthesised member tag. - Null preserves libplctag's default 82-byte STRING for back-compat. ## Test plan - [x] `dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.AbCip` — clean (0 / 0) - [x] `dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Tests` — **237 / 237 passed** (4 new tests for cap=40, null back-compat, non-String type gate, UDT member fan-out) - [ ] Integration tests — skipped (live PLC required) 🤖 Auto-generated by the Mode-B execution loop. Closes #226. Closes #226
dohertj2 added 1 commit 2026-04-25 12:55:32 -04:00
Closes #226

Adds nullable StringLength to AbCipTagDefinition + AbCipStructureMember
so STRING_20 / STRING_40 / STRING_80 UDT variants decode against the
right DATA-array capacity. The configured length threads through a new
StringMaxCapacity field on AbCipTagCreateParams and lands on the
libplctag Tag.StringMaxCapacity attribute (verified property on
libplctag 1.5.2). Null leaves libplctag's default 82-byte STRING in
place for back-compat. Driver gates on DataType == String so a stray
StringLength on a DINT tag doesn't reshape that buffer. UDT member
fan-out copies StringLength from the AbCipStructureMember onto the
synthesised member tag definition.

Tests: 4 new in AbCipDriverReadTests covering threaded StringMaxCapacity,
the null back-compat path, the non-String gate, and the UDT-member fan-out.
dohertj2 merged commit 29edd835a3 into auto/driver-gaps 2026-04-25 12:55:36 -04:00
dohertj2 deleted branch auto/abcip/1.2 2026-04-25 12:55:37 -04:00
Sign in to join this conversation.