[twincat] TwinCAT — Bit-indexed BOOL writes (RMW) #343
Reference in New Issue
Block a user
Delete Branch "auto/twincat/1.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
Replaces the
NotSupportedExceptionfor bit-indexed BOOL writes (MyVar.3) with a read-modify-write path..Nbit selector, reads the parent as UDINT, applies the bit mask (word | (1u<<N)to set /word & ~(1u<<N)to clear), writes the parent back.SemaphoreSlimcached in a never-evictedConcurrentDictionary<string, SemaphoreSlim>. Same pattern AbCip uses.TryGetParentSymbolPath+ApplyBitasinternal statichelpers (project already hasInternalsVisibleToon the test project) so the pure logic is testable without a real ADS target.The existing bit read path (
ExtractBit) is unchanged.Test plan
dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.TwinCAT— clean (0 / 0)dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.TwinCAT.Tests— 134 / 134 passed (11 new inTwinCATBitWriteTests: helper unit tests, driver round-trip set/clear, regression that bit writes no longer return BadNotSupported)FakeTwinCATClient.WriteValueAsyncto model parent-word RMW so driver-level tests can verify resulting parent state.🤖 Auto-generated by the Mode-B execution loop. Closes #307.
Closes #307