[ablegacy] AbLegacy — Sub-element bit semantics #323

Merged
dohertj2 merged 1 commits from auto/ablegacy/3 into auto/driver-gaps 2026-04-25 13:44:23 -04:00
Owner

Summary

.DN/.EN/.TT/.CU/.CD/.OV/.UN/.ER/.EU/.EM/.UL/.IN/.FD should surface as Boolean. Today the Timer/Counter/Control element types collapse to a single Int32, hiding the per-bit semantics HMIs expect.

  • AbLegacyDataType.cs — three helpers added:
    • EffectiveDriverDataType(type, subElement) — Boolean for Timer EN/TT/DN, Counter CU/CD/DN/OV/UN, Control EN/EU/DN/EM/ER/UL/IN/FD; Int32 for word members (PRE/ACC/LEN/POS); permissive fallback for unknown sub-elements.
    • StatusBitIndex — standard PCCC bit positions (T4 word0 bits 13/14/15, C5 word0 10-14, R6 word0 8-15).
    • IsPlcSetStatusBit — flags read-only DN/TT/OV/UN/FD/ER/EM/UL/IN.
  • AbLegacyDriver.DiscoverAsync — publishes effective type and ViewOnly security class for PLC-set bits.
  • AbLegacyDriver.ReadAsync — synthesises a bit index from the parsed sub-element and passes it to DecodeValue.
  • AbLegacyDriver.WriteAsync — rejects PLC-set status bits with BadNotWritable.
  • LibplctagLegacyTagRuntime.DecodeValue — calls _tag.GetBit(statusBit) for Timer/Counter/Control sub-elements when a bit index is supplied (preferring libplctag's native bit-of-element path); falls back to GetInt32(0) for word members.

Test plan

  • dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy — clean (0 / 0)
  • dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.Tests217 / 217 passed (61 new: 47 inline-data cases for type/bit/writability mappings + 14 driver-level read/write scenarios)
  • Integration tests — skipped (live PLC required)

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

Closes #246

## Summary `.DN/.EN/.TT/.CU/.CD/.OV/.UN/.ER/.EU/.EM/.UL/.IN/.FD` should surface as Boolean. Today the Timer/Counter/Control element types collapse to a single Int32, hiding the per-bit semantics HMIs expect. - `AbLegacyDataType.cs` — three helpers added: - `EffectiveDriverDataType(type, subElement)` — Boolean for Timer EN/TT/DN, Counter CU/CD/DN/OV/UN, Control EN/EU/DN/EM/ER/UL/IN/FD; Int32 for word members (PRE/ACC/LEN/POS); permissive fallback for unknown sub-elements. - `StatusBitIndex` — standard PCCC bit positions (T4 word0 bits 13/14/15, C5 word0 10-14, R6 word0 8-15). - `IsPlcSetStatusBit` — flags read-only DN/TT/OV/UN/FD/ER/EM/UL/IN. - `AbLegacyDriver.DiscoverAsync` — publishes effective type and `ViewOnly` security class for PLC-set bits. - `AbLegacyDriver.ReadAsync` — synthesises a bit index from the parsed sub-element and passes it to `DecodeValue`. - `AbLegacyDriver.WriteAsync` — rejects PLC-set status bits with `BadNotWritable`. - `LibplctagLegacyTagRuntime.DecodeValue` — calls `_tag.GetBit(statusBit)` for Timer/Counter/Control sub-elements when a bit index is supplied (preferring libplctag's native bit-of-element path); falls back to `GetInt32(0)` for word members. ## Test plan - [x] `dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy` — clean (0 / 0) - [x] `dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy.Tests` — **217 / 217 passed** (61 new: 47 inline-data cases for type/bit/writability mappings + 14 driver-level read/write scenarios) - [ ] Integration tests — skipped (live PLC required) 🤖 Auto-generated by the Mode-B execution loop. Closes #246. Closes #246
dohertj2 added 1 commit 2026-04-25 13:44:19 -04:00
dohertj2 merged commit b95eaacc05 into auto/driver-gaps 2026-04-25 13:44:23 -04:00
dohertj2 deleted branch auto/ablegacy/3 2026-04-25 13:44:24 -04:00
Sign in to join this conversation.