You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/08/08 09:10:44 UTC

[plc4x] branch develop updated (93692fb6e -> d3f713283)

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

sruehl pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


    from 93692fb6e small updates in driver documentation
     new 35c2e2694 fix(spi): WriteBufferBoxBased should not switch out writer for sub
     new 362680547 refactor(cbus): add virtual fields for hex encoded fields
     new d3f713283 refactor(cbus): followup on improved message output

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 plc4go/internal/cbus/MessageCodec.go               |   1 -
 plc4go/internal/spi/utils/WriteBufferBoxBased.go   |   1 -
 .../cbus/readwrite/model/ParameterChangeReply.go   |  56 ++---
 .../protocols/cbus/readwrite/model/PowerUpReply.go |  56 ++---
 .../cbus/readwrite/model/ReplyEncodedReply.go      |  43 ++++
 .../cbus/readwrite/model/RequestCommand.go         |  47 ++++
 .../readwrite/model/RequestDirectCommandAccess.go  |  26 ++
 .../cbus/readwrite/model/RequestObsolete.go        |  28 +++
 .../internal/analyzer/analyzer.go                  |   1 -
 .../internal/cbusanalyzer/analyzer.go              |  52 ----
 .../apache/plc4x/java/cbus/RandomPackagesTest.java |  77 +-----
 .../org/apache/plc4x/java/cbus/ReferenceTest.java  | 273 +++++++++++++--------
 .../java/spi/generation/WriteBufferBoxBased.java   |   2 +-
 .../src/main/resources/protocols/cbus/c-bus.mspec  |  22 +-
 14 files changed, 395 insertions(+), 290 deletions(-)


[plc4x] 03/03: refactor(cbus): followup on improved message output

Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit d3f71328325b5500262f87c1ffe1245363107fbc
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Aug 8 11:10:34 2022 +0200

    refactor(cbus): followup on improved message output
---
 plc4go/internal/cbus/MessageCodec.go               |   1 -
 .../internal/analyzer/analyzer.go                  |   1 -
 .../internal/cbusanalyzer/analyzer.go              |  52 ----
 .../apache/plc4x/java/cbus/RandomPackagesTest.java |  77 +-----
 .../org/apache/plc4x/java/cbus/ReferenceTest.java  | 273 +++++++++++++--------
 5 files changed, 177 insertions(+), 227 deletions(-)

diff --git a/plc4go/internal/cbus/MessageCodec.go b/plc4go/internal/cbus/MessageCodec.go
index b61c093c4..bd9738a29 100644
--- a/plc4go/internal/cbus/MessageCodec.go
+++ b/plc4go/internal/cbus/MessageCodec.go
@@ -192,7 +192,6 @@ lookingForTheEnd:
 	rb := utils.NewReadBufferByteBased(read)
 	cBusMessage, err := readwriteModel.CBusMessageParse(rb, pciResponse, m.requestContext, m.cbusOptions)
 	if err != nil {
-		// TODO: bit bad we need to do this but cal detection is not reliable enough
 		{ // Try SAL
 			rb := utils.NewReadBufferByteBased(read)
 			cBusMessage, secondErr := readwriteModel.CBusMessageParse(rb, pciResponse, readwriteModel.NewRequestContext(false), m.cbusOptions)
diff --git a/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go b/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go
index 17b9f147b..1e74430fe 100644
--- a/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go
+++ b/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go
@@ -63,7 +63,6 @@ func Analyze(pcapFile, protocolType string) {
 		analyzer.Init()
 		packageParse = analyzer.PackageParse
 		serializePackage = analyzer.SerializePackage
-		prettyPrint = analyzer.PrettyPrint
 		mapPackets = analyzer.MapPackets
 		if !config.AnalyzeConfigInstance.NoCustomMapping {
 			byteOutput = analyzer.ByteOutput
diff --git a/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer/analyzer.go b/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer/analyzer.go
index 92724de14..6997dc2b8 100644
--- a/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer/analyzer.go
+++ b/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer/analyzer.go
@@ -227,58 +227,6 @@ func (a *Analyzer) SerializePackage(message interface{}) ([]byte, error) {
 	}
 }
 
-// PrettyPrint as messages switch encoding (hex strings) we print the inner messages too
-func (a *Analyzer) PrettyPrint(message interface{}) {
-	if message, ok := message.(model.CBusMessage); !ok {
-		log.Fatal().Msgf("Unsupported type %T supplied", message)
-		panic("unreachable statement")
-	} else {
-		fmt.Printf("%v\n", message)
-		switch message := message.(type) {
-		case model.CBusMessageToServerExactly:
-			switch request := message.GetRequest().(type) {
-			case model.RequestDirectCommandAccessExactly:
-				fmt.Printf("%v\n", request.GetCalData())
-			case model.RequestObsoleteExactly:
-				fmt.Printf("%v\n", request.GetCalData())
-			case model.RequestCommandExactly:
-				fmt.Printf("%v\n", request.GetCbusCommand())
-			}
-		case model.CBusMessageToClientExactly:
-			switch reply := message.GetReply().(type) {
-			case model.ReplyOrConfirmationConfirmationExactly:
-				switch reply := reply.GetEmbeddedReply().(type) {
-				// TODO: add recursion
-				case model.ReplyOrConfirmationReplyExactly:
-					switch reply := reply.GetReply().(type) {
-					case model.ReplyEncodedReplyExactly:
-						switch reply := reply.GetEncodedReply().(type) {
-						case model.EncodedReplyCALReplyExactly:
-							// We print this a second time as the first print contains only the hex part
-							fmt.Printf("%v\n", reply.GetCalReply())
-						case model.MonitoredSALReplyExactly:
-							// We print this a second time as the first print contains only the hex part
-							fmt.Printf("%v\n", reply.GetMonitoredSAL())
-						}
-					}
-				}
-			case model.ReplyOrConfirmationReplyExactly:
-				switch reply := reply.GetReply().(type) {
-				case model.ReplyEncodedReplyExactly:
-					switch reply := reply.GetEncodedReply().(type) {
-					case model.EncodedReplyCALReplyExactly:
-						// We print this a second time as the first print contains only the hex part
-						fmt.Printf("%v\n", reply.GetCalReply())
-					case model.MonitoredSALReplyExactly:
-						// We print this a second time as the first print contains only the hex part
-						fmt.Printf("%v\n", reply.GetMonitoredSAL())
-					}
-				}
-			}
-		}
-	}
-}
-
 // MapPackets reorders the packages as they were not split
 func (a *Analyzer) MapPackets(in chan gopacket.Packet, packetInformationCreator func(packet gopacket.Packet) common.PacketInformation) chan gopacket.Packet {
 	if a.mappedPacketChan == nil {
diff --git a/plc4j/drivers/c-bus/src/test/java/org/apache/plc4x/java/cbus/RandomPackagesTest.java b/plc4j/drivers/c-bus/src/test/java/org/apache/plc4x/java/cbus/RandomPackagesTest.java
index 71e5364b2..0fdeee194 100644
--- a/plc4j/drivers/c-bus/src/test/java/org/apache/plc4x/java/cbus/RandomPackagesTest.java
+++ b/plc4j/drivers/c-bus/src/test/java/org/apache/plc4x/java/cbus/RandomPackagesTest.java
@@ -20,7 +20,6 @@ package org.apache.plc4x.java.cbus;
 
 import org.apache.plc4x.java.cbus.readwrite.*;
 import org.apache.plc4x.java.spi.generation.ReadBufferByteBased;
-import org.apache.plc4x.java.spi.generation.WriteBufferByteBased;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
@@ -60,6 +59,7 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
+
         assertMessageMatches(bytes, msg);
     }
 
@@ -70,10 +70,7 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        CBusMessageToServer msgToServer = (CBusMessageToServer) msg;
-        RequestCommand requestCommand = (RequestCommand) msgToServer.getRequest();
-        CBusCommand cbusCommand = requestCommand.getCbusCommand();
-        System.out.println(cbusCommand);
+
         assertMessageMatches(bytes, msg);
     }
 
@@ -87,11 +84,7 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        CBusMessageToClient messageToClient = (CBusMessageToClient) msg;
-        ReplyOrConfirmationConfirmation confirmationReply = (ReplyOrConfirmationConfirmation) messageToClient.getReply();
-        ReplyOrConfirmationReply normalReply = (ReplyOrConfirmationReply) confirmationReply.getEmbeddedReply();
-        EncodedReplyCALReply encodedReplyCALReply = (EncodedReplyCALReply) ((ReplyEncodedReply) normalReply.getReply()).getEncodedReply();
-        System.out.println(encodedReplyCALReply.getCalReply());
+
         assertMessageMatches(bytes, msg);
     }
 
@@ -104,11 +97,7 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        CBusMessageToClient messageToClient = (CBusMessageToClient) msg;
-        ReplyOrConfirmationConfirmation confirmationReply = (ReplyOrConfirmationConfirmation) messageToClient.getReply();
-        ReplyOrConfirmationReply normalReply = (ReplyOrConfirmationReply) confirmationReply.getEmbeddedReply();
-        EncodedReplyCALReply encodedReplyCALReply = (EncodedReplyCALReply) ((ReplyEncodedReply) normalReply.getReply()).getEncodedReply();
-        System.out.println(encodedReplyCALReply.getCalReply());
+
         assertMessageMatches(bytes, msg);
     }
 
@@ -119,9 +108,7 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        CBusMessageToServer messageToServer = (CBusMessageToServer) msg;
-        RequestCommand requestCommand = (RequestCommand) messageToServer.getRequest();
-        System.out.println(requestCommand.getCbusCommand());
+
         assertMessageMatches(bytes, msg);
     }
 
