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/07/01 15:44:29 UTC

[plc4x] branch develop updated: feat(c-bus): minor changes on c-bus

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


The following commit(s) were added to refs/heads/develop by this push:
     new 6576810a9 feat(c-bus): minor changes on c-bus
6576810a9 is described below

commit 6576810a9f99b438c978ff64cf99d4901bc73253
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri Jul 1 17:44:22 2022 +0200

    feat(c-bus): minor changes on c-bus
---
 .../protocols/cbus/readwrite/model/CBusCommand.go  |  35 ----
 .../cbus/readwrite/model/ExclamationMark.go        | 123 -------------
 .../cbus/readwrite/model/ExclamationMarkReply.go   | 201 ---------------------
 plc4go/protocols/cbus/readwrite/model/Reply.go     |  10 +-
 .../cbus/readwrite/model/RequestCommand.go         |  35 ++++
 .../apache/plc4x/java/cbus/RandomPackagesTest.java | 113 ++++++++++--
 .../src/main/resources/protocols/cbus/c-bus.mspec  |  18 +-
 7 files changed, 149 insertions(+), 386 deletions(-)

diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommand.go b/plc4go/protocols/cbus/readwrite/model/CBusCommand.go
index cdb75255f..eb94f8a9b 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusCommand.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusCommand.go
@@ -20,16 +20,12 @@
 package model
 
 import (
-	"fmt"
 	"github.com/apache/plc4x/plc4go/internal/spi/utils"
 	"github.com/pkg/errors"
 )
 
 // Code generated by code-generation. DO NOT EDIT.
 
