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 2023/02/23 07:39:55 UTC
[plc4x] branch fix/cdutz/reenable-golang-driver-testsuites updated: chore(driver/eip): Did even more finetuning of the eip mspec and continued implementing the go version of the updated EIP driver
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch fix/cdutz/reenable-golang-driver-testsuites
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/fix/cdutz/reenable-golang-driver-testsuites by this push:
new 8f45962e51 chore(driver/eip): Did even more finetuning of the eip mspec and continued implementing the go version of the updated EIP driver
8f45962e51 is described below
commit 8f45962e51485148dcec2e602f2a01154092bf4e
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Thu Feb 23 08:39:43 2023 +0100
chore(driver/eip): Did even more finetuning of the eip mspec and continued implementing the go version of the updated EIP driver
---
.../testing/protocols/eip/DriverTestsuite.xml | 30 +--
....xml => ParserSerializerTestsuiteBigEndian.xml} | 37 ++--
...l => ParserSerializerTestsuiteLittleEndian.xml} | 152 ++++++-------
plc4go/internal/eip/Connection.go | 165 +++++++++++---
plc4go/internal/eip/{Driver.go => EipDriver.go} | 0
plc4go/internal/eip/MessageCodec.go | 2 +-
plc4go/internal/eip/Reader.go | 246 +++++----------------
.../bacnetip/readwrite/model/BACnetVendorId.go | 32 +++
plc4go/protocols/eip/readwrite/model/CipRRData.go | 91 ++++----
.../eip/readwrite/model/ListServicesResponse.go | 91 ++++----
.../protocols/eip/readwrite/model/SendUnitData.go | 93 ++++----
.../protocols/eip/readwrite/model/StaticHelper.go | 4 +-
plc4go/tests/drivers/tests/eip_driver_test.go | 10 +-
.../drivers/tests/eip_parser_serializer_test.go | 12 +-
.../java/bacnetip/readwrite/BACnetVendorId.java | 2 +
.../apache/plc4x/java/eip/readwrite/CipRRData.java | 69 +++---
.../java/eip/readwrite/ListServicesResponse.java | 67 +++---
.../plc4x/java/eip/readwrite/SendUnitData.java | 61 +++--
.../java/eip/base/protocol/EipProtocolLogic.java | 126 ++++-------
.../eip/src/main/resources/protocols/eip/eip.mspec | 52 ++---
.../resources/protocols/eip/DriverTestsuite.xml | 30 +--
.../eip/ParserSerializerTestsuiteBigEndian.xml | 24 +-
.../eip/ParserSerializerTestsuiteLittleEndian.xml | 114 +++++-----
23 files changed, 681 insertions(+), 829 deletions(-)
diff --git a/plc4go/assets/testing/protocols/eip/DriverTestsuite.xml b/plc4go/assets/testing/protocols/eip/DriverTestsuite.xml
index 14f91f78ec..d8e9f8b3c6 100644
--- a/plc4go/assets/testing/protocols/eip/DriverTestsuite.xml
+++ b/plc4go/assets/testing/protocols/eip/DriverTestsuite.xml
@@ -66,8 +66,8 @@
<senderContext dataType="byte" bitLength="64">0x504c433458202020</senderContext>
<options dataType="uint" bitLength="32">0</options>
<ListServicesResponse>
- <itemCount dataType="uint" bitLength="16">1</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">1</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">256</id>
<ServicesResponse>
@@ -80,7 +80,7 @@
<data dataType="byte" bitLength="120">0x436f6d6d756e69636174696f6e7300</data>
</ServicesResponse>
</TypeId>
- </typeId>
+ </typeIds>
</ListServicesResponse>
</EipPacket>
</incoming-plc-message>
@@ -133,8 +133,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -188,7 +188,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</outgoing-plc-message>
@@ -206,8 +206,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -231,7 +231,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</incoming-plc-message>
@@ -264,8 +264,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -335,7 +335,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</outgoing-plc-message>
@@ -353,8 +353,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -386,7 +386,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</incoming-plc-message>
diff --git a/plc4go/assets/testing/protocols/eip/ParserSerializerTestsuite.xml b/plc4go/assets/testing/protocols/eip/ParserSerializerTestsuiteBigEndian.xml
similarity index 93%
rename from plc4go/assets/testing/protocols/eip/ParserSerializerTestsuite.xml
rename to plc4go/assets/testing/protocols/eip/ParserSerializerTestsuiteBigEndian.xml
index 6edf289bbb..ccb07dd278 100644
--- a/plc4go/assets/testing/protocols/eip/ParserSerializerTestsuite.xml
+++ b/plc4go/assets/testing/protocols/eip/ParserSerializerTestsuiteBigEndian.xml
@@ -30,7 +30,6 @@
<raw>00650004000000000000000000000000000000000000000000010000</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>BIG_ENDIAN</byteOrder>
<response>false</response>
</parser-arguments>
<xml>
@@ -56,7 +55,6 @@
</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>BIG_ENDIAN</byteOrder>
<response>false</response>
</parser-arguments>
<xml>
@@ -70,8 +68,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -87,7 +85,7 @@
<response dataType="bit" bitLength="1">false</response>
<service dataType="uint" bitLength="7">82</service>
<CipUnconnectedRequest>
- <requestPathSize dataType="int" bitLength="8">2</requestPathSize>
+ <requestPathSize dataType="uint" bitLength="8">2</requestPathSize>
<classSegment>
<PathSegment>
<pathSegment dataType="uint" bitLength="3">1</pathSegment>
@@ -127,7 +125,7 @@
<response dataType="bit" bitLength="1">false</response>
<service dataType="uint" bitLength="7">76</service>
<CipReadRequest>
- <requestPathSize dataType="int" bitLength="8">3</requestPathSize>
+ <requestPathSize dataType="uint" bitLength="8">3</requestPathSize>
<tag dataType="byte" bitLength="48">0x910472617465</tag>
<elementNb dataType="uint" bitLength="16">1</elementNb>
</CipReadRequest>
@@ -141,7 +139,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -152,7 +150,6 @@
<raw>006F001A000012340000000001000000000000010000000000000000000000020000000000B2000ACC00000000C400000216</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>BIG_ENDIAN</byteOrder>
<response>true</response>
</parser-arguments>
<xml>
@@ -166,8 +163,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -199,7 +196,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -212,7 +209,6 @@
</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>BIG_ENDIAN</byteOrder>
<response>false</response>
</parser-arguments>
<xml>
@@ -226,8 +222,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -243,7 +239,7 @@
<response dataType="bit" bitLength="1">false</response>
<service dataType="uint" bitLength="7">82</service>
<CipUnconnectedRequest>
- <requestPathSize dataType="int" bitLength="8">2</requestPathSize>
+ <requestPathSize dataType="uint" bitLength="8">2</requestPathSize>
<classSegment>
<PathSegment>
<pathSegment dataType="uint" bitLength="3">1</pathSegment>
@@ -283,7 +279,7 @@
<response dataType="bit" bitLength="1">false</response>
<service dataType="uint" bitLength="7">77</service>
<CipWriteRequest>
- <requestPathSize dataType="int" bitLength="8">6</requestPathSize>
+ <requestPathSize dataType="uint" bitLength="8">6</requestPathSize>
<tag dataType="byte" bitLength="96">0x9116436172746f6e53697a65</tag>
<dataType>
<CIPDataTypeCode dataType="uint" bitLength="16" stringRepresentation="DINT">196</CIPDataTypeCode>
@@ -301,7 +297,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -312,7 +308,6 @@
<raw>006F0014000012340000000001000000000000010000000000000000000000020000000000B20004CD000000</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>BIG_ENDIAN</byteOrder>
<response>true</response>
</parser-arguments>
<xml>
@@ -326,8 +321,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -351,7 +346,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
diff --git a/plc4go/assets/testing/protocols/eip/ParserSerializerTestsuiteLittle.xml b/plc4go/assets/testing/protocols/eip/ParserSerializerTestsuiteLittleEndian.xml
similarity index 95%
rename from plc4go/assets/testing/protocols/eip/ParserSerializerTestsuiteLittle.xml
rename to plc4go/assets/testing/protocols/eip/ParserSerializerTestsuiteLittleEndian.xml
index 2d9878554f..de96f703ad 100644
--- a/plc4go/assets/testing/protocols/eip/ParserSerializerTestsuiteLittle.xml
+++ b/plc4go/assets/testing/protocols/eip/ParserSerializerTestsuiteLittleEndian.xml
@@ -30,7 +30,6 @@
<raw>70003800c9070440000000005765277265000000000000000000000000000200a10004005942feffb10024000100520d91124b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b4b910370707000010000000000</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>false</response>
</parser-arguments>
<xml>
@@ -44,8 +43,8 @@
<SendUnitData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">161</id>
<ConnectedAddressItem>
@@ -72,7 +71,7 @@
</service>
</ConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</SendUnitData>
</EipPacket>
</xml>
@@ -83,7 +82,6 @@
<raw>6f0044001d5e074000000000000000000000000000000000000000000000020000000000b20034005b02200624010a0e02000020b4a500002bcb37132a0000000300000034122000a20f004201402000a20f0042a303010020022401</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>false</response>
</parser-arguments>
<xml>
@@ -97,8 +95,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -114,7 +112,7 @@
<response dataType="bit" bitLength="1">false</response>
<service dataType="uint" bitLength="7">91</service>
<CipConnectionManagerRequest>
- <requestPathSize dataType="int" bitLength="8">2</requestPathSize>
+ <requestPathSize dataType="uint" bitLength="8">2</requestPathSize>
<classSegment>
<PathSegment>
<pathSegment dataType="uint" bitLength="3">1</pathSegment>
@@ -240,7 +238,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -251,7 +249,6 @@
<raw>6f002e001d5e074000000000000000000000000000000000000000000000020000000000b2001e00db0000005b6bfeffb4a500002bcb37132a00000034122000014020000000</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>true</response>
</parser-arguments>
<xml>
@@ -265,8 +262,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -297,7 +294,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -308,7 +305,6 @@
<raw>70002e001d5e0740000000005765277265000000000000000000000000000200a10004005b6bfeffb1001a0001005208910d5a5a5a5f5a5a5a5f415252415900010000000000</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>false</response>
</parser-arguments>
<xml>
@@ -322,8 +318,8 @@
<SendUnitData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">161</id>
<ConnectedAddressItem>
@@ -350,7 +346,7 @@
</service>
</ConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</SendUnitData>
</EipPacket>
</xml>
@@ -361,7 +357,6 @@
<raw>700020001d5e0740000000000000000000000000000000000000000000000200a1000400b4a50000b1000c000100d2000000c40000000000</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>true</response>
</parser-arguments>
<xml>
@@ -375,8 +370,8 @@
<SendUnitData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">161</id>
<ConnectedAddressItem>
@@ -408,7 +403,7 @@
</service>
</ConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</SendUnitData>
</EipPacket>
</xml>
@@ -419,7 +414,6 @@
<raw>700032001d5e0740000000006e6f000000000000000000000000000000000200a10004005b6bfeffb1001e0002004d09910d5a5a5a5f5a5a5a5f4152524159002801c400010001000000</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>false</response>
</parser-arguments>
<xml>
@@ -433,8 +427,8 @@
<SendUnitData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">161</id>
<ConnectedAddressItem>
@@ -452,7 +446,7 @@
<response dataType="bit" bitLength="1">false</response>
<service dataType="uint" bitLength="7">77</service>
<CipWriteRequest>
- <requestPathSize dataType="int" bitLength="8">9</requestPathSize>
+ <requestPathSize dataType="uint" bitLength="8">9</requestPathSize>
<tag dataType="byte" bitLength="144">0x910d5a5a5a5f5a5a5a5f4152524159002801</tag>
<dataType>
<CIPDataTypeCode dataType="uint" bitLength="16" stringRepresentation="DINT">196</CIPDataTypeCode>
@@ -464,7 +458,7 @@
</service>
</ConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</SendUnitData>
</EipPacket>
</xml>
@@ -475,7 +469,6 @@
<raw>700032001d5e0740000000006e6f000000000000000000000000000000000200a10004005b6bfeffb1001e0002004d09910d5a5a5a5f5a5a5a5f4152524159002801c400010001000000</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>true</response>
</parser-arguments>
<xml>
@@ -489,8 +482,8 @@
<SendUnitData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">161</id>
<ConnectedAddressItem>
@@ -508,7 +501,7 @@
<response dataType="bit" bitLength="1">false</response>
<service dataType="uint" bitLength="7">77</service>
<CipWriteRequest>
- <requestPathSize dataType="int" bitLength="8">9</requestPathSize>
+ <requestPathSize dataType="uint" bitLength="8">9</requestPathSize>
<tag dataType="byte" bitLength="144">0x910d5a5a5a5f5a5a5a5f4152524159002801</tag>
<dataType>
<CIPDataTypeCode dataType="uint" bitLength="16" stringRepresentation="DINT">196</CIPDataTypeCode>
@@ -520,7 +513,7 @@
</service>
</ConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</SendUnitData>
</EipPacket>
</xml>
@@ -531,7 +524,6 @@
<raw>6f0028001d5e074000000000000000000000000000000000000000000000020000000000b20018004e02200624010a0e2bcb37132a0000000300010020022401</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>false</response>
</parser-arguments>
<xml>
@@ -545,8 +537,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -562,7 +554,7 @@
<response dataType="bit" bitLength="1">false</response>
<service dataType="uint" bitLength="7">78</service>
<CipConnectionManagerCloseRequest>
- <requestPathSize dataType="int" bitLength="8">2</requestPathSize>
+ <requestPathSize dataType="uint" bitLength="8">2</requestPathSize>
<classSegment>
<PathSegment>
<pathSegment dataType="uint" bitLength="3">1</pathSegment>
@@ -652,7 +644,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -663,7 +655,6 @@
<raw>6f001e00c907044000000000000000000000000000000000000000000000020000000000b2000e00ce000000902137132a0000000000</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>true</response>
</parser-arguments>
<xml>
@@ -677,8 +668,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -707,7 +698,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -718,7 +709,6 @@
<raw>650004000000000000000000302e382e332020200000000001000000</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>false</response>
</parser-arguments>
<xml>
@@ -742,7 +732,6 @@
<raw>650004001d5e074000000000302e382e332020200000000001000000</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>true</response>
</parser-arguments>
<xml>
@@ -766,7 +755,6 @@
<raw>660000001d5e074000000000000000000000000000000000</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>false</response>
</parser-arguments>
<xml>
@@ -788,7 +776,6 @@
<raw>6f002c002a01004000000000000000000000000000000000000000000000020000000000b2001c00520220062401059d0e004c0591084d79537472696e67010001000100</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>false</response>
</parser-arguments>
<xml>
@@ -802,8 +789,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -819,7 +806,7 @@
<response dataType="bit" bitLength="1">false</response>
<service dataType="uint" bitLength="7">82</service>
<CipUnconnectedRequest>
- <requestPathSize dataType="int" bitLength="8">2</requestPathSize>
+ <requestPathSize dataType="uint" bitLength="8">2</requestPathSize>
<classSegment>
<PathSegment>
<pathSegment dataType="uint" bitLength="3">1</pathSegment>
@@ -859,7 +846,7 @@
<response dataType="bit" bitLength="1">false</response>
<service dataType="uint" bitLength="7">76</service>
<CipReadRequest>
- <requestPathSize dataType="int" bitLength="8">5</requestPathSize>
+ <requestPathSize dataType="uint" bitLength="8">5</requestPathSize>
<tag dataType="byte" bitLength="80">0x91084d79537472696e67</tag>
<elementNb dataType="uint" bitLength="16">1</elementNb>
</CipReadRequest>
@@ -873,7 +860,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -884,7 +871,6 @@
<raw>6f0070002a01004000000000000000000000000000000000000000000000020000000000b2006000cc000000a002ce0f2b000000556d6d2c2049206e6f772073656520796f7520696e207468652077697265736861726b20636170747572650000000000000000000000000000000000000000000000000000000000000000000000000000000000</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>true</response>
</parser-arguments>
<xml>
@@ -898,8 +884,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -931,7 +917,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -942,7 +928,6 @@
<raw>6500040081926a3500000000504c4334582020200000000001000000</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>true</response>
</parser-arguments>
<xml>
@@ -966,7 +951,6 @@
<raw>700020005e5dccfd00000000504c433458202020000000000000000000000200a1000400c3a45cf2b1000c000100cc000000ca0000000000</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>true</response>
</parser-arguments>
<xml>
@@ -980,8 +964,8 @@
<SendUnitData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">161</id>
<ConnectedAddressItem>
@@ -1015,7 +999,7 @@
</service>
</ConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</SendUnitData>
</EipPacket>
</xml>
@@ -1026,7 +1010,6 @@
<raw>04000000ec9a149000000000000000000000000000000000</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>false</response>
</parser-arguments>
<xml>
@@ -1048,7 +1031,6 @@
<raw>04001900ec9a14900000000000000000000000000000000001000001130001002000436f6d6d756e69636174696f6e7300</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>true</response>
</parser-arguments>
<xml>
@@ -1060,8 +1042,8 @@
<senderContext dataType="byte" bitLength="64">0x0000000000000000</senderContext>
<options dataType="uint" bitLength="32">0</options>
<ListServicesResponse>
- <itemCount dataType="uint" bitLength="16">1</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">1</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">256</id>
<ServicesResponse>
@@ -1074,7 +1056,7 @@
<data dataType="byte" bitLength="120">0x436f6d6d756e69636174696f6e7300</data>
</ServicesResponse>
</TypeId>
- </typeId>
+ </typeIds>
</ListServicesResponse>
</EipPacket>
</xml>
@@ -1085,7 +1067,6 @@
<raw>040019000000000000000000504c4334582020200000000001000001130001002000436f6d6d756e69636174696f6e7300</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>true</response>
</parser-arguments>
<xml>
@@ -1097,8 +1078,8 @@
<senderContext dataType="byte" bitLength="64">0x504c433458202020</senderContext>
<options dataType="uint" bitLength="32">0</options>
<ListServicesResponse>
- <itemCount dataType="uint" bitLength="16">1</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">1</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">256</id>
<ServicesResponse>
@@ -1111,7 +1092,7 @@
<data dataType="byte" bitLength="120">0x436f6d6d756e69636174696f6e7300</data>
</ServicesResponse>
</TypeId>
- </typeId>
+ </typeIds>
</ListServicesResponse>
</EipPacket>
</xml>
@@ -1122,7 +1103,6 @@
<raw>6f00160045000040000000001400000030145b0300000000000000002000020000000000b2000600010220022401</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>false</response>
</parser-arguments>
<xml>
@@ -1136,8 +1116,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">32</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -1153,7 +1133,7 @@
<response dataType="bit" bitLength="1">false</response>
<service dataType="uint" bitLength="7">1</service>
<GetAttributeAllRequest>
- <requestPathSize dataType="int" bitLength="8">2</requestPathSize>
+ <requestPathSize dataType="uint" bitLength="8">2</requestPathSize>
<classSegment>
<PathSegment>
<pathSegment dataType="uint" bitLength="3">1</pathSegment>
@@ -1191,7 +1171,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -1202,7 +1182,6 @@
<raw>6f00b60045000040000000001400000030145b0300000000000000000000020000000000b200a600810000004e003a03770066004300f6003700f500ac035f005d005e000003ab033703a503040348004203a4038b002f031204b603b203b303b003b10330034f004e00aa03a803a703a6036e037003320331032d031703b20049033503710072007803ac00b0002b03b100730067006b0068007d038d008c006d006a0038031a0369004500f20074006e008e0070006c0002006a036400a100f4000100c100c000060000010500</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>true</response>
</parser-arguments>
<xml>
@@ -1216,8 +1195,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -1329,7 +1308,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -1340,7 +1319,6 @@
<raw>6f004c08b181852100000000504c43345820202000000000000000000000020000000000b2003c088100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 [...]
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>true</response>
</parser-arguments>
<xml>
@@ -1354,8 +1332,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -1389,7 +1367,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -1401,7 +1379,6 @@
<raw>6f0014000100000000000000504c43345820202000000000000000000000020000000000b200040081000800</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>true</response>
</parser-arguments>
<xml>
@@ -1415,8 +1392,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -1440,7 +1417,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -1451,7 +1428,6 @@
<raw>6f0014000100000000000000504c43345820202000000000000000000000020000000000b2000400d2000800</raw>
<root-type>EipPacket</root-type>
<parser-arguments>
- <byteOrder>LITTLE_ENDIAN</byteOrder>
<response>true</response>
</parser-arguments>
<xml>
@@ -1465,8 +1441,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -1490,7 +1466,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
diff --git a/plc4go/internal/eip/Connection.go b/plc4go/internal/eip/Connection.go
index fbf225a195..9f9cbea906 100644
--- a/plc4go/internal/eip/Connection.go
+++ b/plc4go/internal/eip/Connection.go
@@ -34,16 +34,26 @@ import (
"github.com/rs/zerolog/log"
)
+const (
+ DefaultSenderContext = "PLC4X "
+ EmptySessionHandle = uint32(0)
+ EmptyInterfaceHandle = uint32(0)
+)
+
type Connection struct {
_default.DefaultConnection
- messageCodec spi.MessageCodec
- configuration Configuration
- driverContext DriverContext
- tm *spi.RequestTransactionManager
- sessionHandle uint32
- senderContext []uint8
- connectionId string
- tracer *spi.Tracer
+ messageCodec spi.MessageCodec
+ configuration Configuration
+ driverContext DriverContext
+ tm *spi.RequestTransactionManager
+ sessionHandle uint32
+ senderContext []uint8
+ connectionId uint32
+ cipEncapsulationAvailable bool
+ connectionSerialNumber uint16
+ connectionPathSize uint8
+ routingAddress []readWriteModel.PathSegment
+ tracer *spi.Tracer
}
func NewConnection(messageCodec spi.MessageCodec, configuration Configuration, driverContext DriverContext, tagHandler spi.PlcTagHandler, tm *spi.RequestTransactionManager, options map[string][]string) *Connection {
@@ -55,18 +65,23 @@ func NewConnection(messageCodec spi.MessageCodec, configuration Configuration, d
}
if traceEnabledOption, ok := options["traceEnabled"]; ok {
if len(traceEnabledOption) == 1 {
- connection.tracer = spi.NewTracer(connection.connectionId)
+ // TODO: Fix this.
+ // connection.tracer = spi.NewTracer(connection.connectionId)
}
}
connection.DefaultConnection = _default.NewDefaultConnection(connection,
_default.WithPlcTagHandler(tagHandler),
_default.WithPlcValueHandler(NewValueHandler()),
)
+
+ // TODO: connectionPathSize
+ // TODO: routingAddress
return connection
}
func (m *Connection) GetConnectionId() string {
- return m.connectionId
+ // TODO: Fix this
+ return "" //m.connectionId
}
func (m *Connection) IsTraceEnabled() bool {
@@ -118,7 +133,7 @@ func (m *Connection) Close() <-chan plc4go.PlcConnectionCloseResult {
result := make(chan plc4go.PlcConnectionCloseResult)
go func() {
log.Debug().Msg("Sending UnregisterSession EIP Packet")
- _ = m.messageCodec.SendRequest(ctx, readWriteModel.NewEipDisconnectRequest(m.sessionHandle, 0, make([]byte, 8), 0, readWriteModel.IntegerEncoding_BIG_ENDIAN), func(message spi.Message) bool {
+ _ = m.messageCodec.SendRequest(ctx, readWriteModel.NewEipDisconnectRequest(m.sessionHandle, 0, []byte(DefaultSenderContext), 0), func(message spi.Message) bool {
return true
}, func(message spi.Message) error {
return nil
@@ -131,25 +146,27 @@ func (m *Connection) Close() <-chan plc4go.PlcConnectionCloseResult {
}
func (m *Connection) setupConnection(ctx context.Context, ch chan plc4go.PlcConnectionConnectResult) {
- log.Debug().Msg("Sending EIP Connection Request")
- if err := m.messageCodec.SendRequest(ctx, readWriteModel.NewEipConnectionRequest(0, 0, make([]byte, 8), 0, readWriteModel.IntegerEncoding_BIG_ENDIAN), func(message spi.Message) bool {
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // List Services Request
+
+ log.Debug().Msg("Sending ListServices Request")
+ listServicesResultChan := make(chan readWriteModel.ListServicesResponse)
+ listServicesResultErrorChan := make(chan error)
+ if err := m.messageCodec.SendRequest(ctx, readWriteModel.NewListServicesRequest(EmptySessionHandle, uint32(readWriteModel.CIPStatus_Success), []byte(DefaultSenderContext), uint32(0)), func(message spi.Message) bool {
eipPacket := message.(readWriteModel.EipPacket)
if eipPacket == nil {
return false
}
- eipPacketConnectionRequest := eipPacket.(readWriteModel.EipConnectionRequest)
- return eipPacketConnectionRequest != nil
+ eipPacketListServicesResponse := eipPacket.(readWriteModel.ListServicesResponse)
+ return eipPacketListServicesResponse != nil
}, func(message spi.Message) error {
- eipPacket := message.(readWriteModel.EipPacket)
- if eipPacket.GetStatus() == 0 {
- m.sessionHandle = eipPacket.GetSessionHandle()
- m.senderContext = eipPacket.GetSenderContext()
- log.Debug().Msgf("Got assigned with Session %d", m.sessionHandle)
- // Send an event that connection setup is complete.
- m.fireConnected(ch)
- } else {
-
+ listServicesResponse := message.(readWriteModel.ListServicesResponse)
+ serviceResponse := listServicesResponse.GetTypeIds()[0].(readWriteModel.ServicesResponse)
+ if serviceResponse.GetSupportsCIPEncapsulation() {
+ log.Debug().Msg("Device is capable of CIP over EIP encapsulation")
}
+ m.cipEncapsulationAvailable = serviceResponse.GetSupportsCIPEncapsulation()
+ listServicesResultChan <- listServicesResponse
return nil
}, func(err error) error {
// If this is a timeout, do a check if the connection requires a reconnection
@@ -157,10 +174,106 @@ func (m *Connection) setupConnection(ctx context.Context, ch chan plc4go.PlcConn
log.Warn().Msg("Timeout during Connection establishing, closing channel...")
m.Close()
}
- m.fireConnectionError(errors.Wrap(err, "got error processing request"), ch)
+ listServicesResultErrorChan <- errors.Wrap(err, "got error processing request")
return nil
}, m.GetTtl()); err != nil {
- m.fireConnectionError(errors.Wrap(err, "Error during sending of EIP Connection Request"), ch)
+ m.fireConnectionError(errors.Wrap(err, "Error during sending of EIP ListServices Request"), ch)
+ }
+
+ select {
+ case err := <-listServicesResultErrorChan:
+ m.fireConnectionError(errors.Wrap(err, "Error receiving of ListServices response"), ch)
+ case _ = <-listServicesResultChan:
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Connect Register Session
+
+ log.Debug().Msg("Sending ListServices Request")
+ connectionResponseChan := make(chan readWriteModel.EipConnectionResponse)
+ connectionResponseErrorChan := make(chan error)
+ if err := m.messageCodec.SendRequest(ctx, readWriteModel.NewListServicesRequest(EmptySessionHandle, uint32(readWriteModel.CIPStatus_Success), []byte(DefaultSenderContext), uint32(0)), func(message spi.Message) bool {
+ eipPacket := message.(readWriteModel.EipPacket)
+ return eipPacket != nil
+ }, func(message spi.Message) error {
+ eipPacket := message.(readWriteModel.EipPacket)
+ connectionResponse := eipPacket.(readWriteModel.EipConnectionResponse)
+ if connectionResponse != nil {
+ if connectionResponse.GetStatus() == 0 {
+ m.sessionHandle = connectionResponse.GetSessionHandle()
+ m.senderContext = connectionResponse.GetSenderContext()
+ log.Debug().Msgf("Got assigned with Session %d", m.sessionHandle)
+ connectionResponseChan <- connectionResponse
+ } else {
+ log.Error().Msgf("Got unsuccessful status for connection request: %d", connectionResponse.GetStatus())
+ connectionResponseErrorChan <- errors.New("got unsuccessful connection response")
+ }
+ } else {
+ // TODO: This seems pretty hard-coded ... possibly find out if we can't simplify this.
+ classSegment := readWriteModel.NewLogicalSegment(readWriteModel.NewClassID(0, 6))
+ instanceSegment := readWriteModel.NewLogicalSegment(readWriteModel.NewClassID(0, 1))
+ exchange := readWriteModel.NewUnConnectedDataItem(
+ readWriteModel.NewCipConnectionManagerRequest(classSegment, instanceSegment, 0, 10,
+ 14, 536870914, 33944, m.connectionSerialNumber,
+ 4919, 42, 3, 2101812,
+ readWriteModel.NewNetworkConnectionParameters(4002, false, 2, 0, true),
+ 2113537,
+ readWriteModel.NewNetworkConnectionParameters(4002, false, 2, 0, true),
+ readWriteModel.NewTransportType(true, 2, 3),
+ m.connectionPathSize, m.routingAddress, 1))
+ typeIds := []readWriteModel.TypeId{readWriteModel.NewNullAddressItem(), exchange}
+ eipWrapper := readWriteModel.NewCipRRData(m.sessionHandle, 0, typeIds,
+ m.sessionHandle, uint32(readWriteModel.CIPStatus_Success), m.senderContext, 0)
+ if err := m.messageCodec.SendRequest(ctx, eipWrapper,
+ func(message spi.Message) bool {
+ eipPacket := message.(readWriteModel.EipPacket)
+ if eipPacket == nil {
+ return false
+ }
+ cipRRData := eipPacket.(readWriteModel.CipRRData)
+ return cipRRData != nil
+ }, func(message spi.Message) error {
+ cipRRData := message.(readWriteModel.CipRRData)
+ if cipRRData.GetStatus() == 0 {
+ unconnectedDataItem := cipRRData.GetTypeIds()[1].(readWriteModel.UnConnectedDataItem)
+ connectionManagerResponse := unconnectedDataItem.GetService().(readWriteModel.CipConnectionManagerResponse)
+ m.connectionId = connectionManagerResponse.GetOtConnectionId()
+ log.Debug().Msgf("Got assigned with connection if %d", m.connectionId)
+ connectionResponseChan <- connectionResponse
+ } else {
+ connectionResponseErrorChan <- fmt.Errorf("got status code while opening Connection manager: %d", cipRRData.GetStatus())
+ }
+ return nil
+ }, func(err error) error {
+ // If this is a timeout, do a check if the connection requires a reconnection
+ if _, isTimeout := err.(plcerrors.TimeoutError); isTimeout {
+ log.Warn().Msg("Timeout during Connection establishing, closing channel...")
+ m.Close()
+ }
+ connectionResponseErrorChan <- errors.Wrap(err, "got error processing request")
+ return nil
+ }, m.GetTtl()); err != nil {
+ m.fireConnectionError(errors.Wrap(err, "Error during sending of EIP ListServices Request"), ch)
+ }
+ }
+ return nil
+ }, func(err error) error {
+ // If this is a timeout, do a check if the connection requires a reconnection
+ if _, isTimeout := err.(plcerrors.TimeoutError); isTimeout {
+ log.Warn().Msg("Timeout during Connection establishing, closing channel...")
+ m.Close()
+ }
+ connectionResponseErrorChan <- errors.Wrap(err, "got error processing request")
+ return nil
+ }, m.GetTtl()); err != nil {
+ m.fireConnectionError(errors.Wrap(err, "Error during sending of EIP ListServices Request"), ch)
+ }
+
+ select {
+ case err := <-connectionResponseErrorChan:
+ m.fireConnectionError(errors.Wrap(err, "Error receiving of ListServices response"), ch)
+ case _ = <-connectionResponseChan:
+ // Send an event that connection setup is complete.
+ m.fireConnected(ch)
+ }
}
}
diff --git a/plc4go/internal/eip/Driver.go b/plc4go/internal/eip/EipDriver.go
similarity index 100%
rename from plc4go/internal/eip/Driver.go
rename to plc4go/internal/eip/EipDriver.go
diff --git a/plc4go/internal/eip/MessageCodec.go b/plc4go/internal/eip/MessageCodec.go
index ff12bddafd..37aa4650b1 100644
--- a/plc4go/internal/eip/MessageCodec.go
+++ b/plc4go/internal/eip/MessageCodec.go
@@ -87,7 +87,7 @@ func (m *MessageCodec) Receive() (spi.Message, error) {
return nil, nil
}
rb := utils.NewReadBufferByteBased(data, utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian))
- eipPacket, err := model.EipPacketParseWithBuffer(context.Background(), rb, model.IntegerEncoding_BIG_ENDIAN, true)
+ eipPacket, err := model.EipPacketParseWithBuffer(context.Background(), rb, true)
if err != nil {
log.Warn().Err(err).Msg("error parsing")
// TODO: Possibly clean up ...
diff --git a/plc4go/internal/eip/Reader.go b/plc4go/internal/eip/Reader.go
index f49707ff80..b369fe640c 100644
--- a/plc4go/internal/eip/Reader.go
+++ b/plc4go/internal/eip/Reader.go
@@ -58,14 +58,14 @@ func (m *Reader) Read(ctx context.Context, readRequest model.PlcReadRequest) <-c
log.Trace().Msg("Reading")
result := make(chan model.PlcReadRequestResult)
go func() {
-
- requestItems := make([]readWriteModel.CipService, len(readRequest.GetTagNames()))
- for i, tagName := range readRequest.GetTagNames() {
+ classSegment := readWriteModel.NewLogicalSegment(readWriteModel.NewClassID(0, 6))
+ instanceSegment := readWriteModel.NewLogicalSegment(readWriteModel.NewClassID(0, 1))
+ for _, tagName := range readRequest.GetTagNames() {
plcTag := readRequest.GetTag(tagName).(EIPPlcTag)
tag := plcTag.GetTag()
- elements := uint16(1)
+ elementsNb := uint16(1)
if plcTag.GetElementNb() > 1 {
- elements = plcTag.GetElementNb()
+ elementsNb = plcTag.GetElementNb()
}
ansi, err := toAnsi(tag)
if err != nil {
@@ -76,174 +76,56 @@ func (m *Reader) Read(ctx context.Context, readRequest model.PlcReadRequest) <-c
}
return
}
- request := readWriteModel.NewCipReadRequest(getRequestSize(tag), ansi, elements, 0)
- requestItems[i] = request
- }
- if len(requestItems) > 1 {
- nb := uint16(len(requestItems))
- offsets := make([]uint16, nb)
- offset := 2 + nb*2
- for i := uint16(0); i < nb; i++ {
- offsets[i] = offset
- offset += requestItems[i].GetLengthInBytes(context.Background())
- }
-
- serviceArr := make([]readWriteModel.CipService, nb)
- for i := uint16(0); i < nb; i++ {
- serviceArr[i] = requestItems[i]
+ request := readWriteModel.NewCipReadRequest(ansi, elementsNb, uint16(0))
+ requestItem := readWriteModel.NewCipUnconnectedRequest(classSegment, instanceSegment, request,
+ m.configuration.backplane, m.configuration.slot, uint16(0))
+ typeIds := []readWriteModel.TypeId{
+ readWriteModel.NewNullAddressItem(),
+ readWriteModel.NewUnConnectedDataItem(requestItem),
}
+ pkt := readWriteModel.NewCipRRData(0, 0, typeIds, *m.sessionHandle,
+ uint32(readWriteModel.CIPStatus_Success), []byte(DefaultSenderContext), 0)
- data := readWriteModel.NewServices(nb, offsets, serviceArr, 0)
- //Encapsulate the data
- pkt := readWriteModel.NewCipRRData(
- readWriteModel.NewCipExchange(
- readWriteModel.NewCipUnconnectedRequest(
- readWriteModel.NewMultipleServiceRequest(data, 0),
- m.configuration.backplane,
- m.configuration.slot,
- 0,
- ),
- 0,
- ),
- *m.sessionHandle,
- 0,
- make([]byte, 8),
- 0,
- 0,
- )
-
- // Start a new request-transaction (Is ended in the response-handler)
transaction := m.tm.StartTransaction()
transaction.Submit(func() {
- // Send the over the wire
- log.Trace().Msg("Send ")
- if err := m.messageCodec.SendRequest(ctx, pkt, func(message spi.Message) bool {
- eipPacket := message.(readWriteModel.EipPacket)
- if eipPacket == nil {
- return false
- }
- cipRRData := eipPacket.(readWriteModel.CipRRData)
- if cipRRData == nil {
- return false
- }
- if eipPacket.GetSessionHandle() != *m.sessionHandle {
- return false
- }
- multipleServiceResponse := cipRRData.GetExchange().GetService().(readWriteModel.MultipleServiceResponse)
- if multipleServiceResponse == nil {
- return false
- }
- if multipleServiceResponse.GetServiceNb() != nb {
- return false
- }
- return true
- }, func(message spi.Message) error {
- // Convert the response into an
- log.Trace().Msg("convert response to ")
- eipPacket := message.(readWriteModel.EipPacket)
- cipRRData := eipPacket.(readWriteModel.CipRRData)
- multipleServiceResponse := cipRRData.GetExchange().GetService().(readWriteModel.MultipleServiceResponse)
- // Convert the eip response into a PLC4X response
- log.Trace().Msg("convert response to PLC4X response")
- readResponse, err := m.ToPlc4xReadResponse(multipleServiceResponse, readRequest)
-
- if err != nil {
+ if err := m.messageCodec.SendRequest(ctx, pkt,
+ func(message spi.Message) bool {
+ eipPacket := message.(readWriteModel.EipPacket)
+ if eipPacket == nil {
+ return false
+ }
+ cipRRData := eipPacket.(readWriteModel.CipRRData)
+ if cipRRData == nil {
+ return false
+ }
+ return cipRRData.GetSessionHandle() == *m.sessionHandle
+ },
+ func(message spi.Message) error {
+ cipRRData := message.(readWriteModel.CipRRData)
+ unconnectedDataItem := cipRRData.GetTypeIds()[1].(readWriteModel.UnConnectedDataItem)
+ // Convert the eip response into a PLC4X response
+ log.Trace().Msg("convert response to PLC4X response")
+ readResponse, err := m.ToPlc4xReadResponse(unconnectedDataItem.GetService(), readRequest)
+ if err != nil {
+ result <- &plc4goModel.DefaultPlcReadRequestResult{
+ Request: readRequest,
+ Err: errors.Wrap(err, "Error decoding response"),
+ }
+ return transaction.EndRequest()
+ }
result <- &plc4goModel.DefaultPlcReadRequestResult{
- Request: readRequest,
- Err: errors.Wrap(err, "Error decoding response"),
+ Request: readRequest,
+ Response: readResponse,
}
return transaction.EndRequest()
- }
- result <- &plc4goModel.DefaultPlcReadRequestResult{
- Request: readRequest,
- Response: readResponse,
- }
- return transaction.EndRequest()
- }, func(err error) error {
- result <- &plc4goModel.DefaultPlcReadRequestResult{
- Request: readRequest,
- Err: errors.Wrap(err, "got timeout while waiting for response"),
- }
- return transaction.EndRequest()
- }, time.Second*1); err != nil {
- result <- &plc4goModel.DefaultPlcReadRequestResult{
- Request: readRequest,
- Response: nil,
- Err: errors.Wrap(err, "error sending message"),
- }
- _ = transaction.EndRequest()
- }
- })
- } else if len(requestItems) == 1 {
- //Encapsulate the data
- pkt := readWriteModel.NewCipRRData(
- readWriteModel.NewCipExchange(
- readWriteModel.NewCipUnconnectedRequest(
- requestItems[0],
- m.configuration.backplane,
- m.configuration.slot,
- 0,
- ),
- 0,
- ),
- *m.sessionHandle,
- 0,
- make([]byte, 8),
- 0,
- 0,
- )
-
- // Start a new request-transaction (Is ended in the response-handler)
- transaction := m.tm.StartTransaction()
- transaction.Submit(func() {
- // Send the over the wire
- log.Trace().Msg("Send ")
- if err := m.messageCodec.SendRequest(ctx, pkt, func(message spi.Message) bool {
- eipPacket := message.(readWriteModel.EipPacket)
- if eipPacket == nil {
- return false
- }
- cipRRData := eipPacket.(readWriteModel.CipRRData)
- if cipRRData == nil {
- return false
- }
- if eipPacket.GetSessionHandle() != *m.sessionHandle {
- return false
- }
- cipReadResponse := cipRRData.GetExchange().GetService().(readWriteModel.CipReadResponse)
- if cipReadResponse == nil {
- return false
- }
- return true
- }, func(message spi.Message) error {
- // Convert the response into an
- log.Trace().Msg("convert response to ")
- eipPacket := message.(readWriteModel.EipPacket)
- cipRRData := eipPacket.(readWriteModel.CipRRData)
- cipReadResponse := cipRRData.GetExchange().GetService().(readWriteModel.CipReadResponse)
- // Convert the eip response into a PLC4X response
- log.Trace().Msg("convert response to PLC4X response")
- readResponse, err := m.ToPlc4xReadResponse(cipReadResponse, readRequest)
-
- if err != nil {
+ },
+ func(err error) error {
result <- &plc4goModel.DefaultPlcReadRequestResult{
Request: readRequest,
- Err: errors.Wrap(err, "Error decoding response"),
+ Err: errors.Wrap(err, "got timeout while waiting for response"),
}
return transaction.EndRequest()
- }
- result <- &plc4goModel.DefaultPlcReadRequestResult{
- Request: readRequest,
- Response: readResponse,
- }
- return transaction.EndRequest()
- }, func(err error) error {
- result <- &plc4goModel.DefaultPlcReadRequestResult{
- Request: readRequest,
- Err: errors.Wrap(err, "got timeout while waiting for response"),
- }
- return transaction.EndRequest()
- }, time.Second*1); err != nil {
+ }, time.Second*1); err != nil {
result <- &plc4goModel.DefaultPlcReadRequestResult{
Request: readRequest,
Response: nil,
@@ -257,33 +139,6 @@ func (m *Reader) Read(ctx context.Context, readRequest model.PlcReadRequest) <-c
return result
}
-func getRequestSize(tag string) int8 {
- //We need the size of the request in words (0x91, tagLength, ... tag + possible pad)
- // Taking half to get word size
- isArray := false
- isStruct := false
- tagIsolated := tag
-
- if strings.Contains(tag, "[") {
- isArray = true
- tagIsolated = tag[0:strings.Index(tag, "[")]
- }
-
- if strings.Contains(tag, ".") {
- isStruct = true
- tagIsolated = strings.Replace(tagIsolated, ".", "", -1)
- }
- dataLength := (len(tagIsolated) + 2) + (len(tagIsolated) % 2)
- if isArray {
- dataLength += 2
- }
- if isStruct {
- dataLength += 2
- }
- requestPathSize := (int8)(dataLength / 2)
- return requestPathSize
-}
-
func toAnsi(tag string) ([]byte, error) {
arrayIndex := byte(0)
isArray := false
@@ -375,8 +230,8 @@ func (m *Reader) ToPlc4xReadResponse(response readWriteModel.CipService, readReq
tag := readRequest.GetTag(tagName).(EIPPlcTag)
code := decodeResponseCode(cipReadResponse.GetStatus())
var plcValue values.PlcValue
- _type := cipReadResponse.GetDataType()
- data := utils.NewReadBufferByteBased(cipReadResponse.GetData(), utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian))
+ _type := cipReadResponse.GetData().GetDataType()
+ data := utils.NewReadBufferByteBased(cipReadResponse.GetData().GetData(), utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian))
if code == model.PlcResponseCode_OK {
var err error
plcValue, err = parsePlcValue(tag, data, _type)
@@ -402,18 +257,19 @@ func (m *Reader) ToPlc4xReadResponse(response readWriteModel.CipService, readReq
}
serviceBuf := utils.NewReadBufferByteBased(read.GetBytes()[offset:offset+length], utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian))
var err error
- arr[i], err = readWriteModel.CipServiceParseWithBuffer(context.Background(), serviceBuf, length)
+ // TODO: If we're using a connected connection, do this differently
+ arr[i], err = readWriteModel.CipServiceParseWithBuffer(context.Background(), serviceBuf, false, length)
if err != nil {
return nil, err
}
}
- services := readWriteModel.NewServices(nb, multipleServiceResponse.GetOffsets(), arr, 0)
+ services := readWriteModel.NewServices(multipleServiceResponse.GetOffsets(), arr, uint16(0))
for i, tagName := range readRequest.GetTagNames() {
tag := readRequest.GetTag(tagName).(EIPPlcTag)
if cipReadResponse, ok := services.Services[i].(readWriteModel.CipReadResponse); ok {
code := decodeResponseCode(cipReadResponse.GetStatus())
- _type := cipReadResponse.GetDataType()
- data := utils.NewReadBufferByteBased(cipReadResponse.GetData(), utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian))
+ _type := cipReadResponse.GetData().GetDataType()
+ data := utils.NewReadBufferByteBased(cipReadResponse.GetData().GetData(), utils.WithByteOrderForReadBufferByteBased(binary.LittleEndian))
var plcValue values.PlcValue
if code == model.PlcResponseCode_OK {
var err error
diff --git a/plc4go/protocols/bacnetip/readwrite/model/BACnetVendorId.go b/plc4go/protocols/bacnetip/readwrite/model/BACnetVendorId.go
index 6d10136ee0..ee884e7dbe 100644
--- a/plc4go/protocols/bacnetip/readwrite/model/BACnetVendorId.go
+++ b/plc4go/protocols/bacnetip/readwrite/model/BACnetVendorId.go
@@ -1435,6 +1435,8 @@ const (
BACnetVendorId_THING_WAREHOUSELLC BACnetVendorId = 1404
BACnetVendorId_INNOFRIENDS_GMBH BACnetVendorId = 1405
BACnetVendorId_METRONICAKP_SPJ BACnetVendorId = 1406
+ BACnetVendorId_TECHKNAVE BACnetVendorId = 1407
+ BACnetVendorId_ELSNER_ELEKTRONIK BACnetVendorId = 1408
BACnetVendorId_UNKNOWN_VENDOR BACnetVendorId = 0xFFFF
)
@@ -2841,6 +2843,8 @@ func init() {
BACnetVendorId_THING_WAREHOUSELLC,
BACnetVendorId_INNOFRIENDS_GMBH,
BACnetVendorId_METRONICAKP_SPJ,
+ BACnetVendorId_TECHKNAVE,
+ BACnetVendorId_ELSNER_ELEKTRONIK,
BACnetVendorId_UNKNOWN_VENDOR,
}
}
@@ -4659,6 +4663,14 @@ func (e BACnetVendorId) VendorId() uint16 {
{ /* '1406' */
return 1406
}
+ case 1407:
+ { /* '1407' */
+ return 1407
+ }
+ case 1408:
+ { /* '1408' */
+ return 1408
+ }
case 141:
{ /* '141' */
return 141
@@ -10273,6 +10285,14 @@ func (e BACnetVendorId) VendorName() string {
{ /* '1406' */
return "Metronic AKP Sp. J."
}
+ case 1407:
+ { /* '1407' */
+ return "Techknave"
+ }
+ case 1408:
+ { /* '1408' */
+ return "Elsner Elektronik"
+ }
case 141:
{ /* '141' */
return "Yaskawa America, Inc."
@@ -14980,6 +15000,10 @@ func BACnetVendorIdByValue(value uint16) (enum BACnetVendorId, ok bool) {
return BACnetVendorId_INNOFRIENDS_GMBH, true
case 1406:
return BACnetVendorId_METRONICAKP_SPJ, true
+ case 1407:
+ return BACnetVendorId_TECHKNAVE, true
+ case 1408:
+ return BACnetVendorId_ELSNER_ELEKTRONIK, true
case 141:
return BACnetVendorId_YASKAWA_AMERICA_INC, true
case 142:
@@ -17784,6 +17808,10 @@ func BACnetVendorIdByName(value string) (enum BACnetVendorId, ok bool) {
return BACnetVendorId_INNOFRIENDS_GMBH, true
case "METRONICAKP_SPJ":
return BACnetVendorId_METRONICAKP_SPJ, true
+ case "TECHKNAVE":
+ return BACnetVendorId_TECHKNAVE, true
+ case "ELSNER_ELEKTRONIK":
+ return BACnetVendorId_ELSNER_ELEKTRONIK, true
case "YASKAWA_AMERICA_INC":
return BACnetVendorId_YASKAWA_AMERICA_INC, true
case "DEO_SCONTROLSYSTEMS_GMBH":
@@ -20645,6 +20673,10 @@ func (e BACnetVendorId) PLC4XEnumName() string {
return "INNOFRIENDS_GMBH"
case BACnetVendorId_METRONICAKP_SPJ:
return "METRONICAKP_SPJ"
+ case BACnetVendorId_TECHKNAVE:
+ return "TECHKNAVE"
+ case BACnetVendorId_ELSNER_ELEKTRONIK:
+ return "ELSNER_ELEKTRONIK"
case BACnetVendorId_YASKAWA_AMERICA_INC:
return "YASKAWA_AMERICA_INC"
case BACnetVendorId_DEO_SCONTROLSYSTEMS_GMBH:
diff --git a/plc4go/protocols/eip/readwrite/model/CipRRData.go b/plc4go/protocols/eip/readwrite/model/CipRRData.go
index 28bcce2870..a7cf680903 100644
--- a/plc4go/protocols/eip/readwrite/model/CipRRData.go
+++ b/plc4go/protocols/eip/readwrite/model/CipRRData.go
@@ -37,10 +37,8 @@ type CipRRData interface {
GetInterfaceHandle() uint32
// GetTimeout returns Timeout (property field)
GetTimeout() uint16
- // GetItemCount returns ItemCount (property field)
- GetItemCount() uint16
- // GetTypeId returns TypeId (property field)
- GetTypeId() []TypeId
+ // GetTypeIds returns TypeIds (property field)
+ GetTypeIds() []TypeId
}
// CipRRDataExactly can be used when we want exactly this type and not a type which fulfills CipRRData.
@@ -55,8 +53,7 @@ type _CipRRData struct {
*_EipPacket
InterfaceHandle uint32
Timeout uint16
- ItemCount uint16
- TypeId []TypeId
+ TypeIds []TypeId
}
///////////////////////////////////////////////////////////
@@ -105,12 +102,8 @@ func (m *_CipRRData) GetTimeout() uint16 {
return m.Timeout
}
-func (m *_CipRRData) GetItemCount() uint16 {
- return m.ItemCount
-}
-
-func (m *_CipRRData) GetTypeId() []TypeId {
- return m.TypeId
+func (m *_CipRRData) GetTypeIds() []TypeId {
+ return m.TypeIds
}
///////////////////////
@@ -119,12 +112,11 @@ func (m *_CipRRData) GetTypeId() []TypeId {
///////////////////////////////////////////////////////////
// NewCipRRData factory function for _CipRRData
-func NewCipRRData(interfaceHandle uint32, timeout uint16, itemCount uint16, typeId []TypeId, sessionHandle uint32, status uint32, senderContext []byte, options uint32) *_CipRRData {
+func NewCipRRData(interfaceHandle uint32, timeout uint16, typeIds []TypeId, sessionHandle uint32, status uint32, senderContext []byte, options uint32) *_CipRRData {
_result := &_CipRRData{
InterfaceHandle: interfaceHandle,
Timeout: timeout,
- ItemCount: itemCount,
- TypeId: typeId,
+ TypeIds: typeIds,
_EipPacket: NewEipPacket(sessionHandle, status, senderContext, options),
}
_result._EipPacket._EipPacketChildRequirements = _result
@@ -155,13 +147,13 @@ func (m *_CipRRData) GetLengthInBits(ctx context.Context) uint16 {
// Simple field (timeout)
lengthInBits += 16
- // Simple field (itemCount)
+ // Implicit Field (typeIdCount)
lengthInBits += 16
// Array field
- if len(m.TypeId) > 0 {
- for _curItem, element := range m.TypeId {
- arrayCtx := spiContext.CreateArrayContext(ctx, len(m.TypeId), _curItem)
+ if len(m.TypeIds) > 0 {
+ for _curItem, element := range m.TypeIds {
+ arrayCtx := spiContext.CreateArrayContext(ctx, len(m.TypeIds), _curItem)
_ = arrayCtx
_ = _curItem
lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx)
@@ -202,38 +194,38 @@ func CipRRDataParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer,
}
timeout := _timeout
- // Simple Field (itemCount)
- _itemCount, _itemCountErr := readBuffer.ReadUint16("itemCount", 16)
- if _itemCountErr != nil {
- return nil, errors.Wrap(_itemCountErr, "Error parsing 'itemCount' field of CipRRData")
+ // Implicit Field (typeIdCount) (Used for parsing, but its value is not stored as it's implicitly given by the objects content)
+ typeIdCount, _typeIdCountErr := readBuffer.ReadUint16("typeIdCount", 16)
+ _ = typeIdCount
+ if _typeIdCountErr != nil {
+ return nil, errors.Wrap(_typeIdCountErr, "Error parsing 'typeIdCount' field of CipRRData")
}
- itemCount := _itemCount
- // Array field (typeId)
- if pullErr := readBuffer.PullContext("typeId", utils.WithRenderAsList(true)); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for typeId")
+ // Array field (typeIds)
+ if pullErr := readBuffer.PullContext("typeIds", utils.WithRenderAsList(true)); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for typeIds")
}
// Count array
- typeId := make([]TypeId, itemCount)
+ typeIds := make([]TypeId, typeIdCount)
// This happens when the size is set conditional to 0
- if len(typeId) == 0 {
- typeId = nil
+ if len(typeIds) == 0 {
+ typeIds = nil
}
{
- _numItems := uint16(itemCount)
+ _numItems := uint16(typeIdCount)
for _curItem := uint16(0); _curItem < _numItems; _curItem++ {
arrayCtx := spiContext.CreateArrayContext(ctx, int(_numItems), int(_curItem))
_ = arrayCtx
_ = _curItem
_item, _err := TypeIdParseWithBuffer(arrayCtx, readBuffer)
if _err != nil {
- return nil, errors.Wrap(_err, "Error parsing 'typeId' field of CipRRData")
+ return nil, errors.Wrap(_err, "Error parsing 'typeIds' field of CipRRData")
}
- typeId[_curItem] = _item.(TypeId)
+ typeIds[_curItem] = _item.(TypeId)
}
}
- if closeErr := readBuffer.CloseContext("typeId", utils.WithRenderAsList(true)); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for typeId")
+ if closeErr := readBuffer.CloseContext("typeIds", utils.WithRenderAsList(true)); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for typeIds")
}
if closeErr := readBuffer.CloseContext("CipRRData"); closeErr != nil {
@@ -245,8 +237,7 @@ func CipRRDataParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffer,
_EipPacket: &_EipPacket{},
InterfaceHandle: interfaceHandle,
Timeout: timeout,
- ItemCount: itemCount,
- TypeId: typeId,
+ TypeIds: typeIds,
}
_child._EipPacket._EipPacketChildRequirements = _child
return _child, nil
@@ -282,28 +273,28 @@ func (m *_CipRRData) SerializeWithWriteBuffer(ctx context.Context, writeBuffer u
return errors.Wrap(_timeoutErr, "Error serializing 'timeout' field")
}
- // Simple Field (itemCount)
- itemCount := uint16(m.GetItemCount())
- _itemCountErr := writeBuffer.WriteUint16("itemCount", 16, (itemCount))
- if _itemCountErr != nil {
- return errors.Wrap(_itemCountErr, "Error serializing 'itemCount' field")
+ // Implicit Field (typeIdCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ typeIdCount := uint16(uint16(len(m.GetTypeIds())))
+ _typeIdCountErr := writeBuffer.WriteUint16("typeIdCount", 16, (typeIdCount))
+ if _typeIdCountErr != nil {
+ return errors.Wrap(_typeIdCountErr, "Error serializing 'typeIdCount' field")
}
- // Array Field (typeId)
- if pushErr := writeBuffer.PushContext("typeId", utils.WithRenderAsList(true)); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for typeId")
+ // Array Field (typeIds)
+ if pushErr := writeBuffer.PushContext("typeIds", utils.WithRenderAsList(true)); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for typeIds")
}
- for _curItem, _element := range m.GetTypeId() {
+ for _curItem, _element := range m.GetTypeIds() {
_ = _curItem
- arrayCtx := spiContext.CreateArrayContext(ctx, len(m.GetTypeId()), _curItem)
+ arrayCtx := spiContext.CreateArrayContext(ctx, len(m.GetTypeIds()), _curItem)
_ = arrayCtx
_elementErr := writeBuffer.WriteSerializable(arrayCtx, _element)
if _elementErr != nil {
- return errors.Wrap(_elementErr, "Error serializing 'typeId' field")
+ return errors.Wrap(_elementErr, "Error serializing 'typeIds' field")
}
}
- if popErr := writeBuffer.PopContext("typeId", utils.WithRenderAsList(true)); popErr != nil {
- return errors.Wrap(popErr, "Error popping for typeId")
+ if popErr := writeBuffer.PopContext("typeIds", utils.WithRenderAsList(true)); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for typeIds")
}
if popErr := writeBuffer.PopContext("CipRRData"); popErr != nil {
diff --git a/plc4go/protocols/eip/readwrite/model/ListServicesResponse.go b/plc4go/protocols/eip/readwrite/model/ListServicesResponse.go
index b226eed94f..5316ffcf33 100644
--- a/plc4go/protocols/eip/readwrite/model/ListServicesResponse.go
+++ b/plc4go/protocols/eip/readwrite/model/ListServicesResponse.go
@@ -33,10 +33,8 @@ type ListServicesResponse interface {
utils.LengthAware
utils.Serializable
EipPacket
- // GetItemCount returns ItemCount (property field)
- GetItemCount() uint16
- // GetTypeId returns TypeId (property field)
- GetTypeId() []TypeId
+ // GetTypeIds returns TypeIds (property field)
+ GetTypeIds() []TypeId
}
// ListServicesResponseExactly can be used when we want exactly this type and not a type which fulfills ListServicesResponse.
@@ -49,8 +47,7 @@ type ListServicesResponseExactly interface {
// _ListServicesResponse is the data-structure of this message
type _ListServicesResponse struct {
*_EipPacket
- ItemCount uint16
- TypeId []TypeId
+ TypeIds []TypeId
}
///////////////////////////////////////////////////////////
@@ -91,12 +88,8 @@ func (m *_ListServicesResponse) GetParent() EipPacket {
/////////////////////// Accessors for property fields.
///////////////////////
-func (m *_ListServicesResponse) GetItemCount() uint16 {
- return m.ItemCount
-}
-
-func (m *_ListServicesResponse) GetTypeId() []TypeId {
- return m.TypeId
+func (m *_ListServicesResponse) GetTypeIds() []TypeId {
+ return m.TypeIds
}
///////////////////////
@@ -105,10 +98,9 @@ func (m *_ListServicesResponse) GetTypeId() []TypeId {
///////////////////////////////////////////////////////////
// NewListServicesResponse factory function for _ListServicesResponse
-func NewListServicesResponse(itemCount uint16, typeId []TypeId, sessionHandle uint32, status uint32, senderContext []byte, options uint32) *_ListServicesResponse {
+func NewListServicesResponse(typeIds []TypeId, sessionHandle uint32, status uint32, senderContext []byte, options uint32) *_ListServicesResponse {
_result := &_ListServicesResponse{
- ItemCount: itemCount,
- TypeId: typeId,
+ TypeIds: typeIds,
_EipPacket: NewEipPacket(sessionHandle, status, senderContext, options),
}
_result._EipPacket._EipPacketChildRequirements = _result
@@ -133,13 +125,13 @@ func (m *_ListServicesResponse) GetTypeName() string {
func (m *_ListServicesResponse) GetLengthInBits(ctx context.Context) uint16 {
lengthInBits := uint16(m.GetParentLengthInBits(ctx))
- // Simple field (itemCount)
+ // Implicit Field (typeIdCount)
lengthInBits += 16
// Array field
- if len(m.TypeId) > 0 {
- for _curItem, element := range m.TypeId {
- arrayCtx := spiContext.CreateArrayContext(ctx, len(m.TypeId), _curItem)
+ if len(m.TypeIds) > 0 {
+ for _curItem, element := range m.TypeIds {
+ arrayCtx := spiContext.CreateArrayContext(ctx, len(m.TypeIds), _curItem)
_ = arrayCtx
_ = _curItem
lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx)
@@ -166,38 +158,38 @@ func ListServicesResponseParseWithBuffer(ctx context.Context, readBuffer utils.R
currentPos := positionAware.GetPos()
_ = currentPos
- // Simple Field (itemCount)
- _itemCount, _itemCountErr := readBuffer.ReadUint16("itemCount", 16)
- if _itemCountErr != nil {
- return nil, errors.Wrap(_itemCountErr, "Error parsing 'itemCount' field of ListServicesResponse")
+ // Implicit Field (typeIdCount) (Used for parsing, but its value is not stored as it's implicitly given by the objects content)
+ typeIdCount, _typeIdCountErr := readBuffer.ReadUint16("typeIdCount", 16)
+ _ = typeIdCount
+ if _typeIdCountErr != nil {
+ return nil, errors.Wrap(_typeIdCountErr, "Error parsing 'typeIdCount' field of ListServicesResponse")
}
- itemCount := _itemCount
- // Array field (typeId)
- if pullErr := readBuffer.PullContext("typeId", utils.WithRenderAsList(true)); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for typeId")
+ // Array field (typeIds)
+ if pullErr := readBuffer.PullContext("typeIds", utils.WithRenderAsList(true)); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for typeIds")
}
// Count array
- typeId := make([]TypeId, itemCount)
+ typeIds := make([]TypeId, typeIdCount)
// This happens when the size is set conditional to 0
- if len(typeId) == 0 {
- typeId = nil
+ if len(typeIds) == 0 {
+ typeIds = nil
}
{
- _numItems := uint16(itemCount)
+ _numItems := uint16(typeIdCount)
for _curItem := uint16(0); _curItem < _numItems; _curItem++ {
arrayCtx := spiContext.CreateArrayContext(ctx, int(_numItems), int(_curItem))
_ = arrayCtx
_ = _curItem
_item, _err := TypeIdParseWithBuffer(arrayCtx, readBuffer)
if _err != nil {
- return nil, errors.Wrap(_err, "Error parsing 'typeId' field of ListServicesResponse")
+ return nil, errors.Wrap(_err, "Error parsing 'typeIds' field of ListServicesResponse")
}
- typeId[_curItem] = _item.(TypeId)
+ typeIds[_curItem] = _item.(TypeId)
}
}
- if closeErr := readBuffer.CloseContext("typeId", utils.WithRenderAsList(true)); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for typeId")
+ if closeErr := readBuffer.CloseContext("typeIds", utils.WithRenderAsList(true)); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for typeIds")
}
if closeErr := readBuffer.CloseContext("ListServicesResponse"); closeErr != nil {
@@ -207,8 +199,7 @@ func ListServicesResponseParseWithBuffer(ctx context.Context, readBuffer utils.R
// Create a partially initialized instance
_child := &_ListServicesResponse{
_EipPacket: &_EipPacket{},
- ItemCount: itemCount,
- TypeId: typeId,
+ TypeIds: typeIds,
}
_child._EipPacket._EipPacketChildRequirements = _child
return _child, nil
@@ -230,28 +221,28 @@ func (m *_ListServicesResponse) SerializeWithWriteBuffer(ctx context.Context, wr
return errors.Wrap(pushErr, "Error pushing for ListServicesResponse")
}
- // Simple Field (itemCount)
- itemCount := uint16(m.GetItemCount())
- _itemCountErr := writeBuffer.WriteUint16("itemCount", 16, (itemCount))
- if _itemCountErr != nil {
- return errors.Wrap(_itemCountErr, "Error serializing 'itemCount' field")
+ // Implicit Field (typeIdCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ typeIdCount := uint16(uint16(len(m.GetTypeIds())))
+ _typeIdCountErr := writeBuffer.WriteUint16("typeIdCount", 16, (typeIdCount))
+ if _typeIdCountErr != nil {
+ return errors.Wrap(_typeIdCountErr, "Error serializing 'typeIdCount' field")
}
- // Array Field (typeId)
- if pushErr := writeBuffer.PushContext("typeId", utils.WithRenderAsList(true)); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for typeId")
+ // Array Field (typeIds)
+ if pushErr := writeBuffer.PushContext("typeIds", utils.WithRenderAsList(true)); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for typeIds")
}
- for _curItem, _element := range m.GetTypeId() {
+ for _curItem, _element := range m.GetTypeIds() {
_ = _curItem
- arrayCtx := spiContext.CreateArrayContext(ctx, len(m.GetTypeId()), _curItem)
+ arrayCtx := spiContext.CreateArrayContext(ctx, len(m.GetTypeIds()), _curItem)
_ = arrayCtx
_elementErr := writeBuffer.WriteSerializable(arrayCtx, _element)
if _elementErr != nil {
- return errors.Wrap(_elementErr, "Error serializing 'typeId' field")
+ return errors.Wrap(_elementErr, "Error serializing 'typeIds' field")
}
}
- if popErr := writeBuffer.PopContext("typeId", utils.WithRenderAsList(true)); popErr != nil {
- return errors.Wrap(popErr, "Error popping for typeId")
+ if popErr := writeBuffer.PopContext("typeIds", utils.WithRenderAsList(true)); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for typeIds")
}
if popErr := writeBuffer.PopContext("ListServicesResponse"); popErr != nil {
diff --git a/plc4go/protocols/eip/readwrite/model/SendUnitData.go b/plc4go/protocols/eip/readwrite/model/SendUnitData.go
index 8cfaca1e5e..2b4744916d 100644
--- a/plc4go/protocols/eip/readwrite/model/SendUnitData.go
+++ b/plc4go/protocols/eip/readwrite/model/SendUnitData.go
@@ -39,10 +39,8 @@ type SendUnitData interface {
EipPacket
// GetTimeout returns Timeout (property field)
GetTimeout() uint16
- // GetItemCount returns ItemCount (property field)
- GetItemCount() uint16
- // GetTypeId returns TypeId (property field)
- GetTypeId() []TypeId
+ // GetTypeIds returns TypeIds (property field)
+ GetTypeIds() []TypeId
}
// SendUnitDataExactly can be used when we want exactly this type and not a type which fulfills SendUnitData.
@@ -55,9 +53,8 @@ type SendUnitDataExactly interface {
// _SendUnitData is the data-structure of this message
type _SendUnitData struct {
*_EipPacket
- Timeout uint16
- ItemCount uint16
- TypeId []TypeId
+ Timeout uint16
+ TypeIds []TypeId
}
///////////////////////////////////////////////////////////
@@ -102,12 +99,8 @@ func (m *_SendUnitData) GetTimeout() uint16 {
return m.Timeout
}
-func (m *_SendUnitData) GetItemCount() uint16 {
- return m.ItemCount
-}
-
-func (m *_SendUnitData) GetTypeId() []TypeId {
- return m.TypeId
+func (m *_SendUnitData) GetTypeIds() []TypeId {
+ return m.TypeIds
}
///////////////////////
@@ -129,11 +122,10 @@ func (m *_SendUnitData) GetInterfaceHandle() uint32 {
///////////////////////////////////////////////////////////
// NewSendUnitData factory function for _SendUnitData
-func NewSendUnitData(timeout uint16, itemCount uint16, typeId []TypeId, sessionHandle uint32, status uint32, senderContext []byte, options uint32) *_SendUnitData {
+func NewSendUnitData(timeout uint16, typeIds []TypeId, sessionHandle uint32, status uint32, senderContext []byte, options uint32) *_SendUnitData {
_result := &_SendUnitData{
Timeout: timeout,
- ItemCount: itemCount,
- TypeId: typeId,
+ TypeIds: typeIds,
_EipPacket: NewEipPacket(sessionHandle, status, senderContext, options),
}
_result._EipPacket._EipPacketChildRequirements = _result
@@ -164,13 +156,13 @@ func (m *_SendUnitData) GetLengthInBits(ctx context.Context) uint16 {
// Simple field (timeout)
lengthInBits += 16
- // Simple field (itemCount)
+ // Implicit Field (typeIdCount)
lengthInBits += 16
// Array field
- if len(m.TypeId) > 0 {
- for _curItem, element := range m.TypeId {
- arrayCtx := spiContext.CreateArrayContext(ctx, len(m.TypeId), _curItem)
+ if len(m.TypeIds) > 0 {
+ for _curItem, element := range m.TypeIds {
+ arrayCtx := spiContext.CreateArrayContext(ctx, len(m.TypeIds), _curItem)
_ = arrayCtx
_ = _curItem
lengthInBits += element.(interface{ GetLengthInBits(context.Context) uint16 }).GetLengthInBits(arrayCtx)
@@ -213,38 +205,38 @@ func SendUnitDataParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffe
}
timeout := _timeout
- // Simple Field (itemCount)
- _itemCount, _itemCountErr := readBuffer.ReadUint16("itemCount", 16)
- if _itemCountErr != nil {
- return nil, errors.Wrap(_itemCountErr, "Error parsing 'itemCount' field of SendUnitData")
+ // Implicit Field (typeIdCount) (Used for parsing, but its value is not stored as it's implicitly given by the objects content)
+ typeIdCount, _typeIdCountErr := readBuffer.ReadUint16("typeIdCount", 16)
+ _ = typeIdCount
+ if _typeIdCountErr != nil {
+ return nil, errors.Wrap(_typeIdCountErr, "Error parsing 'typeIdCount' field of SendUnitData")
}
- itemCount := _itemCount
- // Array field (typeId)
- if pullErr := readBuffer.PullContext("typeId", utils.WithRenderAsList(true)); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for typeId")
+ // Array field (typeIds)
+ if pullErr := readBuffer.PullContext("typeIds", utils.WithRenderAsList(true)); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for typeIds")
}
// Count array
- typeId := make([]TypeId, itemCount)
+ typeIds := make([]TypeId, typeIdCount)
// This happens when the size is set conditional to 0
- if len(typeId) == 0 {
- typeId = nil
+ if len(typeIds) == 0 {
+ typeIds = nil
}
{
- _numItems := uint16(itemCount)
+ _numItems := uint16(typeIdCount)
for _curItem := uint16(0); _curItem < _numItems; _curItem++ {
arrayCtx := spiContext.CreateArrayContext(ctx, int(_numItems), int(_curItem))
_ = arrayCtx
_ = _curItem
_item, _err := TypeIdParseWithBuffer(arrayCtx, readBuffer)
if _err != nil {
- return nil, errors.Wrap(_err, "Error parsing 'typeId' field of SendUnitData")
+ return nil, errors.Wrap(_err, "Error parsing 'typeIds' field of SendUnitData")
}
- typeId[_curItem] = _item.(TypeId)
+ typeIds[_curItem] = _item.(TypeId)
}
}
- if closeErr := readBuffer.CloseContext("typeId", utils.WithRenderAsList(true)); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for typeId")
+ if closeErr := readBuffer.CloseContext("typeIds", utils.WithRenderAsList(true)); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for typeIds")
}
if closeErr := readBuffer.CloseContext("SendUnitData"); closeErr != nil {
@@ -255,8 +247,7 @@ func SendUnitDataParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffe
_child := &_SendUnitData{
_EipPacket: &_EipPacket{},
Timeout: timeout,
- ItemCount: itemCount,
- TypeId: typeId,
+ TypeIds: typeIds,
}
_child._EipPacket._EipPacketChildRequirements = _child
return _child, nil
@@ -291,28 +282,28 @@ func (m *_SendUnitData) SerializeWithWriteBuffer(ctx context.Context, writeBuffe
return errors.Wrap(_timeoutErr, "Error serializing 'timeout' field")
}
- // Simple Field (itemCount)
- itemCount := uint16(m.GetItemCount())
- _itemCountErr := writeBuffer.WriteUint16("itemCount", 16, (itemCount))
- if _itemCountErr != nil {
- return errors.Wrap(_itemCountErr, "Error serializing 'itemCount' field")
+ // Implicit Field (typeIdCount) (Used for parsing, but it's value is not stored as it's implicitly given by the objects content)
+ typeIdCount := uint16(uint16(len(m.GetTypeIds())))
+ _typeIdCountErr := writeBuffer.WriteUint16("typeIdCount", 16, (typeIdCount))
+ if _typeIdCountErr != nil {
+ return errors.Wrap(_typeIdCountErr, "Error serializing 'typeIdCount' field")
}
- // Array Field (typeId)
- if pushErr := writeBuffer.PushContext("typeId", utils.WithRenderAsList(true)); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for typeId")
+ // Array Field (typeIds)
+ if pushErr := writeBuffer.PushContext("typeIds", utils.WithRenderAsList(true)); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for typeIds")
}
- for _curItem, _element := range m.GetTypeId() {
+ for _curItem, _element := range m.GetTypeIds() {
_ = _curItem
- arrayCtx := spiContext.CreateArrayContext(ctx, len(m.GetTypeId()), _curItem)
+ arrayCtx := spiContext.CreateArrayContext(ctx, len(m.GetTypeIds()), _curItem)
_ = arrayCtx
_elementErr := writeBuffer.WriteSerializable(arrayCtx, _element)
if _elementErr != nil {
- return errors.Wrap(_elementErr, "Error serializing 'typeId' field")
+ return errors.Wrap(_elementErr, "Error serializing 'typeIds' field")
}
}
- if popErr := writeBuffer.PopContext("typeId", utils.WithRenderAsList(true)); popErr != nil {
- return errors.Wrap(popErr, "Error popping for typeId")
+ if popErr := writeBuffer.PopContext("typeIds", utils.WithRenderAsList(true)); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for typeIds")
}
if popErr := writeBuffer.PopContext("SendUnitData"); popErr != nil {
diff --git a/plc4go/protocols/eip/readwrite/model/StaticHelper.go b/plc4go/protocols/eip/readwrite/model/StaticHelper.go
index 39973d8623..4b2971d910 100644
--- a/plc4go/protocols/eip/readwrite/model/StaticHelper.go
+++ b/plc4go/protocols/eip/readwrite/model/StaticHelper.go
@@ -6,10 +6,10 @@ import (
"github.com/apache/plc4x/plc4go/spi/utils"
)
-func NoMorePathSegments(readBuffer utils.ReadBuffer, oder IntegerEncoding) bool {
+func NoMorePathSegments(readBuffer utils.ReadBuffer) bool {
initialPos := readBuffer.GetPos()
defer readBuffer.Reset(initialPos)
- _, err := PathSegmentParseWithBuffer(context.Background(), readBuffer, oder)
+ _, err := PathSegmentParseWithBuffer(context.Background(), readBuffer)
return err != nil
}
diff --git a/plc4go/tests/drivers/tests/eip_driver_test.go b/plc4go/tests/drivers/tests/eip_driver_test.go
index f64f4e00ec..a60f902f0f 100644
--- a/plc4go/tests/drivers/tests/eip_driver_test.go
+++ b/plc4go/tests/drivers/tests/eip_driver_test.go
@@ -20,20 +20,14 @@
package tests
import (
- "context"
"testing"
"github.com/apache/plc4x/plc4go/internal/eip"
- eipIO "github.com/apache/plc4x/plc4go/protocols/eip/readwrite"
- eipModel "github.com/apache/plc4x/plc4go/protocols/eip/readwrite/model"
+ "github.com/apache/plc4x/plc4go/protocols/eip/readwrite"
"github.com/apache/plc4x/plc4go/spi/testutils"
- "github.com/apache/plc4x/plc4go/spi/utils"
_ "github.com/apache/plc4x/plc4go/tests/initializetest"
)
func TestEIPDriver(t *testing.T) {
- options := []testutils.WithOption{testutils.WithRootTypeParser(func(readBufferByteBased utils.ReadBufferByteBased) (interface{}, error) {
- return eipModel.EipPacketParseWithBuffer(context.Background(), readBufferByteBased)
- })}
- testutils.RunDriverTestsuiteWithOptions(t, eip.NewDriver(), "assets/testing/protocols/eip/DriverTestsuite.xml", eipIO.EipXmlParserHelper{}, options)
+ testutils.RunDriverTestsuite(t, eip.NewDriver(), "assets/testing/protocols/eip/DriverTestsuite.xml", readwrite.EipXmlParserHelper{})
}
diff --git a/plc4go/tests/drivers/tests/eip_parser_serializer_test.go b/plc4go/tests/drivers/tests/eip_parser_serializer_test.go
index 3b93830c1c..f88eb5dacd 100644
--- a/plc4go/tests/drivers/tests/eip_parser_serializer_test.go
+++ b/plc4go/tests/drivers/tests/eip_parser_serializer_test.go
@@ -20,12 +20,16 @@
package tests
import (
+ "testing"
+
"github.com/apache/plc4x/plc4go/spi/testutils"
_ "github.com/apache/plc4x/plc4go/tests/initializetest"
- "testing"
)
-func TestEipParserSerializer(t *testing.T) {
- //t.Skip("Still a WIP")
- testutils.RunParserSerializerTestsuite(t, "assets/testing/protocols/eip/ParserSerializerTestsuite.xml")
+func TestEipParserSerializerBigEndian(t *testing.T) {
+ testutils.RunParserSerializerTestsuite(t, "assets/testing/protocols/eip/ParserSerializerTestsuiteBigEndian.xml")
+}
+
+func TestEipParserSerializerLittleEndian(t *testing.T) {
+ testutils.RunParserSerializerTestsuite(t, "assets/testing/protocols/eip/ParserSerializerTestsuiteLittleEndian.xml")
}
diff --git a/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java b/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java
index 3ad63e9cba..3a8b12ea1b 100644
--- a/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java
+++ b/plc4j/drivers/bacnet/src/main/generated/org/apache/plc4x/java/bacnetip/readwrite/BACnetVendorId.java
@@ -1615,6 +1615,8 @@ public enum BACnetVendorId {
THING_WAREHOUSELLC((int) 1404, (int) 1404, (String) "Thing Warehouse LLC"),
INNOFRIENDS_GMBH((int) 1405, (int) 1405, (String) "Innofriends GmbH"),
METRONICAKP_SPJ((int) 1406, (int) 1406, (String) "Metronic AKP Sp. J."),
+ TECHKNAVE((int) 1407, (int) 1407, (String) "Techknave"),
+ ELSNER_ELEKTRONIK((int) 1408, (int) 1408, (String) "Elsner Elektronik"),
UNKNOWN_VENDOR((int) 0xFFFF, (int) 0xFFFF, (String) "Unknown");
private static final Map<Integer, BACnetVendorId> map;
diff --git a/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/CipRRData.java b/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/CipRRData.java
index 58b77f0f22..28649e9a0e 100644
--- a/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/CipRRData.java
+++ b/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/CipRRData.java
@@ -53,8 +53,7 @@ public class CipRRData extends EipPacket implements Message {
// Properties.
protected final long interfaceHandle;
protected final int timeout;
- protected final int itemCount;
- protected final List<TypeId> typeId;
+ protected final List<TypeId> typeIds;
public CipRRData(
long sessionHandle,
@@ -63,13 +62,11 @@ public class CipRRData extends EipPacket implements Message {
long options,
long interfaceHandle,
int timeout,
- int itemCount,
- List<TypeId> typeId) {
+ List<TypeId> typeIds) {
super(sessionHandle, status, senderContext, options);
this.interfaceHandle = interfaceHandle;
this.timeout = timeout;
- this.itemCount = itemCount;
- this.typeId = typeId;
+ this.typeIds = typeIds;
}
public long getInterfaceHandle() {
@@ -80,12 +77,8 @@ public class CipRRData extends EipPacket implements Message {
return timeout;
}
- public int getItemCount() {
- return itemCount;
- }
-
- public List<TypeId> getTypeId() {
- return typeId;
+ public List<TypeId> getTypeIds() {
+ return typeIds;
}
@Override
@@ -101,11 +94,13 @@ public class CipRRData extends EipPacket implements Message {
// Simple Field (timeout)
writeSimpleField("timeout", timeout, writeUnsignedInt(writeBuffer, 16));
- // Simple Field (itemCount)
- writeSimpleField("itemCount", itemCount, writeUnsignedInt(writeBuffer, 16));
+ // Implicit Field (typeIdCount) (Used for parsing, but its value is not stored as it's
+ // implicitly given by the objects content)
+ int typeIdCount = (int) (COUNT(getTypeIds()));
+ writeImplicitField("typeIdCount", typeIdCount, writeUnsignedInt(writeBuffer, 16));
- // Array Field (typeId)
- writeComplexTypeArrayField("typeId", typeId, writeBuffer);
+ // Array Field (typeIds)
+ writeComplexTypeArrayField("typeIds", typeIds, writeBuffer);
writeBuffer.popContext("CipRRData");
}
@@ -127,14 +122,14 @@ public class CipRRData extends EipPacket implements Message {
// Simple field (timeout)
lengthInBits += 16;
- // Simple field (itemCount)
+ // Implicit Field (typeIdCount)
lengthInBits += 16;
// Array field
- if (typeId != null) {
+ if (typeIds != null) {
int i = 0;
- for (TypeId element : typeId) {
- ThreadLocalHelper.lastItemThreadLocal.set(++i >= typeId.size());
+ for (TypeId element : typeIds) {
+ ThreadLocalHelper.lastItemThreadLocal.set(++i >= typeIds.size());
lengthInBits += element.getLengthInBits();
}
}
@@ -154,44 +149,34 @@ public class CipRRData extends EipPacket implements Message {
int timeout = readSimpleField("timeout", readUnsignedInt(readBuffer, 16));
- int itemCount = readSimpleField("itemCount", readUnsignedInt(readBuffer, 16));
+ int typeIdCount = readImplicitField("typeIdCount", readUnsignedInt(readBuffer, 16));
- List<TypeId> typeId =
+ List<TypeId> typeIds =
readCountArrayField(
- "typeId",
+ "typeIds",
new DataReaderComplexDefault<>(() -> TypeId.staticParse(readBuffer), readBuffer),
- itemCount);
+ typeIdCount);
readBuffer.closeContext("CipRRData");
// Create the instance
- return new CipRRDataBuilderImpl(interfaceHandle, timeout, itemCount, typeId);
+ return new CipRRDataBuilderImpl(interfaceHandle, timeout, typeIds);
}
public static class CipRRDataBuilderImpl implements EipPacket.EipPacketBuilder {
private final long interfaceHandle;
private final int timeout;
- private final int itemCount;
- private final List<TypeId> typeId;
+ private final List<TypeId> typeIds;
- public CipRRDataBuilderImpl(
- long interfaceHandle, int timeout, int itemCount, List<TypeId> typeId) {
+ public CipRRDataBuilderImpl(long interfaceHandle, int timeout, List<TypeId> typeIds) {
this.interfaceHandle = interfaceHandle;
this.timeout = timeout;
- this.itemCount = itemCount;
- this.typeId = typeId;
+ this.typeIds = typeIds;
}
public CipRRData build(long sessionHandle, long status, byte[] senderContext, long options) {
CipRRData cipRRData =
new CipRRData(
- sessionHandle,
- status,
- senderContext,
- options,
- interfaceHandle,
- timeout,
- itemCount,
- typeId);
+ sessionHandle, status, senderContext, options, interfaceHandle, timeout, typeIds);
return cipRRData;
}
}
@@ -207,16 +192,14 @@ public class CipRRData extends EipPacket implements Message {
CipRRData that = (CipRRData) o;
return (getInterfaceHandle() == that.getInterfaceHandle())
&& (getTimeout() == that.getTimeout())
- && (getItemCount() == that.getItemCount())
- && (getTypeId() == that.getTypeId())
+ && (getTypeIds() == that.getTypeIds())
&& super.equals(that)
&& true;
}
@Override
public int hashCode() {
- return Objects.hash(
- super.hashCode(), getInterfaceHandle(), getTimeout(), getItemCount(), getTypeId());
+ return Objects.hash(super.hashCode(), getInterfaceHandle(), getTimeout(), getTypeIds());
}
@Override
diff --git a/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/ListServicesResponse.java b/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/ListServicesResponse.java
index d0c4f88a99..a535856853 100644
--- a/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/ListServicesResponse.java
+++ b/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/ListServicesResponse.java
@@ -51,27 +51,16 @@ public class ListServicesResponse extends EipPacket implements Message {
}
// Properties.
- protected final int itemCount;
- protected final List<TypeId> typeId;
+ protected final List<TypeId> typeIds;
public ListServicesResponse(
- long sessionHandle,
- long status,
- byte[] senderContext,
- long options,
- int itemCount,
- List<TypeId> typeId) {
+ long sessionHandle, long status, byte[] senderContext, long options, List<TypeId> typeIds) {
super(sessionHandle, status, senderContext, options);
- this.itemCount = itemCount;
- this.typeId = typeId;
+ this.typeIds = typeIds;
}
- public int getItemCount() {
- return itemCount;
- }
-
- public List<TypeId> getTypeId() {
- return typeId;
+ public List<TypeId> getTypeIds() {
+ return typeIds;
}
@Override
@@ -81,11 +70,13 @@ public class ListServicesResponse extends EipPacket implements Message {
int startPos = positionAware.getPos();
writeBuffer.pushContext("ListServicesResponse");
- // Simple Field (itemCount)
- writeSimpleField("itemCount", itemCount, writeUnsignedInt(writeBuffer, 16));
+ // Implicit Field (typeIdCount) (Used for parsing, but its value is not stored as it's
+ // implicitly given by the objects content)
+ int typeIdCount = (int) (COUNT(getTypeIds()));
+ writeImplicitField("typeIdCount", typeIdCount, writeUnsignedInt(writeBuffer, 16));
- // Array Field (typeId)
- writeComplexTypeArrayField("typeId", typeId, writeBuffer);
+ // Array Field (typeIds)
+ writeComplexTypeArrayField("typeIds", typeIds, writeBuffer);
writeBuffer.popContext("ListServicesResponse");
}
@@ -101,14 +92,14 @@ public class ListServicesResponse extends EipPacket implements Message {
ListServicesResponse _value = this;
boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
- // Simple field (itemCount)
+ // Implicit Field (typeIdCount)
lengthInBits += 16;
// Array field
- if (typeId != null) {
+ if (typeIds != null) {
int i = 0;
- for (TypeId element : typeId) {
- ThreadLocalHelper.lastItemThreadLocal.set(++i >= typeId.size());
+ for (TypeId element : typeIds) {
+ ThreadLocalHelper.lastItemThreadLocal.set(++i >= typeIds.size());
lengthInBits += element.getLengthInBits();
}
}
@@ -124,33 +115,30 @@ public class ListServicesResponse extends EipPacket implements Message {
int curPos;
boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
- int itemCount = readSimpleField("itemCount", readUnsignedInt(readBuffer, 16));
+ int typeIdCount = readImplicitField("typeIdCount", readUnsignedInt(readBuffer, 16));
- List<TypeId> typeId =
+ List<TypeId> typeIds =
readCountArrayField(
- "typeId",
+ "typeIds",
new DataReaderComplexDefault<>(() -> TypeId.staticParse(readBuffer), readBuffer),
- itemCount);
+ typeIdCount);
readBuffer.closeContext("ListServicesResponse");
// Create the instance
- return new ListServicesResponseBuilderImpl(itemCount, typeId);
+ return new ListServicesResponseBuilderImpl(typeIds);
}
public static class ListServicesResponseBuilderImpl implements EipPacket.EipPacketBuilder {
- private final int itemCount;
- private final List<TypeId> typeId;
+ private final List<TypeId> typeIds;
- public ListServicesResponseBuilderImpl(int itemCount, List<TypeId> typeId) {
- this.itemCount = itemCount;
- this.typeId = typeId;
+ public ListServicesResponseBuilderImpl(List<TypeId> typeIds) {
+ this.typeIds = typeIds;
}
public ListServicesResponse build(
long sessionHandle, long status, byte[] senderContext, long options) {
ListServicesResponse listServicesResponse =
- new ListServicesResponse(
- sessionHandle, status, senderContext, options, itemCount, typeId);
+ new ListServicesResponse(sessionHandle, status, senderContext, options, typeIds);
return listServicesResponse;
}
}
@@ -164,15 +152,12 @@ public class ListServicesResponse extends EipPacket implements Message {
return false;
}
ListServicesResponse that = (ListServicesResponse) o;
- return (getItemCount() == that.getItemCount())
- && (getTypeId() == that.getTypeId())
- && super.equals(that)
- && true;
+ return (getTypeIds() == that.getTypeIds()) && super.equals(that) && true;
}
@Override
public int hashCode() {
- return Objects.hash(super.hashCode(), getItemCount(), getTypeId());
+ return Objects.hash(super.hashCode(), getTypeIds());
}
@Override
diff --git a/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/SendUnitData.java b/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/SendUnitData.java
index b05d3976d8..ef03ec040b 100644
--- a/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/SendUnitData.java
+++ b/plc4j/drivers/eip/src/main/generated/org/apache/plc4x/java/eip/readwrite/SendUnitData.java
@@ -55,8 +55,7 @@ public class SendUnitData extends EipPacket implements Message {
// Properties.
protected final int timeout;
- protected final int itemCount;
- protected final List<TypeId> typeId;
+ protected final List<TypeId> typeIds;
public SendUnitData(
long sessionHandle,
@@ -64,24 +63,18 @@ public class SendUnitData extends EipPacket implements Message {
byte[] senderContext,
long options,
int timeout,
- int itemCount,
- List<TypeId> typeId) {
+ List<TypeId> typeIds) {
super(sessionHandle, status, senderContext, options);
this.timeout = timeout;
- this.itemCount = itemCount;
- this.typeId = typeId;
+ this.typeIds = typeIds;
}
public int getTimeout() {
return timeout;
}
- public int getItemCount() {
- return itemCount;
- }
-
- public List<TypeId> getTypeId() {
- return typeId;
+ public List<TypeId> getTypeIds() {
+ return typeIds;
}
public long getInterfaceHandle() {
@@ -101,11 +94,13 @@ public class SendUnitData extends EipPacket implements Message {
// Simple Field (timeout)
writeSimpleField("timeout", timeout, writeUnsignedInt(writeBuffer, 16));
- // Simple Field (itemCount)
- writeSimpleField("itemCount", itemCount, writeUnsignedInt(writeBuffer, 16));
+ // Implicit Field (typeIdCount) (Used for parsing, but its value is not stored as it's
+ // implicitly given by the objects content)
+ int typeIdCount = (int) (COUNT(getTypeIds()));
+ writeImplicitField("typeIdCount", typeIdCount, writeUnsignedInt(writeBuffer, 16));
- // Array Field (typeId)
- writeComplexTypeArrayField("typeId", typeId, writeBuffer);
+ // Array Field (typeIds)
+ writeComplexTypeArrayField("typeIds", typeIds, writeBuffer);
writeBuffer.popContext("SendUnitData");
}
@@ -127,14 +122,14 @@ public class SendUnitData extends EipPacket implements Message {
// Simple field (timeout)
lengthInBits += 16;
- // Simple field (itemCount)
+ // Implicit Field (typeIdCount)
lengthInBits += 16;
// Array field
- if (typeId != null) {
+ if (typeIds != null) {
int i = 0;
- for (TypeId element : typeId) {
- ThreadLocalHelper.lastItemThreadLocal.set(++i >= typeId.size());
+ for (TypeId element : typeIds) {
+ ThreadLocalHelper.lastItemThreadLocal.set(++i >= typeIds.size());
lengthInBits += element.getLengthInBits();
}
}
@@ -156,34 +151,31 @@ public class SendUnitData extends EipPacket implements Message {
int timeout = readSimpleField("timeout", readUnsignedInt(readBuffer, 16));
- int itemCount = readSimpleField("itemCount", readUnsignedInt(readBuffer, 16));
+ int typeIdCount = readImplicitField("typeIdCount", readUnsignedInt(readBuffer, 16));
- List<TypeId> typeId =
+ List<TypeId> typeIds =
readCountArrayField(
- "typeId",
+ "typeIds",
new DataReaderComplexDefault<>(() -> TypeId.staticParse(readBuffer), readBuffer),
- itemCount);
+ typeIdCount);
readBuffer.closeContext("SendUnitData");
// Create the instance
- return new SendUnitDataBuilderImpl(timeout, itemCount, typeId);
+ return new SendUnitDataBuilderImpl(timeout, typeIds);
}
public static class SendUnitDataBuilderImpl implements EipPacket.EipPacketBuilder {
private final int timeout;
- private final int itemCount;
- private final List<TypeId> typeId;
+ private final List<TypeId> typeIds;
- public SendUnitDataBuilderImpl(int timeout, int itemCount, List<TypeId> typeId) {
+ public SendUnitDataBuilderImpl(int timeout, List<TypeId> typeIds) {
this.timeout = timeout;
- this.itemCount = itemCount;
- this.typeId = typeId;
+ this.typeIds = typeIds;
}
public SendUnitData build(long sessionHandle, long status, byte[] senderContext, long options) {
SendUnitData sendUnitData =
- new SendUnitData(
- sessionHandle, status, senderContext, options, timeout, itemCount, typeId);
+ new SendUnitData(sessionHandle, status, senderContext, options, timeout, typeIds);
return sendUnitData;
}
}
@@ -198,15 +190,14 @@ public class SendUnitData extends EipPacket implements Message {
}
SendUnitData that = (SendUnitData) o;
return (getTimeout() == that.getTimeout())
- && (getItemCount() == that.getItemCount())
- && (getTypeId() == that.getTypeId())
+ && (getTypeIds() == that.getTypeIds())
&& super.equals(that)
&& true;
}
@Override
public int hashCode() {
- return Objects.hash(super.hashCode(), getTimeout(), getItemCount(), getTypeId());
+ return Objects.hash(super.hashCode(), getTimeout(), getTypeIds());
}
@Override
diff --git a/plc4j/drivers/eip/src/main/java/org/apache/plc4x/java/eip/base/protocol/EipProtocolLogic.java b/plc4j/drivers/eip/src/main/java/org/apache/plc4x/java/eip/base/protocol/EipProtocolLogic.java
index 5bab17a7af..2a350c25c4 100644
--- a/plc4j/drivers/eip/src/main/java/org/apache/plc4x/java/eip/base/protocol/EipProtocolLogic.java
+++ b/plc4j/drivers/eip/src/main/java/org/apache/plc4x/java/eip/base/protocol/EipProtocolLogic.java
@@ -175,7 +175,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
.onError((p,e) -> {throw new PlcRuntimeException("List EIP Services failed");})
.handle(p -> {
if (p.getStatus() == CIPStatus.Success.getValue()) {
- ServicesResponse listServicesResponse = (ServicesResponse) ((ListServicesResponse) p).getTypeId().get(0);
+ ServicesResponse listServicesResponse = (ServicesResponse) ((ListServicesResponse) p).getTypeIds().get(0);
if (listServicesResponse.getSupportsCIPEncapsulation()) {
logger.debug("Device is capable of CIP over EIP encapsulation");
}
@@ -199,12 +199,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
instanceSegment)
);
- List<TypeId> typeIds = new ArrayList<TypeId>() {
- {
- add(nullAddressItem);
- add(exchange);
- }
- };
+ List<TypeId> typeIds = Arrays.asList(nullAddressItem, exchange);
CipRRData eipWrapper = new CipRRData(
sessionHandle,
@@ -213,7 +208,6 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
0L,
EMPTY_INTERFACE_HANDLE,
0,
- 2,
typeIds
);
@@ -222,7 +216,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
.check(p -> p instanceof CipRRData)
.handle(p -> {
if (p.getStatus() == CIPStatus.Success.getValue()) {
- UnConnectedDataItem dataItem = (UnConnectedDataItem) ((CipRRData) p).getTypeId().get(1);
+ UnConnectedDataItem dataItem = (UnConnectedDataItem) ((CipRRData) p).getTypeIds().get(1);
GetAttributeAllResponse response = (GetAttributeAllResponse) dataItem.getService();
if ( (long) response.getStatus() != CIPStatus.Success.getValue()) {
throw new PlcRuntimeException("Got status code while polling for supported CIP attributes [" + response.getStatus() + "]");
@@ -321,12 +315,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
this.routingAddress)
);
- List<TypeId> typeIds = new ArrayList<TypeId>() {
- {
- add(nullAddressItem);
- add(exchange);
- }
- };
+ List<TypeId> typeIds = Arrays.asList(nullAddressItem, exchange);
CipRRData eipWrapper = new CipRRData(
sessionHandle,
@@ -335,17 +324,17 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
0L,
EMPTY_INTERFACE_HANDLE,
0,
- 2,
typeIds
);
context.sendRequest(eipWrapper)
- .expectResponse(EipPacket.class, REQUEST_TIMEOUT).unwrap(p -> p)
+ .expectResponse(EipPacket.class, REQUEST_TIMEOUT)
.check(p -> p instanceof CipRRData)
+ .unwrap(p -> (CipRRData) p)
.handle(p -> {
if (p.getStatus() == 0L) {
CipRRData rrData = (CipRRData) p;
- List<TypeId> connectionManagerExchange = rrData.getTypeId();
+ List<TypeId> connectionManagerExchange = rrData.getTypeIds();
CipConnectionManagerResponse connectionManagerResponse = (CipConnectionManagerResponse) ((UnConnectedDataItem) connectionManagerExchange.get(1)).getService();
this.connectionId = connectionManagerResponse.getOtConnectionId();
@@ -380,12 +369,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
this.connectionPathSize,
this.routingAddress));
- List<TypeId> typeIds = new ArrayList<TypeId>() {
- {
- add(nullAddressItem);
- add(exchange);
- }
- };
+ List<TypeId> typeIds = Arrays.asList(nullAddressItem, exchange);
CipRRData eipWrapper = new CipRRData(
sessionHandle,
@@ -394,7 +378,6 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
0L,
EMPTY_INTERFACE_HANDLE,
0,
- 2,
typeIds);
@@ -416,8 +399,8 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
EipDisconnectRequest connectionRequest =
new EipDisconnectRequest(
- 0L,
sessionHandle,
+ 0L,
DEFAULT_SENDER_CONTEXT,
0L);
context.sendRequest(connectionRequest)
@@ -467,7 +450,6 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
0L,
0L,
0,
- 2,
typeIds);
transaction.submit(() -> context.sendRequest(pkt)
@@ -478,7 +460,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
.unwrap(p -> (CipRRData) p)
.check(p -> p.getSessionHandle() == sessionHandle)
.handle(p -> {
- List<TypeId> responseTypeIds = p.getTypeId();
+ List<TypeId> responseTypeIds = p.getTypeIds();
UnConnectedDataItem dataItem = (UnConnectedDataItem) responseTypeIds.get(1);
Map<String, ResponseItem<PlcValue>> readResponse = decodeSingleReadResponse(dataItem.getService(), tagName, eipTag);
values.putAll(readResponse);
@@ -554,7 +536,6 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
0L,
0L,
0,
- 2,
typeIds
);
@@ -566,7 +547,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
.unwrap(p -> (CipRRData) p)
.check(p -> p.getSessionHandle() == sessionHandle)
.handle(p -> {
- List<TypeId> responseTypeIds = p.getTypeId();
+ List<TypeId> responseTypeIds = p.getTypeIds();
UnConnectedDataItem dataItem = (UnConnectedDataItem) responseTypeIds.get(1);
PlcReadResponse readResponse = decodeReadResponse(dataItem.getService(), request);
future.complete(readResponse);
@@ -626,7 +607,6 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
DEFAULT_SENDER_CONTEXT,
0L,
0,
- 2,
typeIds
);
@@ -640,7 +620,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
.unwrap(p -> (SendUnitData) p)
.check(p -> p.getSessionHandle() == sessionHandle)
.handle(p -> {
- List<TypeId> responseTypeIds = p.getTypeId();
+ List<TypeId> responseTypeIds = p.getTypeIds();
ConnectedDataItem dataItem = (ConnectedDataItem) responseTypeIds.get(1);
PlcReadResponse readResponse = decodeReadResponse(dataItem.getService(), request);
future.complete(readResponse);
@@ -678,14 +658,12 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
PathSegment newSegment;
if (qualifier != null) {
- switch (qualifier) {
- case "[":
- newSegment = new LogicalSegment(new MemberID((byte) 0x00, Short.parseShort(identifier)));
- segments.add(newSegment);
- break;
- default:
- newSegment = new DataSegment(new AnsiExtendedSymbolSegment(identifier, (short) 0));
- segments.add(newSegment);
+ if (qualifier.equals("[")) {
+ newSegment = new LogicalSegment(new MemberID((byte) 0x00, Short.parseShort(identifier)));
+ segments.add(newSegment);
+ } else {
+ newSegment = new DataSegment(new AnsiExtendedSymbolSegment(identifier, (short) 0));
+ segments.add(newSegment);
}
} else {
newSegment = new DataSegment(new AnsiExtendedSymbolSegment(identifier,
@@ -896,7 +874,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
String tag = field.getTag();
int elements = Math.max(field.getElementNb(), 1);
- byte[] data = encodeValue(value, field.getType(), (short) elements);
+ byte[] data = encodeValue(value, field.getType());
CipWriteRequest writeReq = null;
try {
writeReq = new CipWriteRequest(toAnsi(tag), field.getType(), elements, data);
@@ -916,12 +894,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
(byte) configuration.getBackplane(),
(byte) configuration.getSlot()));
- List<TypeId> typeIds = new ArrayList<TypeId>() {
- {
- add(nullAddressItem);
- add(exchange);
- }
- };
+ List<TypeId> typeIds = Arrays.asList(nullAddressItem, exchange);
CipRRData rrdata = new CipRRData(
sessionHandle,
@@ -930,7 +903,6 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
0L,
EMPTY_INTERFACE_HANDLE,
0,
- 2,
typeIds);
transaction.submit(() -> context.sendRequest(rrdata)
@@ -940,10 +912,10 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
.check(p -> p instanceof CipRRData).unwrap(p -> (CipRRData) p)
.check(p -> p.getSessionHandle() == sessionHandle)
//.check(p -> p.getSenderContext() == senderContext)
- .check(p -> ((UnConnectedDataItem) p.getTypeId().get(1)).getService() instanceof CipWriteResponse)
- .unwrap(p -> (CipWriteResponse) ((UnConnectedDataItem) p.getTypeId().get(1)).getService())
+ .check(p -> ((UnConnectedDataItem) p.getTypeIds().get(1)).getService() instanceof CipWriteResponse)
+ .unwrap(p -> (CipWriteResponse) ((UnConnectedDataItem) p.getTypeIds().get(1)).getService())
.handle(p -> {
- Map<String, PlcResponseCode> responseItem = decodeSingleWriteResponse(p, fieldName, field);
+ Map<String, PlcResponseCode> responseItem = decodeSingleWriteResponse(p, fieldName);
values.putAll(responseItem);
internalFuture.complete(true);
transaction.endRequest();
@@ -972,7 +944,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
String tag = field.getTag();
int elements = Math.max(field.getElementNb(), 1);
- byte[] data = encodeValue(value, field.getType(), (short) elements);
+ byte[] data = encodeValue(value, field.getType());
try {
CipWriteRequest writeReq = new CipWriteRequest(toAnsi(tag), field.getType(), elements, data);
items.add(writeReq);
@@ -997,12 +969,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
(byte) configuration.getBackplane(),
(byte) configuration.getSlot()));
- List<TypeId> typeIds = new ArrayList<TypeId>() {
- {
- add(nullAddressItem);
- add(exchange);
- }
- };
+ List<TypeId> typeIds = Arrays.asList(nullAddressItem, exchange);
CipRRData rrdata = new CipRRData(
sessionHandle,
@@ -1011,7 +978,6 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
0L,
EMPTY_INTERFACE_HANDLE,
0,
- 2,
typeIds);
transaction.submit(() -> context.sendRequest(rrdata)
@@ -1021,8 +987,8 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
.check(p -> p instanceof CipRRData).unwrap(p -> (CipRRData) p)
.check(p -> p.getSessionHandle() == sessionHandle)
//.check(p -> p.getSenderContext() == senderContext)
- .check(p -> ((UnConnectedDataItem) p.getTypeId().get(1)).getService() instanceof CipWriteResponse)
- .unwrap(p -> (CipWriteResponse) ((UnConnectedDataItem) p.getTypeId().get(1)).getService())
+ .check(p -> ((UnConnectedDataItem) p.getTypeIds().get(1)).getService() instanceof CipWriteResponse)
+ .unwrap(p -> (CipWriteResponse) ((UnConnectedDataItem) p.getTypeIds().get(1)).getService())
.handle(p -> {
future.complete((PlcWriteResponse) decodeWriteResponse(p, writeRequest));
transaction.endRequest();
@@ -1056,12 +1022,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
(byte) configuration.getBackplane(),
(byte) configuration.getSlot()));
- List<TypeId> typeIds = new ArrayList<TypeId>() {
- {
- add(nullAddressItem);
- add(exchange);
- }
- };
+ List<TypeId> typeIds = Arrays.asList(nullAddressItem, exchange);
CipRRData pkt = new CipRRData(
sessionHandle,
@@ -1070,7 +1031,6 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
0L,
EMPTY_INTERFACE_HANDLE,
0,
- 2,
typeIds);
transaction.submit(() -> context.sendRequest(pkt)
@@ -1081,7 +1041,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
.check(p -> p.getSessionHandle() == sessionHandle)
//.check(p -> p.getSenderContext() == senderContext)
.unwrap(p -> (CipRRData) p)
- .unwrap(p -> ((UnConnectedDataItem) p.getTypeId().get(1)).getService()).check(p -> p instanceof MultipleServiceResponse)
+ .unwrap(p -> ((UnConnectedDataItem) p.getTypeIds().get(1)).getService()).check(p -> p instanceof MultipleServiceResponse)
.unwrap(p -> (MultipleServiceResponse) p)
.check(p -> p.getServiceNb() == nb)
.handle(p -> {
@@ -1103,7 +1063,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
String tag = field.getTag();
int elements = Math.max(field.getElementNb(), 1);
- byte[] data = encodeValue(value, field.getType(), (short) elements);
+ byte[] data = encodeValue(value, field.getType());
try {
CipWriteRequest writeReq = new CipWriteRequest(toAnsi(tag), field.getType(), elements, data);
items.add(writeReq);
@@ -1123,12 +1083,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
ConnectedAddressItem addressItem = new ConnectedAddressItem(this.connectionId);
- List<TypeId> typeIds = new ArrayList<TypeId>() {
- {
- add(addressItem);
- add(exchange);
- }
- };
+ List<TypeId> typeIds = Arrays.asList(addressItem, exchange);
SendUnitData rrdata = new SendUnitData(
sessionHandle,
@@ -1136,7 +1091,6 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
senderContext,
0L,
0,
- 2,
typeIds);
transaction.submit(() -> context.sendRequest(rrdata)
@@ -1145,8 +1099,8 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
.onError((p, e) -> future.completeExceptionally(e))
.check(p -> p instanceof SendUnitData).unwrap(p -> (SendUnitData) p)
.check(p -> p.getSessionHandle() == sessionHandle)
- .check(p -> ((ConnectedDataItem) p.getTypeId().get(1)).getService() instanceof CipWriteResponse)
- .unwrap(p -> (CipWriteResponse) ((ConnectedDataItem) p.getTypeId().get(1)).getService())
+ .check(p -> ((ConnectedDataItem) p.getTypeIds().get(1)).getService() instanceof CipWriteResponse)
+ .unwrap(p -> (CipWriteResponse) ((ConnectedDataItem) p.getTypeIds().get(1)).getService())
.handle(p -> {
future.complete((PlcWriteResponse) decodeWriteResponse(p, writeRequest));
transaction.endRequest();
@@ -1173,12 +1127,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
this.sequenceCount,
new MultipleServiceRequest(data));
- List<TypeId> typeIds = new ArrayList<TypeId>() {
- {
- add(nullAddressItem);
- add(exchange);
- }
- };
+ List<TypeId> typeIds = Arrays.asList(nullAddressItem, exchange);
SendUnitData pkt = new SendUnitData(
sessionHandle,
@@ -1186,7 +1135,6 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
DEFAULT_SENDER_CONTEXT,
0L,
0,
- 2,
typeIds);
transaction.submit(() -> context.sendRequest(pkt)
@@ -1197,7 +1145,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
.check(p -> p.getSessionHandle() == sessionHandle)
//.check(p -> p.getSenderContext() == senderContext)
.unwrap(p -> (SendUnitData) p)
- .unwrap(p -> ((ConnectedDataItem) p.getTypeId().get(1)).getService()).check(p -> p instanceof MultipleServiceResponse)
+ .unwrap(p -> ((ConnectedDataItem) p.getTypeIds().get(1)).getService()).check(p -> p instanceof MultipleServiceResponse)
.unwrap(p -> (MultipleServiceResponse) p)
.check(p -> p.getServiceNb() == nb)
.handle(p -> {
@@ -1222,7 +1170,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
return future;
}
- private Map<String, PlcResponseCode> decodeSingleWriteResponse(CipWriteResponse resp, String fieldName, PlcTag field) {
+ private Map<String, PlcResponseCode> decodeSingleWriteResponse(CipWriteResponse resp, String fieldName) {
Map<String, PlcResponseCode> responses = new HashMap<>();
responses.put(fieldName, decodeResponseCode(resp.getStatus()));
return responses;
@@ -1273,7 +1221,7 @@ public class EipProtocolLogic extends Plc4xProtocolBase<EipPacket> implements Ha
return null;
}
- private byte[] encodeValue(PlcValue value, CIPDataTypeCode type, short elements) {
+ private byte[] encodeValue(PlcValue value, CIPDataTypeCode type) {
//ByteBuffer buffer = ByteBuffer.allocate(4+type.getSize()).order(ByteOrder.LITTLE_ENDIAN);
ByteBuffer buffer = ByteBuffer.allocate(type.getSize()).order(ByteOrder.LITTLE_ENDIAN);
switch (type) {
diff --git a/protocols/eip/src/main/resources/protocols/eip/eip.mspec b/protocols/eip/src/main/resources/protocols/eip/eip.mspec
index b6ff9bb40f..03ff51373e 100644
--- a/protocols/eip/src/main/resources/protocols/eip/eip.mspec
+++ b/protocols/eip/src/main/resources/protocols/eip/eip.mspec
@@ -38,32 +38,32 @@
['0x0004','true','0' NullListServicesResponse
]
['0x0004','true' ListServicesResponse
- [simple uint 16 itemCount ]
- [array TypeId typeId count 'itemCount' ]
+ [implicit uint 16 typeIdCount 'COUNT(typeIds)' ]
+ [array TypeId typeIds count 'typeIdCount' ]
]
['0x0065','false' EipConnectionRequest
- [const uint 16 protocolVersion 0x01 ]
- [const uint 16 flags 0x00 ]
+ [const uint 16 protocolVersion 0x01 ]
+ [const uint 16 flags 0x00 ]
]
['0x0065','true','0' NullEipConnectionResponse
]
['0x0065','true' EipConnectionResponse
- [const uint 16 protocolVersion 0x01 ]
- [const uint 16 flags 0x00 ]
+ [const uint 16 protocolVersion 0x01 ]
+ [const uint 16 flags 0x00 ]
]
['0x0066' EipDisconnectRequest
]
['0x006F' CipRRData
- [simple uint 32 interfaceHandle ]
- [simple uint 16 timeout ]
- [simple uint 16 itemCount ]
- [array TypeId typeId count 'itemCount' ]
+ [simple uint 32 interfaceHandle ]
+ [simple uint 16 timeout ]
+ [implicit uint 16 typeIdCount 'COUNT(typeIds)' ]
+ [array TypeId typeIds count 'typeIdCount' ]
]
['0x0070' SendUnitData
- [const uint 32 interfaceHandle 0x00000000 ]
- [simple uint 16 timeout ]
- [simple uint 16 itemCount ]
- [array TypeId typeId count 'itemCount' ]
+ [const uint 32 interfaceHandle 0x00000000 ]
+ [simple uint 16 timeout ]
+ [implicit uint 16 typeIdCount 'COUNT(typeIds)' ]
+ [array TypeId typeIds count 'typeIdCount' ]
]
]
]
@@ -123,7 +123,7 @@
[reserved uint 8 '0x00' ]
[simple uint 8 status ]
[simple uint 8 extStatus ]
- [optional CIPData('serviceLen - 4') data '(serviceLen -4) > 0' ]
+ [optional CIPData('serviceLen - 4') data '(serviceLen - 4) > 0' ]
]
['0x4D','false' CipWriteRequest
[implicit uint 8 requestPathSize 'COUNT(tag) / 2' ]
@@ -259,7 +259,7 @@
['true' PortSegmentExtended
[simple uint 4 port]
[simple uint 8 linkAddressSize]
- [virtual uint 8 paddingByte 'linkAddressSize % 2'
+ [virtual uint 8 paddingByte 'linkAddressSize % 2']
[simple vstring '(linkAddressSize * 8) + (paddingByte * 8)' address]
]
]
@@ -295,16 +295,16 @@
]
[type CIPAttributes(uint 16 packetLength)
- [implicit uint 16 numberOfClasses 'COUNT(classId)']
- [array uint 16 classId count 'numberOfClasses']
- [simple uint 16 numberAvailable]
- [simple uint 16 numberActive]
- [array byte data count 'packetLength - 2 - (COUNT(classId) * 2) - 4'
+ [implicit uint 16 numberOfClasses 'COUNT(classId)']
+ [array uint 16 classId count 'numberOfClasses']
+ [simple uint 16 numberAvailable]
+ [simple uint 16 numberActive]
+ [array byte data count 'packetLength - 2 - (COUNT(classId) * 2) - 4']
]
[type CIPData(uint 16 packetLength)
[simple CIPDataTypeCode dataType]
- [array byte data count 'packetLength - 2']
+ [array byte data count 'packetLength - 2']
]
[type CIPDataConnected
@@ -313,10 +313,10 @@
]
[type InstanceSegment
- [simple uint 3 pathSegmentType]
- [simple uint 3 logicalSegmentType]
- [simple uint 2 logicalSegmentFormat]
- [simple uint 8 instance]
+ [simple uint 3 pathSegmentType]
+ [simple uint 3 logicalSegmentType]
+ [simple uint 2 logicalSegmentFormat]
+ [simple uint 8 instance]
]
[type ClassSegment
diff --git a/protocols/eip/src/test/resources/protocols/eip/DriverTestsuite.xml b/protocols/eip/src/test/resources/protocols/eip/DriverTestsuite.xml
index 14f91f78ec..d8e9f8b3c6 100644
--- a/protocols/eip/src/test/resources/protocols/eip/DriverTestsuite.xml
+++ b/protocols/eip/src/test/resources/protocols/eip/DriverTestsuite.xml
@@ -66,8 +66,8 @@
<senderContext dataType="byte" bitLength="64">0x504c433458202020</senderContext>
<options dataType="uint" bitLength="32">0</options>
<ListServicesResponse>
- <itemCount dataType="uint" bitLength="16">1</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">1</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">256</id>
<ServicesResponse>
@@ -80,7 +80,7 @@
<data dataType="byte" bitLength="120">0x436f6d6d756e69636174696f6e7300</data>
</ServicesResponse>
</TypeId>
- </typeId>
+ </typeIds>
</ListServicesResponse>
</EipPacket>
</incoming-plc-message>
@@ -133,8 +133,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -188,7 +188,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</outgoing-plc-message>
@@ -206,8 +206,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -231,7 +231,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</incoming-plc-message>
@@ -264,8 +264,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -335,7 +335,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</outgoing-plc-message>
@@ -353,8 +353,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -386,7 +386,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</incoming-plc-message>
diff --git a/protocols/eip/src/test/resources/protocols/eip/ParserSerializerTestsuiteBigEndian.xml b/protocols/eip/src/test/resources/protocols/eip/ParserSerializerTestsuiteBigEndian.xml
index ba19304a51..ccb07dd278 100644
--- a/protocols/eip/src/test/resources/protocols/eip/ParserSerializerTestsuiteBigEndian.xml
+++ b/protocols/eip/src/test/resources/protocols/eip/ParserSerializerTestsuiteBigEndian.xml
@@ -68,8 +68,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -139,7 +139,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -163,8 +163,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -196,7 +196,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -222,8 +222,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -297,7 +297,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -321,8 +321,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -346,7 +346,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
diff --git a/protocols/eip/src/test/resources/protocols/eip/ParserSerializerTestsuiteLittleEndian.xml b/protocols/eip/src/test/resources/protocols/eip/ParserSerializerTestsuiteLittleEndian.xml
index baa9ecdfa4..de96f703ad 100644
--- a/protocols/eip/src/test/resources/protocols/eip/ParserSerializerTestsuiteLittleEndian.xml
+++ b/protocols/eip/src/test/resources/protocols/eip/ParserSerializerTestsuiteLittleEndian.xml
@@ -43,8 +43,8 @@
<SendUnitData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">161</id>
<ConnectedAddressItem>
@@ -71,7 +71,7 @@
</service>
</ConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</SendUnitData>
</EipPacket>
</xml>
@@ -95,8 +95,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -238,7 +238,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -262,8 +262,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -294,7 +294,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -318,8 +318,8 @@
<SendUnitData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">161</id>
<ConnectedAddressItem>
@@ -346,7 +346,7 @@
</service>
</ConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</SendUnitData>
</EipPacket>
</xml>
@@ -370,8 +370,8 @@
<SendUnitData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">161</id>
<ConnectedAddressItem>
@@ -403,7 +403,7 @@
</service>
</ConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</SendUnitData>
</EipPacket>
</xml>
@@ -427,8 +427,8 @@
<SendUnitData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">161</id>
<ConnectedAddressItem>
@@ -458,7 +458,7 @@
</service>
</ConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</SendUnitData>
</EipPacket>
</xml>
@@ -482,8 +482,8 @@
<SendUnitData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">161</id>
<ConnectedAddressItem>
@@ -513,7 +513,7 @@
</service>
</ConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</SendUnitData>
</EipPacket>
</xml>
@@ -537,8 +537,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -644,7 +644,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -668,8 +668,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -698,7 +698,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -789,8 +789,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -860,7 +860,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -884,8 +884,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -917,7 +917,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -964,8 +964,8 @@
<SendUnitData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">161</id>
<ConnectedAddressItem>
@@ -999,7 +999,7 @@
</service>
</ConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</SendUnitData>
</EipPacket>
</xml>
@@ -1042,8 +1042,8 @@
<senderContext dataType="byte" bitLength="64">0x0000000000000000</senderContext>
<options dataType="uint" bitLength="32">0</options>
<ListServicesResponse>
- <itemCount dataType="uint" bitLength="16">1</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">1</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">256</id>
<ServicesResponse>
@@ -1056,7 +1056,7 @@
<data dataType="byte" bitLength="120">0x436f6d6d756e69636174696f6e7300</data>
</ServicesResponse>
</TypeId>
- </typeId>
+ </typeIds>
</ListServicesResponse>
</EipPacket>
</xml>
@@ -1078,8 +1078,8 @@
<senderContext dataType="byte" bitLength="64">0x504c433458202020</senderContext>
<options dataType="uint" bitLength="32">0</options>
<ListServicesResponse>
- <itemCount dataType="uint" bitLength="16">1</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">1</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">256</id>
<ServicesResponse>
@@ -1092,7 +1092,7 @@
<data dataType="byte" bitLength="120">0x436f6d6d756e69636174696f6e7300</data>
</ServicesResponse>
</TypeId>
- </typeId>
+ </typeIds>
</ListServicesResponse>
</EipPacket>
</xml>
@@ -1116,8 +1116,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">32</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -1171,7 +1171,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -1195,8 +1195,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -1308,7 +1308,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -1332,8 +1332,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -1367,7 +1367,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -1392,8 +1392,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -1417,7 +1417,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>
@@ -1441,8 +1441,8 @@
<CipRRData>
<interfaceHandle dataType="uint" bitLength="32">0</interfaceHandle>
<timeout dataType="uint" bitLength="16">0</timeout>
- <itemCount dataType="uint" bitLength="16">2</itemCount>
- <typeId isList="true">
+ <typeIdCount dataType="uint" bitLength="16">2</typeIdCount>
+ <typeIds isList="true">
<TypeId>
<id dataType="uint" bitLength="16">0</id>
<NullAddressItem>
@@ -1466,7 +1466,7 @@
</service>
</UnConnectedDataItem>
</TypeId>
- </typeId>
+ </typeIds>
</CipRRData>
</EipPacket>
</xml>