@@ -133,8 +120,7 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        CALData calData = ((RequestObsolete) ((CBusMessageToServer) msg).getRequest()).getCalData();
-        System.out.println(calData);
+
         assertMessageMatches(bytes, msg);
     }
 
@@ -148,11 +134,7 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        CBusMessageToClient messageToClient = (CBusMessageToClient) msg;
-        ReplyOrConfirmationConfirmation confirmationReply = (ReplyOrConfirmationConfirmation) messageToClient.getReply();
-        ReplyOrConfirmationReply normalReply = (ReplyOrConfirmationReply) confirmationReply.getEmbeddedReply();
-        EncodedReplyCALReply encodedReplyCALReply = (EncodedReplyCALReply) ((ReplyEncodedReply) normalReply.getReply()).getEncodedReply();
-        System.out.println(encodedReplyCALReply.getCalReply());
+
         assertMessageMatches(bytes, msg);
     }
 
@@ -163,14 +145,7 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        CBusMessageToServer messageToServer = (CBusMessageToServer) msg;
-        RequestDirectCommandAccess requestDirectCommandAccess = (RequestDirectCommandAccess) messageToServer.getRequest();
-        CALData calData = ((RequestDirectCommandAccess) ((CBusMessageToServer) msg).getRequest()).getCalData();
-        System.out.println(calData);
-
-        WriteBufferByteBased writeBuffer = new WriteBufferByteBased(bytes.length);
-        msg.serialize(writeBuffer);
-        assertThat(writeBuffer.getBytes()).isEqualTo(bytes);
+
         assertMessageMatches(bytes, msg);
     }
 
@@ -183,11 +158,6 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        CBusMessageToClient messageToClient = (CBusMessageToClient) msg;
-        ReplyOrConfirmationConfirmation confirmationReply = (ReplyOrConfirmationConfirmation) messageToClient.getReply();
-        ReplyOrConfirmationReply normalReply = (ReplyOrConfirmationReply) confirmationReply.getEmbeddedReply();
-        EncodedReplyCALReply encodedReplyCALReply = (EncodedReplyCALReply) ((ReplyEncodedReply) normalReply.getReply()).getEncodedReply();
-        System.out.println(encodedReplyCALReply.getCalReply());
 
         assertMessageMatches(bytes, msg);
     }
@@ -200,7 +170,6 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        System.out.println(((RequestObsolete) ((CBusMessageToServer) msg).getRequest()).getCalData());
 
         assertMessageMatches(bytes, msg);
     }
@@ -214,11 +183,6 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        CBusMessageToClient messageToClient = (CBusMessageToClient) msg;
-        ReplyOrConfirmationConfirmation confirmationReply = (ReplyOrConfirmationConfirmation) messageToClient.getReply();
-        ReplyOrConfirmationReply normalReply = (ReplyOrConfirmationReply) confirmationReply.getEmbeddedReply();
-        EncodedReplyCALReply encodedReplyCALReply = (EncodedReplyCALReply) ((ReplyEncodedReply) normalReply.getReply()).getEncodedReply();
-        System.out.println(encodedReplyCALReply.getCalReply());
 
         assertMessageMatches(bytes, msg);
     }
@@ -231,10 +195,7 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        CBusMessageToServer messageToServer = (CBusMessageToServer) msg;
-        RequestCommand requestCommand = (RequestCommand) messageToServer.getRequest();
-        CBusCommand cbusCommand = requestCommand.getCbusCommand();
-        System.out.println(cbusCommand);
+
         assertMessageMatches(bytes, msg);
     }
 
@@ -247,7 +208,7 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
         assertMessageMatches(bytes, msg);
     }
 
@@ -259,7 +220,7 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
         assertMessageMatches(bytes, msg);
     }
 
@@ -272,7 +233,6 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
 
         assertMessageMatches(bytes, msg);
     }
@@ -285,7 +245,6 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        System.out.println(((RequestObsolete) ((CBusMessageToServer) msg).getRequest()).getCalData());
 
         assertMessageMatches(bytes, msg);
     }
@@ -299,7 +258,6 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((ReplyOrConfirmationConfirmation) ((CBusMessageToClient) msg).getReply()).getEmbeddedReply()).getReply()).getEncodedReply());
 
         assertMessageMatches(bytes, msg);
     }
@@ -313,7 +271,6 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
 
         assertMessageMatches(bytes, msg);
     }
@@ -328,7 +285,6 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((ReplyOrConfirmationConfirmation) ((CBusMessageToClient) msg).getReply()).getEmbeddedReply()).getReply()).getEncodedReply());
 
         assertMessageMatches(bytes, msg);
     }
@@ -342,7 +298,6 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((ReplyOrConfirmationConfirmation) ((CBusMessageToClient) msg).getReply()).getEmbeddedReply()).getReply()).getEncodedReply());
 
         assertMessageMatches(bytes, msg);
     }
@@ -356,7 +311,6 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((ReplyOrConfirmationConfirmation) ((CBusMessageToClient) msg).getReply()).getEmbeddedReply()).getReply()).getEncodedReply());
 
         assertMessageMatches(bytes, msg);
     }
@@ -366,13 +320,12 @@ public class RandomPackagesTest {
         byte[] bytes = "0531AC0036040108FF0000DC\r\n".getBytes(StandardCharsets.UTF_8);
         ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
         requestContext = new RequestContext(false);
+        cBusOptions = C_BUS_OPTIONS_WITH_SRCHK;
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
 
-        // TODO: apparently the set the first bit of AuxiliaryLevel to true wich is not valid according to the documentation
-        //assertMessageMatches(bytes, msg);
+        assertMessageMatches(bytes, msg);
     }
 
     @Test
@@ -384,7 +337,6 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
 
         assertMessageMatches(bytes, msg);
     }
@@ -394,7 +346,6 @@ public class RandomPackagesTest {
     void closestFitIsAStatusRequestButWeDonTHaveAnyBytesBeforeThat() throws Exception {
         byte[] bytes = "FAFF00r\r".getBytes(StandardCharsets.UTF_8);
         ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
-        cBusOptions = C_BUS_OPTIONS_WITH_SRCHK;
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
@@ -410,7 +361,6 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
 
         assertMessageMatches(bytes, msg);
     }
@@ -434,7 +384,6 @@ public class RandomPackagesTest {
         CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
         assertThat(msg).isNotNull();
         System.out.println(msg);
-        System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
 
         assertMessageMatches(bytes, msg);
     }
diff --git a/plc4j/drivers/c-bus/src/test/java/org/apache/plc4x/java/cbus/ReferenceTest.java b/plc4j/drivers/c-bus/src/test/java/org/apache/plc4x/java/cbus/ReferenceTest.java
index d6a2e1aac..d433316f4 100644
--- a/plc4j/drivers/c-bus/src/test/java/org/apache/plc4x/java/cbus/ReferenceTest.java
+++ b/plc4j/drivers/c-bus/src/test/java/org/apache/plc4x/java/cbus/ReferenceTest.java
@@ -33,6 +33,8 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 public class ReferenceTest {
 
+    public static final CBusOptions C_BUS_OPTIONS_WITH_SRCHK = new CBusOptions(false, false, false, false, false, false, false, false, true);
+
     RequestContext requestContext;
     CBusOptions cBusOptions;
 
@@ -59,6 +61,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -69,7 +72,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestDirectCommandAccess) ((CBusMessageToServer) msg).getRequest()).getCalData());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -80,7 +83,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestDirectCommandAccess) ((CBusMessageToServer) msg).getRequest()).getCalData());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -91,7 +94,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestDirectCommandAccess) ((CBusMessageToServer) msg).getRequest()).getCalData());
+
                 assertMessageMatches(bytes, msg);
             }
         }
