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/01/15 12:54:38 UTC

[plc4x] 01/03: feat(ams): Made it possible to decode error responses

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch feature/cdutz/connection-cache-and-scraper-ng
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 3681ea988ae5206b9b977afda94a82409d2cb0eb
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Sat Jan 14 16:17:38 2023 +0100

    feat(ams): Made it possible to decode error responses
---
 plc4go/protocols/ads/readwrite/model/AmsPacket.go  | 44 ++++++++-------
 .../apache/plc4x/java/ads/readwrite/AmsPacket.java | 65 +++++++++++++++-------
 .../ads/src/main/resources/protocols/ads/ads.mspec | 45 ++++++++-------
 3 files changed, 92 insertions(+), 62 deletions(-)

diff --git a/plc4go/protocols/ads/readwrite/model/AmsPacket.go b/plc4go/protocols/ads/readwrite/model/AmsPacket.go
index cf0ae2073b..1e794fa7dc 100644
--- a/plc4go/protocols/ads/readwrite/model/AmsPacket.go
+++ b/plc4go/protocols/ads/readwrite/model/AmsPacket.go
@@ -450,48 +450,50 @@ func AmsPacketParseWithBuffer(readBuffer utils.ReadBuffer) (AmsPacket, error) {
 	var _child AmsPacketChildSerializeRequirement
 	var typeSwitchError error
 	switch {
-	case commandId == CommandId_INVALID && response == bool(false): // AdsInvalidRequest
+	case errorCode == 0x00000000 && commandId == CommandId_INVALID && response == bool(false): // AdsInvalidRequest
 		_childTemp, typeSwitchError = AdsInvalidRequestParseWithBuffer(readBuffer)
-	case commandId == CommandId_INVALID && response == bool(true): // AdsInvalidResponse
+	case errorCode == 0x00000000 && commandId == CommandId_INVALID && response == bool(true): // AdsInvalidResponse
 		_childTemp, typeSwitchError = AdsInvalidResponseParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_READ_DEVICE_INFO && response == bool(false): // AdsReadDeviceInfoRequest
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_READ_DEVICE_INFO && response == bool(false): // AdsReadDeviceInfoRequest
 		_childTemp, typeSwitchError = AdsReadDeviceInfoRequestParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_READ_DEVICE_INFO && response == bool(true): // AdsReadDeviceInfoResponse
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_READ_DEVICE_INFO && response == bool(true): // AdsReadDeviceInfoResponse
 		_childTemp, typeSwitchError = AdsReadDeviceInfoResponseParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_READ && response == bool(false): // AdsReadRequest
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_READ && response == bool(false): // AdsReadRequest
 		_childTemp, typeSwitchError = AdsReadRequestParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_READ && response == bool(true): // AdsReadResponse
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_READ && response == bool(true): // AdsReadResponse
 		_childTemp, typeSwitchError = AdsReadResponseParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_WRITE && response == bool(false): // AdsWriteRequest
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_WRITE && response == bool(false): // AdsWriteRequest
 		_childTemp, typeSwitchError = AdsWriteRequestParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_WRITE && response == bool(true): // AdsWriteResponse
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_WRITE && response == bool(true): // AdsWriteResponse
 		_childTemp, typeSwitchError = AdsWriteResponseParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_READ_STATE && response == bool(false): // AdsReadStateRequest
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_READ_STATE && response == bool(false): // AdsReadStateRequest
 		_childTemp, typeSwitchError = AdsReadStateRequestParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_READ_STATE && response == bool(true): // AdsReadStateResponse
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_READ_STATE && response == bool(true): // AdsReadStateResponse
 		_childTemp, typeSwitchError = AdsReadStateResponseParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_WRITE_CONTROL && response == bool(false): // AdsWriteControlRequest
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_WRITE_CONTROL && response == bool(false): // AdsWriteControlRequest
 		_childTemp, typeSwitchError = AdsWriteControlRequestParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_WRITE_CONTROL && response == bool(true): // AdsWriteControlResponse
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_WRITE_CONTROL && response == bool(true): // AdsWriteControlResponse
 		_childTemp, typeSwitchError = AdsWriteControlResponseParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_ADD_DEVICE_NOTIFICATION && response == bool(false): // AdsAddDeviceNotificationRequest
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_ADD_DEVICE_NOTIFICATION && response == bool(false): // AdsAddDeviceNotificationRequest
 		_childTemp, typeSwitchError = AdsAddDeviceNotificationRequestParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_ADD_DEVICE_NOTIFICATION && response == bool(true): // AdsAddDeviceNotificationResponse
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_ADD_DEVICE_NOTIFICATION && response == bool(true): // AdsAddDeviceNotificationResponse
 		_childTemp, typeSwitchError = AdsAddDeviceNotificationResponseParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_DELETE_DEVICE_NOTIFICATION && response == bool(false): // AdsDeleteDeviceNotificationRequest
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_DELETE_DEVICE_NOTIFICATION && response == bool(false): // AdsDeleteDeviceNotificationRequest
 		_childTemp, typeSwitchError = AdsDeleteDeviceNotificationRequestParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_DELETE_DEVICE_NOTIFICATION && response == bool(true): // AdsDeleteDeviceNotificationResponse
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_DELETE_DEVICE_NOTIFICATION && response == bool(true): // AdsDeleteDeviceNotificationResponse
 		_childTemp, typeSwitchError = AdsDeleteDeviceNotificationResponseParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_DEVICE_NOTIFICATION && response == bool(false): // AdsDeviceNotificationRequest
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_DEVICE_NOTIFICATION && response == bool(false): // AdsDeviceNotificationRequest
 		_childTemp, typeSwitchError = AdsDeviceNotificationRequestParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_DEVICE_NOTIFICATION && response == bool(true): // AdsDeviceNotificationResponse
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_DEVICE_NOTIFICATION && response == bool(true): // AdsDeviceNotificationResponse
 		_childTemp, typeSwitchError = AdsDeviceNotificationResponseParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_READ_WRITE && response == bool(false): // AdsReadWriteRequest
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_READ_WRITE && response == bool(false): // AdsReadWriteRequest
 		_childTemp, typeSwitchError = AdsReadWriteRequestParseWithBuffer(readBuffer)
-	case commandId == CommandId_ADS_READ_WRITE && response == bool(true): // AdsReadWriteResponse
+	case errorCode == 0x00000000 && commandId == CommandId_ADS_READ_WRITE && response == bool(true): // AdsReadWriteResponse
 		_childTemp, typeSwitchError = AdsReadWriteResponseParseWithBuffer(readBuffer)
+	case true: // ErrorResponse
+		_childTemp, typeSwitchError = ErrorResponseParseWithBuffer(readBuffer)
 	default:
-		typeSwitchError = errors.Errorf("Unmapped type for parameters [commandId=%v, response=%v]", commandId, response)
+		typeSwitchError = errors.Errorf("Unmapped type for parameters [errorCode=%v, commandId=%v, response=%v]", errorCode, commandId, response)
 	}
 	if typeSwitchError != nil {
 		return nil, errors.Wrap(typeSwitchError, "Error parsing sub-type for type-switch of AmsPacket")
diff --git a/plc4j/drivers/ads/src/main/generated/org/apache/plc4x/java/ads/readwrite/AmsPacket.java b/plc4j/drivers/ads/src/main/generated/org/apache/plc4x/java/ads/readwrite/AmsPacket.java
index 6547947b91..520d01ff4d 100644
--- a/plc4j/drivers/ads/src/main/generated/org/apache/plc4x/java/ads/readwrite/AmsPacket.java
+++ b/plc4j/drivers/ads/src/main/generated/org/apache/plc4x/java/ads/readwrite/AmsPacket.java
@@ -346,71 +346,96 @@ public abstract class AmsPacket implements Message {
 
     // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
     AmsPacketBuilder builder = null;
-    if (EvaluationHelper.equals(commandId, CommandId.INVALID)
+    if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.INVALID)
         && EvaluationHelper.equals(response, (boolean) false)) {
       builder = AdsInvalidRequest.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.INVALID)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.INVALID)
         && EvaluationHelper.equals(response, (boolean) true)) {
       builder = AdsInvalidResponse.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_READ_DEVICE_INFO)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_READ_DEVICE_INFO)
         && EvaluationHelper.equals(response, (boolean) false)) {
       builder = AdsReadDeviceInfoRequest.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_READ_DEVICE_INFO)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_READ_DEVICE_INFO)
         && EvaluationHelper.equals(response, (boolean) true)) {
       builder = AdsReadDeviceInfoResponse.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_READ)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_READ)
         && EvaluationHelper.equals(response, (boolean) false)) {
       builder = AdsReadRequest.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_READ)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_READ)
         && EvaluationHelper.equals(response, (boolean) true)) {
       builder = AdsReadResponse.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_WRITE)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_WRITE)
         && EvaluationHelper.equals(response, (boolean) false)) {
       builder = AdsWriteRequest.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_WRITE)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_WRITE)
         && EvaluationHelper.equals(response, (boolean) true)) {
       builder = AdsWriteResponse.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_READ_STATE)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_READ_STATE)
         && EvaluationHelper.equals(response, (boolean) false)) {
       builder = AdsReadStateRequest.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_READ_STATE)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_READ_STATE)
         && EvaluationHelper.equals(response, (boolean) true)) {
       builder = AdsReadStateResponse.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_WRITE_CONTROL)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_WRITE_CONTROL)
         && EvaluationHelper.equals(response, (boolean) false)) {
       builder = AdsWriteControlRequest.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_WRITE_CONTROL)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_WRITE_CONTROL)
         && EvaluationHelper.equals(response, (boolean) true)) {
       builder = AdsWriteControlResponse.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_ADD_DEVICE_NOTIFICATION)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_ADD_DEVICE_NOTIFICATION)
         && EvaluationHelper.equals(response, (boolean) false)) {
       builder = AdsAddDeviceNotificationRequest.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_ADD_DEVICE_NOTIFICATION)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_ADD_DEVICE_NOTIFICATION)
         && EvaluationHelper.equals(response, (boolean) true)) {
       builder = AdsAddDeviceNotificationResponse.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_DELETE_DEVICE_NOTIFICATION)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_DELETE_DEVICE_NOTIFICATION)
         && EvaluationHelper.equals(response, (boolean) false)) {
       builder = AdsDeleteDeviceNotificationRequest.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_DELETE_DEVICE_NOTIFICATION)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_DELETE_DEVICE_NOTIFICATION)
         && EvaluationHelper.equals(response, (boolean) true)) {
       builder = AdsDeleteDeviceNotificationResponse.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_DEVICE_NOTIFICATION)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_DEVICE_NOTIFICATION)
         && EvaluationHelper.equals(response, (boolean) false)) {
       builder = AdsDeviceNotificationRequest.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_DEVICE_NOTIFICATION)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_DEVICE_NOTIFICATION)
         && EvaluationHelper.equals(response, (boolean) true)) {
       builder = AdsDeviceNotificationResponse.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_READ_WRITE)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_READ_WRITE)
         && EvaluationHelper.equals(response, (boolean) false)) {
       builder = AdsReadWriteRequest.staticParseBuilder(readBuffer);
-    } else if (EvaluationHelper.equals(commandId, CommandId.ADS_READ_WRITE)
+    } else if (EvaluationHelper.equals(errorCode, (long) 0x00000000L)
+        && EvaluationHelper.equals(commandId, CommandId.ADS_READ_WRITE)
         && EvaluationHelper.equals(response, (boolean) true)) {
       builder = AdsReadWriteResponse.staticParseBuilder(readBuffer);
+    } else {
+      builder = ErrorResponse.staticParseBuilder(readBuffer);
     }
     if (builder == null) {
       throw new ParseException(
           "Unsupported case for discriminated type"
               + " parameters ["
+              + "errorCode="
+              + errorCode
+              + " "
               + "commandId="
               + commandId
               + " "
diff --git a/protocols/ads/src/main/resources/protocols/ads/ads.mspec b/protocols/ads/src/main/resources/protocols/ads/ads.mspec
index ffead9cd7d..a7e5a3b699 100644
--- a/protocols/ads/src/main/resources/protocols/ads/ads.mspec
+++ b/protocols/ads/src/main/resources/protocols/ads/ads.mspec
@@ -146,12 +146,13 @@
     // 4 bytes	Free usable 32 bit array. Usually this array serves to send an Id. This Id makes is possible to assign a received response to a request, which was sent before.
     [simple        uint        32  invokeId                                  ]
     // The payload
-    [typeSwitch commandId, response
-        ['INVALID', 'false' AdsInvalidRequest]
-        ['INVALID', 'true' AdsInvalidResponse]
+    // TODO: In case of an error code that is not 0, we might not have a payload at all
+    [typeSwitch errorCode, commandId, response
+        ['0x00000000', 'INVALID', 'false' AdsInvalidRequest]
+        ['0x00000000', 'INVALID', 'true' AdsInvalidResponse]
 
-        ['ADS_READ_DEVICE_INFO', 'false' AdsReadDeviceInfoRequest]
-        ['ADS_READ_DEVICE_INFO', 'true' AdsReadDeviceInfoResponse
+        ['0x00000000', 'ADS_READ_DEVICE_INFO', 'false' AdsReadDeviceInfoRequest]
+        ['0x00000000', 'ADS_READ_DEVICE_INFO', 'true' AdsReadDeviceInfoResponse
             // 4 bytes	ADS error number.
             [simple ReturnCode result]
             // Version	1 byte	Major version number
@@ -164,7 +165,7 @@
             [array byte  device count '16']
         ]
 
-        ['ADS_READ', 'false' AdsReadRequest
+        ['0x00000000', 'ADS_READ', 'false' AdsReadRequest
             // 4 bytes	Index Group of the data which should be read.
             [simple uint 32 indexGroup]
             // 4 bytes	Index Offset of the data which should be read.
@@ -172,7 +173,7 @@
             // 4 bytes	Length of the data (in bytes) which should be read.
             [simple uint 32 length]
         ]
-        ['ADS_READ', 'true' AdsReadResponse
+        ['0x00000000', 'ADS_READ', 'true' AdsReadResponse
             // 4 bytes	ADS error number
             [simple ReturnCode result]
             // 4 bytes	Length of data which are supplied back.
@@ -181,7 +182,7 @@
             [array byte data count 'length']
         ]
 
-        ['ADS_WRITE', 'false' AdsWriteRequest
+        ['0x00000000', 'ADS_WRITE', 'false' AdsWriteRequest
             // 4 bytes	Index Group of the data which should be written.
             [simple uint 32 indexGroup]
             // 4 bytes	Index Offset of the data which should be written.
@@ -191,13 +192,13 @@
             // n bytes	Data which are written in the ADS device.
             [array byte data count 'length']
         ]
-        ['ADS_WRITE', 'true' AdsWriteResponse
+        ['0x00000000', 'ADS_WRITE', 'true' AdsWriteResponse
             // 4 bytes	ADS error number
             [simple ReturnCode result]
         ]
 
-        ['ADS_READ_STATE', 'false' AdsReadStateRequest]
-        ['ADS_READ_STATE', 'true' AdsReadStateResponse
+        ['0x00000000', 'ADS_READ_STATE', 'false' AdsReadStateRequest]
+        ['0x00000000', 'ADS_READ_STATE', 'true' AdsReadStateResponse
             // 4 bytes	ADS error number
             [simple ReturnCode result]
             // 2 bytes	New ADS status (see data type ADSSTATE of the ADS-DLL).
@@ -206,7 +207,7 @@
             [simple uint 16 deviceState]
         ]
 
-        ['ADS_WRITE_CONTROL', 'false' AdsWriteControlRequest
+        ['0x00000000', 'ADS_WRITE_CONTROL', 'false' AdsWriteControlRequest
             // 2 bytes	New ADS status (see data type ADSSTATE of the ADS-DLL).
             [simple uint 16 adsState]
             // 2 bytes	New device status.
@@ -216,12 +217,12 @@
             // n bytes	Additional data which are sent to the ADS device
             [array byte data count 'length']
         ]
-        ['ADS_WRITE_CONTROL', 'true' AdsWriteControlResponse
+        ['0x00000000', 'ADS_WRITE_CONTROL', 'true' AdsWriteControlResponse
             // 4 bytes	ADS error number
             [simple ReturnCode result]
         ]
 
-        ['ADS_ADD_DEVICE_NOTIFICATION', 'false' AdsAddDeviceNotificationRequest
+        ['0x00000000', 'ADS_ADD_DEVICE_NOTIFICATION', 'false' AdsAddDeviceNotificationRequest
             // 4 bytes	Index Group of the data, which should be sent per notification.
             [simple     uint 32      indexGroup      ]
             // 4 bytes	Index Offset of the data, which should be sent per notification.
@@ -239,23 +240,23 @@
             [reserved   uint 64      '0x0000'        ]
             [reserved   uint 64      '0x0000'        ]
         ]
-        ['ADS_ADD_DEVICE_NOTIFICATION', 'true' AdsAddDeviceNotificationResponse
+        ['0x00000000', 'ADS_ADD_DEVICE_NOTIFICATION', 'true' AdsAddDeviceNotificationResponse
             // 4 bytes	ADS error number
             [simple ReturnCode result]
             // 4 bytes	Handle of notification
             [simple uint 32 notificationHandle]
         ]
 
-        ['ADS_DELETE_DEVICE_NOTIFICATION', 'false' AdsDeleteDeviceNotificationRequest
+        ['0x00000000', 'ADS_DELETE_DEVICE_NOTIFICATION', 'false' AdsDeleteDeviceNotificationRequest
             // 4 bytes	Handle of notification
             [simple uint 32 notificationHandle]
         ]
-        ['ADS_DELETE_DEVICE_NOTIFICATION', 'true' AdsDeleteDeviceNotificationResponse
+        ['0x00000000', 'ADS_DELETE_DEVICE_NOTIFICATION', 'true' AdsDeleteDeviceNotificationResponse
             // 4 bytes	ADS error number
             [simple ReturnCode result]
         ]
 
-        ['ADS_DEVICE_NOTIFICATION', 'false' AdsDeviceNotificationRequest
+        ['0x00000000', 'ADS_DEVICE_NOTIFICATION', 'false' AdsDeviceNotificationRequest
             // 4 bytes	Size of data in byte.
             [simple uint 32 length]
             // 4 bytes	Number of elements of type AdsStampHeader.
@@ -263,9 +264,9 @@
             // n bytes	Array with elements of type AdsStampHeader.
             [array AdsStampHeader adsStampHeaders count 'stamps']
         ]
-        ['ADS_DEVICE_NOTIFICATION', 'true' AdsDeviceNotificationResponse]
+        ['0x00000000', 'ADS_DEVICE_NOTIFICATION', 'true' AdsDeviceNotificationResponse]
 
-        ['ADS_READ_WRITE', 'false' AdsReadWriteRequest
+        ['0x00000000', 'ADS_READ_WRITE', 'false' AdsReadWriteRequest
             // 4 bytes	Index Group of the data which should be written.
             [simple uint 32 indexGroup]
             // 4 bytes	Index Offset of the data which should be written.
@@ -279,7 +280,7 @@
             // n bytes	Data which are written in the ADS device.
             [array byte data count 'writeLength - (COUNT(items) * 12)']
         ]
-        ['ADS_READ_WRITE', 'true' AdsReadWriteResponse
+        ['0x00000000', 'ADS_READ_WRITE', 'true' AdsReadWriteResponse
             // 4 bytes	ADS error number
             [simple ReturnCode result]
             // 4 bytes	Length of data in byte.
@@ -287,6 +288,8 @@
             // n bytes Additional data which are sent to the ADS device
             [array byte data count 'length']
         ]
+        [ErrorResponse
+        ]
     ]
 ]