Auto: twincat-1.1 — Int64 fidelity for LINT/ULINT
Map LInt/ULInt to DriverDataType.Int64/UInt64 instead of truncating to Int32. AdsTwinCATClient.MapToClrType already returns long/ulong so the wire-level read returns the correct boxed types. Closes #305
This commit is contained in:
@@ -37,7 +37,8 @@ public static class TwinCATDataTypeExtensions
|
||||
TwinCATDataType.SInt or TwinCATDataType.USInt
|
||||
or TwinCATDataType.Int or TwinCATDataType.UInt
|
||||
or TwinCATDataType.DInt or TwinCATDataType.UDInt => DriverDataType.Int32,
|
||||
TwinCATDataType.LInt or TwinCATDataType.ULInt => DriverDataType.Int32, // matches Int64 gap
|
||||
TwinCATDataType.LInt => DriverDataType.Int64,
|
||||
TwinCATDataType.ULInt => DriverDataType.UInt64,
|
||||
TwinCATDataType.Real => DriverDataType.Float32,
|
||||
TwinCATDataType.LReal => DriverDataType.Float64,
|
||||
TwinCATDataType.String or TwinCATDataType.WString => DriverDataType.String,
|
||||
|
||||
@@ -83,6 +83,8 @@ public sealed class TwinCATDriverTests
|
||||
{
|
||||
TwinCATDataType.Bool.ToDriverDataType().ShouldBe(DriverDataType.Boolean);
|
||||
TwinCATDataType.DInt.ToDriverDataType().ShouldBe(DriverDataType.Int32);
|
||||
TwinCATDataType.LInt.ToDriverDataType().ShouldBe(DriverDataType.Int64);
|
||||
TwinCATDataType.ULInt.ToDriverDataType().ShouldBe(DriverDataType.UInt64);
|
||||
TwinCATDataType.Real.ToDriverDataType().ShouldBe(DriverDataType.Float32);
|
||||
TwinCATDataType.LReal.ToDriverDataType().ShouldBe(DriverDataType.Float64);
|
||||
TwinCATDataType.String.ToDriverDataType().ShouldBe(DriverDataType.String);
|
||||
|
||||
Reference in New Issue
Block a user