@@ -111,6 +114,7 @@ public class ReferenceTest {
                 ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
                 CBusHeader msg = CBusHeader.staticParse(readBufferByteBased);
                 assertThat(msg).isNotNull();
+
                 System.out.println(msg);
             }
 
@@ -120,6 +124,7 @@ public class ReferenceTest {
                 ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
                 CBusHeader msg = CBusHeader.staticParse(readBufferByteBased);
                 assertThat(msg).isNotNull();
+
                 System.out.println(msg);
             }
 
@@ -129,6 +134,7 @@ public class ReferenceTest {
                 ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
                 CBusHeader msg = CBusHeader.staticParse(readBufferByteBased);
                 assertThat(msg).isNotNull();
+
                 System.out.println(msg);
             }
 
@@ -145,6 +151,7 @@ public class ReferenceTest {
                 ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
+
                 System.out.println(msg);
             }
 
@@ -156,6 +163,7 @@ public class ReferenceTest {
                 ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
+
                 System.out.println(msg);
             }
 
@@ -166,6 +174,7 @@ public class ReferenceTest {
                 ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
+
                 System.out.println(msg);
             }
 
@@ -178,6 +187,7 @@ public class ReferenceTest {
                 ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
+
                 System.out.println(msg);
             }
 
@@ -189,8 +199,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                CALData calData = ((RequestDirectCommandAccess) ((CBusMessageToServer) msg).getRequest()).getCalData();
-                System.out.println(calData);
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -203,8 +212,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                CALData calData = ((RequestObsolete) ((CBusMessageToServer) msg).getRequest()).getCalData();
-                System.out.println(calData);
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -217,23 +225,25 @@ public class ReferenceTest {
             @Test
             void pointToPointCommandDirect() throws Exception {
                 byte[] bytes = "\\0603002102D4\r".getBytes(StandardCharsets.UTF_8);
+                cBusOptions = C_BUS_OPTIONS_WITH_SRCHK;
                 ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                CBusCommand cbusCommand = ((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand();
-                System.out.println(cbusCommand);
+
+                assertMessageMatches(bytes, msg);
             }
 
             @Test
             void pointToPointCommandBridged() throws Exception {
                 byte[] bytes = "\\06420903210289\r".getBytes(StandardCharsets.UTF_8);
                 ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+                cBusOptions = C_BUS_OPTIONS_WITH_SRCHK;
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                CBusCommand cbusCommand = ((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand();
-                System.out.println(cbusCommand);
+
+                assertMessageMatches(bytes, msg);
             }
         }
 
@@ -249,8 +259,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                CBusCommand cbusCommand = ((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand();
-                System.out.println(cbusCommand);
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -262,8 +271,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                CBusCommand cbusCommand = ((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand();
-                System.out.println(cbusCommand);
+
                 assertMessageMatches(bytes, msg);
             }
         }
@@ -279,8 +287,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                CBusCommand cbusCommand = ((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand();
-                System.out.println(cbusCommand);
+
                 assertMessageMatches(bytes, msg);
             }
         }
@@ -295,6 +302,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -307,6 +315,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -321,6 +330,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
+
                 assertMessageMatches(bytes, msg);
             }
         }
@@ -336,9 +346,7 @@ public class ReferenceTest {
                 ReplyOrConfirmation msg = ReplyOrConfirmation.staticParse(readBufferByteBased, cBusOptions, requestContext);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                EncodedReply encodedReply = ((ReplyEncodedReply) ((ReplyOrConfirmationReply) msg).getReply()).getEncodedReply();
-                MonitoredSAL monitoredSAL = ((MonitoredSALReply) encodedReply).getMonitoredSAL();
-                System.out.println(monitoredSAL);
+
                 assertMessageMatches(bytes, msg);
             }
         }
@@ -353,6 +361,7 @@ public class ReferenceTest {
                 ReplyOrConfirmation msg = ReplyOrConfirmation.staticParse(readBufferByteBased, cBusOptions, requestContext);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -363,6 +372,7 @@ public class ReferenceTest {
                 ReplyOrConfirmation msg = ReplyOrConfirmation.staticParse(readBufferByteBased, cBusOptions, requestContext);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -373,6 +383,7 @@ public class ReferenceTest {
                 ReplyOrConfirmation msg = ReplyOrConfirmation.staticParse(readBufferByteBased, cBusOptions, requestContext);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -383,6 +394,7 @@ public class ReferenceTest {
                 ReplyOrConfirmation msg = ReplyOrConfirmation.staticParse(readBufferByteBased, cBusOptions, requestContext);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -393,6 +405,7 @@ public class ReferenceTest {
                 ReplyOrConfirmation msg = ReplyOrConfirmation.staticParse(readBufferByteBased, cBusOptions, requestContext);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
+
                 assertMessageMatches(bytes, msg);
             }
         }
@@ -407,6 +420,7 @@ public class ReferenceTest {
             CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
             assertThat(msg).isNotNull();
             System.out.println(msg);
+
             assertMessageMatches(bytes, msg);
         }
 
@@ -419,6 +433,7 @@ public class ReferenceTest {
             CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
             assertThat(msg).isNotNull();
             System.out.println(msg);
+
             assertMessageMatches(bytes, msg);
         }
 
@@ -431,6 +446,7 @@ public class ReferenceTest {
             CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
             assertThat(msg).isNotNull();
             System.out.println(msg);
+
             assertMessageMatches(bytes, msg);
         }
 
@@ -444,7 +460,7 @@ public class ReferenceTest {
             CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
             assertThat(msg).isNotNull();
             System.out.println(msg);
-            System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
             assertMessageMatches(bytes, msg);
         }
 
@@ -457,6 +473,7 @@ public class ReferenceTest {
             CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
             assertThat(msg).isNotNull();
             System.out.println(msg);
+
             assertMessageMatches(bytes, msg);
         }
 
@@ -469,6 +486,7 @@ public class ReferenceTest {
             CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
             assertThat(msg).isNotNull();
             System.out.println(msg);
+
             assertMessageMatches(bytes, msg);
         }
 
@@ -483,6 +501,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -494,6 +513,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -506,7 +526,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -518,7 +538,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -530,7 +550,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -544,7 +564,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((EncodedReplyCALReply) ((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply()).getCalReply());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -559,7 +579,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((EncodedReplyCALReply) ((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply()).getCalReply());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -574,7 +594,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((EncodedReplyCALReply) ((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply()).getCalReply());
+
                 assertMessageMatches(bytes, msg);
             }
         }
@@ -591,6 +611,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -604,7 +625,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -622,8 +643,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                CBusCommand cbusCommand = ((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand();
-                System.out.println(cbusCommand);
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -635,6 +655,7 @@ public class ReferenceTest {
                 CBusCommand msg = CBusCommand.staticParse(readBufferByteBased, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -660,6 +681,7 @@ public class ReferenceTest {
             CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
             assertThat(msg).isNotNull();
             System.out.println(msg);
+
             assertMessageMatches(bytes, msg);
         }
 
@@ -671,6 +693,7 @@ public class ReferenceTest {
             CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
             assertThat(msg).isNotNull();
             System.out.println(msg);
+
             assertMessageMatches(bytes, msg);
         }
 
@@ -682,7 +705,6 @@ public class ReferenceTest {
             CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
             assertThat(msg).isNotNull();
             System.out.println(msg);
-            System.out.println(((RequestObsolete) ((CBusMessageToServer) msg).getRequest()).getCalData());
 
             assertMessageMatches(bytes, msg);
         }
@@ -701,7 +723,7 @@ public class ReferenceTest {
             CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
             assertThat(msg).isNotNull();
             System.out.println(msg);
-            System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
             assertMessageMatches(bytes, msg);
         }
 
@@ -720,6 +742,8 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
+
+                    assertMessageMatches(bytes, msg);
                 }
 
                 @Test
@@ -729,28 +753,33 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestObsolete) ((CBusMessageToServer) msg).getRequest()).getCalData());
+
+                    assertMessageMatches(bytes, msg);
                 }
 
                 @Test
                 void writeSomethingResponse() throws Exception {
                     byte[] bytes = "g.322100AD\r\n".getBytes(StandardCharsets.UTF_8);
                     ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+                    cBusOptions = C_BUS_OPTIONS_WITH_SRCHK;
                     requestContext = new RequestContext(false);
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((ReplyOrConfirmationConfirmation) ((CBusMessageToClient) msg).getReply()).getEmbeddedReply()).getReply()).getEncodedReply());
+
+                    assertMessageMatches(bytes, msg);
                 }
 
                 @Test
                 void writeSomething2() throws Exception {
                     byte[] bytes = "A3420002g\r".getBytes(StandardCharsets.UTF_8);
                     ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+                    cBusOptions = C_BUS_OPTIONS_WITH_SRCHK;
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestObsolete) ((CBusMessageToServer) msg).getRequest()).getCalData());
+
+                    assertMessageMatches(bytes, msg);
                 }
 
                 @Test
