[ablegacy] AbLegacy — Sub-element bit semantics #323
Reference in New Issue
Block a user
Delete Branch "auto/ablegacy/3"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
.DN/.EN/.TT/.CU/.CD/.OV/.UN/.ER/.EU/.EM/.UL/.IN/.FDshould 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 andViewOnlysecurity class for PLC-set bits.AbLegacyDriver.ReadAsync— synthesises a bit index from the parsed sub-element and passes it toDecodeValue.AbLegacyDriver.WriteAsync— rejects PLC-set status bits withBadNotWritable.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 toGetInt32(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.Tests— 217 / 217 passed (61 new: 47 inline-data cases for type/bit/writability mappings + 14 driver-level read/write scenarios)🤖 Auto-generated by the Mode-B execution loop. Closes #246.
Closes #246