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:46 UTC

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

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'                        ]
         ]
     ]
 ]