@@ -758,10 +787,12 @@ public class ReferenceTest {
                     byte[] bytes = "g.3242008C\r\n".getBytes(StandardCharsets.UTF_8);
                     ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
                     requestContext = new RequestContext(false);
+                    cBusOptions = C_BUS_OPTIONS_WITH_SRCHK;
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((ReplyOrConfirmationConfirmation) ((CBusMessageToClient) msg).getReply()).getEmbeddedReply()).getReply()).getEncodedReply());
+
+                    assertMessageMatches(bytes, msg);
                 }
 
                 @Test
@@ -771,18 +802,20 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestObsolete) ((CBusMessageToServer) msg).getRequest()).getCalData());
+
+                    assertMessageMatches(bytes, msg);
                 }
 
                 @Test
                 void writeSomethingResponse3() throws Exception {
-                    byte[] bytes = "g.8600000032300000\r\n".getBytes(StandardCharsets.UTF_8);
+                    byte[] bytes = "g.8600000032300018\r\n".getBytes(StandardCharsets.UTF_8);
                     ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
-                    requestContext = new RequestContext(false);
+                    cBusOptions = C_BUS_OPTIONS_WITH_SRCHK;
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((ReplyOrConfirmationConfirmation) ((CBusMessageToClient) msg).getReply()).getEmbeddedReply()).getReply()).getEncodedReply());
+
+                    assertMessageMatches(bytes, msg);
                 }
             }
 
@@ -794,7 +827,8 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestObsolete) ((CBusMessageToServer) msg).getRequest()).getCalData());
+
+                assertMessageMatches(bytes, msg);
             }
         }
 
@@ -810,7 +844,8 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
+                assertMessageMatches(bytes, msg);
             }
 
             // 6.2
@@ -822,7 +857,8 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
+                assertMessageMatches(bytes, msg);
             }
 
             // 6.3
@@ -834,7 +870,8 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
+                assertMessageMatches(bytes, msg);
             }
         }
 
@@ -850,7 +887,8 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
+                assertMessageMatches(bytes, msg);
             }
 
             // 7.1
@@ -862,7 +900,8 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
+                assertMessageMatches(bytes, msg);
             }
 
             // 7.2
@@ -874,7 +913,8 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
+                assertMessageMatches(bytes, msg);
             }
 
             // 7.2
@@ -886,7 +926,8 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
+                assertMessageMatches(bytes, msg);
             }
 
             // 7.3
@@ -898,7 +939,8 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
+                assertMessageMatches(bytes, msg);
             }
 
             // 7.3
@@ -910,7 +952,8 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
+                assertMessageMatches(bytes, msg);
             }
 
             @Disabled("Needs to be implemented")
@@ -926,7 +969,8 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
+                    assertMessageMatches(bytes, msg);
                 }
 
                 @Test
@@ -938,7 +982,8 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
+                    assertMessageMatches(bytes, msg);
                 }
 
                 @Test
@@ -950,7 +995,8 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
+                    assertMessageMatches(bytes, msg);
                 }
             }
 
@@ -963,11 +1009,12 @@ public class ReferenceTest {
             void BigMMI1() throws Exception {
                 byte[] bytes = "D8380068AA0140550550001000000014000000000000000000CF\r\n".getBytes(StandardCharsets.UTF_8);
                 ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
-                cBusOptions = new CBusOptions(false, false, false, false, false, false, false, false, false);
+                cBusOptions = new CBusOptions(false, false, false, false, false, false, false, false, true);
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
+                assertMessageMatches(bytes, msg);
             }
 
             @Test
@@ -978,7 +1025,8 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
+                assertMessageMatches(bytes, msg);
             }
 
             @Test
@@ -989,7 +1037,8 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
+                assertMessageMatches(bytes, msg);
             }
         }
 
@@ -1006,7 +1055,8 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
+                    assertMessageMatches(bytes, msg);
                 }
 
                 @Test
@@ -1017,7 +1067,8 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
+                    assertMessageMatches(bytes, msg);
                 }
 
                 @Test
@@ -1028,7 +1079,8 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
+                    assertMessageMatches(bytes, msg);
                 }
             }
 
@@ -1042,7 +1094,8 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
+                    assertMessageMatches(bytes, msg);
                 }
 
                 @Test
@@ -1053,7 +1106,8 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
+                    assertMessageMatches(bytes, msg);
                 }
 
                 @Test
@@ -1064,7 +1118,8 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((ReplyEncodedReply) ((ReplyOrConfirmationReply) ((CBusMessageToClient) msg).getReply()).getReply()).getEncodedReply());
+
+                    assertMessageMatches(bytes, msg);
                 }
             }
         }
@@ -1085,7 +1140,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1096,7 +1151,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1107,7 +1162,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1121,7 +1176,7 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                     assertMessageMatches(bytes, msg);
                 }
 
@@ -1132,7 +1187,7 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                     assertMessageMatches(bytes, msg);
                 }
 
@@ -1143,7 +1198,7 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                     assertMessageMatches(bytes, msg);
                 }
 
@@ -1154,7 +1209,7 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                     assertMessageMatches(bytes, msg);
                 }
 
@@ -1165,7 +1220,7 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                     assertMessageMatches(bytes, msg);
                 }
 
@@ -1176,7 +1231,7 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                     assertMessageMatches(bytes, msg);
                 }
 
@@ -1187,7 +1242,7 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                     assertMessageMatches(bytes, msg);
                 }
 
@@ -1205,7 +1260,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1217,7 +1272,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
         }
@@ -1238,7 +1293,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1250,7 +1305,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1265,7 +1320,7 @@ public class ReferenceTest {
             CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
             assertThat(msg).isNotNull();
             System.out.println(msg);
-            System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
             assertMessageMatches(bytes, msg);
         }
 
@@ -1278,7 +1333,7 @@ public class ReferenceTest {
             CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
             assertThat(msg).isNotNull();
             System.out.println(msg);
-            System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
             assertMessageMatches(bytes, msg);
         }
 
@@ -1294,7 +1349,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1306,7 +1361,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
         }
@@ -1328,7 +1383,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1340,7 +1395,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1357,7 +1412,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1369,7 +1424,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1391,7 +1446,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1403,7 +1458,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
         }
@@ -1424,7 +1479,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1438,7 +1493,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
         }
@@ -1459,7 +1514,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
         }
@@ -1487,7 +1542,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1499,7 +1554,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1511,7 +1566,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1523,7 +1578,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
         }
@@ -1551,7 +1606,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1563,7 +1618,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1576,7 +1631,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1587,7 +1642,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
         }
@@ -1609,7 +1664,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1622,7 +1677,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1634,7 +1689,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1657,7 +1712,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1669,7 +1724,7 @@ public class ReferenceTest {
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                 assertThat(msg).isNotNull();
                 System.out.println(msg);
-                System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                 assertMessageMatches(bytes, msg);
             }
 
@@ -1684,7 +1739,7 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                     assertMessageMatches(bytes, msg);
                 }
 
@@ -1695,7 +1750,7 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                     assertMessageMatches(bytes, msg);
                 }
             }
@@ -1709,7 +1764,7 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                     assertMessageMatches(bytes, msg);
                 }
 
@@ -1720,7 +1775,7 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                     assertMessageMatches(bytes, msg);
                 }
 
@@ -1731,7 +1786,7 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                     assertMessageMatches(bytes, msg);
                 }
 
@@ -1742,7 +1797,7 @@ public class ReferenceTest {
                     CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions);
                     assertThat(msg).isNotNull();
                     System.out.println(msg);
-                    System.out.println(((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand());
+
                     assertMessageMatches(bytes, msg);
                 }
             }


[plc4x] 02/03: refactor(cbus): add virtual fields for hex encoded fields

Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 362680547e039b16301e0995439b7112065cd12f
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Aug 8 10:51:01 2022 +0200

    refactor(cbus): add virtual fields for hex encoded fields
    
    This makes it easier to print them as you don't need double prints as they are now contained within