-// Constant values.
-const CBusCommand_INITIATOR byte = 0x5C
-
 // CBusCommand is the corresponding interface of CBusCommand
 type CBusCommand interface {
 	utils.LengthAware
@@ -104,19 +100,6 @@ func (m *_CBusCommand) GetDestinationAddressType() DestinationAddressType {
 	return CastDestinationAddressType(m.GetHeader().GetDestinationAddressType())
 }
 
-///////////////////////
-///////////////////////
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-/////////////////////// Accessors for const fields.
-///////////////////////
-
-func (m *_CBusCommand) GetInitiator() byte {
-	return CBusCommand_INITIATOR
-}
-
 ///////////////////////
 ///////////////////////
 ///////////////////////////////////////////////////////////
@@ -145,9 +128,6 @@ func (m *_CBusCommand) GetTypeName() string {
 func (m *_CBusCommand) GetParentLengthInBits() uint16 {
 	lengthInBits := uint16(0)
 
-	// Const Field (initiator)
-	lengthInBits += 8
-
 	// Simple field (header)
 	lengthInBits += m.Header.GetLengthInBits()
 
@@ -171,15 +151,6 @@ func CBusCommandParse(readBuffer utils.ReadBuffer, srchk bool) (CBusCommand, err
 	currentPos := positionAware.GetPos()
 	_ = currentPos
 
-	// Const Field (initiator)
-	initiator, _initiatorErr := readBuffer.ReadByte("initiator")
-	if _initiatorErr != nil {
-		return nil, errors.Wrap(_initiatorErr, "Error parsing 'initiator' field of CBusCommand")
-	}
-	if initiator != CBusCommand_INITIATOR {
-		return nil, errors.New("Expected constant value " + fmt.Sprintf("%d", CBusCommand_INITIATOR) + " but got " + fmt.Sprintf("%d", initiator))
-	}
-
 	// Simple Field (header)
 	if pullErr := readBuffer.PullContext("header"); pullErr != nil {
 		return nil, errors.Wrap(pullErr, "Error pulling for header")
@@ -248,12 +219,6 @@ func (pm *_CBusCommand) SerializeParent(writeBuffer utils.WriteBuffer, child CBu
 		return errors.Wrap(pushErr, "Error pushing for CBusCommand")
 	}
 
-	// Const Field (initiator)
-	_initiatorErr := writeBuffer.WriteByte("initiator", 0x5C)
-	if _initiatorErr != nil {
-		return errors.Wrap(_initiatorErr, "Error serializing 'initiator' field")
-	}
-
 	// Simple Field (header)
 	if pushErr := writeBuffer.PushContext("header"); pushErr != nil {
 		return errors.Wrap(pushErr, "Error pushing for header")
diff --git a/plc4go/protocols/cbus/readwrite/model/ExclamationMark.go b/plc4go/protocols/cbus/readwrite/model/ExclamationMark.go
deleted file mode 100644
index b69118208..000000000
--- a/plc4go/protocols/cbus/readwrite/model/ExclamationMark.go
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package model
-
-import (
-	"github.com/apache/plc4x/plc4go/internal/spi/utils"
-	"github.com/pkg/errors"
-)
-
-// Code generated by code-generation. DO NOT EDIT.
-
-// ExclamationMark is the corresponding interface of ExclamationMark
-type ExclamationMark interface {
-	utils.LengthAware
-	utils.Serializable
-}
-
-// ExclamationMarkExactly can be used when we want exactly this type and not a type which fulfills ExclamationMark.
-// This is useful for switch cases.
-type ExclamationMarkExactly interface {
-	ExclamationMark
-	isExclamationMark() bool
-}
-
-// _ExclamationMark is the data-structure of this message
-type _ExclamationMark struct {
-}
-
-// NewExclamationMark factory function for _ExclamationMark
-func NewExclamationMark() *_ExclamationMark {
-	return &_ExclamationMark{}
-}
-
-// Deprecated: use the interface for direct cast
-func CastExclamationMark(structType interface{}) ExclamationMark {
-	if casted, ok := structType.(ExclamationMark); ok {
-		return casted
-	}
-	if casted, ok := structType.(*ExclamationMark); ok {
-		return *casted
-	}
-	return nil
-}
-
-func (m *_ExclamationMark) GetTypeName() string {
-	return "ExclamationMark"
-}
-
-func (m *_ExclamationMark) GetLengthInBits() uint16 {
-	return m.GetLengthInBitsConditional(false)
-}
-
-func (m *_ExclamationMark) GetLengthInBitsConditional(lastItem bool) uint16 {
-	lengthInBits := uint16(0)
-
-	return lengthInBits
-}
-
-func (m *_ExclamationMark) GetLengthInBytes() uint16 {
-	return m.GetLengthInBits() / 8
-}
-
-func ExclamationMarkParse(readBuffer utils.ReadBuffer) (ExclamationMark, error) {
-	positionAware := readBuffer
-	_ = positionAware
-	if pullErr := readBuffer.PullContext("ExclamationMark"); pullErr != nil {
-		return nil, errors.Wrap(pullErr, "Error pulling for ExclamationMark")
-	}
-	currentPos := positionAware.GetPos()
-	_ = currentPos
-
-	if closeErr := readBuffer.CloseContext("ExclamationMark"); closeErr != nil {
-		return nil, errors.Wrap(closeErr, "Error closing for ExclamationMark")
-	}
-
-	// Create the instance
-	return NewExclamationMark(), nil
-}
-
-func (m *_ExclamationMark) Serialize(writeBuffer utils.WriteBuffer) error {
-	positionAware := writeBuffer
-	_ = positionAware
-	if pushErr := writeBuffer.PushContext("ExclamationMark"); pushErr != nil {
-		return errors.Wrap(pushErr, "Error pushing for ExclamationMark")
-	}
-
-	if popErr := writeBuffer.PopContext("ExclamationMark"); popErr != nil {
-		return errors.Wrap(popErr, "Error popping for ExclamationMark")
-	}
-	return nil
-}
-
-func (m *_ExclamationMark) isExclamationMark() bool {
-	return true
-}
-
-func (m *_ExclamationMark) String() string {
-	if m == nil {
-		return "<nil>"
-	}
-	writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true)
-	if err := writeBuffer.WriteSerializable(m); err != nil {
-		return err.Error()
-	}
-	return writeBuffer.GetBox().String()
-}
diff --git a/plc4go/protocols/cbus/readwrite/model/ExclamationMarkReply.go b/plc4go/protocols/cbus/readwrite/model/ExclamationMarkReply.go
deleted file mode 100644
index a12338842..000000000
--- a/plc4go/protocols/cbus/readwrite/model/ExclamationMarkReply.go
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package model
-
-import (
-	"github.com/apache/plc4x/plc4go/internal/spi/utils"
-	"github.com/pkg/errors"
-)
-
-// Code generated by code-generation. DO NOT EDIT.
-
-// ExclamationMarkReply is the corresponding interface of ExclamationMarkReply
-type ExclamationMarkReply interface {
-	utils.LengthAware
-	utils.Serializable
-	Reply
-	// GetIsA returns IsA (property field)
-	GetIsA() ExclamationMark
-}
-
-// ExclamationMarkReplyExactly can be used when we want exactly this type and not a type which fulfills ExclamationMarkReply.
-// This is useful for switch cases.
-type ExclamationMarkReplyExactly interface {
-	ExclamationMarkReply
-	isExclamationMarkReply() bool
-}
-
-// _ExclamationMarkReply is the data-structure of this message
-type _ExclamationMarkReply struct {
-	*_Reply
-	IsA ExclamationMark
-}
-
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-/////////////////////// Accessors for discriminator values.
-///////////////////////
-
-///////////////////////
-///////////////////////
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-
-func (m *_ExclamationMarkReply) InitializeParent(parent Reply, peekedByte byte) {
-	m.PeekedByte = peekedByte
-}
-
-func (m *_ExclamationMarkReply) GetParent() Reply {
-	return m._Reply
-}
-
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-/////////////////////// Accessors for property fields.
-///////////////////////
-
-func (m *_ExclamationMarkReply) GetIsA() ExclamationMark {
-	return m.IsA
-}
-
-///////////////////////
-///////////////////////
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-
-// NewExclamationMarkReply factory function for _ExclamationMarkReply
-func NewExclamationMarkReply(isA ExclamationMark, peekedByte byte) *_ExclamationMarkReply {
-	_result := &_ExclamationMarkReply{
-		IsA:    isA,
-		_Reply: NewReply(peekedByte),
-	}
-	_result._Reply._ReplyChildRequirements = _result
-	return _result
-}
-
-// Deprecated: use the interface for direct cast
-func CastExclamationMarkReply(structType interface{}) ExclamationMarkReply {
-	if casted, ok := structType.(ExclamationMarkReply); ok {
-		return casted
-	}
-	if casted, ok := structType.(*ExclamationMarkReply); ok {
-		return *casted
-	}
-	return nil
-}
-
-func (m *_ExclamationMarkReply) GetTypeName() string {
-	return "ExclamationMarkReply"
-}
-
-func (m *_ExclamationMarkReply) GetLengthInBits() uint16 {
-	return m.GetLengthInBitsConditional(false)
-}
-
-func (m *_ExclamationMarkReply) GetLengthInBitsConditional(lastItem bool) uint16 {
-	lengthInBits := uint16(m.GetParentLengthInBits())
-
-	// Simple field (isA)
-	lengthInBits += m.IsA.GetLengthInBits()
-
-	return lengthInBits
-}
-
-func (m *_ExclamationMarkReply) GetLengthInBytes() uint16 {
-	return m.GetLengthInBits() / 8
-}
-
-func ExclamationMarkReplyParse(readBuffer utils.ReadBuffer) (ExclamationMarkReply, error) {
-	positionAware := readBuffer
-	_ = positionAware
-	if pullErr := readBuffer.PullContext("ExclamationMarkReply"); pullErr != nil {
-		return nil, errors.Wrap(pullErr, "Error pulling for ExclamationMarkReply")
-	}
-	currentPos := positionAware.GetPos()
-	_ = currentPos
-
-	// Simple Field (isA)
-	if pullErr := readBuffer.PullContext("isA"); pullErr != nil {
-		return nil, errors.Wrap(pullErr, "Error pulling for isA")
-	}
-	_isA, _isAErr := ExclamationMarkParse(readBuffer)
-	if _isAErr != nil {
-		return nil, errors.Wrap(_isAErr, "Error parsing 'isA' field")
-	}
-	isA := _isA.(ExclamationMark)
-	if closeErr := readBuffer.CloseContext("isA"); closeErr != nil {
-		return nil, errors.Wrap(closeErr, "Error closing for isA")
-	}
-
-	if closeErr := readBuffer.CloseContext("ExclamationMarkReply"); closeErr != nil {
-		return nil, errors.Wrap(closeErr, "Error closing for ExclamationMarkReply")
-	}
-
-	// Create a partially initialized instance
-	_child := &_ExclamationMarkReply{
-		IsA:    isA,
-		_Reply: &_Reply{},
-	}
-	_child._Reply._ReplyChildRequirements = _child
-	return _child, nil
-}
-
-func (m *_ExclamationMarkReply) Serialize(writeBuffer utils.WriteBuffer) error {
-	positionAware := writeBuffer
-	_ = positionAware
-	ser := func() error {
-		if pushErr := writeBuffer.PushContext("ExclamationMarkReply"); pushErr != nil {
-			return errors.Wrap(pushErr, "Error pushing for ExclamationMarkReply")
-		}
-
-		// Simple Field (isA)
-		if pushErr := writeBuffer.PushContext("isA"); pushErr != nil {
-			return errors.Wrap(pushErr, "Error pushing for isA")
-		}
-		_isAErr := writeBuffer.WriteSerializable(m.GetIsA())
-		if popErr := writeBuffer.PopContext("isA"); popErr != nil {
-			return errors.Wrap(popErr, "Error popping for isA")
-		}
-		if _isAErr != nil {
-			return errors.Wrap(_isAErr, "Error serializing 'isA' field")
-		}
-
-		if popErr := writeBuffer.PopContext("ExclamationMarkReply"); popErr != nil {
-			return errors.Wrap(popErr, "Error popping for ExclamationMarkReply")
-		}
-		return nil
-	}
-	return m.SerializeParent(writeBuffer, m, ser)
-}
-
-func (m *_ExclamationMarkReply) isExclamationMarkReply() bool {
-	return true
-}
-
-func (m *_ExclamationMarkReply) String() string {
-	if m == nil {
-		return "<nil>"
-	}
-	writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true)
-	if err := writeBuffer.WriteSerializable(m); err != nil {
-		return err.Error()
-	}
-	return writeBuffer.GetBox().String()
-}
diff --git a/plc4go/protocols/cbus/readwrite/model/Reply.go b/plc4go/protocols/cbus/readwrite/model/Reply.go
index e2bb5fd2d..911aebef7 100644
--- a/plc4go/protocols/cbus/readwrite/model/Reply.go
+++ b/plc4go/protocols/cbus/readwrite/model/Reply.go
@@ -161,18 +161,18 @@ func ReplyParse(readBuffer utils.ReadBuffer) (Reply, error) {
 	var _child ReplyChildSerializeRequirement
 	var typeSwitchError error
 	switch {
-	case peekedByte == 0x0: // CALReplyReply
-		_childTemp, typeSwitchError = CALReplyReplyParse(readBuffer)
-	case peekedByte == 0x0: // MonitoredSALReply
-		_childTemp, typeSwitchError = MonitoredSALReplyParse(readBuffer)
 	case true && isAlpha == bool(true): // ConfirmationReply
 		_childTemp, typeSwitchError = ConfirmationReplyParse(readBuffer)
 	case peekedByte == 0x2B: // PowerUpReply
 		_childTemp, typeSwitchError = PowerUpReplyParse(readBuffer)
-	case peekedByte == 0x0: // ParameterChangeReply
+	case peekedByte == 0x3D: // ParameterChangeReply
 		_childTemp, typeSwitchError = ParameterChangeReplyParse(readBuffer)
 	case peekedByte == 0x21: // ServerErrorReply
 		_childTemp, typeSwitchError = ServerErrorReplyParse(readBuffer)
+	case peekedByte == 0x0: // MonitoredSALReply
+		_childTemp, typeSwitchError = MonitoredSALReplyParse(readBuffer)
+	case true: // CALReplyReply
+		_childTemp, typeSwitchError = CALReplyReplyParse(readBuffer)
 	default:
 		typeSwitchError = errors.Errorf("Unmapped type for parameters [peekedByte=%v, isAlpha=%v]", peekedByte, isAlpha)
 	}
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestCommand.go b/plc4go/protocols/cbus/readwrite/model/RequestCommand.go
index be53113ca..404bc6c01 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestCommand.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestCommand.go
@@ -20,12 +20,16 @@
 package model
 
 import (
+	"fmt"
 	"github.com/apache/plc4x/plc4go/internal/spi/utils"
 	"github.com/pkg/errors"
 )
 
 // Code generated by code-generation. DO NOT EDIT.
 
+// Constant values.
+const RequestCommand_INITIATOR byte = 0x5C
+
 // RequestCommand is the corresponding interface of RequestCommand
 type RequestCommand interface {
 	utils.LengthAware
@@ -75,6 +79,19 @@ func (m *_RequestCommand) GetCbusCommand() CBusCommand {
 	return m.CbusCommand
 }
 
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for const fields.
+///////////////////////
+
+func (m *_RequestCommand) GetInitiator() byte {
+	return RequestCommand_INITIATOR
+}
+
 ///////////////////////
 ///////////////////////
 ///////////////////////////////////////////////////////////
@@ -112,6 +129,9 @@ func (m *_RequestCommand) GetLengthInBits() uint16 {
 func (m *_RequestCommand) GetLengthInBitsConditional(lastItem bool) uint16 {
 	lengthInBits := uint16(m.GetParentLengthInBits())
 
+	// Const Field (initiator)
+	lengthInBits += 8
+
 	// Simple field (cbusCommand)
 	lengthInBits += m.CbusCommand.GetLengthInBits()
 
@@ -131,6 +151,15 @@ func RequestCommandParse(readBuffer utils.ReadBuffer, srchk bool) (RequestComman
 	currentPos := positionAware.GetPos()
 	_ = currentPos
 
+	// Const Field (initiator)
+	initiator, _initiatorErr := readBuffer.ReadByte("initiator")
+	if _initiatorErr != nil {
+		return nil, errors.Wrap(_initiatorErr, "Error parsing 'initiator' field of RequestCommand")
+	}
+	if initiator != RequestCommand_INITIATOR {
+		return nil, errors.New("Expected constant value " + fmt.Sprintf("%d", RequestCommand_INITIATOR) + " but got " + fmt.Sprintf("%d", initiator))
+	}
+
 	// Simple Field (cbusCommand)
 	if pullErr := readBuffer.PullContext("cbusCommand"); pullErr != nil {
 		return nil, errors.Wrap(pullErr, "Error pulling for cbusCommand")
@@ -167,6 +196,12 @@ func (m *_RequestCommand) Serialize(writeBuffer utils.WriteBuffer) error {
 			return errors.Wrap(pushErr, "Error pushing for RequestCommand")
 		}
 
+		// Const Field (initiator)
+		_initiatorErr := writeBuffer.WriteByte("initiator", 0x5C)
+		if _initiatorErr != nil {
+			return errors.Wrap(_initiatorErr, "Error serializing 'initiator' field")
+		}
+
 		// Simple Field (cbusCommand)
 		if pushErr := writeBuffer.PushContext("cbusCommand"); pushErr != nil {
 			return errors.Wrap(pushErr, "Error pushing for cbusCommand")
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 74eb1b448..c73bf2e9b 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
@@ -25,6 +25,8 @@ import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Nested;
 import org.junit.jupiter.api.Test;
 
+import java.nio.charset.StandardCharsets;
+
 import static org.assertj.core.api.Assertions.assertThat;
 
 public class RandomPackagesTest {
@@ -33,6 +35,10 @@ public class RandomPackagesTest {
     static final String CR = "0D";
     static final String LF = "0A";
 
+    static final String TILDE = "7E";
+
+    static final String AT = "40";
+
     // from: https://updates.clipsal.com/ClipsalSoftwareDownload/DL/downloads/OpenCBus/Serial%20Interface%20User%20Guide.pdf
     @Nested
     class ReferenceDocumentationTest {
@@ -41,7 +47,7 @@ public class RandomPackagesTest {
         void pointToPointCommandDirect() throws Exception {
             byte[] bytes = Hex.decodeHex(BACKSLASH + "0603002102D4" + CR + LF);
             ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
-            CBusCommand msg = CBusCommand.staticParse(readBufferByteBased, true);
+            CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
             assertThat(msg)
                 .isNotNull();
             System.out.println(msg);
@@ -52,7 +58,7 @@ public class RandomPackagesTest {
         void pointToPointCommandBridged() throws Exception {
             byte[] bytes = Hex.decodeHex(BACKSLASH + "06420903210289" + CR + LF);
             ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
-            CBusCommand msg = CBusCommand.staticParse(readBufferByteBased, true);
+            CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
             assertThat(msg)
                 .isNotNull();
             System.out.println(msg);
@@ -63,7 +69,7 @@ public class RandomPackagesTest {
         void pointToMultiPointCommandDirect() throws Exception {
             byte[] bytes = Hex.decodeHex(BACKSLASH + "0538000108BA" + CR + LF);
             ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
-            CBusCommand msg = CBusCommand.staticParse(readBufferByteBased, true);
+            CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
             assertThat(msg)
                 .isNotNull();
             System.out.println(msg);
@@ -74,7 +80,7 @@ public class RandomPackagesTest {
         void pointToMultiPointCommandBridged() throws Exception {
             byte[] bytes = Hex.decodeHex(BACKSLASH + "05FF007A38004A" + CR + LF);
             ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
-            CBusCommand msg = CBusCommand.staticParse(readBufferByteBased, true);
+            CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
             assertThat(msg)
                 .isNotNull();
             System.out.println(msg);
@@ -85,7 +91,7 @@ public class RandomPackagesTest {
         void pointToPointToMultiPointCommand2() throws Exception {
             byte[] bytes = Hex.decodeHex(BACKSLASH + "03420938010871" + CR + LF);
             ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
-            CBusCommand msg = CBusCommand.staticParse(readBufferByteBased, true);
+            CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
             assertThat(msg)
                 .isNotNull();
             System.out.println(msg);
@@ -96,7 +102,7 @@ public class RandomPackagesTest {
         void calRequest() throws Exception {
             byte[] bytes = Hex.decodeHex(BACKSLASH + "0605002102" + CR + LF);
             ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
-            CBusCommand msg = CBusCommand.staticParse(readBufferByteBased, false);
+            CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, false);
             assertThat(msg)
                 .isNotNull();
             System.out.println(msg);
@@ -199,7 +205,7 @@ public class RandomPackagesTest {
 
         // 9.1
         @Nested
-        class PointToMultipointComandsIntoLocalCBusNetwork {
+        class PointToMultiPointCommandsIntoLocalCBusNetwork {
             @Test
             void LightningOff() throws Exception {
                 // TODO: the section describes that on non smart mode the message doesn't have the last CR
@@ -226,7 +232,7 @@ public class RandomPackagesTest {
             @Test
             void LightningStatusReply1() throws Exception {
                 // TODO: the section describes that on non smart mode the message doesn't have the last CR
-                byte[] bytes = Hex.decodeHex("D83800A8AA02000000000000000000000000000000000000009C");
+                byte[] bytes = Hex.decodeHex("D83800A8AA02000000000000000000000000000000000000009C" + CR + LF);
                 ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true);
                 assertThat(msg)
@@ -238,7 +244,7 @@ public class RandomPackagesTest {
             @Test
             void LightningStatusReply2() throws Exception {
                 // TODO: the section describes that on non smart mode the message doesn't have the last CR
-                byte[] bytes = Hex.decodeHex("D838580000000000000000000000000000000000000000000098");
+                byte[] bytes = Hex.decodeHex("D838580000000000000000000000000000000000000000000098" + CR + LF);
                 ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true);
                 assertThat(msg)
@@ -250,7 +256,7 @@ public class RandomPackagesTest {
             @Test
             void LightningStatusReply3() throws Exception {
                 // TODO: the section describes that on non smart mode the message doesn't have the last CR
-                byte[] bytes = Hex.decodeHex("D638B0000000000000000000000000000000000000000042");
+                byte[] bytes = Hex.decodeHex("D638B0000000000000000000000000000000000000000042" + CR + LF);
                 ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true);
                 assertThat(msg)
@@ -262,7 +268,7 @@ public class RandomPackagesTest {
             @Test
             void LightningStatusReply4() throws Exception {
                 // TODO: the section describes that on non smart mode the message doesn't have the last CR
-                byte[] bytes = Hex.decodeHex("86999900F8003800A8AA0200000000000000000000000000000000000000C4");
+                byte[] bytes = Hex.decodeHex("86999900F8003800A8AA0200000000000000000000000000000000000000C4" + CR + LF);
                 ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true);
                 assertThat(msg)
@@ -270,11 +276,12 @@ public class RandomPackagesTest {
                 System.out.println(msg);
             }
 
+
             @Disabled("something is wrong here")
             @Test
             void LightningStatusReply5() throws Exception {
                 // TODO: the section describes that on non smart mode the message doesn't have the last CR
-                byte[] bytes = Hex.decodeHex("86999900F800385800000000000000000000000000000000000000000000C0");
+                byte[] bytes = Hex.decodeHex("86999900F800385800000000000000000000000000000000000000000000C0" + CR + LF);
                 ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true);
                 assertThat(msg)
@@ -286,7 +293,7 @@ public class RandomPackagesTest {
             @Test
             void LightningStatusReply6() throws Exception {
                 // TODO: the section describes that on non smart mode the message doesn't have the last CR
-                byte[] bytes = Hex.decodeHex("86999900F60038B000000000000000000000000000000000000000008F");
+                byte[] bytes = Hex.decodeHex("86999900F60038B000000000000000000000000000000000000000008F" + CR + LF);
                 ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
                 CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true);
                 assertThat(msg)
@@ -295,6 +302,84 @@ public class RandomPackagesTest {
             }
         }
 
+        // 9.2
+        @Nested
+        class PointToPointCommandsIntoLocalCBusNetwork {
+            @Test
+            void RecallCurrentValueOfParameter0x30onUnit0x04() throws Exception {
+                // TODO: the section describes that on non smart mode the message doesn't have the last CR
+                byte[] bytes = Hex.decodeHex(BACKSLASH + "0604001A3001AB" + CR);
+                ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+                CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
+                assertThat(msg)
+                    .isNotNull();
+                System.out.println(msg);
+            }
+
+            @Test
+            void Reply() throws Exception {
+                byte[] bytes = Hex.decodeHex("8604990082300328" + CR + LF);
+                ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+                CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true);
+                assertThat(msg)
+                    .isNotNull();
+                System.out.println(msg);
+            }
+
+        }
+
+        // 9.3
+        @Nested
+        class PointToMultiPointCommandsIntoaRemoteCBusNetwork {
+            @Test
+            void IssueLightningOf() throws Exception {
+                // TODO: the section describes that on non smart mode the message doesn't have the last CR
+                byte[] bytes = Hex.decodeHex(BACKSLASH + "03421B53643801149C" + CR);
+                ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+                CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
+                assertThat(msg)
+                    .isNotNull();
+                System.out.println(msg);
+            }
+
+            @Disabled("it is not clear if that is a request or reply... it fails in both variants")
+            @Test
+            void Reply() throws Exception {
+                byte[] bytes = Hex.decodeHex("0565380354432101148E" + CR + LF);
+                ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+                CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true);
+                assertThat(msg)
+                    .isNotNull();
+                System.out.println(msg);
+            }
+
+        }
+
+        // 9.4
+        @Disabled("no idea that is that here")
+        @Test
+        void SwitchMode() throws Exception {
+            // TODO: the section describes that on non smart mode the message doesn't have the last CR
+            byte[] bytes = Hex.decodeHex(/*TILDE +*/ AT + "A3300019" + CR);
+            ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+            CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
+            assertThat(msg)
+                .isNotNull();
+            System.out.println(msg);
+        }
+
+        // 9.5
+        @Disabled("no idea that is that here")
+        @Test
+        void MultipleCommands() throws Exception {
+            // TODO: the section describes that on non smart mode the message doesn't have the last CR
+            byte[] bytes = Hex.decodeHex(BACKSLASH + "05380001210122012301240A25010A2601D4" + CR);
+            ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+            CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
+            assertThat(msg)
+                .isNotNull();
+            System.out.println(msg);
+        }
     }
 
     @Nested
@@ -305,7 +390,7 @@ public class RandomPackagesTest {
         void pointToPointCommandDirect() throws Exception {
             byte[] bytes = Hex.decodeHex(BACKSLASH + "0538007902D4" + CR + LF);
             ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
-            CBusCommand msg = CBusCommand.staticParse(readBufferByteBased, true);
+            CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
             assertThat(msg)
                 .isNotNull();
             System.out.println(msg);
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 5e1fc2bf3..e9bdecfef 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
@@ -61,6 +61,7 @@
             [simple   RequestTermination  termination                       ]
         ]
         ['0x5C' *Command
+            [const    byte                initiator 0x5C                    ] // 0x5C == "/"
             [simple   CBusCommand('srchk')     cbusCommand                  ]
         ]
         ['0x6E' *Null
@@ -74,7 +75,6 @@
 ]
 
 [discriminatedType CBusCommand(bit srchk)
-    [const   byte       initiator 0x5C   ] // 0x5C == "/"
     [simple  CBusHeader header           ]
     [virtual bit        isDeviceManagement 'header.dp']
     // TODO: header.destinationAddressType could be used directly but for this we need source type resolving to work (WIP)
@@ -517,6 +517,8 @@
 
 [type CALData
     [simple  CALCommandTypeContainer commandTypeContainer                                   ]
+    //TODO: golang doesn't like checking for 0
+    //[validation 'commandTypeContainer!=null' "no command type could be found"               ]
     [virtual CALCommandType          commandType          'commandTypeContainer.commandType']
     [typeSwitch commandType
         ['RESET' CALDataRequestReset
@@ -882,24 +884,24 @@
     [peek    byte peekedByte                                              ]
     [virtual bit  isAlpha '(peekedByte >= 0x67) && (peekedByte <= 0x7A)'  ]
     [typeSwitch peekedByte, isAlpha
-        ['0x0' CALReplyReply
-            [simple CALReply isA]
-        ]
-        ['0x0' MonitoredSALReply
-            [simple MonitoredSAL isA]
-        ]
         [*, 'true' ConfirmationReply
             [simple Confirmation isA]
         ]
         ['0x2B' PowerUpReply
             [simple PowerUp isA]
         ]
-        ['0x0' ParameterChangeReply
+        ['0x3D' ParameterChangeReply
             [simple ParameterChange isA]
         ]
         ['0x21' ServerErrorReply
             [const  byte    errorMarker     0x21        ]
         ]
+        ['0x0' MonitoredSALReply
+            [simple MonitoredSAL isA]
+        ]
+        [* CALReplyReply
+            [simple CALReply isA]
+        ]
     ]
 ]