v3(s7): apply Modbus RawTags exemplar to the S7 driver
Rename S7EquipmentTagParser -> S7TagDefinitionFactory; TryParse(reference)
-> FromTagConfig(tagConfig, rawPath, out def) (drops the leading-{ heuristic,
keys the def by RawPath, adds inverse ToTagConfig). Replace S7DriverOptions.Tags
(pre-declared S7TagDefinition list) with RawTags (IReadOnlyList<RawTagEntry>);
the driver builds its RawPath->def table from RawTags at Initialize via the
factory (skip+log on miss), resolver is byName-only, DiscoverAsync + init guards
+ address pre-parse now run off that table. Factory retires the pre-declared DTO
tag path (RawTags binding only). Cli BuildOptions serialises typed defs to
RawTagEntry. Tests migrated to a S7RawTags helper + FromTagConfig; parser test
files renamed. Coordinator's EquipmentTagConfigInspector S7 rename left to Wave-B
coordinator; Driver.S7.IntegrationTests (Docker-gated) left red per scope.
Driver.S7 + Cli build green; Driver.S7.Tests 264/264, S7.Cli.Tests 49/49.
This commit is contained in:
@@ -34,7 +34,7 @@ public sealed class S7DriverCodeReviewFixTests
|
||||
{
|
||||
Host = "192.0.2.1",
|
||||
Timeout = TimeSpan.FromMilliseconds(250),
|
||||
Tags = [new S7TagDefinition("Quirk", address, S7DataType.Int16)],
|
||||
RawTags = S7RawTags.Entries(new S7TagDefinition("Quirk", address, S7DataType.Int16)),
|
||||
};
|
||||
using var drv = new S7Driver(opts, "s7-tc");
|
||||
|
||||
@@ -58,11 +58,9 @@ public sealed class S7DriverCodeReviewFixTests
|
||||
{
|
||||
Host = "192.0.2.1",
|
||||
Timeout = TimeSpan.FromMilliseconds(250),
|
||||
Tags =
|
||||
[
|
||||
RawTags = S7RawTags.Entries(
|
||||
new S7TagDefinition("Word", "DB1.DBW0", S7DataType.Int16),
|
||||
new S7TagDefinition("Bit", "M0.0", S7DataType.Bool),
|
||||
],
|
||||
new S7TagDefinition("Bit", "M0.0", S7DataType.Bool)),
|
||||
};
|
||||
using var drv = new S7Driver(opts, "s7-ok");
|
||||
|
||||
@@ -111,7 +109,7 @@ public sealed class S7DriverCodeReviewFixTests
|
||||
|
||||
const string json = """
|
||||
{ "Host": "192.0.2.1", "TimeoutMs": 250,
|
||||
"Tags": [ { "Name": "TimerTag", "Address": "T5", "DataType": "Int16" } ] }
|
||||
"RawTags": [ { "RawPath": "TimerTag", "TagConfig": "{\"address\":\"T5\",\"dataType\":\"Int16\"}", "WriteIdempotent": false } ] }
|
||||
""";
|
||||
|
||||
var ex = await Should.ThrowAsync<NotSupportedException>(async () =>
|
||||
|
||||
Reference in New Issue
Block a user