---
 .../cbus/readwrite/model/ParameterChangeReply.go   | 56 +++++++++++-----------
 .../protocols/cbus/readwrite/model/PowerUpReply.go | 56 +++++++++++-----------
 .../cbus/readwrite/model/ReplyEncodedReply.go      | 43 +++++++++++++++++
 .../cbus/readwrite/model/RequestCommand.go         | 47 ++++++++++++++++++
 .../readwrite/model/RequestDirectCommandAccess.go  | 26 ++++++++++
 .../cbus/readwrite/model/RequestObsolete.go        | 28 +++++++++++
 .../src/main/resources/protocols/cbus/c-bus.mspec  | 22 +++++++--
 7 files changed, 217 insertions(+), 61 deletions(-)

diff --git a/plc4go/protocols/cbus/readwrite/model/ParameterChangeReply.go b/plc4go/protocols/cbus/readwrite/model/ParameterChangeReply.go
index a2a0df51c..1da87b98d 100644
--- a/plc4go/protocols/cbus/readwrite/model/ParameterChangeReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/ParameterChangeReply.go
@@ -31,8 +31,8 @@ type ParameterChangeReply interface {
 	utils.LengthAware
 	utils.Serializable
 	Reply
-	// GetIsA returns IsA (property field)
-	GetIsA() ParameterChange
+	// GetParameterChange returns ParameterChange (property field)
+	GetParameterChange() ParameterChange
 }
 
 // ParameterChangeReplyExactly can be used when we want exactly this type and not a type which fulfills ParameterChangeReply.
