[s7] S7 — DTL/DT/S5TIME/TIME/TOD/DATE codecs #338
Reference in New Issue
Block a user
Delete Branch "auto/s7/PR-S7-A3"
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
S7 date/time codec coverage. Adds new static
S7DateTimeCodecclass mirroring theS7StringCodecpattern, with encode/decode for all six wire formats:S7DataTypeenum gainsDtl,DateAndTime,S5Time,Time,TimeOfDay,Date.S7Driver.ReadOneAsync/WriteOneAsyncroute via rawReadBytesAsync/WriteBytesAsync(S7.Net has no string-keyed overload for these widths).MapDataType: DTL/DT/DATE →DateTime; S5TIME/TIME/TOD →Int32ms (no Duration inDriverDataTypeyet).Edge cases: all-zero DTL/DT buffers reject as
InvalidDataException(rather than decoding to year-0001 garbage). BCD nibbles validated on every decode.Test plan
dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.S7+Driver.S7.Cli— clean (0 / 0)dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.S7.Tests— 115 / 115 passed (30 new inS7DateTimeCodecTests: golden-byte vectors per type, round-trip, BCD-nibble rejection, all-zero buffer rejection, signed-TIME negatives, TOD upper-bound)🤖 Auto-generated by the Mode-B execution loop. Closes #289.
Closes #289