You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2021/12/15 21:24:40 UTC
[plc4x] 06/09: - Added a first test for the decoder - Fixed issues in the float and double processing of the ReadBuffer - Made the PlcValues comparable for equality
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feature/plc4net2
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit 7a4b8cb38b879166977e6c5e27e472d8eb480e74
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Thu Dec 3 18:25:51 2020 +0100
- Added a first test for the decoder
- Fixed issues in the float and double processing of the ReadBuffer
- Made the PlcValues comparable for equality
---
sandbox/plc4net/api/plc4net-api.csproj | 2 +-
.../plc4net-driver-knxproj-test.csproj} | 15 +++++---
.../knxnetip/ParserSerializerTestsuite.xml | 0
.../knxnetip/readwrite/model/KnxDatapointTests.cs | 42 ++++++++++++++++++++++
.../drivers/knxnetip/plc4net-driver-knxproj.csproj | 2 +-
.../knxnetip/readwrite/model/KnxDatapoint.cs | 0
.../plc4net/plc4net.driver/plc4net.driver.csproj | 29 ---------------
sandbox/plc4net/plc4net.sln | 7 ++++
sandbox/plc4net/pom.xml | 4 +--
sandbox/plc4net/spi/plc4net-spi.csproj | 2 +-
sandbox/plc4net/spi/spi/generation/ReadBuffer.cs | 26 +++++++-------
sandbox/plc4net/spi/spi/model/values/PlcBOOL.cs | 19 ++++++++++
sandbox/plc4net/spi/spi/model/values/PlcBYTE.cs | 19 ++++++++++
sandbox/plc4net/spi/spi/model/values/PlcCHAR.cs | 19 ++++++++++
sandbox/plc4net/spi/spi/model/values/PlcDATE.cs | 19 ++++++++++
.../spi/spi/model/values/PlcDATE_AND_TIME.cs | 19 ++++++++++
sandbox/plc4net/spi/spi/model/values/PlcDWORD.cs | 18 ++++++++++
sandbox/plc4net/spi/spi/model/values/PlcLTIME.cs | 19 ++++++++++
sandbox/plc4net/spi/spi/model/values/PlcLWORD.cs | 18 ++++++++++
sandbox/plc4net/spi/spi/model/values/PlcNULL.cs | 19 ++++++++++
sandbox/plc4net/spi/spi/model/values/PlcPlcList.cs | 18 ++++++++++
sandbox/plc4net/spi/spi/model/values/PlcSTRING.cs | 19 ++++++++++
.../model/values/PlcSimpleNumericValueAdapter.cs | 18 ++++++++++
sandbox/plc4net/spi/spi/model/values/PlcStruct.cs | 19 +++++++++-
.../spi/spi/model/values/PlcTIME _OF_DAY.cs | 19 ++++++++++
sandbox/plc4net/spi/spi/model/values/PlcTIME.cs | 19 ++++++++++
sandbox/plc4net/spi/spi/model/values/PlcWCHAR.cs | 19 ++++++++++
sandbox/plc4net/spi/spi/model/values/PlcWORD.cs | 18 ++++++++++
sandbox/plc4net/spi/spi/model/values/PlcWSTRING.cs | 19 ++++++++++
29 files changed, 414 insertions(+), 52 deletions(-)
diff --git a/sandbox/plc4net/api/plc4net-api.csproj b/sandbox/plc4net/api/plc4net-api.csproj
index 7da4e99..d568d3b 100644
--- a/sandbox/plc4net/api/plc4net-api.csproj
+++ b/sandbox/plc4net/api/plc4net-api.csproj
@@ -20,7 +20,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>netstandard2.0</TargetFramework>
+ <TargetFramework>net452</TargetFramework>
<RootNamespace>org.apache.plc4net</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Apache PLC4X</Authors>
diff --git a/sandbox/plc4net/drivers/knxnetip/plc4net-driver-knxproj.csproj b/sandbox/plc4net/drivers/knxnetip-test/plc4net-driver-knxproj-test.csproj
similarity index 72%
copy from sandbox/plc4net/drivers/knxnetip/plc4net-driver-knxproj.csproj
copy to sandbox/plc4net/drivers/knxnetip-test/plc4net-driver-knxproj-test.csproj
index 5ed4474..5abe19a 100644
--- a/sandbox/plc4net/drivers/knxnetip/plc4net-driver-knxproj.csproj
+++ b/sandbox/plc4net/drivers/knxnetip-test/plc4net-driver-knxproj-test.csproj
@@ -20,20 +20,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>netstandard2.0</TargetFramework>
+ <TargetFramework>net452</TargetFramework>
<RootNamespace>org.apache.plc4net</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Apache PLC4X</Authors>
<Copyright>The Apache Software Foundation</Copyright>
<PackageProjectUrl>https://plc4x.apache.org</PackageProjectUrl>
- <Title>PLC4Net: Driver: KNXNet/IP</Title>
+ <Title>PLC4Net: Driver: KNXNet/IP: Test</Title>
<PackageLicenseUrl>https://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
<PackageVersion>0.8.0-SNAPSHOT</PackageVersion>
</PropertyGroup>
<ItemGroup>
- <ProjectReference Include="..\..\api\plc4net-api.csproj" />
- <ProjectReference Include="..\..\spi\plc4net-spi.csproj" />
+ <PackageReference Include="xunit" Version="2.4.1" />
+ <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
+ <PrivateAssets>all</PrivateAssets>
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+ </PackageReference>
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\knxnetip\plc4net-driver-knxproj.csproj" />
</ItemGroup>
</Project>
diff --git a/sandbox/plc4net/drivers/knxnetip/generated/testing/assets/protocols/knxnetip/ParserSerializerTestsuite.xml b/sandbox/plc4net/drivers/knxnetip-test/resources/protocols/knxnetip/ParserSerializerTestsuite.xml
similarity index 100%
rename from sandbox/plc4net/drivers/knxnetip/generated/testing/assets/protocols/knxnetip/ParserSerializerTestsuite.xml
rename to sandbox/plc4net/drivers/knxnetip-test/resources/protocols/knxnetip/ParserSerializerTestsuite.xml
diff --git a/sandbox/plc4net/drivers/knxnetip-test/test/knxnetip/readwrite/model/KnxDatapointTests.cs b/sandbox/plc4net/drivers/knxnetip-test/test/knxnetip/readwrite/model/KnxDatapointTests.cs
new file mode 100644
index 0000000..64a0d55
--- /dev/null
+++ b/sandbox/plc4net/drivers/knxnetip-test/test/knxnetip/readwrite/model/KnxDatapointTests.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using org.apache.plc4net.api.value;
+using org.apache.plc4net.drivers.knxnetip.readwrite.model;
+using org.apache.plc4net.spi.generation;
+using org.apache.plc4net.spi.model.values;
+using Xunit;
+
+namespace org.apache.plc4net.test.knxnetip.readwrite.model
+{
+ public class KnxDatapointTests
+ {
+ [Fact]
+ public void DecodeKnxData1()
+ {
+ var formatName = "F32";
+ var input = StrToByteArray("0041b00000");
+ IPlcValue expected = new PlcREAL(22.0f);
+
+ var actual = new KnxDatapoint().Parse(new ReadBuffer(input), formatName);
+
+ Assert.Equal(expected, actual);
+ }
+
+ private static byte[] StrToByteArray(string str)
+ {
+ var hexIndex = new Dictionary<string, byte>();
+ for (var i = 0; i <= 255; i++)
+ {
+ hexIndex.Add(i.ToString("X2"), (byte) i);
+ }
+
+ var hexRes = new List<byte>();
+ for (var i = 0; i < str.Length; i += 2)
+ {
+ hexRes.Add(hexIndex[str.Substring(i, 2).ToUpper()]);
+ }
+ return hexRes.ToArray();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/sandbox/plc4net/drivers/knxnetip/plc4net-driver-knxproj.csproj b/sandbox/plc4net/drivers/knxnetip/plc4net-driver-knxproj.csproj
index 5ed4474..27ae013 100644
--- a/sandbox/plc4net/drivers/knxnetip/plc4net-driver-knxproj.csproj
+++ b/sandbox/plc4net/drivers/knxnetip/plc4net-driver-knxproj.csproj
@@ -20,7 +20,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>netstandard2.0</TargetFramework>
+ <TargetFramework>net452</TargetFramework>
<RootNamespace>org.apache.plc4net</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Apache PLC4X</Authors>
diff --git a/sandbox/plc4net/drivers/knxnetip/generated/sources/knxnetip/readwrite/model/KnxDatapoint.cs b/sandbox/plc4net/drivers/knxnetip/src/knxnetip/readwrite/model/KnxDatapoint.cs
similarity index 100%
rename from sandbox/plc4net/drivers/knxnetip/generated/sources/knxnetip/readwrite/model/KnxDatapoint.cs
rename to sandbox/plc4net/drivers/knxnetip/src/knxnetip/readwrite/model/KnxDatapoint.cs
diff --git a/sandbox/plc4net/plc4net.driver/plc4net.driver.csproj b/sandbox/plc4net/plc4net.driver/plc4net.driver.csproj
deleted file mode 100644
index e54dfc4..0000000
--- a/sandbox/plc4net/plc4net.driver/plc4net.driver.csproj
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<Project Sdk="Microsoft.NET.Sdk">
-
- <PropertyGroup>
- <TargetFramework>netstandard2.0</TargetFramework>
- <BaseOutputPath>target/classes</BaseOutputPath>
- <BaseIntermediateOutputPath>target/classes-intermediate</BaseIntermediateOutputPath>
- <RestoreOutputPath>target/restore-output-path</RestoreOutputPath>
- </PropertyGroup>
-
-</Project>
diff --git a/sandbox/plc4net/plc4net.sln b/sandbox/plc4net/plc4net.sln
index 8e4ebe1..5659034 100644
--- a/sandbox/plc4net/plc4net.sln
+++ b/sandbox/plc4net/plc4net.sln
@@ -27,6 +27,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "drivers", "drivers", "{35D8
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "plc4net-driver-knxproj", "drivers\knxnetip\plc4net-driver-knxproj.csproj", "{640E582A-68DF-4E51-B019-AE5774F31B54}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "plc4net-driver-knxproj-test", "drivers\knxnetip-test\plc4net-driver-knxproj-test.csproj", "{E9497B75-55B6-4C14-AAFB-DB93D0C88166}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -45,8 +47,13 @@ Global
{640E582A-68DF-4E51-B019-AE5774F31B54}.Debug|Any CPU.Build.0 = Debug|Any CPU
{640E582A-68DF-4E51-B019-AE5774F31B54}.Release|Any CPU.ActiveCfg = Release|Any CPU
{640E582A-68DF-4E51-B019-AE5774F31B54}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E9497B75-55B6-4C14-AAFB-DB93D0C88166}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E9497B75-55B6-4C14-AAFB-DB93D0C88166}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E9497B75-55B6-4C14-AAFB-DB93D0C88166}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E9497B75-55B6-4C14-AAFB-DB93D0C88166}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{640E582A-68DF-4E51-B019-AE5774F31B54} = {35D8C56A-A721-46B3-A32C-71FCF212E85D}
+ {E9497B75-55B6-4C14-AAFB-DB93D0C88166} = {35D8C56A-A721-46B3-A32C-71FCF212E85D}
EndGlobalSection
EndGlobal
diff --git a/sandbox/plc4net/pom.xml b/sandbox/plc4net/pom.xml
index 418a489..5d9854c 100644
--- a/sandbox/plc4net/pom.xml
+++ b/sandbox/plc4net/pom.xml
@@ -58,7 +58,7 @@
<artifactId>plc4x-protocols-knxnetip</artifactId>
<classifier>tests</classifier>
<type>test-jar</type>
- <outputDirectory>${project.basedir}/drivers/knxnetip/generated/testing/assets</outputDirectory>
+ <outputDirectory>${project.basedir}/drivers/knxnetip-test/resources</outputDirectory>
<includes>**/*.xml</includes>
<excludes>META-INF/**,org/**</excludes>
</artifactItem>
@@ -85,7 +85,7 @@
<protocolName>knxnetip</protocolName>
<languageName>C#</languageName>
<outputFlavor>read-write</outputFlavor>
- <outputDir>${project.basedir}/drivers/knxnetip/generated/sources</outputDir>
+ <outputDir>${project.basedir}/drivers/knxnetip/src</outputDir>
</configuration>
</execution>
</executions>
diff --git a/sandbox/plc4net/spi/plc4net-spi.csproj b/sandbox/plc4net/spi/plc4net-spi.csproj
index 649ee68..481ffa1 100644
--- a/sandbox/plc4net/spi/plc4net-spi.csproj
+++ b/sandbox/plc4net/spi/plc4net-spi.csproj
@@ -20,7 +20,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>netstandard2.0</TargetFramework>
+ <TargetFramework>net452</TargetFramework>
<RootNamespace>org.apache.plc4net</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Apache PLC4X</Authors>
diff --git a/sandbox/plc4net/spi/spi/generation/ReadBuffer.cs b/sandbox/plc4net/spi/spi/generation/ReadBuffer.cs
index f727fba..33669a4 100644
--- a/sandbox/plc4net/spi/spi/generation/ReadBuffer.cs
+++ b/sandbox/plc4net/spi/spi/generation/ReadBuffer.cs
@@ -76,7 +76,7 @@ namespace org.apache.plc4net.spi.generation
{
throw new ArgumentOutOfRangeException();
}
- return (byte) _reader.ReadInt(0, bitLength);
+ return (byte) _reader.ReadInt(bitLength);
}
public ushort ReadUshort(int bitLength)
@@ -85,7 +85,7 @@ namespace org.apache.plc4net.spi.generation
{
throw new ArgumentOutOfRangeException();
}
- return (ushort) _reader.ReadInt(0, bitLength);
+ return (ushort) _reader.ReadInt(bitLength);
}
public uint ReadUint(int bitLength)
@@ -94,7 +94,7 @@ namespace org.apache.plc4net.spi.generation
{
throw new ArgumentOutOfRangeException();
}
- return (uint) _reader.ReadInt(0, bitLength);
+ return (uint) _reader.ReadInt(bitLength);
}
public ulong ReadUlong(int bitLength)
@@ -107,9 +107,9 @@ namespace org.apache.plc4net.spi.generation
ulong firstInt = 0;
if (bitLength > 32)
{
- firstInt = (ulong) _reader.ReadInt(0, bitLength - 32) << 32;
+ firstInt = (ulong) _reader.ReadInt(bitLength - 32) << 32;
}
- return firstInt | (ulong) _reader.ReadInt(0, bitLength);
+ return firstInt | (ulong) _reader.ReadInt(bitLength);
}
public sbyte ReadSbyte(int bitLength)
@@ -118,7 +118,7 @@ namespace org.apache.plc4net.spi.generation
{
throw new ArgumentOutOfRangeException();
}
- return (sbyte) _reader.ReadInt(0, bitLength);
+ return (sbyte) _reader.ReadInt(bitLength);
}
public short ReadShort(int bitLength)
@@ -127,7 +127,7 @@ namespace org.apache.plc4net.spi.generation
{
throw new ArgumentOutOfRangeException();
}
- return (short) _reader.ReadInt(0, bitLength);
+ return (short) _reader.ReadInt(bitLength);
}
public int ReadInt(int bitLength)
@@ -136,7 +136,7 @@ namespace org.apache.plc4net.spi.generation
{
throw new ArgumentOutOfRangeException();
}
- return (int) _reader.ReadInt(0, bitLength);
+ return _reader.ReadInt(bitLength);
}
public long ReadLong(int bitLength)
@@ -149,16 +149,16 @@ namespace org.apache.plc4net.spi.generation
long firstInt = 0;
if (bitLength > 32)
{
- firstInt = (long) _reader.ReadInt(0, bitLength - 32) << 32;
+ firstInt = (long) _reader.ReadInt(bitLength - 32) << 32;
}
- return firstInt | (long) _reader.ReadInt(0, bitLength);
+ return firstInt | (long) _reader.ReadInt(bitLength);
}
public float ReadFloat(bool signed, int exponentBitLength, int mantissaBitLength)
{
if (signed && exponentBitLength == 8 && mantissaBitLength == 23)
{
- return Convert.ToSingle(ReadInt(32));
+ return BitConverter.ToSingle(BitConverter.GetBytes(ReadInt(32)), 0);
}
// This is the format as described in the KNX spec ... it's not a real half precision floating point.
if (signed && exponentBitLength == 4 && mantissaBitLength == 11)
@@ -185,11 +185,11 @@ namespace org.apache.plc4net.spi.generation
{
if (signed && exponentBitLength == 8 && mantissaBitLength == 23)
{
- return Convert.ToDouble(ReadInt(32));
+ return BitConverter.ToDouble(BitConverter.GetBytes(ReadInt(32)), 0);
}
if (signed && exponentBitLength == 11 && mantissaBitLength == 52)
{
- return Convert.ToDouble(ReadLong(64));
+ return BitConverter.ToDouble(BitConverter.GetBytes(ReadLong(64)), 0);
}
throw new NotImplementedException("This encoding is currently not supported");
}
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcBOOL.cs b/sandbox/plc4net/spi/spi/model/values/PlcBOOL.cs
index a3a11ad..57df8a3 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcBOOL.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcBOOL.cs
@@ -29,5 +29,24 @@ namespace org.apache.plc4net.spi.model.values
{
this.value = value;
}
+
+ protected bool Equals(PlcBOOL other)
+ {
+ return value == other.value;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcBOOL) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return value.GetHashCode();
+ }
+
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcBYTE.cs b/sandbox/plc4net/spi/spi/model/values/PlcBYTE.cs
index 9351847..a11fbcc 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcBYTE.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcBYTE.cs
@@ -55,5 +55,24 @@ namespace org.apache.plc4net.spi.model.values
GetBoolAt(6), GetBoolAt(7)
};
}
+
+ protected bool Equals(PlcBYTE other)
+ {
+ return value == other.value;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcBYTE) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return value.GetHashCode();
+ }
+
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcCHAR.cs b/sandbox/plc4net/spi/spi/model/values/PlcCHAR.cs
index 958bb0f..29f322c 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcCHAR.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcCHAR.cs
@@ -29,5 +29,24 @@ namespace org.apache.plc4net.spi.model.values
{
this.value = value;
}
+
+ protected bool Equals(PlcCHAR other)
+ {
+ return value == other.value;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcCHAR) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return value.GetHashCode();
+ }
+
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcDATE.cs b/sandbox/plc4net/spi/spi/model/values/PlcDATE.cs
index d51b3c4..b857d91 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcDATE.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcDATE.cs
@@ -30,5 +30,24 @@ namespace org.apache.plc4net.spi.model.values
{
this.value = value;
}
+
+ protected bool Equals(PlcDATE other)
+ {
+ return value.Equals(other.value);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcDATE) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return value.GetHashCode();
+ }
+
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcDATE_AND_TIME.cs b/sandbox/plc4net/spi/spi/model/values/PlcDATE_AND_TIME.cs
index 1a9b528..e744887 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcDATE_AND_TIME.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcDATE_AND_TIME.cs
@@ -29,5 +29,24 @@ namespace org.apache.plc4net.spi.model.values
{
this.value = value;
}
+
+ protected bool Equals(PlcDATE_AND_TIME other)
+ {
+ return value.Equals(other.value);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcDATE_AND_TIME) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return value.GetHashCode();
+ }
+
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcDWORD.cs b/sandbox/plc4net/spi/spi/model/values/PlcDWORD.cs
index 3051771..1e6065d 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcDWORD.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcDWORD.cs
@@ -68,5 +68,23 @@ namespace org.apache.plc4net.spi.model.values
};
}
+ protected bool Equals(PlcDWORD other)
+ {
+ return value == other.value;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcDWORD) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return (int) value;
+ }
+
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcLTIME.cs b/sandbox/plc4net/spi/spi/model/values/PlcLTIME.cs
index cfd3b7c..6bf4ceb 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcLTIME.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcLTIME.cs
@@ -30,5 +30,24 @@ namespace org.apache.plc4net.spi.model.values
{
this.value = value;
}
+
+ protected bool Equals(PlcLTIME other)
+ {
+ return value.Equals(other.value);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcLTIME) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return value.GetHashCode();
+ }
+
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcLWORD.cs b/sandbox/plc4net/spi/spi/model/values/PlcLWORD.cs
index 64d67f3..2bfe6f3 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcLWORD.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcLWORD.cs
@@ -84,5 +84,23 @@ namespace org.apache.plc4net.spi.model.values
};
}
+ protected bool Equals(PlcLWORD other)
+ {
+ return value == other.value;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcLWORD) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return value.GetHashCode();
+ }
+
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcNULL.cs b/sandbox/plc4net/spi/spi/model/values/PlcNULL.cs
index 1822fd1..fb8c33a 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcNULL.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcNULL.cs
@@ -26,5 +26,24 @@ namespace org.apache.plc4net.spi.model.values
public PlcNULL()
{
}
+
+ protected bool Equals(PlcNULL other)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcNULL) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ throw new System.NotImplementedException();
+ }
+
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcPlcList.cs b/sandbox/plc4net/spi/spi/model/values/PlcPlcList.cs
index 1930a60..6d7f9a7 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcPlcList.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcPlcList.cs
@@ -30,5 +30,23 @@ namespace org.apache.plc4net.spi.model.values
{
this.values = values;
}
+
+ protected bool Equals(PlcList other)
+ {
+ return Equals(values, other.values);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcList) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return (values != null ? values.GetHashCode() : 0);
+ }
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcSTRING.cs b/sandbox/plc4net/spi/spi/model/values/PlcSTRING.cs
index be41810..9ff291a 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcSTRING.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcSTRING.cs
@@ -29,5 +29,24 @@ namespace org.apache.plc4net.spi.model.values
{
this.value = value;
}
+
+ protected bool Equals(PlcSTRING other)
+ {
+ return value == other.value;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcSTRING) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return (value != null ? value.GetHashCode() : 0);
+ }
+
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcSimpleNumericValueAdapter.cs b/sandbox/plc4net/spi/spi/model/values/PlcSimpleNumericValueAdapter.cs
index 122cc0f..8c2a1a0 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcSimpleNumericValueAdapter.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcSimpleNumericValueAdapter.cs
@@ -190,5 +190,23 @@ namespace org.apache.plc4net.spi.model.values
return value.ToString();
}
+ protected bool Equals(SimpleNumericValueAdapter<T> other)
+ {
+ return Equals(value, other.value);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((SimpleNumericValueAdapter<T>) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return (value != null ? value.GetHashCode() : 0);
+ }
+
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcStruct.cs b/sandbox/plc4net/spi/spi/model/values/PlcStruct.cs
index 206fac3..1739f14 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcStruct.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcStruct.cs
@@ -31,7 +31,24 @@ namespace org.apache.plc4net.spi.model.values
{
this.values = values;
}
-
+
+ protected bool Equals(PlcStruct other)
+ {
+ return Equals(values, other.values);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcStruct) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return (values != null ? values.GetHashCode() : 0);
+ }
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcTIME _OF_DAY.cs b/sandbox/plc4net/spi/spi/model/values/PlcTIME _OF_DAY.cs
index 2c3c67a..ff80f7c 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcTIME _OF_DAY.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcTIME _OF_DAY.cs
@@ -30,5 +30,24 @@ namespace org.apache.plc4net.spi.model.values
{
this.value = value;
}
+
+ protected bool Equals(PlcTIME_OF_DAY other)
+ {
+ return value.Equals(other.value);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcTIME_OF_DAY) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return value.GetHashCode();
+ }
+
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcTIME.cs b/sandbox/plc4net/spi/spi/model/values/PlcTIME.cs
index 0d78c57..ead78c3 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcTIME.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcTIME.cs
@@ -30,5 +30,24 @@ namespace org.apache.plc4net.spi.model.values
{
this.value = value;
}
+
+ protected bool Equals(PlcTIME other)
+ {
+ return value.Equals(other.value);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcTIME) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return value.GetHashCode();
+ }
+
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcWCHAR.cs b/sandbox/plc4net/spi/spi/model/values/PlcWCHAR.cs
index 5b34f8a..518e964 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcWCHAR.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcWCHAR.cs
@@ -29,5 +29,24 @@ namespace org.apache.plc4net.spi.model.values
{
this.value = value;
}
+
+ protected bool Equals(PlcWCHAR other)
+ {
+ return value == other.value;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcWCHAR) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return value.GetHashCode();
+ }
+
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcWORD.cs b/sandbox/plc4net/spi/spi/model/values/PlcWORD.cs
index 84e2b99..b0f0041 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcWORD.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcWORD.cs
@@ -60,5 +60,23 @@ namespace org.apache.plc4net.spi.model.values
};
}
+ protected bool Equals(PlcWORD other)
+ {
+ return value == other.value;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcWORD) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return value.GetHashCode();
+ }
+
}
}
\ No newline at end of file
diff --git a/sandbox/plc4net/spi/spi/model/values/PlcWSTRING.cs b/sandbox/plc4net/spi/spi/model/values/PlcWSTRING.cs
index e344e7e..7564b95 100644
--- a/sandbox/plc4net/spi/spi/model/values/PlcWSTRING.cs
+++ b/sandbox/plc4net/spi/spi/model/values/PlcWSTRING.cs
@@ -29,5 +29,24 @@ namespace org.apache.plc4net.spi.model.values
{
this.value = value;
}
+
+ protected bool Equals(PlcWSTRING other)
+ {
+ return value == other.value;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((PlcWSTRING) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return (value != null ? value.GetHashCode() : 0);
+ }
+
}
}
\ No newline at end of file