@@ -45,7 +45,7 @@ type ParameterChangeReplyExactly interface {
 // _ParameterChangeReply is the data-structure of this message
 type _ParameterChangeReply struct {
 	*_Reply
-	IsA ParameterChange
+	ParameterChange ParameterChange
 }
 
 ///////////////////////////////////////////////////////////
@@ -71,8 +71,8 @@ func (m *_ParameterChangeReply) GetParent() Reply {
 /////////////////////// Accessors for property fields.
 ///////////////////////
 
-func (m *_ParameterChangeReply) GetIsA() ParameterChange {
-	return m.IsA
+func (m *_ParameterChangeReply) GetParameterChange() ParameterChange {
+	return m.ParameterChange
 }
 
 ///////////////////////
@@ -81,10 +81,10 @@ func (m *_ParameterChangeReply) GetIsA() ParameterChange {
 ///////////////////////////////////////////////////////////
 
 // NewParameterChangeReply factory function for _ParameterChangeReply
-func NewParameterChangeReply(isA ParameterChange, peekedByte byte, cBusOptions CBusOptions, requestContext RequestContext) *_ParameterChangeReply {
+func NewParameterChangeReply(parameterChange ParameterChange, peekedByte byte, cBusOptions CBusOptions, requestContext RequestContext) *_ParameterChangeReply {
 	_result := &_ParameterChangeReply{
-		IsA:    isA,
-		_Reply: NewReply(peekedByte, cBusOptions, requestContext),
+		ParameterChange: parameterChange,
+		_Reply:          NewReply(peekedByte, cBusOptions, requestContext),
 	}
 	_result._Reply._ReplyChildRequirements = _result
 	return _result
@@ -112,8 +112,8 @@ func (m *_ParameterChangeReply) GetLengthInBits() uint16 {
 func (m *_ParameterChangeReply) GetLengthInBitsConditional(lastItem bool) uint16 {
 	lengthInBits := uint16(m.GetParentLengthInBits())
 
-	// Simple field (isA)
-	lengthInBits += m.IsA.GetLengthInBits()
+	// Simple field (parameterChange)
+	lengthInBits += m.ParameterChange.GetLengthInBits()
 
 	return lengthInBits
 }
@@ -131,17 +131,17 @@ func ParameterChangeReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOpti
 	currentPos := positionAware.GetPos()
 	_ = currentPos
 
-	// Simple Field (isA)
-	if pullErr := readBuffer.PullContext("isA"); pullErr != nil {
-		return nil, errors.Wrap(pullErr, "Error pulling for isA")
+	// Simple Field (parameterChange)
+	if pullErr := readBuffer.PullContext("parameterChange"); pullErr != nil {
+		return nil, errors.Wrap(pullErr, "Error pulling for parameterChange")
 	}
-	_isA, _isAErr := ParameterChangeParse(readBuffer)
-	if _isAErr != nil {
-		return nil, errors.Wrap(_isAErr, "Error parsing 'isA' field of ParameterChangeReply")
+	_parameterChange, _parameterChangeErr := ParameterChangeParse(readBuffer)
+	if _parameterChangeErr != nil {
+		return nil, errors.Wrap(_parameterChangeErr, "Error parsing 'parameterChange' field of ParameterChangeReply")
 	}
-	isA := _isA.(ParameterChange)
-	if closeErr := readBuffer.CloseContext("isA"); closeErr != nil {
-		return nil, errors.Wrap(closeErr, "Error closing for isA")
+	parameterChange := _parameterChange.(ParameterChange)
+	if closeErr := readBuffer.CloseContext("parameterChange"); closeErr != nil {
+		return nil, errors.Wrap(closeErr, "Error closing for parameterChange")
 	}
 
 	if closeErr := readBuffer.CloseContext("ParameterChangeReply"); closeErr != nil {
@@ -154,7 +154,7 @@ func ParameterChangeReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOpti
 			CBusOptions:    cBusOptions,
 			RequestContext: requestContext,
 		},
-		IsA: isA,
+		ParameterChange: parameterChange,
 	}
 	_child._Reply._ReplyChildRequirements = _child
 	return _child, nil
@@ -168,16 +168,16 @@ func (m *_ParameterChangeReply) Serialize(writeBuffer utils.WriteBuffer) error {
 			return errors.Wrap(pushErr, "Error pushing for ParameterChangeReply")
 		}
 
-		// Simple Field (isA)
-		if pushErr := writeBuffer.PushContext("isA"); pushErr != nil {
-			return errors.Wrap(pushErr, "Error pushing for isA")
+		// Simple Field (parameterChange)
+		if pushErr := writeBuffer.PushContext("parameterChange"); pushErr != nil {
+			return errors.Wrap(pushErr, "Error pushing for parameterChange")
 		}
-		_isAErr := writeBuffer.WriteSerializable(m.GetIsA())
-		if popErr := writeBuffer.PopContext("isA"); popErr != nil {
-			return errors.Wrap(popErr, "Error popping for isA")
+		_parameterChangeErr := writeBuffer.WriteSerializable(m.GetParameterChange())
+		if popErr := writeBuffer.PopContext("parameterChange"); popErr != nil {
+			return errors.Wrap(popErr, "Error popping for parameterChange")
 		}
-		if _isAErr != nil {
-			return errors.Wrap(_isAErr, "Error serializing 'isA' field")
+		if _parameterChangeErr != nil {
+			return errors.Wrap(_parameterChangeErr, "Error serializing 'parameterChange' field")
 		}
 
 		if popErr := writeBuffer.PopContext("ParameterChangeReply"); popErr != nil {
diff --git a/plc4go/protocols/cbus/readwrite/model/PowerUpReply.go b/plc4go/protocols/cbus/readwrite/model/PowerUpReply.go
index 15b4b86f0..c32f40f96 100644
--- a/plc4go/protocols/cbus/readwrite/model/PowerUpReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/PowerUpReply.go
@@ -31,8 +31,8 @@ type PowerUpReply interface {
 	utils.LengthAware
 	utils.Serializable
 	Reply
-	// GetIsA returns IsA (property field)
-	GetIsA() PowerUp
+	// GetPowerUpIndicator returns PowerUpIndicator (property field)
+	GetPowerUpIndicator() PowerUp
 }
 
 // PowerUpReplyExactly can be used when we want exactly this type and not a type which fulfills PowerUpReply.
@@ -45,7 +45,7 @@ type PowerUpReplyExactly interface {
 // _PowerUpReply is the data-structure of this message
 type _PowerUpReply struct {
 	*_Reply
-	IsA PowerUp
+	PowerUpIndicator PowerUp
 }
 
 ///////////////////////////////////////////////////////////
@@ -71,8 +71,8 @@ func (m *_PowerUpReply) GetParent() Reply {
 /////////////////////// Accessors for property fields.
 ///////////////////////
 
-func (m *_PowerUpReply) GetIsA() PowerUp {
-	return m.IsA
+func (m *_PowerUpReply) GetPowerUpIndicator() PowerUp {
+	return m.PowerUpIndicator
 }
 
 ///////////////////////
@@ -81,10 +81,10 @@ func (m *_PowerUpReply) GetIsA() PowerUp {
 ///////////////////////////////////////////////////////////
 
 // NewPowerUpReply factory function for _PowerUpReply
-func NewPowerUpReply(isA PowerUp, peekedByte byte, cBusOptions CBusOptions, requestContext RequestContext) *_PowerUpReply {
+func NewPowerUpReply(powerUpIndicator PowerUp, peekedByte byte, cBusOptions CBusOptions, requestContext RequestContext) *_PowerUpReply {
 	_result := &_PowerUpReply{
-		IsA:    isA,
-		_Reply: NewReply(peekedByte, cBusOptions, requestContext),
+		PowerUpIndicator: powerUpIndicator,
+		_Reply:           NewReply(peekedByte, cBusOptions, requestContext),
 	}
 	_result._Reply._ReplyChildRequirements = _result
 	return _result
@@ -112,8 +112,8 @@ func (m *_PowerUpReply) GetLengthInBits() uint16 {
 func (m *_PowerUpReply) GetLengthInBitsConditional(lastItem bool) uint16 {
 	lengthInBits := uint16(m.GetParentLengthInBits())
 
-	// Simple field (isA)
-	lengthInBits += m.IsA.GetLengthInBits()
+	// Simple field (powerUpIndicator)
+	lengthInBits += m.PowerUpIndicator.GetLengthInBits()
 
 	return lengthInBits
 }
@@ -131,17 +131,17 @@ func PowerUpReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, req
 	currentPos := positionAware.GetPos()
 	_ = currentPos
 
-	// Simple Field (isA)
-	if pullErr := readBuffer.PullContext("isA"); pullErr != nil {
-		return nil, errors.Wrap(pullErr, "Error pulling for isA")
+	// Simple Field (powerUpIndicator)
+	if pullErr := readBuffer.PullContext("powerUpIndicator"); pullErr != nil {
+		return nil, errors.Wrap(pullErr, "Error pulling for powerUpIndicator")
 	}
-	_isA, _isAErr := PowerUpParse(readBuffer)
-	if _isAErr != nil {
-		return nil, errors.Wrap(_isAErr, "Error parsing 'isA' field of PowerUpReply")
+	_powerUpIndicator, _powerUpIndicatorErr := PowerUpParse(readBuffer)
+	if _powerUpIndicatorErr != nil {
+		return nil, errors.Wrap(_powerUpIndicatorErr, "Error parsing 'powerUpIndicator' field of PowerUpReply")
 	}
-	isA := _isA.(PowerUp)
-	if closeErr := readBuffer.CloseContext("isA"); closeErr != nil {
-		return nil, errors.Wrap(closeErr, "Error closing for isA")
+	powerUpIndicator := _powerUpIndicator.(PowerUp)
+	if closeErr := readBuffer.CloseContext("powerUpIndicator"); closeErr != nil {
+		return nil, errors.Wrap(closeErr, "Error closing for powerUpIndicator")
 	}
 
 	if closeErr := readBuffer.CloseContext("PowerUpReply"); closeErr != nil {
@@ -154,7 +154,7 @@ func PowerUpReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, req
 			CBusOptions:    cBusOptions,
 			RequestContext: requestContext,
 		},
-		IsA: isA,
+		PowerUpIndicator: powerUpIndicator,
 	}
 	_child._Reply._ReplyChildRequirements = _child
 	return _child, nil
@@ -168,16 +168,16 @@ func (m *_PowerUpReply) Serialize(writeBuffer utils.WriteBuffer) error {
 			return errors.Wrap(pushErr, "Error pushing for PowerUpReply")
 		}
 
-		// Simple Field (isA)
-		if pushErr := writeBuffer.PushContext("isA"); pushErr != nil {
-			return errors.Wrap(pushErr, "Error pushing for isA")
+		// Simple Field (powerUpIndicator)
+		if pushErr := writeBuffer.PushContext("powerUpIndicator"); pushErr != nil {
+			return errors.Wrap(pushErr, "Error pushing for powerUpIndicator")
 		}
-		_isAErr := writeBuffer.WriteSerializable(m.GetIsA())
-		if popErr := writeBuffer.PopContext("isA"); popErr != nil {
-			return errors.Wrap(popErr, "Error popping for isA")
+		_powerUpIndicatorErr := writeBuffer.WriteSerializable(m.GetPowerUpIndicator())
+		if popErr := writeBuffer.PopContext("powerUpIndicator"); popErr != nil {
+			return errors.Wrap(popErr, "Error popping for powerUpIndicator")
 		}
-		if _isAErr != nil {
-			return errors.Wrap(_isAErr, "Error serializing 'isA' field")
+		if _powerUpIndicatorErr != nil {
+			return errors.Wrap(_powerUpIndicatorErr, "Error serializing 'powerUpIndicator' field")
 		}
 
 		if popErr := writeBuffer.PopContext("PowerUpReply"); popErr != nil {
diff --git a/plc4go/protocols/cbus/readwrite/model/ReplyEncodedReply.go b/plc4go/protocols/cbus/readwrite/model/ReplyEncodedReply.go
index aae9c0094..6ec8c80c2 100644
--- a/plc4go/protocols/cbus/readwrite/model/ReplyEncodedReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/ReplyEncodedReply.go
@@ -35,6 +35,10 @@ type ReplyEncodedReply interface {
 	GetEncodedReply() EncodedReply
 	// GetChksum returns Chksum (property field)
 	GetChksum() Checksum
+	// GetEncodedReplyDecoded returns EncodedReplyDecoded (virtual field)
+	GetEncodedReplyDecoded() EncodedReply
+	// GetChksumDecoded returns ChksumDecoded (virtual field)
+	GetChksumDecoded() Checksum
 }
 
 // ReplyEncodedReplyExactly can be used when we want exactly this type and not a type which fulfills ReplyEncodedReply.
@@ -82,6 +86,23 @@ func (m *_ReplyEncodedReply) GetChksum() Checksum {
 	return m.Chksum
 }
 
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for virtual fields.
+///////////////////////
+
+func (m *_ReplyEncodedReply) GetEncodedReplyDecoded() EncodedReply {
+	return CastEncodedReply(m.GetEncodedReply())
+}
+
+func (m *_ReplyEncodedReply) GetChksumDecoded() Checksum {
+	return CastChecksum(m.GetChksum())
+}
+
 ///////////////////////
 ///////////////////////
 ///////////////////////////////////////////////////////////
@@ -123,9 +144,13 @@ func (m *_ReplyEncodedReply) GetLengthInBitsConditional(lastItem bool) uint16 {
 	// Manual Field (encodedReply)
 	lengthInBits += uint16(int32((int32(m.GetEncodedReply().GetLengthInBytes()) * int32(int32(2)))) * int32(int32(8)))
 
+	// A virtual field doesn't have any in- or output.
+
 	// Manual Field (chksum)
 	lengthInBits += uint16(utils.InlineIf((m.CBusOptions.GetSrchk()), func() interface{} { return int32((int32(16))) }, func() interface{} { return int32((int32(0))) }).(int32))
 
+	// A virtual field doesn't have any in- or output.
+
 	return lengthInBits
 }
 
@@ -152,6 +177,11 @@ func ReplyEncodedReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions
 		encodedReply = _encodedReply.(EncodedReply)
 	}
 
+	// Virtual field
+	_encodedReplyDecoded := encodedReply
+	encodedReplyDecoded := _encodedReplyDecoded
+	_ = encodedReplyDecoded
+
 	// Manual Field (chksum)
 	_chksum, _chksumErr := ReadAndValidateChecksum(readBuffer, encodedReply, cBusOptions.GetSrchk())
 	if _chksumErr != nil {
@@ -162,6 +192,11 @@ func ReplyEncodedReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions
 		chksum = _chksum.(Checksum)
 	}
 
+	// Virtual field
+	_chksumDecoded := chksum
+	chksumDecoded := _chksumDecoded
+	_ = chksumDecoded
+
 	if closeErr := readBuffer.CloseContext("ReplyEncodedReply"); closeErr != nil {
 		return nil, errors.Wrap(closeErr, "Error closing for ReplyEncodedReply")
 	}
@@ -192,12 +227,20 @@ func (m *_ReplyEncodedReply) Serialize(writeBuffer utils.WriteBuffer) error {
 		if _encodedReplyErr != nil {
 			return errors.Wrap(_encodedReplyErr, "Error serializing 'encodedReply' field")
 		}
+		// Virtual field
+		if _encodedReplyDecodedErr := writeBuffer.WriteVirtual("encodedReplyDecoded", m.GetEncodedReplyDecoded()); _encodedReplyDecodedErr != nil {
+			return errors.Wrap(_encodedReplyDecodedErr, "Error serializing 'encodedReplyDecoded' field")
+		}
 
 		// Manual Field (chksum)
 		_chksumErr := CalculateChecksum(writeBuffer, m.GetEncodedReply(), m.CBusOptions.GetSrchk())
 		if _chksumErr != nil {
 			return errors.Wrap(_chksumErr, "Error serializing 'chksum' field")
 		}
+		// Virtual field
+		if _chksumDecodedErr := writeBuffer.WriteVirtual("chksumDecoded", m.GetChksumDecoded()); _chksumDecodedErr != nil {
+			return errors.Wrap(_chksumDecodedErr, "Error serializing 'chksumDecoded' field")
+		}
 
 		if popErr := writeBuffer.PopContext("ReplyEncodedReply"); popErr != nil {
 			return errors.Wrap(popErr, "Error popping for ReplyEncodedReply")
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestCommand.go b/plc4go/protocols/cbus/readwrite/model/RequestCommand.go
index 401386b97..6fc520c71 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestCommand.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestCommand.go
@@ -43,6 +43,10 @@ type RequestCommand interface {
 	GetChksum() Checksum
 	// GetAlpha returns Alpha (property field)
 	GetAlpha() Alpha
+	// GetCbusCommandDecoded returns CbusCommandDecoded (virtual field)
+	GetCbusCommandDecoded() CBusCommand
+	// GetChksumDecoded returns ChksumDecoded (virtual field)
+	GetChksumDecoded() Checksum
 }
 
 // RequestCommandExactly can be used when we want exactly this type and not a type which fulfills RequestCommand.
@@ -99,6 +103,27 @@ func (m *_RequestCommand) GetAlpha() Alpha {
 	return m.Alpha
 }
 
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for virtual fields.
+///////////////////////
+
+func (m *_RequestCommand) GetCbusCommandDecoded() CBusCommand {
+	alpha := m.Alpha
+	_ = alpha
+	return CastCBusCommand(m.GetCbusCommand())
+}
+
+func (m *_RequestCommand) GetChksumDecoded() Checksum {
+	alpha := m.Alpha
+	_ = alpha
+	return CastChecksum(m.GetChksum())
+}
+
 ///////////////////////
 ///////////////////////
 ///////////////////////////////////////////////////////////
@@ -157,9 +182,13 @@ func (m *_RequestCommand) GetLengthInBitsConditional(lastItem bool) uint16 {
 	// Manual Field (cbusCommand)
 	lengthInBits += uint16(int32((int32(m.GetCbusCommand().GetLengthInBytes()) * int32(int32(2)))) * int32(int32(8)))
 
+	// A virtual field doesn't have any in- or output.
+
 	// Manual Field (chksum)
 	lengthInBits += uint16(utils.InlineIf((m.CBusOptions.GetSrchk()), func() interface{} { return int32((int32(16))) }, func() interface{} { return int32((int32(0))) }).(int32))
 
+	// A virtual field doesn't have any in- or output.
+
 	// Optional Field (alpha)
 	if m.Alpha != nil {
 		lengthInBits += m.Alpha.GetLengthInBits()
@@ -200,6 +229,11 @@ func RequestCommandParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions) (
 		cbusCommand = _cbusCommand.(CBusCommand)
 	}
 
+	// Virtual field
+	_cbusCommandDecoded := cbusCommand
+	cbusCommandDecoded := _cbusCommandDecoded
+	_ = cbusCommandDecoded
+
 	// Manual Field (chksum)
 	_chksum, _chksumErr := ReadAndValidateChecksum(readBuffer, cbusCommand, cBusOptions.GetSrchk())
 	if _chksumErr != nil {
@@ -210,6 +244,11 @@ func RequestCommandParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions) (
 		chksum = _chksum.(Checksum)
 	}
 
+	// Virtual field
+	_chksumDecoded := chksum
+	chksumDecoded := _chksumDecoded
+	_ = chksumDecoded
+
 	// Optional Field (alpha) (Can be skipped, if a given expression evaluates to false)
 	var alpha Alpha = nil
 	{
@@ -268,12 +307,20 @@ func (m *_RequestCommand) Serialize(writeBuffer utils.WriteBuffer) error {
 		if _cbusCommandErr != nil {
 			return errors.Wrap(_cbusCommandErr, "Error serializing 'cbusCommand' field")
 		}
+		// Virtual field
+		if _cbusCommandDecodedErr := writeBuffer.WriteVirtual("cbusCommandDecoded", m.GetCbusCommandDecoded()); _cbusCommandDecodedErr != nil {
+			return errors.Wrap(_cbusCommandDecodedErr, "Error serializing 'cbusCommandDecoded' field")
+		}
 
 		// Manual Field (chksum)
 		_chksumErr := CalculateChecksum(writeBuffer, m.GetCbusCommand(), m.CBusOptions.GetSrchk())
 		if _chksumErr != nil {
 			return errors.Wrap(_chksumErr, "Error serializing 'chksum' field")
 		}
+		// Virtual field
+		if _chksumDecodedErr := writeBuffer.WriteVirtual("chksumDecoded", m.GetChksumDecoded()); _chksumDecodedErr != nil {
+			return errors.Wrap(_chksumDecodedErr, "Error serializing 'chksumDecoded' field")
+		}
 
 		// Optional Field (alpha) (Can be skipped, if the value is null)
 		var alpha Alpha = nil
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestDirectCommandAccess.go b/plc4go/protocols/cbus/readwrite/model/RequestDirectCommandAccess.go
index d53fcb9f2..2ccce84cc 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestDirectCommandAccess.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestDirectCommandAccess.go
@@ -37,6 +37,8 @@ type RequestDirectCommandAccess interface {
 	Request
 	// GetCalData returns CalData (property field)
 	GetCalData() CALData
+	// GetCalDataDecoded returns CalDataDecoded (virtual field)
+	GetCalDataDecoded() CALData
 }
 
 // RequestDirectCommandAccessExactly can be used when we want exactly this type and not a type which fulfills RequestDirectCommandAccess.
@@ -83,6 +85,19 @@ func (m *_RequestDirectCommandAccess) GetCalData() CALData {
 	return m.CalData
 }
 
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for virtual fields.
+///////////////////////
+
+func (m *_RequestDirectCommandAccess) GetCalDataDecoded() CALData {
+	return CastCALData(m.GetCalData())
+}
+
 ///////////////////////
 ///////////////////////
 ///////////////////////////////////////////////////////////
@@ -139,6 +154,8 @@ func (m *_RequestDirectCommandAccess) GetLengthInBitsConditional(lastItem bool)
 	// Manual Field (calData)
 	lengthInBits += uint16(int32((int32(m.GetCalData().GetLengthInBytes()) * int32(int32(2)))) * int32(int32(8)))
 
+	// A virtual field doesn't have any in- or output.
+
 	return lengthInBits
 }
 
@@ -174,6 +191,11 @@ func RequestDirectCommandAccessParse(readBuffer utils.ReadBuffer, cBusOptions CB
 		calData = _calData.(CALData)
 	}
 
+	// Virtual field
+	_calDataDecoded := calData
+	calDataDecoded := _calDataDecoded
+	_ = calDataDecoded
+
 	if closeErr := readBuffer.CloseContext("RequestDirectCommandAccess"); closeErr != nil {
 		return nil, errors.Wrap(closeErr, "Error closing for RequestDirectCommandAccess")
 	}
@@ -208,6 +230,10 @@ func (m *_RequestDirectCommandAccess) Serialize(writeBuffer utils.WriteBuffer) e
 		if _calDataErr != nil {
 			return errors.Wrap(_calDataErr, "Error serializing 'calData' field")
 		}
+		// Virtual field
+		if _calDataDecodedErr := writeBuffer.WriteVirtual("calDataDecoded", m.GetCalDataDecoded()); _calDataDecodedErr != nil {
+			return errors.Wrap(_calDataDecodedErr, "Error serializing 'calDataDecoded' field")
+		}
 
 		if popErr := writeBuffer.PopContext("RequestDirectCommandAccess"); popErr != nil {
 			return errors.Wrap(popErr, "Error popping for RequestDirectCommandAccess")
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestObsolete.go b/plc4go/protocols/cbus/readwrite/model/RequestObsolete.go
index c212cebe6..060c82734 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestObsolete.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestObsolete.go
@@ -37,6 +37,8 @@ type RequestObsolete interface {
 	GetCalData() CALData
 	// GetAlpha returns Alpha (property field)
 	GetAlpha() Alpha
+	// GetCalDataDecoded returns CalDataDecoded (virtual field)
+	GetCalDataDecoded() CALData
 }
 
 // RequestObsoleteExactly can be used when we want exactly this type and not a type which fulfills RequestObsolete.
@@ -88,6 +90,21 @@ func (m *_RequestObsolete) GetAlpha() Alpha {
 	return m.Alpha
 }
 
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for virtual fields.
+///////////////////////
+
+func (m *_RequestObsolete) GetCalDataDecoded() CALData {
+	alpha := m.Alpha
+	_ = alpha
+	return CastCALData(m.GetCalData())
+}
+
 ///////////////////////
 ///////////////////////
 ///////////////////////////////////////////////////////////
@@ -129,6 +146,8 @@ func (m *_RequestObsolete) GetLengthInBitsConditional(lastItem bool) uint16 {
 	// Manual Field (calData)
 	lengthInBits += uint16(int32((int32(m.GetCalData().GetLengthInBytes()) * int32(int32(2)))) * int32(int32(8)))
 
+	// A virtual field doesn't have any in- or output.
+
 	// Optional Field (alpha)
 	if m.Alpha != nil {
 		lengthInBits += m.Alpha.GetLengthInBits()
@@ -160,6 +179,11 @@ func RequestObsoleteParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions)
 		calData = _calData.(CALData)
 	}
 
+	// Virtual field
+	_calDataDecoded := calData
+	calDataDecoded := _calDataDecoded
+	_ = calDataDecoded
+
 	// Optional Field (alpha) (Can be skipped, if a given expression evaluates to false)
 	var alpha Alpha = nil
 	{
@@ -211,6 +235,10 @@ func (m *_RequestObsolete) Serialize(writeBuffer utils.WriteBuffer) error {
 		if _calDataErr != nil {
 			return errors.Wrap(_calDataErr, "Error serializing 'calData' field")
 		}
+		// Virtual field
+		if _calDataDecodedErr := writeBuffer.WriteVirtual("calDataDecoded", m.GetCalDataDecoded()); _calDataDecodedErr != nil {
+			return errors.Wrap(_calDataDecodedErr, "Error serializing 'calDataDecoded' field")
+		}
 
 		// Optional Field (alpha) (Can be skipped, if the value is null)
 		var alpha Alpha = nil
diff --git a/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec b/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
index 8acd7efbd..c50b41542 100644
--- a/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
+++ b/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
@@ -85,6 +85,8 @@
                         'STATIC_CALL("readCALData", readBuffer)'
                         'STATIC_CALL("writeCALData", writeBuffer, calData)'
                         '(calData.lengthInBytes*2)*8'                       ]
+            [virtual  CALData
+                              calDataDecoded 'calData'                      ]
         ]
         ['REQUEST_COMMAND' *Command
             [const    byte  initiator 0x5C                                  ] // 0x5C == "/"
@@ -93,11 +95,15 @@
                         'STATIC_CALL("readCBusCommand", readBuffer, cBusOptions, cBusOptions.srchk)'
                         'STATIC_CALL("writeCBusCommand", writeBuffer, cbusCommand)'
                         '(cbusCommand.lengthInBytes*2)*8'                   ]
+            [virtual  CBusCommand
+                              cbusCommandDecoded 'cbusCommand'              ]
             [manual   Checksum
                               chksum
                         'STATIC_CALL("readAndValidateChecksum", readBuffer, cbusCommand, cBusOptions.srchk)'
                         'STATIC_CALL("calculateChecksum", writeBuffer, cbusCommand, cBusOptions.srchk)'
                         '(cBusOptions.srchk)?(16):(0)'                      ]
+            [virtual  Checksum
+                              chksumDecoded 'chksum'                        ]
             [optional Alpha         alpha                                   ]
         ]
         ['NULL' *Null
@@ -112,6 +118,8 @@
                         'STATIC_CALL("readCALData", readBuffer)'
                         'STATIC_CALL("writeCALData", writeBuffer, calData)'
                         '(calData.lengthInBytes*2)*8'                       ]
+            [virtual  CALData
+                              calDataDecoded 'calData'                      ]
             [optional Alpha   alpha                                         ]
         ]
     ]
@@ -1446,25 +1454,29 @@
     [peek    byte peekedByte                                                                ]
     [typeSwitch peekedByte
         ['0x2B' PowerUpReply // is a +
-            [simple PowerUp isA]
+            [simple PowerUp powerUpIndicator                                ]
         ]
         ['0x3D' ParameterChangeReply // is a =
-            [simple ParameterChange isA                 ]
+            [simple ParameterChange parameterChange                         ]
         ]
         ['0x21' ServerErrorReply // is a !
-            [const  byte    errorMarker     0x21        ]
+            [const  byte    errorMarker     0x21                            ]
         ]
         [*      *EncodedReply
             [manual   EncodedReply
                               encodedReply
                                     'STATIC_CALL("readEncodedReply", readBuffer, cBusOptions, requestContext, cBusOptions.srchk)'
                                     'STATIC_CALL("writeEncodedReply", writeBuffer, encodedReply)'
-                                    '(encodedReply.lengthInBytes*2)*8'                                   ]
+                                    '(encodedReply.lengthInBytes*2)*8'      ]
+            [virtual  EncodedReply
+                              encodedReplyDecoded 'encodedReply'            ]
             [manual   Checksum
                               chksum
                         'STATIC_CALL("readAndValidateChecksum", readBuffer, encodedReply, cBusOptions.srchk)'
                         'STATIC_CALL("calculateChecksum", writeBuffer, encodedReply, cBusOptions.srchk)'
-                        '(cBusOptions.srchk)?(16):(0)'        ]
+                        '(cBusOptions.srchk)?(16):(0)'                      ]
+            [virtual  Checksum
+                              chksumDecoded 'chksum'                        ]
         ]
     ]
 ]


[plc4x] 01/03: fix(spi): WriteBufferBoxBased should not switch out writer for sub

Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 35c2e26940a126bdc94c7e5f343a7e601fe4443e
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Aug 8 10:50:19 2022 +0200

    fix(spi): WriteBufferBoxBased should not switch out writer for sub
    
    The TLP box is in the right boxing anyway. So this avoids totally messed up sub boxes
---
 plc4go/internal/spi/utils/WriteBufferBoxBased.go                        | 1 -
 .../java/org/apache/plc4x/java/spi/generation/WriteBufferBoxBased.java  | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/plc4go/internal/spi/utils/WriteBufferBoxBased.go b/plc4go/internal/spi/utils/WriteBufferBoxBased.go
index 80e1a2d36..14b579440 100644
--- a/plc4go/internal/spi/utils/WriteBufferBoxBased.go
+++ b/plc4go/internal/spi/utils/WriteBufferBoxBased.go
@@ -223,7 +223,6 @@ func (b *boxedWriteBuffer) WriteVirtual(logicalName string, value interface{}, w
 		asciiBox = b.asciiBoxWriterLight.BoxString(logicalName, fmt.Sprintf("%x %f%s", value, value, additionalStringRepresentation), 0)
 	case Serializable:
 		virtualBoxedWriteBuffer := NewBoxedWriteBuffer()
-		virtualBoxedWriteBuffer.(*boxedWriteBuffer).asciiBoxWriter = AsciiBoxWriterLight
 		if err := value.(Serializable).Serialize(virtualBoxedWriteBuffer); err == nil {
 			asciiBox = b.asciiBoxWriterLight.BoxBox(logicalName, virtualBoxedWriteBuffer.GetBox(), 0)
 		} else {
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/WriteBufferBoxBased.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/WriteBufferBoxBased.java
index 397a93406..96a5e9d1b 100644
--- a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/WriteBufferBoxBased.java
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/generation/WriteBufferBoxBased.java
@@ -228,7 +228,7 @@ public class WriteBufferBoxBased implements WriteBuffer, BufferCommons {
         } else if (value instanceof Serializable) {
             Serializable serializable = (Serializable) value;
             try {
-                WriteBufferBoxBased writeBuffer = new WriteBufferBoxBased(asciiBoxWriterLight, asciiBoxWriterLight, true, true);
+                WriteBufferBoxBased writeBuffer = new WriteBufferBoxBased(true, true);
                 serializable.serialize(writeBuffer);
                 virtualBox = asciiBoxWriterLight.boxBox(logicalName, writeBuffer.getBox(), 0);
             } catch (SerializationException e) {