refactor(driver-s7): extract S7DriverOptions to .Contracts with parallel CpuType enum
Introduces Driver.S7.Contracts (dependency-free POCO project) and moves S7DriverOptions / S7ProbeOptions / S7TagDefinition / S7DataType into it. Adds S7CpuType enum mirroring S7.Net.CpuType exactly (7 values with explicit integer codes). Runtime S7CpuTypeMap bridges S7CpuType → S7.Net.CpuType at the single Plc construction site in S7Driver.InitializeAsync. S7DriverFactoryExtensions and S7CommandBase updated to use S7CpuType; test files updated to match (S7_1500Profile, S7DriverScaffoldTests). AdminUI can now reference Driver.S7.Contracts without pulling in S7netplus.
This commit is contained in:
+1
-3
@@ -1,5 +1,3 @@
|
||||
using S7NetCpuType = global::S7.Net.CpuType;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.Driver.S7.IntegrationTests.S7_1500;
|
||||
|
||||
/// <summary>
|
||||
@@ -34,7 +32,7 @@ public static class S7_1500Profile
|
||||
{
|
||||
Host = host,
|
||||
Port = port,
|
||||
CpuType = S7NetCpuType.S71500,
|
||||
CpuType = S7CpuType.S71500,
|
||||
Rack = 0,
|
||||
Slot = 0,
|
||||
Timeout = TimeSpan.FromSeconds(5),
|
||||
|
||||
@@ -18,7 +18,7 @@ public sealed class S7DriverScaffoldTests
|
||||
{
|
||||
var opts = new S7DriverOptions();
|
||||
opts.Port.ShouldBe(102, "ISO-on-TCP is always 102 for S7; documented in driver-specs.md §5");
|
||||
opts.CpuType.ShouldBe(global::S7.Net.CpuType.S71500);
|
||||
opts.CpuType.ShouldBe(S7CpuType.S71500);
|
||||
opts.Rack.ShouldBe((short)0);
|
||||
opts.Slot.ShouldBe((short)0, "S7-1200/1500 onboard PN ports are slot 0 by convention");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user