From 2e6228a243b3448a7ea37c7b794e92fb53d8244b Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Sat, 25 Apr 2026 12:44:43 -0400 Subject: [PATCH] =?UTF-8?q?Auto:=20abcip-1.1=20=E2=80=94=20LINT/ULINT=2064?= =?UTF-8?q?-bit=20fidelity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #225 --- src/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDataType.cs | 5 +++-- src/ZB.MOM.WW.OtOpcUa.Driver.AbCip/LibplctagTagRuntime.cs | 4 ++-- .../ZB.MOM.WW.OtOpcUa.Driver.AbCip.Tests/AbCipDriverTests.cs | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDataType.cs b/src/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDataType.cs index cc0b822..1a7ea4c 100644 --- a/src/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDataType.cs +++ b/src/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDataType.cs @@ -50,11 +50,12 @@ public static class AbCipDataTypeExtensions AbCipDataType.Bool => DriverDataType.Boolean, AbCipDataType.SInt or AbCipDataType.Int or AbCipDataType.DInt => DriverDataType.Int32, AbCipDataType.USInt or AbCipDataType.UInt or AbCipDataType.UDInt => DriverDataType.Int32, - AbCipDataType.LInt or AbCipDataType.ULInt => DriverDataType.Int32, // TODO: Int64 — matches Modbus gap + AbCipDataType.LInt => DriverDataType.Int64, + AbCipDataType.ULInt => DriverDataType.UInt64, AbCipDataType.Real => DriverDataType.Float32, AbCipDataType.LReal => DriverDataType.Float64, AbCipDataType.String => DriverDataType.String, - AbCipDataType.Dt => DriverDataType.Int32, // epoch-seconds DINT + AbCipDataType.Dt => DriverDataType.Int64, // Logix v32+ DT == LINT epoch-millis AbCipDataType.Structure => DriverDataType.String, // placeholder until UDT PR 6 introduces a structured kind _ => DriverDataType.Int32, }; diff --git a/src/ZB.MOM.WW.OtOpcUa.Driver.AbCip/LibplctagTagRuntime.cs b/src/ZB.MOM.WW.OtOpcUa.Driver.AbCip/LibplctagTagRuntime.cs index aeda12f..0b0d478 100644 --- a/src/ZB.MOM.WW.OtOpcUa.Driver.AbCip/LibplctagTagRuntime.cs +++ b/src/ZB.MOM.WW.OtOpcUa.Driver.AbCip/LibplctagTagRuntime.cs @@ -50,7 +50,7 @@ internal sealed class LibplctagTagRuntime : IAbCipTagRuntime AbCipDataType.Real => _tag.GetFloat32(offset), AbCipDataType.LReal => _tag.GetFloat64(offset), AbCipDataType.String => _tag.GetString(offset), - AbCipDataType.Dt => _tag.GetInt32(offset), + AbCipDataType.Dt => _tag.GetInt64(offset), AbCipDataType.Structure => null, _ => null, }; @@ -105,7 +105,7 @@ internal sealed class LibplctagTagRuntime : IAbCipTagRuntime _tag.SetString(0, Convert.ToString(value) ?? string.Empty); break; case AbCipDataType.Dt: - _tag.SetInt32(0, Convert.ToInt32(value)); + _tag.SetInt64(0, Convert.ToInt64(value)); break; case AbCipDataType.Structure: throw new NotSupportedException("Whole-UDT writes land in PR 6."); diff --git a/tests/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Tests/AbCipDriverTests.cs b/tests/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Tests/AbCipDriverTests.cs index a489d2d..5afddfe 100644 --- a/tests/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Tests/AbCipDriverTests.cs +++ b/tests/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Tests/AbCipDriverTests.cs @@ -124,8 +124,11 @@ public sealed class AbCipDriverTests { AbCipDataType.Bool.ToDriverDataType().ShouldBe(DriverDataType.Boolean); AbCipDataType.DInt.ToDriverDataType().ShouldBe(DriverDataType.Int32); + AbCipDataType.LInt.ToDriverDataType().ShouldBe(DriverDataType.Int64); + AbCipDataType.ULInt.ToDriverDataType().ShouldBe(DriverDataType.UInt64); AbCipDataType.Real.ToDriverDataType().ShouldBe(DriverDataType.Float32); AbCipDataType.LReal.ToDriverDataType().ShouldBe(DriverDataType.Float64); AbCipDataType.String.ToDriverDataType().ShouldBe(DriverDataType.String); + AbCipDataType.Dt.ToDriverDataType().ShouldBe(DriverDataType.Int64); } } -- 2.49.1