Phase 3 PR 64 -- S7 IReadable + IWritable via S7.Net #63
Reference in New Issue
Block a user
Delete Branch "phase-3-pr64-s7-read-write"
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
Adds
IReadable+IWritabletoS7Driver, routing through S7netplus's string-basedPlc.ReadAsync(string, ct)/Plc.WriteAsync(string, object, ct). All operations serialize on the driver'sSemaphoreSlim Gateper S7netplus's one-connection-per-PLC requirement.Supported types this PR:
Bool,Byte,Int16,UInt16,Int32,UInt32,Float32. S7.Net's string-address API returns unsigned boxed values; driver reinterprets into the caller'sS7DataTypevia(DataType, Size, raw)switch (unchecked cast for signed,BitConverter.UInt32BitsToSingle/SingleToUInt32Bitsfor float).Deferred: Int64 / UInt64 / Float64 (LReal) / String / DateTime throw
NotSupportedException→BadNotSupported. Need S7.Net's typedReadAsync(DataType, db, offset, VarType, ...)path with STRING header handling — follow-up PR.Init-time validation: every tag's
Addressparses throughS7AddressParseratInitializeAsync; bad addresses throwFormatExceptionand flip health toFaulted— impossible to ship a half-healthy driver with a latent bad tag.StatusCode mapping:
BadNodeIdUnknown(0x80340000)BadNotSupported(0x803D0000)BadNotWritable(0x803B0000)PlcException(PUT/GET disabled on S7-1200/1500) →BadDeviceFailure(0x80550000) — distinguishes the TIA-Portal-config problem from transient faults perdriver-specs.md§5BadCommunicationError(0x80050000)Validation
dotnet build: 0 errorsScope note
Wire-level round-trip test against a live S7 or an in-process mock is deferred — S7.Net doesn't ship a fake and an adequate mock is non-trivial. Error-path unit tests cover the init-fail + not-initialized + unknown-tag paths without a live PLC.
Test plan