From b474d63335a5c41e69d8de854c3b31b2871f2987 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Thu, 28 May 2026 08:57:36 -0400 Subject: [PATCH] refactor(driver-abcip): extract AbCipDriverOptions to .Contracts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move AbCipDriverOptions (and AbCipDataType enum) to a new Driver.AbCip.Contracts sibling project. AbCipDataTypeExtensions (which uses DriverDataType from Core.Abstractions) stays in the runtime driver as AbCipDataTypeExtensions.cs. Replace two doc-comment and with X per the approved decision — no compilable using was present. The runtime Driver.AbCip project gains a ProjectReference to .Contracts; the .slnx is updated accordingly. --- ZB.MOM.WW.OtOpcUa.slnx | 1 + .../AbCipDataType.cs | 35 +++++++++++++++++++ .../AbCipDriverOptions.cs | 4 +-- ...M.WW.OtOpcUa.Driver.AbCip.Contracts.csproj | 9 +++++ ...DataType.cs => AbCipDataTypeExtensions.cs} | 35 ------------------- .../ZB.MOM.WW.OtOpcUa.Driver.AbCip.csproj | 1 + 6 files changed, 48 insertions(+), 37 deletions(-) create mode 100644 src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Contracts/AbCipDataType.cs rename src/Drivers/{ZB.MOM.WW.OtOpcUa.Driver.AbCip => ZB.MOM.WW.OtOpcUa.Driver.AbCip.Contracts}/AbCipDriverOptions.cs (98%) create mode 100644 src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Contracts/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Contracts.csproj rename src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/{AbCipDataType.cs => AbCipDataTypeExtensions.cs} (54%) diff --git a/ZB.MOM.WW.OtOpcUa.slnx b/ZB.MOM.WW.OtOpcUa.slnx index 5cff2221..ebe20da3 100644 --- a/ZB.MOM.WW.OtOpcUa.slnx +++ b/ZB.MOM.WW.OtOpcUa.slnx @@ -28,6 +28,7 @@ + diff --git a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Contracts/AbCipDataType.cs b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Contracts/AbCipDataType.cs new file mode 100644 index 00000000..c79fbb05 --- /dev/null +++ b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Contracts/AbCipDataType.cs @@ -0,0 +1,35 @@ +namespace ZB.MOM.WW.OtOpcUa.Driver.AbCip; + +/// +/// Logix atomic + string data types, plus a Structure marker used when a tag +/// references a UDT / predefined structure (Timer, Counter, Control). The concrete UDT +/// shape is resolved via the CIP Template Object at discovery time. +/// +/// +/// Mirrors the shape of ModbusDataType. Atomic Logix names (BOOL / SINT / INT / DINT / +/// LINT / REAL / LREAL / STRING / DT) map one-to-one; BIT + BOOL-in-DINT collapse into +/// Bool with the .N bit-index carried on the AbCipTagPath +/// rather than the data type itself. +/// +public enum AbCipDataType +{ + Bool, + SInt, // signed 8-bit + Int, // signed 16-bit + DInt, // signed 32-bit + LInt, // signed 64-bit + USInt, // unsigned 8-bit (Logix 5000 post-V21) + UInt, // unsigned 16-bit + UDInt, // unsigned 32-bit + ULInt, // unsigned 64-bit + Real, // 32-bit IEEE-754 + LReal, // 64-bit IEEE-754 + String, // Logix STRING (DINT Length + SINT[82] DATA — flattened to .NET string by libplctag) + Dt, // Date/Time — Logix DT == DINT representing seconds-since-epoch per Rockwell conventions + /// + /// UDT / Predefined Structure (Timer / Counter / Control / Message / Axis). Shape is + /// resolved at discovery time; reads + writes fan out to member Variables unless the + /// caller has explicitly opted into whole-UDT decode. + /// + Structure, +} diff --git a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDriverOptions.cs b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Contracts/AbCipDriverOptions.cs similarity index 98% rename from src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDriverOptions.cs rename to src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Contracts/AbCipDriverOptions.cs index 10d516b8..0be1d21a 100644 --- a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDriverOptions.cs +++ b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Contracts/AbCipDriverOptions.cs @@ -45,7 +45,7 @@ public sealed class AbCipDriverOptions /// /// Task #177 — when true, declared ALMD tags are surfaced as alarm conditions - /// via ; the driver polls each subscribed + /// via IAlarmSource; the driver polls each subscribed /// alarm's InFaulted + Severity members + fires OnAlarmEvent on /// state transitions. Default false — operators explicitly opt in because /// projection semantics don't exactly mirror Rockwell FT Alarm & Events; shops @@ -158,7 +158,7 @@ public enum AbCipPlcFamily /// /// Background connectivity-probe settings. Enabled by default; the probe reads a cheap tag -/// on the PLC at the configured interval to drive +/// on the PLC at the configured interval to drive IHostConnectivityProbe /// state transitions + Admin UI health status. /// public sealed class AbCipProbeOptions diff --git a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Contracts/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Contracts.csproj b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Contracts/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Contracts.csproj new file mode 100644 index 00000000..d911061a --- /dev/null +++ b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Contracts/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Contracts.csproj @@ -0,0 +1,9 @@ + + + net10.0 + enable + enable + true + + + diff --git a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDataType.cs b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDataTypeExtensions.cs similarity index 54% rename from src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDataType.cs rename to src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDataTypeExtensions.cs index aa67eee0..5d712559 100644 --- a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDataType.cs +++ b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDataTypeExtensions.cs @@ -2,41 +2,6 @@ using ZB.MOM.WW.OtOpcUa.Core.Abstractions; namespace ZB.MOM.WW.OtOpcUa.Driver.AbCip; -/// -/// Logix atomic + string data types, plus a marker used when a tag -/// references a UDT / predefined structure (Timer, Counter, Control). The concrete UDT -/// shape is resolved via the CIP Template Object at discovery time (see -/// + ). -/// -/// -/// Mirrors the shape of ModbusDataType. Atomic Logix names (BOOL / SINT / INT / DINT / -/// LINT / REAL / LREAL / STRING / DT) map one-to-one; BIT + BOOL-in-DINT collapse into -/// with the .N bit-index carried on the -/// rather than the data type itself. -/// -public enum AbCipDataType -{ - Bool, - SInt, // signed 8-bit - Int, // signed 16-bit - DInt, // signed 32-bit - LInt, // signed 64-bit - USInt, // unsigned 8-bit (Logix 5000 post-V21) - UInt, // unsigned 16-bit - UDInt, // unsigned 32-bit - ULInt, // unsigned 64-bit - Real, // 32-bit IEEE-754 - LReal, // 64-bit IEEE-754 - String, // Logix STRING (DINT Length + SINT[82] DATA — flattened to .NET string by libplctag) - Dt, // Date/Time — Logix DT == DINT representing seconds-since-epoch per Rockwell conventions - /// - /// UDT / Predefined Structure (Timer / Counter / Control / Message / Axis). Shape is - /// resolved at discovery time; reads + writes fan out to member Variables unless the - /// caller has explicitly opted into whole-UDT decode. - /// - Structure, -} - /// Map a Logix atomic type to the driver-surface . public static class AbCipDataTypeExtensions { diff --git a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/ZB.MOM.WW.OtOpcUa.Driver.AbCip.csproj b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/ZB.MOM.WW.OtOpcUa.Driver.AbCip.csproj index 3f3429a2..50b2cae4 100644 --- a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/ZB.MOM.WW.OtOpcUa.Driver.AbCip.csproj +++ b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/ZB.MOM.WW.OtOpcUa.Driver.AbCip.csproj @@ -13,6 +13,7 @@ +