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/04 12:33:04 UTC
[plc4x] branch develop updated: fix(c-bus): fixed hex de- and encoding
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 512b6b051 fix(c-bus): fixed hex de- and encoding
512b6b051 is described below
commit 512b6b05185ee19c2a483ef0af8a3eb4945b31ab
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Jul 4 14:32:50 2022 +0200
fix(c-bus): fixed hex de- and encoding
---
plc4go/protocols/cbus/readwrite/ParserHelper.go | 18 +-
plc4go/protocols/cbus/readwrite/XmlParserHelper.go | 21 +-
plc4go/protocols/cbus/readwrite/model/CALReply.go | 49 +----
.../protocols/cbus/readwrite/model/CALReplyLong.go | 7 +-
.../cbus/readwrite/model/CALReplyReply.go | 87 +++++----
.../cbus/readwrite/model/CALReplyShort.go | 7 +-
.../CBusCommandPointToPointToMultiPointNormal.go | 7 +-
.../CBusCommandPointToPointToMultiPointStatus.go | 7 +-
.../protocols/cbus/readwrite/model/CBusMessage.go | 13 +-
.../cbus/readwrite/model/CBusMessageToClient.go | 11 +-
.../cbus/readwrite/model/CBusMessageToServer.go | 11 +-
.../model/CBusPointToMultiPointCommand.go | 45 +----
.../model/CBusPointToMultiPointCommandNormal.go | 7 +-
.../model/CBusPointToMultiPointCommandStatus.go | 7 +-
.../readwrite/model/CBusPointToPointCommand.go | 45 +----
.../model/CBusPointToPointCommandDirect.go | 7 +-
.../model/CBusPointToPointCommandIndirect.go | 7 +-
.../model/CBusPointToPointToMultipointCommand.go | 45 +----
.../cbus/readwrite/model/ConfirmationReply.go | 15 +-
.../readwrite/model/ExtendedFormatStatusReply.go | 41 +---
...Client.go => ExtendedFormatStatusReplyReply.go} | 105 +++++-----
.../protocols/cbus/readwrite/model/MonitoredSAL.go | 49 +----
.../model/MonitoredSALLongFormSmartMode.go | 7 +-
.../cbus/readwrite/model/MonitoredSALReply.go | 15 +-
.../model/MonitoredSALShortFormBasicMode.go | 7 +-
.../cbus/readwrite/model/ParameterChange.go | 50 +----
.../cbus/readwrite/model/ParameterChangeReply.go | 15 +-
plc4go/protocols/cbus/readwrite/model/PowerUp.go | 41 +---
.../protocols/cbus/readwrite/model/PowerUpReply.go | 15 +-
plc4go/protocols/cbus/readwrite/model/Reply.go | 68 +++++--
plc4go/protocols/cbus/readwrite/model/Request.go | 114 ++++++++---
.../cbus/readwrite/model/RequestCommand.go | 39 ++--
.../readwrite/model/RequestDirectCommandAccess.go | 84 ++------
.../protocols/cbus/readwrite/model/RequestEmpty.go | 59 +-----
.../protocols/cbus/readwrite/model/RequestNull.go | 58 +-----
.../protocols/cbus/readwrite/model/RequestReset.go | 58 +-----
.../readwrite/model/RequestSmartConnectShortcut.go | 58 +-----
.../protocols/cbus/readwrite/model/RequestType.go | 213 +++++++++++++++++++++
.../cbus/readwrite/model/ServerErrorReply.go | 13 +-
.../readwrite/model/StandardFormatStatusReply.go | 41 +---
...Client.go => StandardFormatStatusReplyReply.go} | 105 +++++-----
.../protocols/cbus/readwrite/model/StaticHelper.go | 81 ++++++++
.../internal/analyzer/analyzer.go | 5 +-
.../internal/cbusanalyzer/analyzer.go | 2 +-
.../java/cbus/readwrite/utils/StaticHelper.java | 68 +++++++
.../apache/plc4x/java/cbus/RandomPackagesTest.java | 126 ++++++------
.../src/main/resources/protocols/cbus/c-bus.mspec | 88 +++++----
47 files changed, 1018 insertions(+), 1023 deletions(-)
diff --git a/plc4go/protocols/cbus/readwrite/ParserHelper.go b/plc4go/protocols/cbus/readwrite/ParserHelper.go
index 7cfcc63d6..6f54dbc62 100644
--- a/plc4go/protocols/cbus/readwrite/ParserHelper.go
+++ b/plc4go/protocols/cbus/readwrite/ParserHelper.go
@@ -55,7 +55,11 @@ func (m CbusParserHelper) Parse(typeName string, arguments []string, io utils.Re
if err != nil {
return nil, errors.Wrap(err, "Error parsing")
}
- return model.CBusMessageParse(io, response, srchk)
+ messageLength, err := utils.StrToUint16(arguments[2])
+ if err != nil {
+ return nil, errors.Wrap(err, "Error parsing")
+ }
+ return model.CBusMessageParse(io, response, srchk, messageLength)
case "ResponseTermination":
return model.ResponseTerminationParse(io)
case "CBusOptions":
@@ -78,7 +82,11 @@ func (m CbusParserHelper) Parse(typeName string, arguments []string, io utils.Re
case "PowerUp":
return model.PowerUpParse(io)
case "Reply":
- return model.ReplyParse(io)
+ messageLength, err := utils.StrToUint16(arguments[0])
+ if err != nil {
+ return nil, errors.Wrap(err, "Error parsing")
+ }
+ return model.ReplyParse(io, messageLength)
case "SerialInterfaceAddress":
return model.SerialInterfaceAddressParse(io)
case "BridgeAddress":
@@ -120,7 +128,11 @@ func (m CbusParserHelper) Parse(typeName string, arguments []string, io utils.Re
if err != nil {
return nil, errors.Wrap(err, "Error parsing")
}
- return model.RequestParse(io, srchk)
+ messageLength, err := utils.StrToUint16(arguments[1])
+ if err != nil {
+ return nil, errors.Wrap(err, "Error parsing")
+ }
+ return model.RequestParse(io, srchk, messageLength)
case "CBusPointToPointCommand":
srchk, err := utils.StrToBool(arguments[0])
if err != nil {
diff --git a/plc4go/protocols/cbus/readwrite/XmlParserHelper.go b/plc4go/protocols/cbus/readwrite/XmlParserHelper.go
index 1100c917a..0ec5f9cec 100644
--- a/plc4go/protocols/cbus/readwrite/XmlParserHelper.go
+++ b/plc4go/protocols/cbus/readwrite/XmlParserHelper.go
@@ -59,7 +59,12 @@ func (m CbusXmlParserHelper) Parse(typeName string, xmlString string, parserArgu
case "CBusMessage":
response := parserArguments[0] == "true"
srchk := parserArguments[1] == "true"
- return model.CBusMessageParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), response, srchk)
+ parsedUint2, err := strconv.ParseUint(parserArguments[2], 10, 16)
+ if err != nil {
+ return nil, err
+ }
+ messageLength := uint16(parsedUint2)
+ return model.CBusMessageParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), response, srchk, messageLength)
case "ResponseTermination":
return model.ResponseTerminationParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "CBusOptions":
@@ -79,7 +84,12 @@ func (m CbusXmlParserHelper) Parse(typeName string, xmlString string, parserArgu
case "PowerUp":
return model.PowerUpParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "Reply":
- return model.ReplyParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
+ parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 16)
+ if err != nil {
+ return nil, err
+ }
+ messageLength := uint16(parsedUint0)
+ return model.ReplyParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), messageLength)
case "SerialInterfaceAddress":
return model.SerialInterfaceAddressParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "BridgeAddress":
@@ -115,7 +125,12 @@ func (m CbusXmlParserHelper) Parse(typeName string, xmlString string, parserArgu
return model.CBusHeaderParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "Request":
srchk := parserArguments[0] == "true"
- return model.RequestParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), srchk)
+ parsedUint1, err := strconv.ParseUint(parserArguments[1], 10, 16)
+ if err != nil {
+ return nil, err
+ }
+ messageLength := uint16(parsedUint1)
+ return model.RequestParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), srchk, messageLength)
case "CBusPointToPointCommand":
srchk := parserArguments[0] == "true"
return model.CBusPointToPointCommandParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), srchk)
diff --git a/plc4go/protocols/cbus/readwrite/model/CALReply.go b/plc4go/protocols/cbus/readwrite/model/CALReply.go
index 8aa95de1c..1c86422c7 100644
--- a/plc4go/protocols/cbus/readwrite/model/CALReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/CALReply.go
@@ -34,8 +34,6 @@ type CALReply interface {
GetCalType() byte
// GetCalData returns CalData (property field)
GetCalData() CALData
- // GetTermination returns Termination (property field)
- GetTermination() ResponseTermination
}
// CALReplyExactly can be used when we want exactly this type and not a type which fulfills CALReply.
@@ -48,9 +46,8 @@ type CALReplyExactly interface {
// _CALReply is the data-structure of this message
type _CALReply struct {
_CALReplyChildRequirements
- CalType byte
- CalData CALData
- Termination ResponseTermination
+ CalType byte
+ CalData CALData
}
type _CALReplyChildRequirements interface {
@@ -66,7 +63,7 @@ type CALReplyParent interface {
type CALReplyChild interface {
utils.Serializable
- InitializeParent(parent CALReply, calType byte, calData CALData, termination ResponseTermination)
+ InitializeParent(parent CALReply, calType byte, calData CALData)
GetParent() *CALReply
GetTypeName() string
@@ -86,18 +83,14 @@ func (m *_CALReply) GetCalData() CALData {
return m.CalData
}
-func (m *_CALReply) GetTermination() ResponseTermination {
- return m.Termination
-}
-
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// NewCALReply factory function for _CALReply
-func NewCALReply(calType byte, calData CALData, termination ResponseTermination) *_CALReply {
- return &_CALReply{CalType: calType, CalData: calData, Termination: termination}
+func NewCALReply(calType byte, calData CALData) *_CALReply {
+ return &_CALReply{CalType: calType, CalData: calData}
}
// Deprecated: use the interface for direct cast
@@ -121,9 +114,6 @@ func (m *_CALReply) GetParentLengthInBits() uint16 {
// Simple field (calData)
lengthInBits += m.CalData.GetLengthInBits()
- // Simple field (termination)
- lengthInBits += m.Termination.GetLengthInBits()
-
return lengthInBits
}
@@ -152,7 +142,7 @@ func CALReplyParse(readBuffer utils.ReadBuffer) (CALReply, error) {
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
type CALReplyChildSerializeRequirement interface {
CALReply
- InitializeParent(CALReply, byte, CALData, ResponseTermination)
+ InitializeParent(CALReply, byte, CALData)
GetParent() CALReply
}
var _childTemp interface{}
@@ -184,25 +174,12 @@ func CALReplyParse(readBuffer utils.ReadBuffer) (CALReply, error) {
return nil, errors.Wrap(closeErr, "Error closing for calData")
}
- // Simple Field (termination)
- if pullErr := readBuffer.PullContext("termination"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for termination")
- }
- _termination, _terminationErr := ResponseTerminationParse(readBuffer)
- if _terminationErr != nil {
- return nil, errors.Wrap(_terminationErr, "Error parsing 'termination' field of CALReply")
- }
- termination := _termination.(ResponseTermination)
- if closeErr := readBuffer.CloseContext("termination"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for termination")
- }
-
if closeErr := readBuffer.CloseContext("CALReply"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for CALReply")
}
// Finish initializing
- _child.InitializeParent(_child, calType, calData, termination)
+ _child.InitializeParent(_child, calType, calData)
return _child, nil
}
@@ -233,18 +210,6 @@ func (pm *_CALReply) SerializeParent(writeBuffer utils.WriteBuffer, child CALRep
return errors.Wrap(_calDataErr, "Error serializing 'calData' field")
}
- // Simple Field (termination)
- if pushErr := writeBuffer.PushContext("termination"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for termination")
- }
- _terminationErr := writeBuffer.WriteSerializable(m.GetTermination())
- if popErr := writeBuffer.PopContext("termination"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for termination")
- }
- if _terminationErr != nil {
- return errors.Wrap(_terminationErr, "Error serializing 'termination' field")
- }
-
if popErr := writeBuffer.PopContext("CALReply"); popErr != nil {
return errors.Wrap(popErr, "Error popping for CALReply")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/CALReplyLong.go b/plc4go/protocols/cbus/readwrite/model/CALReplyLong.go
index c0778e6b5..0f0fb4cd8 100644
--- a/plc4go/protocols/cbus/readwrite/model/CALReplyLong.go
+++ b/plc4go/protocols/cbus/readwrite/model/CALReplyLong.go
@@ -77,10 +77,9 @@ type _CALReplyLong struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_CALReplyLong) InitializeParent(parent CALReply, calType byte, calData CALData, termination ResponseTermination) {
+func (m *_CALReplyLong) InitializeParent(parent CALReply, calType byte, calData CALData) {
m.CalType = calType
m.CalData = calData
- m.Termination = termination
}
func (m *_CALReplyLong) GetParent() CALReply {
@@ -143,7 +142,7 @@ func (m *_CALReplyLong) GetIsUnitAddress() bool {
///////////////////////////////////////////////////////////
// NewCALReplyLong factory function for _CALReplyLong
-func NewCALReplyLong(terminatingByte uint32, unitAddress UnitAddress, bridgeAddress BridgeAddress, serialInterfaceAddress SerialInterfaceAddress, reservedByte *byte, replyNetwork ReplyNetwork, calType byte, calData CALData, termination ResponseTermination) *_CALReplyLong {
+func NewCALReplyLong(terminatingByte uint32, unitAddress UnitAddress, bridgeAddress BridgeAddress, serialInterfaceAddress SerialInterfaceAddress, reservedByte *byte, replyNetwork ReplyNetwork, calType byte, calData CALData) *_CALReplyLong {
_result := &_CALReplyLong{
TerminatingByte: terminatingByte,
UnitAddress: unitAddress,
@@ -151,7 +150,7 @@ func NewCALReplyLong(terminatingByte uint32, unitAddress UnitAddress, bridgeAddr
SerialInterfaceAddress: serialInterfaceAddress,
ReservedByte: reservedByte,
ReplyNetwork: replyNetwork,
- _CALReply: NewCALReply(calType, calData, termination),
+ _CALReply: NewCALReply(calType, calData),
}
_result._CALReply._CALReplyChildRequirements = _result
return _result
diff --git a/plc4go/protocols/cbus/readwrite/model/CALReplyReply.go b/plc4go/protocols/cbus/readwrite/model/CALReplyReply.go
index 140f00059..f9cea66fe 100644
--- a/plc4go/protocols/cbus/readwrite/model/CALReplyReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/CALReplyReply.go
@@ -31,8 +31,10 @@ type CALReplyReply interface {
utils.LengthAware
utils.Serializable
Reply
- // GetIsA returns IsA (property field)
- GetIsA() CALReply
+ // GetCalReply returns CalReply (property field)
+ GetCalReply() CALReply
+ // GetPayloadLength returns PayloadLength (virtual field)
+ GetPayloadLength() uint16
}
// CALReplyReplyExactly can be used when we want exactly this type and not a type which fulfills CALReplyReply.
@@ -45,7 +47,7 @@ type CALReplyReplyExactly interface {
// _CALReplyReply is the data-structure of this message
type _CALReplyReply struct {
*_Reply
- IsA CALReply
+ CalReply CALReply
}
///////////////////////////////////////////////////////////
@@ -58,8 +60,9 @@ type _CALReplyReply struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_CALReplyReply) InitializeParent(parent Reply, peekedByte byte) {
+func (m *_CALReplyReply) InitializeParent(parent Reply, peekedByte byte, termination ResponseTermination) {
m.PeekedByte = peekedByte
+ m.Termination = termination
}
func (m *_CALReplyReply) GetParent() Reply {
@@ -71,8 +74,21 @@ func (m *_CALReplyReply) GetParent() Reply {
/////////////////////// Accessors for property fields.
///////////////////////
-func (m *_CALReplyReply) GetIsA() CALReply {
- return m.IsA
+func (m *_CALReplyReply) GetCalReply() CALReply {
+ return m.CalReply
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for virtual fields.
+///////////////////////
+
+func (m *_CALReplyReply) GetPayloadLength() uint16 {
+ return uint16(uint16(m.MessageLength) - uint16(uint16(2)))
}
///////////////////////
@@ -81,10 +97,10 @@ func (m *_CALReplyReply) GetIsA() CALReply {
///////////////////////////////////////////////////////////
// NewCALReplyReply factory function for _CALReplyReply
-func NewCALReplyReply(isA CALReply, peekedByte byte) *_CALReplyReply {
+func NewCALReplyReply(calReply CALReply, peekedByte byte, termination ResponseTermination, messageLength uint16) *_CALReplyReply {
_result := &_CALReplyReply{
- IsA: isA,
- _Reply: NewReply(peekedByte),
+ CalReply: calReply,
+ _Reply: NewReply(peekedByte, termination, messageLength),
}
_result._Reply._ReplyChildRequirements = _result
return _result
@@ -112,8 +128,10 @@ func (m *_CALReplyReply) GetLengthInBits() uint16 {
func (m *_CALReplyReply) GetLengthInBitsConditional(lastItem bool) uint16 {
lengthInBits := uint16(m.GetParentLengthInBits())
- // Simple field (isA)
- lengthInBits += m.IsA.GetLengthInBits()
+ // A virtual field doesn't have any in- or output.
+
+ // Manual Field (calReply)
+ lengthInBits += uint16(int32(m.GetLengthInBytes()) * int32(int32(2)))
return lengthInBits
}
@@ -122,7 +140,7 @@ func (m *_CALReplyReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CALReplyReplyParse(readBuffer utils.ReadBuffer) (CALReplyReply, error) {
+func CALReplyReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (CALReplyReply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CALReplyReply"); pullErr != nil {
@@ -131,18 +149,17 @@ func CALReplyReplyParse(readBuffer utils.ReadBuffer) (CALReplyReply, error) {
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 := CALReplyParse(readBuffer)
- if _isAErr != nil {
- return nil, errors.Wrap(_isAErr, "Error parsing 'isA' field of CALReplyReply")
- }
- isA := _isA.(CALReply)
- if closeErr := readBuffer.CloseContext("isA"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for isA")
+ // Virtual field
+ _payloadLength := uint16(messageLength) - uint16(uint16(2))
+ payloadLength := uint16(_payloadLength)
+ _ = payloadLength
+
+ // Manual Field (calReply)
+ _calReply, _calReplyErr := ReadCALReply(readBuffer, payloadLength)
+ if _calReplyErr != nil {
+ return nil, errors.Wrap(_calReplyErr, "Error parsing 'calReply' field of CALReplyReply")
}
+ calReply := _calReply.(CALReply)
if closeErr := readBuffer.CloseContext("CALReplyReply"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for CALReplyReply")
@@ -150,8 +167,10 @@ func CALReplyReplyParse(readBuffer utils.ReadBuffer) (CALReplyReply, error) {
// Create a partially initialized instance
_child := &_CALReplyReply{
- IsA: isA,
- _Reply: &_Reply{},
+ CalReply: calReply,
+ _Reply: &_Reply{
+ MessageLength: messageLength,
+ },
}
_child._Reply._ReplyChildRequirements = _child
return _child, nil
@@ -164,17 +183,15 @@ func (m *_CALReplyReply) Serialize(writeBuffer utils.WriteBuffer) error {
if pushErr := writeBuffer.PushContext("CALReplyReply"); pushErr != nil {
return errors.Wrap(pushErr, "Error pushing for CALReplyReply")
}
-
- // 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")
+ // Virtual field
+ if _payloadLengthErr := writeBuffer.WriteVirtual("payloadLength", m.GetPayloadLength()); _payloadLengthErr != nil {
+ return errors.Wrap(_payloadLengthErr, "Error serializing 'payloadLength' field")
}
- if _isAErr != nil {
- return errors.Wrap(_isAErr, "Error serializing 'isA' field")
+
+ // Manual Field (calReply)
+ _calReplyErr := WriteCALReply(writeBuffer, m.GetCalReply())
+ if _calReplyErr != nil {
+ return errors.Wrap(_calReplyErr, "Error serializing 'calReply' field")
}
if popErr := writeBuffer.PopContext("CALReplyReply"); popErr != nil {
diff --git a/plc4go/protocols/cbus/readwrite/model/CALReplyShort.go b/plc4go/protocols/cbus/readwrite/model/CALReplyShort.go
index 57b8355b5..2aea990ba 100644
--- a/plc4go/protocols/cbus/readwrite/model/CALReplyShort.go
+++ b/plc4go/protocols/cbus/readwrite/model/CALReplyShort.go
@@ -55,10 +55,9 @@ type _CALReplyShort struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_CALReplyShort) InitializeParent(parent CALReply, calType byte, calData CALData, termination ResponseTermination) {
+func (m *_CALReplyShort) InitializeParent(parent CALReply, calType byte, calData CALData) {
m.CalType = calType
m.CalData = calData
- m.Termination = termination
}
func (m *_CALReplyShort) GetParent() CALReply {
@@ -66,9 +65,9 @@ func (m *_CALReplyShort) GetParent() CALReply {
}
// NewCALReplyShort factory function for _CALReplyShort
-func NewCALReplyShort(calType byte, calData CALData, termination ResponseTermination) *_CALReplyShort {
+func NewCALReplyShort(calType byte, calData CALData) *_CALReplyShort {
_result := &_CALReplyShort{
- _CALReply: NewCALReply(calType, calData, termination),
+ _CALReply: NewCALReply(calType, calData),
}
_result._CALReply._CALReplyChildRequirements = _result
return _result
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointNormal.go b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointNormal.go
index 23d8608b9..6875bcc3d 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointNormal.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointNormal.go
@@ -69,11 +69,10 @@ type _CBusCommandPointToPointToMultiPointNormal struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_CBusCommandPointToPointToMultiPointNormal) InitializeParent(parent CBusPointToPointToMultipointCommand, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, termination RequestTermination) {
+func (m *_CBusCommandPointToPointToMultiPointNormal) InitializeParent(parent CBusPointToPointToMultipointCommand, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte) {
m.BridgeAddress = bridgeAddress
m.NetworkRoute = networkRoute
m.PeekedApplication = peekedApplication
- m.Termination = termination
}
func (m *_CBusCommandPointToPointToMultiPointNormal) GetParent() CBusPointToPointToMultipointCommand {
@@ -107,13 +106,13 @@ func (m *_CBusCommandPointToPointToMultiPointNormal) GetAlpha() Alpha {
///////////////////////////////////////////////////////////
// NewCBusCommandPointToPointToMultiPointNormal factory function for _CBusCommandPointToPointToMultiPointNormal
-func NewCBusCommandPointToPointToMultiPointNormal(application ApplicationIdContainer, salData SALData, crc Checksum, alpha Alpha, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, termination RequestTermination, srchk bool) *_CBusCommandPointToPointToMultiPointNormal {
+func NewCBusCommandPointToPointToMultiPointNormal(application ApplicationIdContainer, salData SALData, crc Checksum, alpha Alpha, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, srchk bool) *_CBusCommandPointToPointToMultiPointNormal {
_result := &_CBusCommandPointToPointToMultiPointNormal{
Application: application,
SalData: salData,
Crc: crc,
Alpha: alpha,
- _CBusPointToPointToMultipointCommand: NewCBusPointToPointToMultipointCommand(bridgeAddress, networkRoute, peekedApplication, termination, srchk),
+ _CBusPointToPointToMultipointCommand: NewCBusPointToPointToMultipointCommand(bridgeAddress, networkRoute, peekedApplication, srchk),
}
_result._CBusPointToPointToMultipointCommand._CBusPointToPointToMultipointCommandChildRequirements = _result
return _result
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointStatus.go b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointStatus.go
index f544c3ce4..ac8f7d067 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointStatus.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointStatus.go
@@ -66,11 +66,10 @@ type _CBusCommandPointToPointToMultiPointStatus struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_CBusCommandPointToPointToMultiPointStatus) InitializeParent(parent CBusPointToPointToMultipointCommand, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, termination RequestTermination) {
+func (m *_CBusCommandPointToPointToMultiPointStatus) InitializeParent(parent CBusPointToPointToMultipointCommand, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte) {
m.BridgeAddress = bridgeAddress
m.NetworkRoute = networkRoute
m.PeekedApplication = peekedApplication
- m.Termination = termination
}
func (m *_CBusCommandPointToPointToMultiPointStatus) GetParent() CBusPointToPointToMultipointCommand {
@@ -100,12 +99,12 @@ func (m *_CBusCommandPointToPointToMultiPointStatus) GetAlpha() Alpha {
///////////////////////////////////////////////////////////
// NewCBusCommandPointToPointToMultiPointStatus factory function for _CBusCommandPointToPointToMultiPointStatus
-func NewCBusCommandPointToPointToMultiPointStatus(statusRequest StatusRequest, crc Checksum, alpha Alpha, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, termination RequestTermination, srchk bool) *_CBusCommandPointToPointToMultiPointStatus {
+func NewCBusCommandPointToPointToMultiPointStatus(statusRequest StatusRequest, crc Checksum, alpha Alpha, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, srchk bool) *_CBusCommandPointToPointToMultiPointStatus {
_result := &_CBusCommandPointToPointToMultiPointStatus{
StatusRequest: statusRequest,
Crc: crc,
Alpha: alpha,
- _CBusPointToPointToMultipointCommand: NewCBusPointToPointToMultipointCommand(bridgeAddress, networkRoute, peekedApplication, termination, srchk),
+ _CBusPointToPointToMultipointCommand: NewCBusPointToPointToMultipointCommand(bridgeAddress, networkRoute, peekedApplication, srchk),
}
_result._CBusPointToPointToMultipointCommand._CBusPointToPointToMultipointCommandChildRequirements = _result
return _result
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusMessage.go b/plc4go/protocols/cbus/readwrite/model/CBusMessage.go
index 49e017a89..baa5ceebf 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusMessage.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusMessage.go
@@ -46,7 +46,8 @@ type _CBusMessage struct {
_CBusMessageChildRequirements
// Arguments.
- Srchk bool
+ Srchk bool
+ MessageLength uint16
}
type _CBusMessageChildRequirements interface {
@@ -71,8 +72,8 @@ type CBusMessageChild interface {
}
// NewCBusMessage factory function for _CBusMessage
-func NewCBusMessage(srchk bool) *_CBusMessage {
- return &_CBusMessage{Srchk: srchk}
+func NewCBusMessage(srchk bool, messageLength uint16) *_CBusMessage {
+ return &_CBusMessage{Srchk: srchk, MessageLength: messageLength}
}
// Deprecated: use the interface for direct cast
@@ -100,7 +101,7 @@ func (m *_CBusMessage) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusMessageParse(readBuffer utils.ReadBuffer, response bool, srchk bool) (CBusMessage, error) {
+func CBusMessageParse(readBuffer utils.ReadBuffer, response bool, srchk bool, messageLength uint16) (CBusMessage, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CBusMessage"); pullErr != nil {
@@ -120,9 +121,9 @@ func CBusMessageParse(readBuffer utils.ReadBuffer, response bool, srchk bool) (C
var typeSwitchError error
switch {
case response == bool(false): // CBusMessageToServer
- _childTemp, typeSwitchError = CBusMessageToServerParse(readBuffer, response, srchk)
+ _childTemp, typeSwitchError = CBusMessageToServerParse(readBuffer, response, srchk, messageLength)
case response == bool(true): // CBusMessageToClient
- _childTemp, typeSwitchError = CBusMessageToClientParse(readBuffer, response, srchk)
+ _childTemp, typeSwitchError = CBusMessageToClientParse(readBuffer, response, srchk, messageLength)
default:
typeSwitchError = errors.Errorf("Unmapped type for parameters [response=%v]", response)
}
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusMessageToClient.go b/plc4go/protocols/cbus/readwrite/model/CBusMessageToClient.go
index 29bc0f490..8f130ea18 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusMessageToClient.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusMessageToClient.go
@@ -83,10 +83,10 @@ func (m *_CBusMessageToClient) GetReply() Reply {
///////////////////////////////////////////////////////////
// NewCBusMessageToClient factory function for _CBusMessageToClient
-func NewCBusMessageToClient(reply Reply, srchk bool) *_CBusMessageToClient {
+func NewCBusMessageToClient(reply Reply, srchk bool, messageLength uint16) *_CBusMessageToClient {
_result := &_CBusMessageToClient{
Reply: reply,
- _CBusMessage: NewCBusMessage(srchk),
+ _CBusMessage: NewCBusMessage(srchk, messageLength),
}
_result._CBusMessage._CBusMessageChildRequirements = _result
return _result
@@ -124,7 +124,7 @@ func (m *_CBusMessageToClient) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusMessageToClientParse(readBuffer utils.ReadBuffer, response bool, srchk bool) (CBusMessageToClient, error) {
+func CBusMessageToClientParse(readBuffer utils.ReadBuffer, response bool, srchk bool, messageLength uint16) (CBusMessageToClient, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CBusMessageToClient"); pullErr != nil {
@@ -137,7 +137,7 @@ func CBusMessageToClientParse(readBuffer utils.ReadBuffer, response bool, srchk
if pullErr := readBuffer.PullContext("reply"); pullErr != nil {
return nil, errors.Wrap(pullErr, "Error pulling for reply")
}
- _reply, _replyErr := ReplyParse(readBuffer)
+ _reply, _replyErr := ReplyParse(readBuffer, uint16(messageLength))
if _replyErr != nil {
return nil, errors.Wrap(_replyErr, "Error parsing 'reply' field of CBusMessageToClient")
}
@@ -154,7 +154,8 @@ func CBusMessageToClientParse(readBuffer utils.ReadBuffer, response bool, srchk
_child := &_CBusMessageToClient{
Reply: reply,
_CBusMessage: &_CBusMessage{
- Srchk: srchk,
+ Srchk: srchk,
+ MessageLength: messageLength,
},
}
_child._CBusMessage._CBusMessageChildRequirements = _child
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusMessageToServer.go b/plc4go/protocols/cbus/readwrite/model/CBusMessageToServer.go
index 1624b455b..4bad9d587 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusMessageToServer.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusMessageToServer.go
@@ -83,10 +83,10 @@ func (m *_CBusMessageToServer) GetRequest() Request {
///////////////////////////////////////////////////////////
// NewCBusMessageToServer factory function for _CBusMessageToServer
-func NewCBusMessageToServer(request Request, srchk bool) *_CBusMessageToServer {
+func NewCBusMessageToServer(request Request, srchk bool, messageLength uint16) *_CBusMessageToServer {
_result := &_CBusMessageToServer{
Request: request,
- _CBusMessage: NewCBusMessage(srchk),
+ _CBusMessage: NewCBusMessage(srchk, messageLength),
}
_result._CBusMessage._CBusMessageChildRequirements = _result
return _result
@@ -124,7 +124,7 @@ func (m *_CBusMessageToServer) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusMessageToServerParse(readBuffer utils.ReadBuffer, response bool, srchk bool) (CBusMessageToServer, error) {
+func CBusMessageToServerParse(readBuffer utils.ReadBuffer, response bool, srchk bool, messageLength uint16) (CBusMessageToServer, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CBusMessageToServer"); pullErr != nil {
@@ -137,7 +137,7 @@ func CBusMessageToServerParse(readBuffer utils.ReadBuffer, response bool, srchk
if pullErr := readBuffer.PullContext("request"); pullErr != nil {
return nil, errors.Wrap(pullErr, "Error pulling for request")
}
- _request, _requestErr := RequestParse(readBuffer, bool(srchk))
+ _request, _requestErr := RequestParse(readBuffer, bool(srchk), uint16(messageLength))
if _requestErr != nil {
return nil, errors.Wrap(_requestErr, "Error parsing 'request' field of CBusMessageToServer")
}
@@ -154,7 +154,8 @@ func CBusMessageToServerParse(readBuffer utils.ReadBuffer, response bool, srchk
_child := &_CBusMessageToServer{
Request: request,
_CBusMessage: &_CBusMessage{
- Srchk: srchk,
+ Srchk: srchk,
+ MessageLength: messageLength,
},
}
_child._CBusMessage._CBusMessageChildRequirements = _child
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommand.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommand.go
index 70c51d8e1..c49b09767 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommand.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommand.go
@@ -32,8 +32,6 @@ type CBusPointToMultiPointCommand interface {
utils.Serializable
// GetPeekedApplication returns PeekedApplication (property field)
GetPeekedApplication() byte
- // GetTermination returns Termination (property field)
- GetTermination() RequestTermination
}
// CBusPointToMultiPointCommandExactly can be used when we want exactly this type and not a type which fulfills CBusPointToMultiPointCommand.
@@ -47,7 +45,6 @@ type CBusPointToMultiPointCommandExactly interface {
type _CBusPointToMultiPointCommand struct {
_CBusPointToMultiPointCommandChildRequirements
PeekedApplication byte
- Termination RequestTermination
// Arguments.
Srchk bool
@@ -66,7 +63,7 @@ type CBusPointToMultiPointCommandParent interface {
type CBusPointToMultiPointCommandChild interface {
utils.Serializable
- InitializeParent(parent CBusPointToMultiPointCommand, peekedApplication byte, termination RequestTermination)
+ InitializeParent(parent CBusPointToMultiPointCommand, peekedApplication byte)
GetParent() *CBusPointToMultiPointCommand
GetTypeName() string
@@ -82,18 +79,14 @@ func (m *_CBusPointToMultiPointCommand) GetPeekedApplication() byte {
return m.PeekedApplication
}
-func (m *_CBusPointToMultiPointCommand) GetTermination() RequestTermination {
- return m.Termination
-}
-
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// NewCBusPointToMultiPointCommand factory function for _CBusPointToMultiPointCommand
-func NewCBusPointToMultiPointCommand(peekedApplication byte, termination RequestTermination, srchk bool) *_CBusPointToMultiPointCommand {
- return &_CBusPointToMultiPointCommand{PeekedApplication: peekedApplication, Termination: termination, Srchk: srchk}
+func NewCBusPointToMultiPointCommand(peekedApplication byte, srchk bool) *_CBusPointToMultiPointCommand {
+ return &_CBusPointToMultiPointCommand{PeekedApplication: peekedApplication, Srchk: srchk}
}
// Deprecated: use the interface for direct cast
@@ -114,9 +107,6 @@ func (m *_CBusPointToMultiPointCommand) GetTypeName() string {
func (m *_CBusPointToMultiPointCommand) GetParentLengthInBits() uint16 {
lengthInBits := uint16(0)
- // Simple field (termination)
- lengthInBits += m.Termination.GetLengthInBits()
-
return lengthInBits
}
@@ -145,7 +135,7 @@ func CBusPointToMultiPointCommandParse(readBuffer utils.ReadBuffer, srchk bool)
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
type CBusPointToMultiPointCommandChildSerializeRequirement interface {
CBusPointToMultiPointCommand
- InitializeParent(CBusPointToMultiPointCommand, byte, RequestTermination)
+ InitializeParent(CBusPointToMultiPointCommand, byte)
GetParent() CBusPointToMultiPointCommand
}
var _childTemp interface{}
@@ -164,25 +154,12 @@ func CBusPointToMultiPointCommandParse(readBuffer utils.ReadBuffer, srchk bool)
}
_child = _childTemp.(CBusPointToMultiPointCommandChildSerializeRequirement)
- // Simple Field (termination)
- if pullErr := readBuffer.PullContext("termination"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for termination")
- }
- _termination, _terminationErr := RequestTerminationParse(readBuffer)
- if _terminationErr != nil {
- return nil, errors.Wrap(_terminationErr, "Error parsing 'termination' field of CBusPointToMultiPointCommand")
- }
- termination := _termination.(RequestTermination)
- if closeErr := readBuffer.CloseContext("termination"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for termination")
- }
-
if closeErr := readBuffer.CloseContext("CBusPointToMultiPointCommand"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for CBusPointToMultiPointCommand")
}
// Finish initializing
- _child.InitializeParent(_child, peekedApplication, termination)
+ _child.InitializeParent(_child, peekedApplication)
return _child, nil
}
@@ -201,18 +178,6 @@ func (pm *_CBusPointToMultiPointCommand) SerializeParent(writeBuffer utils.Write
return errors.Wrap(_typeSwitchErr, "Error serializing sub-type field")
}
- // Simple Field (termination)
- if pushErr := writeBuffer.PushContext("termination"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for termination")
- }
- _terminationErr := writeBuffer.WriteSerializable(m.GetTermination())
- if popErr := writeBuffer.PopContext("termination"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for termination")
- }
- if _terminationErr != nil {
- return errors.Wrap(_terminationErr, "Error serializing 'termination' field")
- }
-
if popErr := writeBuffer.PopContext("CBusPointToMultiPointCommand"); popErr != nil {
return errors.Wrap(popErr, "Error popping for CBusPointToMultiPointCommand")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandNormal.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandNormal.go
index c79c56da8..25c3eadf1 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandNormal.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandNormal.go
@@ -69,9 +69,8 @@ type _CBusPointToMultiPointCommandNormal struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_CBusPointToMultiPointCommandNormal) InitializeParent(parent CBusPointToMultiPointCommand, peekedApplication byte, termination RequestTermination) {
+func (m *_CBusPointToMultiPointCommandNormal) InitializeParent(parent CBusPointToMultiPointCommand, peekedApplication byte) {
m.PeekedApplication = peekedApplication
- m.Termination = termination
}
func (m *_CBusPointToMultiPointCommandNormal) GetParent() CBusPointToMultiPointCommand {
@@ -105,13 +104,13 @@ func (m *_CBusPointToMultiPointCommandNormal) GetAlpha() Alpha {
///////////////////////////////////////////////////////////
// NewCBusPointToMultiPointCommandNormal factory function for _CBusPointToMultiPointCommandNormal
-func NewCBusPointToMultiPointCommandNormal(application ApplicationIdContainer, salData SALData, crc Checksum, alpha Alpha, peekedApplication byte, termination RequestTermination, srchk bool) *_CBusPointToMultiPointCommandNormal {
+func NewCBusPointToMultiPointCommandNormal(application ApplicationIdContainer, salData SALData, crc Checksum, alpha Alpha, peekedApplication byte, srchk bool) *_CBusPointToMultiPointCommandNormal {
_result := &_CBusPointToMultiPointCommandNormal{
Application: application,
SalData: salData,
Crc: crc,
Alpha: alpha,
- _CBusPointToMultiPointCommand: NewCBusPointToMultiPointCommand(peekedApplication, termination, srchk),
+ _CBusPointToMultiPointCommand: NewCBusPointToMultiPointCommand(peekedApplication, srchk),
}
_result._CBusPointToMultiPointCommand._CBusPointToMultiPointCommandChildRequirements = _result
return _result
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandStatus.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandStatus.go
index 2585892a0..1a54fd230 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandStatus.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandStatus.go
@@ -66,9 +66,8 @@ type _CBusPointToMultiPointCommandStatus struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_CBusPointToMultiPointCommandStatus) InitializeParent(parent CBusPointToMultiPointCommand, peekedApplication byte, termination RequestTermination) {
+func (m *_CBusPointToMultiPointCommandStatus) InitializeParent(parent CBusPointToMultiPointCommand, peekedApplication byte) {
m.PeekedApplication = peekedApplication
- m.Termination = termination
}
func (m *_CBusPointToMultiPointCommandStatus) GetParent() CBusPointToMultiPointCommand {
@@ -98,12 +97,12 @@ func (m *_CBusPointToMultiPointCommandStatus) GetAlpha() Alpha {
///////////////////////////////////////////////////////////
// NewCBusPointToMultiPointCommandStatus factory function for _CBusPointToMultiPointCommandStatus
-func NewCBusPointToMultiPointCommandStatus(statusRequest StatusRequest, crc Checksum, alpha Alpha, peekedApplication byte, termination RequestTermination, srchk bool) *_CBusPointToMultiPointCommandStatus {
+func NewCBusPointToMultiPointCommandStatus(statusRequest StatusRequest, crc Checksum, alpha Alpha, peekedApplication byte, srchk bool) *_CBusPointToMultiPointCommandStatus {
_result := &_CBusPointToMultiPointCommandStatus{
StatusRequest: statusRequest,
Crc: crc,
Alpha: alpha,
- _CBusPointToMultiPointCommand: NewCBusPointToMultiPointCommand(peekedApplication, termination, srchk),
+ _CBusPointToMultiPointCommand: NewCBusPointToMultiPointCommand(peekedApplication, srchk),
}
_result._CBusPointToMultiPointCommand._CBusPointToMultiPointCommandChildRequirements = _result
return _result
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommand.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommand.go
index 54f69c8ae..a9fe72bba 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommand.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommand.go
@@ -40,8 +40,6 @@ type CBusPointToPointCommand interface {
GetCrc() Checksum
// GetAlpha returns Alpha (property field)
GetAlpha() Alpha
- // GetTermination returns Termination (property field)
- GetTermination() RequestTermination
// GetIsDirect returns IsDirect (virtual field)
GetIsDirect() bool
}
@@ -60,7 +58,6 @@ type _CBusPointToPointCommand struct {
CalData CALData
Crc Checksum
Alpha Alpha
- Termination RequestTermination
// Arguments.
Srchk bool
@@ -79,7 +76,7 @@ type CBusPointToPointCommandParent interface {
type CBusPointToPointCommandChild interface {
utils.Serializable
- InitializeParent(parent CBusPointToPointCommand, bridgeAddressCountPeek uint16, calData CALData, crc Checksum, alpha Alpha, termination RequestTermination)
+ InitializeParent(parent CBusPointToPointCommand, bridgeAddressCountPeek uint16, calData CALData, crc Checksum, alpha Alpha)
GetParent() *CBusPointToPointCommand
GetTypeName() string
@@ -107,10 +104,6 @@ func (m *_CBusPointToPointCommand) GetAlpha() Alpha {
return m.Alpha
}
-func (m *_CBusPointToPointCommand) GetTermination() RequestTermination {
- return m.Termination
-}
-
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
@@ -134,8 +127,8 @@ func (m *_CBusPointToPointCommand) GetIsDirect() bool {
///////////////////////////////////////////////////////////
// NewCBusPointToPointCommand factory function for _CBusPointToPointCommand
-func NewCBusPointToPointCommand(bridgeAddressCountPeek uint16, calData CALData, crc Checksum, alpha Alpha, termination RequestTermination, srchk bool) *_CBusPointToPointCommand {
- return &_CBusPointToPointCommand{BridgeAddressCountPeek: bridgeAddressCountPeek, CalData: calData, Crc: crc, Alpha: alpha, Termination: termination, Srchk: srchk}
+func NewCBusPointToPointCommand(bridgeAddressCountPeek uint16, calData CALData, crc Checksum, alpha Alpha, srchk bool) *_CBusPointToPointCommand {
+ return &_CBusPointToPointCommand{BridgeAddressCountPeek: bridgeAddressCountPeek, CalData: calData, Crc: crc, Alpha: alpha, Srchk: srchk}
}
// Deprecated: use the interface for direct cast
@@ -171,9 +164,6 @@ func (m *_CBusPointToPointCommand) GetParentLengthInBits() uint16 {
lengthInBits += m.Alpha.GetLengthInBits()
}
- // Simple field (termination)
- lengthInBits += m.Termination.GetLengthInBits()
-
return lengthInBits
}
@@ -207,7 +197,7 @@ func CBusPointToPointCommandParse(readBuffer utils.ReadBuffer, srchk bool) (CBus
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
type CBusPointToPointCommandChildSerializeRequirement interface {
CBusPointToPointCommand
- InitializeParent(CBusPointToPointCommand, uint16, CALData, Checksum, Alpha, RequestTermination)
+ InitializeParent(CBusPointToPointCommand, uint16, CALData, Checksum, Alpha)
GetParent() CBusPointToPointCommand
}
var _childTemp interface{}
@@ -283,25 +273,12 @@ func CBusPointToPointCommandParse(readBuffer utils.ReadBuffer, srchk bool) (CBus
}
}
- // Simple Field (termination)
- if pullErr := readBuffer.PullContext("termination"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for termination")
- }
- _termination, _terminationErr := RequestTerminationParse(readBuffer)
- if _terminationErr != nil {
- return nil, errors.Wrap(_terminationErr, "Error parsing 'termination' field of CBusPointToPointCommand")
- }
- termination := _termination.(RequestTermination)
- if closeErr := readBuffer.CloseContext("termination"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for termination")
- }
-
if closeErr := readBuffer.CloseContext("CBusPointToPointCommand"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for CBusPointToPointCommand")
}
// Finish initializing
- _child.InitializeParent(_child, bridgeAddressCountPeek, calData, crc, alpha, termination)
+ _child.InitializeParent(_child, bridgeAddressCountPeek, calData, crc, alpha)
return _child, nil
}
@@ -368,18 +345,6 @@ func (pm *_CBusPointToPointCommand) SerializeParent(writeBuffer utils.WriteBuffe
}
}
- // Simple Field (termination)
- if pushErr := writeBuffer.PushContext("termination"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for termination")
- }
- _terminationErr := writeBuffer.WriteSerializable(m.GetTermination())
- if popErr := writeBuffer.PopContext("termination"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for termination")
- }
- if _terminationErr != nil {
- return errors.Wrap(_terminationErr, "Error serializing 'termination' field")
- }
-
if popErr := writeBuffer.PopContext("CBusPointToPointCommand"); popErr != nil {
return errors.Wrap(popErr, "Error popping for CBusPointToPointCommand")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandDirect.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandDirect.go
index 2bbbf59fe..a03449092 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandDirect.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandDirect.go
@@ -59,12 +59,11 @@ type _CBusPointToPointCommandDirect struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_CBusPointToPointCommandDirect) InitializeParent(parent CBusPointToPointCommand, bridgeAddressCountPeek uint16, calData CALData, crc Checksum, alpha Alpha, termination RequestTermination) {
+func (m *_CBusPointToPointCommandDirect) InitializeParent(parent CBusPointToPointCommand, bridgeAddressCountPeek uint16, calData CALData, crc Checksum, alpha Alpha) {
m.BridgeAddressCountPeek = bridgeAddressCountPeek
m.CalData = calData
m.Crc = crc
m.Alpha = alpha
- m.Termination = termination
}
func (m *_CBusPointToPointCommandDirect) GetParent() CBusPointToPointCommand {
@@ -86,10 +85,10 @@ func (m *_CBusPointToPointCommandDirect) GetUnitAddress() UnitAddress {
///////////////////////////////////////////////////////////
// NewCBusPointToPointCommandDirect factory function for _CBusPointToPointCommandDirect
-func NewCBusPointToPointCommandDirect(unitAddress UnitAddress, bridgeAddressCountPeek uint16, calData CALData, crc Checksum, alpha Alpha, termination RequestTermination, srchk bool) *_CBusPointToPointCommandDirect {
+func NewCBusPointToPointCommandDirect(unitAddress UnitAddress, bridgeAddressCountPeek uint16, calData CALData, crc Checksum, alpha Alpha, srchk bool) *_CBusPointToPointCommandDirect {
_result := &_CBusPointToPointCommandDirect{
UnitAddress: unitAddress,
- _CBusPointToPointCommand: NewCBusPointToPointCommand(bridgeAddressCountPeek, calData, crc, alpha, termination, srchk),
+ _CBusPointToPointCommand: NewCBusPointToPointCommand(bridgeAddressCountPeek, calData, crc, alpha, srchk),
}
_result._CBusPointToPointCommand._CBusPointToPointCommandChildRequirements = _result
return _result
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandIndirect.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandIndirect.go
index c5b8725ba..c75adcf30 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandIndirect.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandIndirect.go
@@ -64,12 +64,11 @@ type _CBusPointToPointCommandIndirect struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_CBusPointToPointCommandIndirect) InitializeParent(parent CBusPointToPointCommand, bridgeAddressCountPeek uint16, calData CALData, crc Checksum, alpha Alpha, termination RequestTermination) {
+func (m *_CBusPointToPointCommandIndirect) InitializeParent(parent CBusPointToPointCommand, bridgeAddressCountPeek uint16, calData CALData, crc Checksum, alpha Alpha) {
m.BridgeAddressCountPeek = bridgeAddressCountPeek
m.CalData = calData
m.Crc = crc
m.Alpha = alpha
- m.Termination = termination
}
func (m *_CBusPointToPointCommandIndirect) GetParent() CBusPointToPointCommand {
@@ -99,12 +98,12 @@ func (m *_CBusPointToPointCommandIndirect) GetUnitAddress() UnitAddress {
///////////////////////////////////////////////////////////
// NewCBusPointToPointCommandIndirect factory function for _CBusPointToPointCommandIndirect
-func NewCBusPointToPointCommandIndirect(bridgeAddress BridgeAddress, networkRoute NetworkRoute, unitAddress UnitAddress, bridgeAddressCountPeek uint16, calData CALData, crc Checksum, alpha Alpha, termination RequestTermination, srchk bool) *_CBusPointToPointCommandIndirect {
+func NewCBusPointToPointCommandIndirect(bridgeAddress BridgeAddress, networkRoute NetworkRoute, unitAddress UnitAddress, bridgeAddressCountPeek uint16, calData CALData, crc Checksum, alpha Alpha, srchk bool) *_CBusPointToPointCommandIndirect {
_result := &_CBusPointToPointCommandIndirect{
BridgeAddress: bridgeAddress,
NetworkRoute: networkRoute,
UnitAddress: unitAddress,
- _CBusPointToPointCommand: NewCBusPointToPointCommand(bridgeAddressCountPeek, calData, crc, alpha, termination, srchk),
+ _CBusPointToPointCommand: NewCBusPointToPointCommand(bridgeAddressCountPeek, calData, crc, alpha, srchk),
}
_result._CBusPointToPointCommand._CBusPointToPointCommandChildRequirements = _result
return _result
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointToMultipointCommand.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointToMultipointCommand.go
index b4b37bbd1..230c9fd32 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointToMultipointCommand.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointToMultipointCommand.go
@@ -36,8 +36,6 @@ type CBusPointToPointToMultipointCommand interface {
GetNetworkRoute() NetworkRoute
// GetPeekedApplication returns PeekedApplication (property field)
GetPeekedApplication() byte
- // GetTermination returns Termination (property field)
- GetTermination() RequestTermination
}
// CBusPointToPointToMultipointCommandExactly can be used when we want exactly this type and not a type which fulfills CBusPointToPointToMultipointCommand.
@@ -53,7 +51,6 @@ type _CBusPointToPointToMultipointCommand struct {
BridgeAddress BridgeAddress
NetworkRoute NetworkRoute
PeekedApplication byte
- Termination RequestTermination
// Arguments.
Srchk bool
@@ -72,7 +69,7 @@ type CBusPointToPointToMultipointCommandParent interface {
type CBusPointToPointToMultipointCommandChild interface {
utils.Serializable
- InitializeParent(parent CBusPointToPointToMultipointCommand, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, termination RequestTermination)
+ InitializeParent(parent CBusPointToPointToMultipointCommand, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte)
GetParent() *CBusPointToPointToMultipointCommand
GetTypeName() string
@@ -96,18 +93,14 @@ func (m *_CBusPointToPointToMultipointCommand) GetPeekedApplication() byte {
return m.PeekedApplication
}
-func (m *_CBusPointToPointToMultipointCommand) GetTermination() RequestTermination {
- return m.Termination
-}
-
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// NewCBusPointToPointToMultipointCommand factory function for _CBusPointToPointToMultipointCommand
-func NewCBusPointToPointToMultipointCommand(bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, termination RequestTermination, srchk bool) *_CBusPointToPointToMultipointCommand {
- return &_CBusPointToPointToMultipointCommand{BridgeAddress: bridgeAddress, NetworkRoute: networkRoute, PeekedApplication: peekedApplication, Termination: termination, Srchk: srchk}
+func NewCBusPointToPointToMultipointCommand(bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, srchk bool) *_CBusPointToPointToMultipointCommand {
+ return &_CBusPointToPointToMultipointCommand{BridgeAddress: bridgeAddress, NetworkRoute: networkRoute, PeekedApplication: peekedApplication, Srchk: srchk}
}
// Deprecated: use the interface for direct cast
@@ -134,9 +127,6 @@ func (m *_CBusPointToPointToMultipointCommand) GetParentLengthInBits() uint16 {
// Simple field (networkRoute)
lengthInBits += m.NetworkRoute.GetLengthInBits()
- // Simple field (termination)
- lengthInBits += m.Termination.GetLengthInBits()
-
return lengthInBits
}
@@ -191,7 +181,7 @@ func CBusPointToPointToMultipointCommandParse(readBuffer utils.ReadBuffer, srchk
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
type CBusPointToPointToMultipointCommandChildSerializeRequirement interface {
CBusPointToPointToMultipointCommand
- InitializeParent(CBusPointToPointToMultipointCommand, BridgeAddress, NetworkRoute, byte, RequestTermination)
+ InitializeParent(CBusPointToPointToMultipointCommand, BridgeAddress, NetworkRoute, byte)
GetParent() CBusPointToPointToMultipointCommand
}
var _childTemp interface{}
@@ -210,25 +200,12 @@ func CBusPointToPointToMultipointCommandParse(readBuffer utils.ReadBuffer, srchk
}
_child = _childTemp.(CBusPointToPointToMultipointCommandChildSerializeRequirement)
- // Simple Field (termination)
- if pullErr := readBuffer.PullContext("termination"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for termination")
- }
- _termination, _terminationErr := RequestTerminationParse(readBuffer)
- if _terminationErr != nil {
- return nil, errors.Wrap(_terminationErr, "Error parsing 'termination' field of CBusPointToPointToMultipointCommand")
- }
- termination := _termination.(RequestTermination)
- if closeErr := readBuffer.CloseContext("termination"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for termination")
- }
-
if closeErr := readBuffer.CloseContext("CBusPointToPointToMultipointCommand"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for CBusPointToPointToMultipointCommand")
}
// Finish initializing
- _child.InitializeParent(_child, bridgeAddress, networkRoute, peekedApplication, termination)
+ _child.InitializeParent(_child, bridgeAddress, networkRoute, peekedApplication)
return _child, nil
}
@@ -271,18 +248,6 @@ func (pm *_CBusPointToPointToMultipointCommand) SerializeParent(writeBuffer util
return errors.Wrap(_typeSwitchErr, "Error serializing sub-type field")
}
- // Simple Field (termination)
- if pushErr := writeBuffer.PushContext("termination"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for termination")
- }
- _terminationErr := writeBuffer.WriteSerializable(m.GetTermination())
- if popErr := writeBuffer.PopContext("termination"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for termination")
- }
- if _terminationErr != nil {
- return errors.Wrap(_terminationErr, "Error serializing 'termination' field")
- }
-
if popErr := writeBuffer.PopContext("CBusPointToPointToMultipointCommand"); popErr != nil {
return errors.Wrap(popErr, "Error popping for CBusPointToPointToMultipointCommand")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/ConfirmationReply.go b/plc4go/protocols/cbus/readwrite/model/ConfirmationReply.go
index a5aaaabfc..8c44d3954 100644
--- a/plc4go/protocols/cbus/readwrite/model/ConfirmationReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/ConfirmationReply.go
@@ -58,8 +58,9 @@ type _ConfirmationReply struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_ConfirmationReply) InitializeParent(parent Reply, peekedByte byte) {
+func (m *_ConfirmationReply) InitializeParent(parent Reply, peekedByte byte, termination ResponseTermination) {
m.PeekedByte = peekedByte
+ m.Termination = termination
}
func (m *_ConfirmationReply) GetParent() Reply {
@@ -81,10 +82,10 @@ func (m *_ConfirmationReply) GetIsA() Confirmation {
///////////////////////////////////////////////////////////
// NewConfirmationReply factory function for _ConfirmationReply
-func NewConfirmationReply(isA Confirmation, peekedByte byte) *_ConfirmationReply {
+func NewConfirmationReply(isA Confirmation, peekedByte byte, termination ResponseTermination, messageLength uint16) *_ConfirmationReply {
_result := &_ConfirmationReply{
IsA: isA,
- _Reply: NewReply(peekedByte),
+ _Reply: NewReply(peekedByte, termination, messageLength),
}
_result._Reply._ReplyChildRequirements = _result
return _result
@@ -122,7 +123,7 @@ func (m *_ConfirmationReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func ConfirmationReplyParse(readBuffer utils.ReadBuffer) (ConfirmationReply, error) {
+func ConfirmationReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (ConfirmationReply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("ConfirmationReply"); pullErr != nil {
@@ -150,8 +151,10 @@ func ConfirmationReplyParse(readBuffer utils.ReadBuffer) (ConfirmationReply, err
// Create a partially initialized instance
_child := &_ConfirmationReply{
- IsA: isA,
- _Reply: &_Reply{},
+ IsA: isA,
+ _Reply: &_Reply{
+ MessageLength: messageLength,
+ },
}
_child._Reply._ReplyChildRequirements = _child
return _child, nil
diff --git a/plc4go/protocols/cbus/readwrite/model/ExtendedFormatStatusReply.go b/plc4go/protocols/cbus/readwrite/model/ExtendedFormatStatusReply.go
index 42707f683..481452da4 100644
--- a/plc4go/protocols/cbus/readwrite/model/ExtendedFormatStatusReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/ExtendedFormatStatusReply.go
@@ -42,8 +42,6 @@ type ExtendedFormatStatusReply interface {
GetStatusBytes() []StatusByte
// GetCrc returns Crc (property field)
GetCrc() Checksum
- // GetTermination returns Termination (property field)
- GetTermination() ResponseTermination
}
// ExtendedFormatStatusReplyExactly can be used when we want exactly this type and not a type which fulfills ExtendedFormatStatusReply.
@@ -61,7 +59,6 @@ type _ExtendedFormatStatusReply struct {
BlockStart uint8
StatusBytes []StatusByte
Crc Checksum
- Termination ResponseTermination
}
///////////////////////////////////////////////////////////
@@ -93,18 +90,14 @@ func (m *_ExtendedFormatStatusReply) GetCrc() Checksum {
return m.Crc
}
-func (m *_ExtendedFormatStatusReply) GetTermination() ResponseTermination {
- return m.Termination
-}
-
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// NewExtendedFormatStatusReply factory function for _ExtendedFormatStatusReply
-func NewExtendedFormatStatusReply(statusHeader ExtendedStatusHeader, coding StatusCoding, application ApplicationIdContainer, blockStart uint8, statusBytes []StatusByte, crc Checksum, termination ResponseTermination) *_ExtendedFormatStatusReply {
- return &_ExtendedFormatStatusReply{StatusHeader: statusHeader, Coding: coding, Application: application, BlockStart: blockStart, StatusBytes: statusBytes, Crc: crc, Termination: termination}
+func NewExtendedFormatStatusReply(statusHeader ExtendedStatusHeader, coding StatusCoding, application ApplicationIdContainer, blockStart uint8, statusBytes []StatusByte, crc Checksum) *_ExtendedFormatStatusReply {
+ return &_ExtendedFormatStatusReply{StatusHeader: statusHeader, Coding: coding, Application: application, BlockStart: blockStart, StatusBytes: statusBytes, Crc: crc}
}
// Deprecated: use the interface for direct cast
@@ -152,9 +145,6 @@ func (m *_ExtendedFormatStatusReply) GetLengthInBitsConditional(lastItem bool) u
// Simple field (crc)
lengthInBits += m.Crc.GetLengthInBits()
- // Simple field (termination)
- lengthInBits += m.Termination.GetLengthInBits()
-
return lengthInBits
}
@@ -253,25 +243,12 @@ func ExtendedFormatStatusReplyParse(readBuffer utils.ReadBuffer) (ExtendedFormat
return nil, errors.Wrap(closeErr, "Error closing for crc")
}
- // Simple Field (termination)
- if pullErr := readBuffer.PullContext("termination"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for termination")
- }
- _termination, _terminationErr := ResponseTerminationParse(readBuffer)
- if _terminationErr != nil {
- return nil, errors.Wrap(_terminationErr, "Error parsing 'termination' field of ExtendedFormatStatusReply")
- }
- termination := _termination.(ResponseTermination)
- if closeErr := readBuffer.CloseContext("termination"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for termination")
- }
-
if closeErr := readBuffer.CloseContext("ExtendedFormatStatusReply"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for ExtendedFormatStatusReply")
}
// Create the instance
- return NewExtendedFormatStatusReply(statusHeader, coding, application, blockStart, statusBytes, crc, termination), nil
+ return NewExtendedFormatStatusReply(statusHeader, coding, application, blockStart, statusBytes, crc), nil
}
func (m *_ExtendedFormatStatusReply) Serialize(writeBuffer utils.WriteBuffer) error {
@@ -350,18 +327,6 @@ func (m *_ExtendedFormatStatusReply) Serialize(writeBuffer utils.WriteBuffer) er
return errors.Wrap(_crcErr, "Error serializing 'crc' field")
}
- // Simple Field (termination)
- if pushErr := writeBuffer.PushContext("termination"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for termination")
- }
- _terminationErr := writeBuffer.WriteSerializable(m.GetTermination())
- if popErr := writeBuffer.PopContext("termination"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for termination")
- }
- if _terminationErr != nil {
- return errors.Wrap(_terminationErr, "Error serializing 'termination' field")
- }
-
if popErr := writeBuffer.PopContext("ExtendedFormatStatusReply"); popErr != nil {
return errors.Wrap(popErr, "Error popping for ExtendedFormatStatusReply")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusMessageToClient.go b/plc4go/protocols/cbus/readwrite/model/ExtendedFormatStatusReplyReply.go
similarity index 51%
copy from plc4go/protocols/cbus/readwrite/model/CBusMessageToClient.go
copy to plc4go/protocols/cbus/readwrite/model/ExtendedFormatStatusReplyReply.go
index 29bc0f490..afda7e33e 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusMessageToClient.go
+++ b/plc4go/protocols/cbus/readwrite/model/ExtendedFormatStatusReplyReply.go
@@ -26,26 +26,26 @@ import (
// Code generated by code-generation. DO NOT EDIT.
-// CBusMessageToClient is the corresponding interface of CBusMessageToClient
-type CBusMessageToClient interface {
+// ExtendedFormatStatusReplyReply is the corresponding interface of ExtendedFormatStatusReplyReply
+type ExtendedFormatStatusReplyReply interface {
utils.LengthAware
utils.Serializable
- CBusMessage
+ Reply
// GetReply returns Reply (property field)
- GetReply() Reply
+ GetReply() ExtendedFormatStatusReply
}
-// CBusMessageToClientExactly can be used when we want exactly this type and not a type which fulfills CBusMessageToClient.
+// ExtendedFormatStatusReplyReplyExactly can be used when we want exactly this type and not a type which fulfills ExtendedFormatStatusReplyReply.
// This is useful for switch cases.
-type CBusMessageToClientExactly interface {
- CBusMessageToClient
- isCBusMessageToClient() bool
+type ExtendedFormatStatusReplyReplyExactly interface {
+ ExtendedFormatStatusReplyReply
+ isExtendedFormatStatusReplyReply() bool
}
-// _CBusMessageToClient is the data-structure of this message
-type _CBusMessageToClient struct {
- *_CBusMessage
- Reply Reply
+// _ExtendedFormatStatusReplyReply is the data-structure of this message
+type _ExtendedFormatStatusReplyReply struct {
+ *_Reply
+ Reply ExtendedFormatStatusReply
}
///////////////////////////////////////////////////////////
@@ -53,19 +53,18 @@ type _CBusMessageToClient struct {
/////////////////////// Accessors for discriminator values.
///////////////////////
-func (m *_CBusMessageToClient) GetResponse() bool {
- return bool(true)
-}
-
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_CBusMessageToClient) InitializeParent(parent CBusMessage) {}
+func (m *_ExtendedFormatStatusReplyReply) InitializeParent(parent Reply, peekedByte byte, termination ResponseTermination) {
+ m.PeekedByte = peekedByte
+ m.Termination = termination
+}
-func (m *_CBusMessageToClient) GetParent() CBusMessage {
- return m._CBusMessage
+func (m *_ExtendedFormatStatusReplyReply) GetParent() Reply {
+ return m._Reply
}
///////////////////////////////////////////////////////////
@@ -73,7 +72,7 @@ func (m *_CBusMessageToClient) GetParent() CBusMessage {
/////////////////////// Accessors for property fields.
///////////////////////
-func (m *_CBusMessageToClient) GetReply() Reply {
+func (m *_ExtendedFormatStatusReplyReply) GetReply() ExtendedFormatStatusReply {
return m.Reply
}
@@ -82,36 +81,36 @@ func (m *_CBusMessageToClient) GetReply() Reply {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-// NewCBusMessageToClient factory function for _CBusMessageToClient
-func NewCBusMessageToClient(reply Reply, srchk bool) *_CBusMessageToClient {
- _result := &_CBusMessageToClient{
- Reply: reply,
- _CBusMessage: NewCBusMessage(srchk),
+// NewExtendedFormatStatusReplyReply factory function for _ExtendedFormatStatusReplyReply
+func NewExtendedFormatStatusReplyReply(reply ExtendedFormatStatusReply, peekedByte byte, termination ResponseTermination, messageLength uint16) *_ExtendedFormatStatusReplyReply {
+ _result := &_ExtendedFormatStatusReplyReply{
+ Reply: reply,
+ _Reply: NewReply(peekedByte, termination, messageLength),
}
- _result._CBusMessage._CBusMessageChildRequirements = _result
+ _result._Reply._ReplyChildRequirements = _result
return _result
}
// Deprecated: use the interface for direct cast
-func CastCBusMessageToClient(structType interface{}) CBusMessageToClient {
- if casted, ok := structType.(CBusMessageToClient); ok {
+func CastExtendedFormatStatusReplyReply(structType interface{}) ExtendedFormatStatusReplyReply {
+ if casted, ok := structType.(ExtendedFormatStatusReplyReply); ok {
return casted
}
- if casted, ok := structType.(*CBusMessageToClient); ok {
+ if casted, ok := structType.(*ExtendedFormatStatusReplyReply); ok {
return *casted
}
return nil
}
-func (m *_CBusMessageToClient) GetTypeName() string {
- return "CBusMessageToClient"
+func (m *_ExtendedFormatStatusReplyReply) GetTypeName() string {
+ return "ExtendedFormatStatusReplyReply"
}
-func (m *_CBusMessageToClient) GetLengthInBits() uint16 {
+func (m *_ExtendedFormatStatusReplyReply) GetLengthInBits() uint16 {
return m.GetLengthInBitsConditional(false)
}
-func (m *_CBusMessageToClient) GetLengthInBitsConditional(lastItem bool) uint16 {
+func (m *_ExtendedFormatStatusReplyReply) GetLengthInBitsConditional(lastItem bool) uint16 {
lengthInBits := uint16(m.GetParentLengthInBits())
// Simple field (reply)
@@ -120,15 +119,15 @@ func (m *_CBusMessageToClient) GetLengthInBitsConditional(lastItem bool) uint16
return lengthInBits
}
-func (m *_CBusMessageToClient) GetLengthInBytes() uint16 {
+func (m *_ExtendedFormatStatusReplyReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusMessageToClientParse(readBuffer utils.ReadBuffer, response bool, srchk bool) (CBusMessageToClient, error) {
+func ExtendedFormatStatusReplyReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (ExtendedFormatStatusReplyReply, error) {
positionAware := readBuffer
_ = positionAware
- if pullErr := readBuffer.PullContext("CBusMessageToClient"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for CBusMessageToClient")
+ if pullErr := readBuffer.PullContext("ExtendedFormatStatusReplyReply"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for ExtendedFormatStatusReplyReply")
}
currentPos := positionAware.GetPos()
_ = currentPos
@@ -137,36 +136,36 @@ func CBusMessageToClientParse(readBuffer utils.ReadBuffer, response bool, srchk
if pullErr := readBuffer.PullContext("reply"); pullErr != nil {
return nil, errors.Wrap(pullErr, "Error pulling for reply")
}
- _reply, _replyErr := ReplyParse(readBuffer)
+ _reply, _replyErr := ExtendedFormatStatusReplyParse(readBuffer)
if _replyErr != nil {
- return nil, errors.Wrap(_replyErr, "Error parsing 'reply' field of CBusMessageToClient")
+ return nil, errors.Wrap(_replyErr, "Error parsing 'reply' field of ExtendedFormatStatusReplyReply")
}
- reply := _reply.(Reply)
+ reply := _reply.(ExtendedFormatStatusReply)
if closeErr := readBuffer.CloseContext("reply"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for reply")
}
- if closeErr := readBuffer.CloseContext("CBusMessageToClient"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for CBusMessageToClient")
+ if closeErr := readBuffer.CloseContext("ExtendedFormatStatusReplyReply"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for ExtendedFormatStatusReplyReply")
}
// Create a partially initialized instance
- _child := &_CBusMessageToClient{
+ _child := &_ExtendedFormatStatusReplyReply{
Reply: reply,
- _CBusMessage: &_CBusMessage{
- Srchk: srchk,
+ _Reply: &_Reply{
+ MessageLength: messageLength,
},
}
- _child._CBusMessage._CBusMessageChildRequirements = _child
+ _child._Reply._ReplyChildRequirements = _child
return _child, nil
}
-func (m *_CBusMessageToClient) Serialize(writeBuffer utils.WriteBuffer) error {
+func (m *_ExtendedFormatStatusReplyReply) Serialize(writeBuffer utils.WriteBuffer) error {
positionAware := writeBuffer
_ = positionAware
ser := func() error {
- if pushErr := writeBuffer.PushContext("CBusMessageToClient"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for CBusMessageToClient")
+ if pushErr := writeBuffer.PushContext("ExtendedFormatStatusReplyReply"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for ExtendedFormatStatusReplyReply")
}
// Simple Field (reply)
@@ -181,19 +180,19 @@ func (m *_CBusMessageToClient) Serialize(writeBuffer utils.WriteBuffer) error {
return errors.Wrap(_replyErr, "Error serializing 'reply' field")
}
- if popErr := writeBuffer.PopContext("CBusMessageToClient"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for CBusMessageToClient")
+ if popErr := writeBuffer.PopContext("ExtendedFormatStatusReplyReply"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for ExtendedFormatStatusReplyReply")
}
return nil
}
return m.SerializeParent(writeBuffer, m, ser)
}
-func (m *_CBusMessageToClient) isCBusMessageToClient() bool {
+func (m *_ExtendedFormatStatusReplyReply) isExtendedFormatStatusReplyReply() bool {
return true
}
-func (m *_CBusMessageToClient) String() string {
+func (m *_ExtendedFormatStatusReplyReply) String() string {
if m == nil {
return "<nil>"
}
diff --git a/plc4go/protocols/cbus/readwrite/model/MonitoredSAL.go b/plc4go/protocols/cbus/readwrite/model/MonitoredSAL.go
index 21727400a..5f3332582 100644
--- a/plc4go/protocols/cbus/readwrite/model/MonitoredSAL.go
+++ b/plc4go/protocols/cbus/readwrite/model/MonitoredSAL.go
@@ -36,8 +36,6 @@ type MonitoredSAL interface {
GetSalType() byte
// GetSalData returns SalData (property field)
GetSalData() SALData
- // GetTermination returns Termination (property field)
- GetTermination() ResponseTermination
}
// MonitoredSALExactly can be used when we want exactly this type and not a type which fulfills MonitoredSAL.
@@ -50,9 +48,8 @@ type MonitoredSALExactly interface {
// _MonitoredSAL is the data-structure of this message
type _MonitoredSAL struct {
_MonitoredSALChildRequirements
- SalType byte
- SalData SALData
- Termination ResponseTermination
+ SalType byte
+ SalData SALData
}
type _MonitoredSALChildRequirements interface {
@@ -68,7 +65,7 @@ type MonitoredSALParent interface {
type MonitoredSALChild interface {
utils.Serializable
- InitializeParent(parent MonitoredSAL, salType byte, salData SALData, termination ResponseTermination)
+ InitializeParent(parent MonitoredSAL, salType byte, salData SALData)
GetParent() *MonitoredSAL
GetTypeName() string
@@ -88,18 +85,14 @@ func (m *_MonitoredSAL) GetSalData() SALData {
return m.SalData
}
-func (m *_MonitoredSAL) GetTermination() ResponseTermination {
- return m.Termination
-}
-
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// NewMonitoredSAL factory function for _MonitoredSAL
-func NewMonitoredSAL(salType byte, salData SALData, termination ResponseTermination) *_MonitoredSAL {
- return &_MonitoredSAL{SalType: salType, SalData: salData, Termination: termination}
+func NewMonitoredSAL(salType byte, salData SALData) *_MonitoredSAL {
+ return &_MonitoredSAL{SalType: salType, SalData: salData}
}
// Deprecated: use the interface for direct cast
@@ -125,9 +118,6 @@ func (m *_MonitoredSAL) GetParentLengthInBits() uint16 {
lengthInBits += m.SalData.GetLengthInBits()
}
- // Simple field (termination)
- lengthInBits += m.Termination.GetLengthInBits()
-
return lengthInBits
}
@@ -156,7 +146,7 @@ func MonitoredSALParse(readBuffer utils.ReadBuffer) (MonitoredSAL, error) {
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
type MonitoredSALChildSerializeRequirement interface {
MonitoredSAL
- InitializeParent(MonitoredSAL, byte, SALData, ResponseTermination)
+ InitializeParent(MonitoredSAL, byte, SALData)
GetParent() MonitoredSAL
}
var _childTemp interface{}
@@ -197,25 +187,12 @@ func MonitoredSALParse(readBuffer utils.ReadBuffer) (MonitoredSAL, error) {
}
}
- // Simple Field (termination)
- if pullErr := readBuffer.PullContext("termination"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for termination")
- }
- _termination, _terminationErr := ResponseTerminationParse(readBuffer)
- if _terminationErr != nil {
- return nil, errors.Wrap(_terminationErr, "Error parsing 'termination' field of MonitoredSAL")
- }
- termination := _termination.(ResponseTermination)
- if closeErr := readBuffer.CloseContext("termination"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for termination")
- }
-
if closeErr := readBuffer.CloseContext("MonitoredSAL"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for MonitoredSAL")
}
// Finish initializing
- _child.InitializeParent(_child, salType, salData, termination)
+ _child.InitializeParent(_child, salType, salData)
return _child, nil
}
@@ -250,18 +227,6 @@ func (pm *_MonitoredSAL) SerializeParent(writeBuffer utils.WriteBuffer, child Mo
}
}
- // Simple Field (termination)
- if pushErr := writeBuffer.PushContext("termination"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for termination")
- }
- _terminationErr := writeBuffer.WriteSerializable(m.GetTermination())
- if popErr := writeBuffer.PopContext("termination"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for termination")
- }
- if _terminationErr != nil {
- return errors.Wrap(_terminationErr, "Error serializing 'termination' field")
- }
-
if popErr := writeBuffer.PopContext("MonitoredSAL"); popErr != nil {
return errors.Wrap(popErr, "Error popping for MonitoredSAL")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/MonitoredSALLongFormSmartMode.go b/plc4go/protocols/cbus/readwrite/model/MonitoredSALLongFormSmartMode.go
index 61f5e983d..1778f5da4 100644
--- a/plc4go/protocols/cbus/readwrite/model/MonitoredSALLongFormSmartMode.go
+++ b/plc4go/protocols/cbus/readwrite/model/MonitoredSALLongFormSmartMode.go
@@ -77,10 +77,9 @@ type _MonitoredSALLongFormSmartMode struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_MonitoredSALLongFormSmartMode) InitializeParent(parent MonitoredSAL, salType byte, salData SALData, termination ResponseTermination) {
+func (m *_MonitoredSALLongFormSmartMode) InitializeParent(parent MonitoredSAL, salType byte, salData SALData) {
m.SalType = salType
m.SalData = salData
- m.Termination = termination
}
func (m *_MonitoredSALLongFormSmartMode) GetParent() MonitoredSAL {
@@ -143,7 +142,7 @@ func (m *_MonitoredSALLongFormSmartMode) GetIsUnitAddress() bool {
///////////////////////////////////////////////////////////
// NewMonitoredSALLongFormSmartMode factory function for _MonitoredSALLongFormSmartMode
-func NewMonitoredSALLongFormSmartMode(terminatingByte uint32, unitAddress UnitAddress, bridgeAddress BridgeAddress, serialInterfaceAddress SerialInterfaceAddress, reservedByte *byte, replyNetwork ReplyNetwork, salType byte, salData SALData, termination ResponseTermination) *_MonitoredSALLongFormSmartMode {
+func NewMonitoredSALLongFormSmartMode(terminatingByte uint32, unitAddress UnitAddress, bridgeAddress BridgeAddress, serialInterfaceAddress SerialInterfaceAddress, reservedByte *byte, replyNetwork ReplyNetwork, salType byte, salData SALData) *_MonitoredSALLongFormSmartMode {
_result := &_MonitoredSALLongFormSmartMode{
TerminatingByte: terminatingByte,
UnitAddress: unitAddress,
@@ -151,7 +150,7 @@ func NewMonitoredSALLongFormSmartMode(terminatingByte uint32, unitAddress UnitAd
SerialInterfaceAddress: serialInterfaceAddress,
ReservedByte: reservedByte,
ReplyNetwork: replyNetwork,
- _MonitoredSAL: NewMonitoredSAL(salType, salData, termination),
+ _MonitoredSAL: NewMonitoredSAL(salType, salData),
}
_result._MonitoredSAL._MonitoredSALChildRequirements = _result
return _result
diff --git a/plc4go/protocols/cbus/readwrite/model/MonitoredSALReply.go b/plc4go/protocols/cbus/readwrite/model/MonitoredSALReply.go
index bf6377704..fd3578568 100644
--- a/plc4go/protocols/cbus/readwrite/model/MonitoredSALReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/MonitoredSALReply.go
@@ -58,8 +58,9 @@ type _MonitoredSALReply struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_MonitoredSALReply) InitializeParent(parent Reply, peekedByte byte) {
+func (m *_MonitoredSALReply) InitializeParent(parent Reply, peekedByte byte, termination ResponseTermination) {
m.PeekedByte = peekedByte
+ m.Termination = termination
}
func (m *_MonitoredSALReply) GetParent() Reply {
@@ -81,10 +82,10 @@ func (m *_MonitoredSALReply) GetIsA() MonitoredSAL {
///////////////////////////////////////////////////////////
// NewMonitoredSALReply factory function for _MonitoredSALReply
-func NewMonitoredSALReply(isA MonitoredSAL, peekedByte byte) *_MonitoredSALReply {
+func NewMonitoredSALReply(isA MonitoredSAL, peekedByte byte, termination ResponseTermination, messageLength uint16) *_MonitoredSALReply {
_result := &_MonitoredSALReply{
IsA: isA,
- _Reply: NewReply(peekedByte),
+ _Reply: NewReply(peekedByte, termination, messageLength),
}
_result._Reply._ReplyChildRequirements = _result
return _result
@@ -122,7 +123,7 @@ func (m *_MonitoredSALReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func MonitoredSALReplyParse(readBuffer utils.ReadBuffer) (MonitoredSALReply, error) {
+func MonitoredSALReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (MonitoredSALReply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("MonitoredSALReply"); pullErr != nil {
@@ -150,8 +151,10 @@ func MonitoredSALReplyParse(readBuffer utils.ReadBuffer) (MonitoredSALReply, err
// Create a partially initialized instance
_child := &_MonitoredSALReply{
- IsA: isA,
- _Reply: &_Reply{},
+ IsA: isA,
+ _Reply: &_Reply{
+ MessageLength: messageLength,
+ },
}
_child._Reply._ReplyChildRequirements = _child
return _child, nil
diff --git a/plc4go/protocols/cbus/readwrite/model/MonitoredSALShortFormBasicMode.go b/plc4go/protocols/cbus/readwrite/model/MonitoredSALShortFormBasicMode.go
index c9b7d298c..d80add221 100644
--- a/plc4go/protocols/cbus/readwrite/model/MonitoredSALShortFormBasicMode.go
+++ b/plc4go/protocols/cbus/readwrite/model/MonitoredSALShortFormBasicMode.go
@@ -72,10 +72,9 @@ type _MonitoredSALShortFormBasicMode struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_MonitoredSALShortFormBasicMode) InitializeParent(parent MonitoredSAL, salType byte, salData SALData, termination ResponseTermination) {
+func (m *_MonitoredSALShortFormBasicMode) InitializeParent(parent MonitoredSAL, salType byte, salData SALData) {
m.SalType = salType
m.SalData = salData
- m.Termination = termination
}
func (m *_MonitoredSALShortFormBasicMode) GetParent() MonitoredSAL {
@@ -113,14 +112,14 @@ func (m *_MonitoredSALShortFormBasicMode) GetApplication() ApplicationIdContaine
///////////////////////////////////////////////////////////
// NewMonitoredSALShortFormBasicMode factory function for _MonitoredSALShortFormBasicMode
-func NewMonitoredSALShortFormBasicMode(counts byte, bridgeCount BridgeCount, networkNumber NetworkNumber, noCounts *byte, application ApplicationIdContainer, salType byte, salData SALData, termination ResponseTermination) *_MonitoredSALShortFormBasicMode {
+func NewMonitoredSALShortFormBasicMode(counts byte, bridgeCount BridgeCount, networkNumber NetworkNumber, noCounts *byte, application ApplicationIdContainer, salType byte, salData SALData) *_MonitoredSALShortFormBasicMode {
_result := &_MonitoredSALShortFormBasicMode{
Counts: counts,
BridgeCount: bridgeCount,
NetworkNumber: networkNumber,
NoCounts: noCounts,
Application: application,
- _MonitoredSAL: NewMonitoredSAL(salType, salData, termination),
+ _MonitoredSAL: NewMonitoredSAL(salType, salData),
}
_result._MonitoredSAL._MonitoredSALChildRequirements = _result
return _result
diff --git a/plc4go/protocols/cbus/readwrite/model/ParameterChange.go b/plc4go/protocols/cbus/readwrite/model/ParameterChange.go
index 69f2ad1de..71b947f02 100644
--- a/plc4go/protocols/cbus/readwrite/model/ParameterChange.go
+++ b/plc4go/protocols/cbus/readwrite/model/ParameterChange.go
@@ -35,8 +35,6 @@ const ParameterChange_SPECIALCHAR2 byte = 0x3D
type ParameterChange interface {
utils.LengthAware
utils.Serializable
- // GetTermination returns Termination (property field)
- GetTermination() ResponseTermination
}
// ParameterChangeExactly can be used when we want exactly this type and not a type which fulfills ParameterChange.
@@ -48,22 +46,8 @@ type ParameterChangeExactly interface {
// _ParameterChange is the data-structure of this message
type _ParameterChange struct {
- Termination ResponseTermination
}
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-/////////////////////// Accessors for property fields.
-///////////////////////
-
-func (m *_ParameterChange) GetTermination() ResponseTermination {
- return m.Termination
-}
-
-///////////////////////
-///////////////////////
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
/////////////////////// Accessors for const fields.
@@ -83,8 +67,8 @@ func (m *_ParameterChange) GetSpecialChar2() byte {
///////////////////////////////////////////////////////////
// NewParameterChange factory function for _ParameterChange
-func NewParameterChange(termination ResponseTermination) *_ParameterChange {
- return &_ParameterChange{Termination: termination}
+func NewParameterChange() *_ParameterChange {
+ return &_ParameterChange{}
}
// Deprecated: use the interface for direct cast
@@ -115,9 +99,6 @@ func (m *_ParameterChange) GetLengthInBitsConditional(lastItem bool) uint16 {
// Const Field (specialChar2)
lengthInBits += 8
- // Simple field (termination)
- lengthInBits += m.Termination.GetLengthInBits()
-
return lengthInBits
}
@@ -152,25 +133,12 @@ func ParameterChangeParse(readBuffer utils.ReadBuffer) (ParameterChange, error)
return nil, errors.New("Expected constant value " + fmt.Sprintf("%d", ParameterChange_SPECIALCHAR2) + " but got " + fmt.Sprintf("%d", specialChar2))
}
- // Simple Field (termination)
- if pullErr := readBuffer.PullContext("termination"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for termination")
- }
- _termination, _terminationErr := ResponseTerminationParse(readBuffer)
- if _terminationErr != nil {
- return nil, errors.Wrap(_terminationErr, "Error parsing 'termination' field of ParameterChange")
- }
- termination := _termination.(ResponseTermination)
- if closeErr := readBuffer.CloseContext("termination"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for termination")
- }
-
if closeErr := readBuffer.CloseContext("ParameterChange"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for ParameterChange")
}
// Create the instance
- return NewParameterChange(termination), nil
+ return NewParameterChange(), nil
}
func (m *_ParameterChange) Serialize(writeBuffer utils.WriteBuffer) error {
@@ -192,18 +160,6 @@ func (m *_ParameterChange) Serialize(writeBuffer utils.WriteBuffer) error {
return errors.Wrap(_specialChar2Err, "Error serializing 'specialChar2' field")
}
- // Simple Field (termination)
- if pushErr := writeBuffer.PushContext("termination"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for termination")
- }
- _terminationErr := writeBuffer.WriteSerializable(m.GetTermination())
- if popErr := writeBuffer.PopContext("termination"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for termination")
- }
- if _terminationErr != nil {
- return errors.Wrap(_terminationErr, "Error serializing 'termination' field")
- }
-
if popErr := writeBuffer.PopContext("ParameterChange"); popErr != nil {
return errors.Wrap(popErr, "Error popping for ParameterChange")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/ParameterChangeReply.go b/plc4go/protocols/cbus/readwrite/model/ParameterChangeReply.go
index 40d992b66..83ca43728 100644
--- a/plc4go/protocols/cbus/readwrite/model/ParameterChangeReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/ParameterChangeReply.go
@@ -58,8 +58,9 @@ type _ParameterChangeReply struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_ParameterChangeReply) InitializeParent(parent Reply, peekedByte byte) {
+func (m *_ParameterChangeReply) InitializeParent(parent Reply, peekedByte byte, termination ResponseTermination) {
m.PeekedByte = peekedByte
+ m.Termination = termination
}
func (m *_ParameterChangeReply) GetParent() Reply {
@@ -81,10 +82,10 @@ func (m *_ParameterChangeReply) GetIsA() ParameterChange {
///////////////////////////////////////////////////////////
// NewParameterChangeReply factory function for _ParameterChangeReply
-func NewParameterChangeReply(isA ParameterChange, peekedByte byte) *_ParameterChangeReply {
+func NewParameterChangeReply(isA ParameterChange, peekedByte byte, termination ResponseTermination, messageLength uint16) *_ParameterChangeReply {
_result := &_ParameterChangeReply{
IsA: isA,
- _Reply: NewReply(peekedByte),
+ _Reply: NewReply(peekedByte, termination, messageLength),
}
_result._Reply._ReplyChildRequirements = _result
return _result
@@ -122,7 +123,7 @@ func (m *_ParameterChangeReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func ParameterChangeReplyParse(readBuffer utils.ReadBuffer) (ParameterChangeReply, error) {
+func ParameterChangeReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (ParameterChangeReply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("ParameterChangeReply"); pullErr != nil {
@@ -150,8 +151,10 @@ func ParameterChangeReplyParse(readBuffer utils.ReadBuffer) (ParameterChangeRepl
// Create a partially initialized instance
_child := &_ParameterChangeReply{
- IsA: isA,
- _Reply: &_Reply{},
+ IsA: isA,
+ _Reply: &_Reply{
+ MessageLength: messageLength,
+ },
}
_child._Reply._ReplyChildRequirements = _child
return _child, nil
diff --git a/plc4go/protocols/cbus/readwrite/model/PowerUp.go b/plc4go/protocols/cbus/readwrite/model/PowerUp.go
index 9dc2b074f..aa7651414 100644
--- a/plc4go/protocols/cbus/readwrite/model/PowerUp.go
+++ b/plc4go/protocols/cbus/readwrite/model/PowerUp.go
@@ -36,8 +36,6 @@ type PowerUp interface {
utils.Serializable
// GetReqTermination returns ReqTermination (property field)
GetReqTermination() RequestTermination
- // GetResTermination returns ResTermination (property field)
- GetResTermination() ResponseTermination
}
// PowerUpExactly can be used when we want exactly this type and not a type which fulfills PowerUp.
@@ -50,7 +48,6 @@ type PowerUpExactly interface {
// _PowerUp is the data-structure of this message
type _PowerUp struct {
ReqTermination RequestTermination
- ResTermination ResponseTermination
}
///////////////////////////////////////////////////////////
@@ -62,10 +59,6 @@ func (m *_PowerUp) GetReqTermination() RequestTermination {
return m.ReqTermination
}
-func (m *_PowerUp) GetResTermination() ResponseTermination {
- return m.ResTermination
-}
-
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
@@ -85,8 +78,8 @@ func (m *_PowerUp) GetPowerUpIndicator() byte {
///////////////////////////////////////////////////////////
// NewPowerUp factory function for _PowerUp
-func NewPowerUp(reqTermination RequestTermination, resTermination ResponseTermination) *_PowerUp {
- return &_PowerUp{ReqTermination: reqTermination, ResTermination: resTermination}
+func NewPowerUp(reqTermination RequestTermination) *_PowerUp {
+ return &_PowerUp{ReqTermination: reqTermination}
}
// Deprecated: use the interface for direct cast
@@ -117,9 +110,6 @@ func (m *_PowerUp) GetLengthInBitsConditional(lastItem bool) uint16 {
// Simple field (reqTermination)
lengthInBits += m.ReqTermination.GetLengthInBits()
- // Simple field (resTermination)
- lengthInBits += m.ResTermination.GetLengthInBits()
-
return lengthInBits
}
@@ -158,25 +148,12 @@ func PowerUpParse(readBuffer utils.ReadBuffer) (PowerUp, error) {
return nil, errors.Wrap(closeErr, "Error closing for reqTermination")
}
- // Simple Field (resTermination)
- if pullErr := readBuffer.PullContext("resTermination"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for resTermination")
- }
- _resTermination, _resTerminationErr := ResponseTerminationParse(readBuffer)
- if _resTerminationErr != nil {
- return nil, errors.Wrap(_resTerminationErr, "Error parsing 'resTermination' field of PowerUp")
- }
- resTermination := _resTermination.(ResponseTermination)
- if closeErr := readBuffer.CloseContext("resTermination"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for resTermination")
- }
-
if closeErr := readBuffer.CloseContext("PowerUp"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for PowerUp")
}
// Create the instance
- return NewPowerUp(reqTermination, resTermination), nil
+ return NewPowerUp(reqTermination), nil
}
func (m *_PowerUp) Serialize(writeBuffer utils.WriteBuffer) error {
@@ -204,18 +181,6 @@ func (m *_PowerUp) Serialize(writeBuffer utils.WriteBuffer) error {
return errors.Wrap(_reqTerminationErr, "Error serializing 'reqTermination' field")
}
- // Simple Field (resTermination)
- if pushErr := writeBuffer.PushContext("resTermination"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for resTermination")
- }
- _resTerminationErr := writeBuffer.WriteSerializable(m.GetResTermination())
- if popErr := writeBuffer.PopContext("resTermination"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for resTermination")
- }
- if _resTerminationErr != nil {
- return errors.Wrap(_resTerminationErr, "Error serializing 'resTermination' field")
- }
-
if popErr := writeBuffer.PopContext("PowerUp"); popErr != nil {
return errors.Wrap(popErr, "Error popping for PowerUp")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/PowerUpReply.go b/plc4go/protocols/cbus/readwrite/model/PowerUpReply.go
index 341b3d19e..5a412a40c 100644
--- a/plc4go/protocols/cbus/readwrite/model/PowerUpReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/PowerUpReply.go
@@ -58,8 +58,9 @@ type _PowerUpReply struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_PowerUpReply) InitializeParent(parent Reply, peekedByte byte) {
+func (m *_PowerUpReply) InitializeParent(parent Reply, peekedByte byte, termination ResponseTermination) {
m.PeekedByte = peekedByte
+ m.Termination = termination
}
func (m *_PowerUpReply) GetParent() Reply {
@@ -81,10 +82,10 @@ func (m *_PowerUpReply) GetIsA() PowerUp {
///////////////////////////////////////////////////////////
// NewPowerUpReply factory function for _PowerUpReply
-func NewPowerUpReply(isA PowerUp, peekedByte byte) *_PowerUpReply {
+func NewPowerUpReply(isA PowerUp, peekedByte byte, termination ResponseTermination, messageLength uint16) *_PowerUpReply {
_result := &_PowerUpReply{
IsA: isA,
- _Reply: NewReply(peekedByte),
+ _Reply: NewReply(peekedByte, termination, messageLength),
}
_result._Reply._ReplyChildRequirements = _result
return _result
@@ -122,7 +123,7 @@ func (m *_PowerUpReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func PowerUpReplyParse(readBuffer utils.ReadBuffer) (PowerUpReply, error) {
+func PowerUpReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (PowerUpReply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("PowerUpReply"); pullErr != nil {
@@ -150,8 +151,10 @@ func PowerUpReplyParse(readBuffer utils.ReadBuffer) (PowerUpReply, error) {
// Create a partially initialized instance
_child := &_PowerUpReply{
- IsA: isA,
- _Reply: &_Reply{},
+ IsA: isA,
+ _Reply: &_Reply{
+ MessageLength: messageLength,
+ },
}
_child._Reply._ReplyChildRequirements = _child
return _child, nil
diff --git a/plc4go/protocols/cbus/readwrite/model/Reply.go b/plc4go/protocols/cbus/readwrite/model/Reply.go
index 911aebef7..11bfe46c4 100644
--- a/plc4go/protocols/cbus/readwrite/model/Reply.go
+++ b/plc4go/protocols/cbus/readwrite/model/Reply.go
@@ -32,6 +32,8 @@ type Reply interface {
utils.Serializable
// GetPeekedByte returns PeekedByte (property field)
GetPeekedByte() byte
+ // GetTermination returns Termination (property field)
+ GetTermination() ResponseTermination
// GetIsAlpha returns IsAlpha (virtual field)
GetIsAlpha() bool
}
@@ -46,7 +48,11 @@ type ReplyExactly interface {
// _Reply is the data-structure of this message
type _Reply struct {
_ReplyChildRequirements
- PeekedByte byte
+ PeekedByte byte
+ Termination ResponseTermination
+
+ // Arguments.
+ MessageLength uint16
}
type _ReplyChildRequirements interface {
@@ -62,7 +68,7 @@ type ReplyParent interface {
type ReplyChild interface {
utils.Serializable
- InitializeParent(parent Reply, peekedByte byte)
+ InitializeParent(parent Reply, peekedByte byte, termination ResponseTermination)
GetParent() *Reply
GetTypeName() string
@@ -78,6 +84,10 @@ func (m *_Reply) GetPeekedByte() byte {
return m.PeekedByte
}
+func (m *_Reply) GetTermination() ResponseTermination {
+ return m.Termination
+}
+
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
@@ -97,8 +107,8 @@ func (m *_Reply) GetIsAlpha() bool {
///////////////////////////////////////////////////////////
// NewReply factory function for _Reply
-func NewReply(peekedByte byte) *_Reply {
- return &_Reply{PeekedByte: peekedByte}
+func NewReply(peekedByte byte, termination ResponseTermination, messageLength uint16) *_Reply {
+ return &_Reply{PeekedByte: peekedByte, Termination: termination, MessageLength: messageLength}
}
// Deprecated: use the interface for direct cast
@@ -121,6 +131,9 @@ func (m *_Reply) GetParentLengthInBits() uint16 {
// A virtual field doesn't have any in- or output.
+ // Simple field (termination)
+ lengthInBits += m.Termination.GetLengthInBits()
+
return lengthInBits
}
@@ -128,7 +141,7 @@ func (m *_Reply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func ReplyParse(readBuffer utils.ReadBuffer) (Reply, error) {
+func ReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (Reply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("Reply"); pullErr != nil {
@@ -154,7 +167,7 @@ func ReplyParse(readBuffer utils.ReadBuffer) (Reply, error) {
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
type ReplyChildSerializeRequirement interface {
Reply
- InitializeParent(Reply, byte)
+ InitializeParent(Reply, byte, ResponseTermination)
GetParent() Reply
}
var _childTemp interface{}
@@ -162,17 +175,21 @@ func ReplyParse(readBuffer utils.ReadBuffer) (Reply, error) {
var typeSwitchError error
switch {
case true && isAlpha == bool(true): // ConfirmationReply
- _childTemp, typeSwitchError = ConfirmationReplyParse(readBuffer)
+ _childTemp, typeSwitchError = ConfirmationReplyParse(readBuffer, messageLength)
case peekedByte == 0x2B: // PowerUpReply
- _childTemp, typeSwitchError = PowerUpReplyParse(readBuffer)
+ _childTemp, typeSwitchError = PowerUpReplyParse(readBuffer, messageLength)
case peekedByte == 0x3D: // ParameterChangeReply
- _childTemp, typeSwitchError = ParameterChangeReplyParse(readBuffer)
+ _childTemp, typeSwitchError = ParameterChangeReplyParse(readBuffer, messageLength)
case peekedByte == 0x21: // ServerErrorReply
- _childTemp, typeSwitchError = ServerErrorReplyParse(readBuffer)
+ _childTemp, typeSwitchError = ServerErrorReplyParse(readBuffer, messageLength)
case peekedByte == 0x0: // MonitoredSALReply
- _childTemp, typeSwitchError = MonitoredSALReplyParse(readBuffer)
+ _childTemp, typeSwitchError = MonitoredSALReplyParse(readBuffer, messageLength)
+ case peekedByte == 0x0: // StandardFormatStatusReplyReply
+ _childTemp, typeSwitchError = StandardFormatStatusReplyReplyParse(readBuffer, messageLength)
+ case peekedByte == 0x0: // ExtendedFormatStatusReplyReply
+ _childTemp, typeSwitchError = ExtendedFormatStatusReplyReplyParse(readBuffer, messageLength)
case true: // CALReplyReply
- _childTemp, typeSwitchError = CALReplyReplyParse(readBuffer)
+ _childTemp, typeSwitchError = CALReplyReplyParse(readBuffer, messageLength)
default:
typeSwitchError = errors.Errorf("Unmapped type for parameters [peekedByte=%v, isAlpha=%v]", peekedByte, isAlpha)
}
@@ -181,12 +198,25 @@ func ReplyParse(readBuffer utils.ReadBuffer) (Reply, error) {
}
_child = _childTemp.(ReplyChildSerializeRequirement)
+ // Simple Field (termination)
+ if pullErr := readBuffer.PullContext("termination"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for termination")
+ }
+ _termination, _terminationErr := ResponseTerminationParse(readBuffer)
+ if _terminationErr != nil {
+ return nil, errors.Wrap(_terminationErr, "Error parsing 'termination' field of Reply")
+ }
+ termination := _termination.(ResponseTermination)
+ if closeErr := readBuffer.CloseContext("termination"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for termination")
+ }
+
if closeErr := readBuffer.CloseContext("Reply"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for Reply")
}
// Finish initializing
- _child.InitializeParent(_child, peekedByte)
+ _child.InitializeParent(_child, peekedByte, termination)
return _child, nil
}
@@ -209,6 +239,18 @@ func (pm *_Reply) SerializeParent(writeBuffer utils.WriteBuffer, child Reply, se
return errors.Wrap(_typeSwitchErr, "Error serializing sub-type field")
}
+ // Simple Field (termination)
+ if pushErr := writeBuffer.PushContext("termination"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for termination")
+ }
+ _terminationErr := writeBuffer.WriteSerializable(m.GetTermination())
+ if popErr := writeBuffer.PopContext("termination"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for termination")
+ }
+ if _terminationErr != nil {
+ return errors.Wrap(_terminationErr, "Error serializing 'termination' field")
+ }
+
if popErr := writeBuffer.PopContext("Reply"); popErr != nil {
return errors.Wrap(popErr, "Error popping for Reply")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/Request.go b/plc4go/protocols/cbus/readwrite/model/Request.go
index 9354e9c56..9c73385dd 100644
--- a/plc4go/protocols/cbus/readwrite/model/Request.go
+++ b/plc4go/protocols/cbus/readwrite/model/Request.go
@@ -31,7 +31,11 @@ type Request interface {
utils.LengthAware
utils.Serializable
// GetPeekedByte returns PeekedByte (property field)
- GetPeekedByte() byte
+ GetPeekedByte() RequestType
+ // GetTermination returns Termination (property field)
+ GetTermination() RequestTermination
+ // GetPayloadLength returns PayloadLength (virtual field)
+ GetPayloadLength() uint16
}
// RequestExactly can be used when we want exactly this type and not a type which fulfills Request.
@@ -44,10 +48,12 @@ type RequestExactly interface {
// _Request is the data-structure of this message
type _Request struct {
_RequestChildRequirements
- PeekedByte byte
+ PeekedByte RequestType
+ Termination RequestTermination
// Arguments.
- Srchk bool
+ Srchk bool
+ MessageLength uint16
}
type _RequestChildRequirements interface {
@@ -63,7 +69,7 @@ type RequestParent interface {
type RequestChild interface {
utils.Serializable
- InitializeParent(parent Request, peekedByte byte)
+ InitializeParent(parent Request, peekedByte RequestType, termination RequestTermination)
GetParent() *Request
GetTypeName() string
@@ -75,18 +81,35 @@ type RequestChild interface {
/////////////////////// Accessors for property fields.
///////////////////////
-func (m *_Request) GetPeekedByte() byte {
+func (m *_Request) GetPeekedByte() RequestType {
return m.PeekedByte
}
+func (m *_Request) GetTermination() RequestTermination {
+ return m.Termination
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for virtual fields.
+///////////////////////
+
+func (m *_Request) GetPayloadLength() uint16 {
+ return uint16(uint16(m.MessageLength) - uint16(uint16(2)))
+}
+
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// NewRequest factory function for _Request
-func NewRequest(peekedByte byte, srchk bool) *_Request {
- return &_Request{PeekedByte: peekedByte, Srchk: srchk}
+func NewRequest(peekedByte RequestType, termination RequestTermination, srchk bool, messageLength uint16) *_Request {
+ return &_Request{PeekedByte: peekedByte, Termination: termination, Srchk: srchk, MessageLength: messageLength}
}
// Deprecated: use the interface for direct cast
@@ -107,6 +130,11 @@ func (m *_Request) GetTypeName() string {
func (m *_Request) GetParentLengthInBits() uint16 {
lengthInBits := uint16(0)
+ // A virtual field doesn't have any in- or output.
+
+ // Simple field (termination)
+ lengthInBits += m.Termination.GetLengthInBits()
+
return lengthInBits
}
@@ -114,7 +142,7 @@ func (m *_Request) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func RequestParse(readBuffer utils.ReadBuffer, srchk bool) (Request, error) {
+func RequestParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16) (Request, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("Request"); pullErr != nil {
@@ -125,35 +153,46 @@ func RequestParse(readBuffer utils.ReadBuffer, srchk bool) (Request, error) {
// Peek Field (peekedByte)
currentPos = positionAware.GetPos()
- peekedByte, _err := readBuffer.ReadByte("peekedByte")
+ if pullErr := readBuffer.PullContext("peekedByte"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for peekedByte")
+ }
+ peekedByte, _err := RequestTypeParse(readBuffer)
if _err != nil {
return nil, errors.Wrap(_err, "Error parsing 'peekedByte' field of Request")
}
+ if closeErr := readBuffer.CloseContext("peekedByte"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for peekedByte")
+ }
readBuffer.Reset(currentPos)
+ // Virtual field
+ _payloadLength := uint16(messageLength) - uint16(uint16(2))
+ payloadLength := uint16(_payloadLength)
+ _ = payloadLength
+
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
type RequestChildSerializeRequirement interface {
Request
- InitializeParent(Request, byte)
+ InitializeParent(Request, RequestType, RequestTermination)
GetParent() Request
}
var _childTemp interface{}
var _child RequestChildSerializeRequirement
var typeSwitchError error
switch {
- case peekedByte == 0x7C: // RequestSmartConnectShortcut
- _childTemp, typeSwitchError = RequestSmartConnectShortcutParse(readBuffer, srchk)
- case peekedByte == 0x7E: // RequestReset
- _childTemp, typeSwitchError = RequestResetParse(readBuffer, srchk)
- case peekedByte == 0x40: // RequestDirectCommandAccess
- _childTemp, typeSwitchError = RequestDirectCommandAccessParse(readBuffer, srchk)
- case peekedByte == 0x5C: // RequestCommand
- _childTemp, typeSwitchError = RequestCommandParse(readBuffer, srchk)
- case peekedByte == 0x6E: // RequestNull
- _childTemp, typeSwitchError = RequestNullParse(readBuffer, srchk)
- case peekedByte == 0x0D: // RequestEmpty
- _childTemp, typeSwitchError = RequestEmptyParse(readBuffer, srchk)
+ case peekedByte == RequestType_SMART_CONNECT_SHORTCUT: // RequestSmartConnectShortcut
+ _childTemp, typeSwitchError = RequestSmartConnectShortcutParse(readBuffer, srchk, messageLength)
+ case peekedByte == RequestType_RESET: // RequestReset
+ _childTemp, typeSwitchError = RequestResetParse(readBuffer, srchk, messageLength)
+ case peekedByte == RequestType_DIRECT_COMMAND: // RequestDirectCommandAccess
+ _childTemp, typeSwitchError = RequestDirectCommandAccessParse(readBuffer, srchk, messageLength, payloadLength)
+ case peekedByte == RequestType_REQUEST_COMMAND: // RequestCommand
+ _childTemp, typeSwitchError = RequestCommandParse(readBuffer, srchk, messageLength, payloadLength)
+ case peekedByte == RequestType_NULL: // RequestNull
+ _childTemp, typeSwitchError = RequestNullParse(readBuffer, srchk, messageLength)
+ case peekedByte == RequestType_EMPTY: // RequestEmpty
+ _childTemp, typeSwitchError = RequestEmptyParse(readBuffer, srchk, messageLength)
default:
typeSwitchError = errors.Errorf("Unmapped type for parameters [peekedByte=%v]", peekedByte)
}
@@ -162,12 +201,25 @@ func RequestParse(readBuffer utils.ReadBuffer, srchk bool) (Request, error) {
}
_child = _childTemp.(RequestChildSerializeRequirement)
+ // Simple Field (termination)
+ if pullErr := readBuffer.PullContext("termination"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for termination")
+ }
+ _termination, _terminationErr := RequestTerminationParse(readBuffer)
+ if _terminationErr != nil {
+ return nil, errors.Wrap(_terminationErr, "Error parsing 'termination' field of Request")
+ }
+ termination := _termination.(RequestTermination)
+ if closeErr := readBuffer.CloseContext("termination"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for termination")
+ }
+
if closeErr := readBuffer.CloseContext("Request"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for Request")
}
// Finish initializing
- _child.InitializeParent(_child, peekedByte)
+ _child.InitializeParent(_child, peekedByte, termination)
return _child, nil
}
@@ -180,12 +232,28 @@ func (pm *_Request) SerializeParent(writeBuffer utils.WriteBuffer, child Request
if pushErr := writeBuffer.PushContext("Request"); pushErr != nil {
return errors.Wrap(pushErr, "Error pushing for Request")
}
+ // Virtual field
+ if _payloadLengthErr := writeBuffer.WriteVirtual("payloadLength", m.GetPayloadLength()); _payloadLengthErr != nil {
+ return errors.Wrap(_payloadLengthErr, "Error serializing 'payloadLength' field")
+ }
// Switch field (Depending on the discriminator values, passes the serialization to a sub-type)
if _typeSwitchErr := serializeChildFunction(); _typeSwitchErr != nil {
return errors.Wrap(_typeSwitchErr, "Error serializing sub-type field")
}
+ // Simple Field (termination)
+ if pushErr := writeBuffer.PushContext("termination"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for termination")
+ }
+ _terminationErr := writeBuffer.WriteSerializable(m.GetTermination())
+ if popErr := writeBuffer.PopContext("termination"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for termination")
+ }
+ if _terminationErr != nil {
+ return errors.Wrap(_terminationErr, "Error serializing 'termination' field")
+ }
+
if popErr := writeBuffer.PopContext("Request"); popErr != nil {
return errors.Wrap(popErr, "Error popping for Request")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestCommand.go b/plc4go/protocols/cbus/readwrite/model/RequestCommand.go
index 404bc6c01..008c67c5b 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestCommand.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestCommand.go
@@ -50,6 +50,9 @@ type RequestCommandExactly interface {
type _RequestCommand struct {
*_Request
CbusCommand CBusCommand
+
+ // Arguments.
+ PayloadLength uint16
}
///////////////////////////////////////////////////////////
@@ -62,8 +65,9 @@ type _RequestCommand struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_RequestCommand) InitializeParent(parent Request, peekedByte byte) {
+func (m *_RequestCommand) InitializeParent(parent Request, peekedByte RequestType, termination RequestTermination) {
m.PeekedByte = peekedByte
+ m.Termination = termination
}
func (m *_RequestCommand) GetParent() Request {
@@ -98,10 +102,10 @@ func (m *_RequestCommand) GetInitiator() byte {
///////////////////////////////////////////////////////////
// NewRequestCommand factory function for _RequestCommand
-func NewRequestCommand(cbusCommand CBusCommand, peekedByte byte, srchk bool) *_RequestCommand {
+func NewRequestCommand(cbusCommand CBusCommand, peekedByte RequestType, termination RequestTermination, srchk bool, messageLength uint16, payloadLength uint16) *_RequestCommand {
_result := &_RequestCommand{
CbusCommand: cbusCommand,
- _Request: NewRequest(peekedByte, srchk),
+ _Request: NewRequest(peekedByte, termination, srchk, messageLength),
}
_result._Request._RequestChildRequirements = _result
return _result
@@ -132,8 +136,8 @@ func (m *_RequestCommand) GetLengthInBitsConditional(lastItem bool) uint16 {
// Const Field (initiator)
lengthInBits += 8
- // Simple field (cbusCommand)
- lengthInBits += m.CbusCommand.GetLengthInBits()
+ // Manual Field (cbusCommand)
+ lengthInBits += uint16(int32(m.GetLengthInBytes()) * int32(int32(2)))
return lengthInBits
}
@@ -142,7 +146,7 @@ func (m *_RequestCommand) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func RequestCommandParse(readBuffer utils.ReadBuffer, srchk bool) (RequestCommand, error) {
+func RequestCommandParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16, payloadLength uint16) (RequestCommand, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("RequestCommand"); pullErr != nil {
@@ -160,18 +164,12 @@ func RequestCommandParse(readBuffer utils.ReadBuffer, srchk bool) (RequestComman
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")
- }
- _cbusCommand, _cbusCommandErr := CBusCommandParse(readBuffer, bool(srchk))
+ // Manual Field (cbusCommand)
+ _cbusCommand, _cbusCommandErr := ReadCBusCommand(readBuffer, payloadLength, srchk)
if _cbusCommandErr != nil {
return nil, errors.Wrap(_cbusCommandErr, "Error parsing 'cbusCommand' field of RequestCommand")
}
cbusCommand := _cbusCommand.(CBusCommand)
- if closeErr := readBuffer.CloseContext("cbusCommand"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for cbusCommand")
- }
if closeErr := readBuffer.CloseContext("RequestCommand"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for RequestCommand")
@@ -181,7 +179,8 @@ func RequestCommandParse(readBuffer utils.ReadBuffer, srchk bool) (RequestComman
_child := &_RequestCommand{
CbusCommand: cbusCommand,
_Request: &_Request{
- Srchk: srchk,
+ Srchk: srchk,
+ MessageLength: messageLength,
},
}
_child._Request._RequestChildRequirements = _child
@@ -202,14 +201,8 @@ func (m *_RequestCommand) Serialize(writeBuffer utils.WriteBuffer) error {
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")
- }
- _cbusCommandErr := writeBuffer.WriteSerializable(m.GetCbusCommand())
- if popErr := writeBuffer.PopContext("cbusCommand"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for cbusCommand")
- }
+ // Manual Field (cbusCommand)
+ _cbusCommandErr := WriteCBusCommand(writeBuffer, m.GetCbusCommand())
if _cbusCommandErr != nil {
return errors.Wrap(_cbusCommandErr, "Error serializing 'cbusCommand' field")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestDirectCommandAccess.go b/plc4go/protocols/cbus/readwrite/model/RequestDirectCommandAccess.go
index aab6c0987..74f87f6f4 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestDirectCommandAccess.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestDirectCommandAccess.go
@@ -36,9 +36,7 @@ type RequestDirectCommandAccess interface {
utils.Serializable
Request
// GetCbusCommand returns CbusCommand (property field)
- GetCbusCommand() CBusPointToPointCommand
- // GetTermination returns Termination (property field)
- GetTermination() RequestTermination
+ GetCbusCommand() CBusCommand
}
// RequestDirectCommandAccessExactly can be used when we want exactly this type and not a type which fulfills RequestDirectCommandAccess.
@@ -51,8 +49,10 @@ type RequestDirectCommandAccessExactly interface {
// _RequestDirectCommandAccess is the data-structure of this message
type _RequestDirectCommandAccess struct {
*_Request
- CbusCommand CBusPointToPointCommand
- Termination RequestTermination
+ CbusCommand CBusCommand
+
+ // Arguments.
+ PayloadLength uint16
}
///////////////////////////////////////////////////////////
@@ -65,8 +65,9 @@ type _RequestDirectCommandAccess struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_RequestDirectCommandAccess) InitializeParent(parent Request, peekedByte byte) {
+func (m *_RequestDirectCommandAccess) InitializeParent(parent Request, peekedByte RequestType, termination RequestTermination) {
m.PeekedByte = peekedByte
+ m.Termination = termination
}
func (m *_RequestDirectCommandAccess) GetParent() Request {
@@ -78,14 +79,10 @@ func (m *_RequestDirectCommandAccess) GetParent() Request {
/////////////////////// Accessors for property fields.
///////////////////////
-func (m *_RequestDirectCommandAccess) GetCbusCommand() CBusPointToPointCommand {
+func (m *_RequestDirectCommandAccess) GetCbusCommand() CBusCommand {
return m.CbusCommand
}
-func (m *_RequestDirectCommandAccess) GetTermination() RequestTermination {
- return m.Termination
-}
-
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
@@ -105,11 +102,10 @@ func (m *_RequestDirectCommandAccess) GetAt() byte {
///////////////////////////////////////////////////////////
// NewRequestDirectCommandAccess factory function for _RequestDirectCommandAccess
-func NewRequestDirectCommandAccess(cbusCommand CBusPointToPointCommand, termination RequestTermination, peekedByte byte, srchk bool) *_RequestDirectCommandAccess {
+func NewRequestDirectCommandAccess(cbusCommand CBusCommand, peekedByte RequestType, termination RequestTermination, srchk bool, messageLength uint16, payloadLength uint16) *_RequestDirectCommandAccess {
_result := &_RequestDirectCommandAccess{
CbusCommand: cbusCommand,
- Termination: termination,
- _Request: NewRequest(peekedByte, srchk),
+ _Request: NewRequest(peekedByte, termination, srchk, messageLength),
}
_result._Request._RequestChildRequirements = _result
return _result
@@ -140,11 +136,8 @@ func (m *_RequestDirectCommandAccess) GetLengthInBitsConditional(lastItem bool)
// Const Field (at)
lengthInBits += 8
- // Simple field (cbusCommand)
- lengthInBits += m.CbusCommand.GetLengthInBits()
-
- // Simple field (termination)
- lengthInBits += m.Termination.GetLengthInBits()
+ // Manual Field (cbusCommand)
+ lengthInBits += uint16(int32(m.GetLengthInBytes()) * int32(int32(2)))
return lengthInBits
}
@@ -153,7 +146,7 @@ func (m *_RequestDirectCommandAccess) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func RequestDirectCommandAccessParse(readBuffer utils.ReadBuffer, srchk bool) (RequestDirectCommandAccess, error) {
+func RequestDirectCommandAccessParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16, payloadLength uint16) (RequestDirectCommandAccess, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("RequestDirectCommandAccess"); pullErr != nil {
@@ -171,31 +164,12 @@ func RequestDirectCommandAccessParse(readBuffer utils.ReadBuffer, srchk bool) (R
return nil, errors.New("Expected constant value " + fmt.Sprintf("%d", RequestDirectCommandAccess_AT) + " but got " + fmt.Sprintf("%d", at))
}
- // Simple Field (cbusCommand)
- if pullErr := readBuffer.PullContext("cbusCommand"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for cbusCommand")
- }
- _cbusCommand, _cbusCommandErr := CBusPointToPointCommandParse(readBuffer, bool(srchk))
+ // Manual Field (cbusCommand)
+ _cbusCommand, _cbusCommandErr := ReadCBusCommand(readBuffer, payloadLength, srchk)
if _cbusCommandErr != nil {
return nil, errors.Wrap(_cbusCommandErr, "Error parsing 'cbusCommand' field of RequestDirectCommandAccess")
}
- cbusCommand := _cbusCommand.(CBusPointToPointCommand)
- if closeErr := readBuffer.CloseContext("cbusCommand"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for cbusCommand")
- }
-
- // Simple Field (termination)
- if pullErr := readBuffer.PullContext("termination"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for termination")
- }
- _termination, _terminationErr := RequestTerminationParse(readBuffer)
- if _terminationErr != nil {
- return nil, errors.Wrap(_terminationErr, "Error parsing 'termination' field of RequestDirectCommandAccess")
- }
- termination := _termination.(RequestTermination)
- if closeErr := readBuffer.CloseContext("termination"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for termination")
- }
+ cbusCommand := _cbusCommand.(CBusCommand)
if closeErr := readBuffer.CloseContext("RequestDirectCommandAccess"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for RequestDirectCommandAccess")
@@ -204,9 +178,9 @@ func RequestDirectCommandAccessParse(readBuffer utils.ReadBuffer, srchk bool) (R
// Create a partially initialized instance
_child := &_RequestDirectCommandAccess{
CbusCommand: cbusCommand,
- Termination: termination,
_Request: &_Request{
- Srchk: srchk,
+ Srchk: srchk,
+ MessageLength: messageLength,
},
}
_child._Request._RequestChildRequirements = _child
@@ -227,30 +201,12 @@ func (m *_RequestDirectCommandAccess) Serialize(writeBuffer utils.WriteBuffer) e
return errors.Wrap(_atErr, "Error serializing 'at' field")
}
- // Simple Field (cbusCommand)
- if pushErr := writeBuffer.PushContext("cbusCommand"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for cbusCommand")
- }
- _cbusCommandErr := writeBuffer.WriteSerializable(m.GetCbusCommand())
- if popErr := writeBuffer.PopContext("cbusCommand"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for cbusCommand")
- }
+ // Manual Field (cbusCommand)
+ _cbusCommandErr := WriteCBusCommand(writeBuffer, m.GetCbusCommand())
if _cbusCommandErr != nil {
return errors.Wrap(_cbusCommandErr, "Error serializing 'cbusCommand' field")
}
- // Simple Field (termination)
- if pushErr := writeBuffer.PushContext("termination"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for termination")
- }
- _terminationErr := writeBuffer.WriteSerializable(m.GetTermination())
- if popErr := writeBuffer.PopContext("termination"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for termination")
- }
- if _terminationErr != nil {
- return errors.Wrap(_terminationErr, "Error serializing 'termination' field")
- }
-
if popErr := writeBuffer.PopContext("RequestDirectCommandAccess"); popErr != nil {
return errors.Wrap(popErr, "Error popping for RequestDirectCommandAccess")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestEmpty.go b/plc4go/protocols/cbus/readwrite/model/RequestEmpty.go
index 87b631d8b..44b219a56 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestEmpty.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestEmpty.go
@@ -31,8 +31,6 @@ type RequestEmpty interface {
utils.LengthAware
utils.Serializable
Request
- // GetTermination returns Termination (property field)
- GetTermination() RequestTermination
}
// RequestEmptyExactly can be used when we want exactly this type and not a type which fulfills RequestEmpty.
@@ -45,7 +43,6 @@ type RequestEmptyExactly interface {
// _RequestEmpty is the data-structure of this message
type _RequestEmpty struct {
*_Request
- Termination RequestTermination
}
///////////////////////////////////////////////////////////
@@ -58,33 +55,19 @@ type _RequestEmpty struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_RequestEmpty) InitializeParent(parent Request, peekedByte byte) {
+func (m *_RequestEmpty) InitializeParent(parent Request, peekedByte RequestType, termination RequestTermination) {
m.PeekedByte = peekedByte
+ m.Termination = termination
}
func (m *_RequestEmpty) GetParent() Request {
return m._Request
}
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-/////////////////////// Accessors for property fields.
-///////////////////////
-
-func (m *_RequestEmpty) GetTermination() RequestTermination {
- return m.Termination
-}
-
-///////////////////////
-///////////////////////
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-
// NewRequestEmpty factory function for _RequestEmpty
-func NewRequestEmpty(termination RequestTermination, peekedByte byte, srchk bool) *_RequestEmpty {
+func NewRequestEmpty(peekedByte RequestType, termination RequestTermination, srchk bool, messageLength uint16) *_RequestEmpty {
_result := &_RequestEmpty{
- Termination: termination,
- _Request: NewRequest(peekedByte, srchk),
+ _Request: NewRequest(peekedByte, termination, srchk, messageLength),
}
_result._Request._RequestChildRequirements = _result
return _result
@@ -112,9 +95,6 @@ func (m *_RequestEmpty) GetLengthInBits() uint16 {
func (m *_RequestEmpty) GetLengthInBitsConditional(lastItem bool) uint16 {
lengthInBits := uint16(m.GetParentLengthInBits())
- // Simple field (termination)
- lengthInBits += m.Termination.GetLengthInBits()
-
return lengthInBits
}
@@ -122,7 +102,7 @@ func (m *_RequestEmpty) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func RequestEmptyParse(readBuffer utils.ReadBuffer, srchk bool) (RequestEmpty, error) {
+func RequestEmptyParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16) (RequestEmpty, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("RequestEmpty"); pullErr != nil {
@@ -131,28 +111,15 @@ func RequestEmptyParse(readBuffer utils.ReadBuffer, srchk bool) (RequestEmpty, e
currentPos := positionAware.GetPos()
_ = currentPos
- // Simple Field (termination)
- if pullErr := readBuffer.PullContext("termination"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for termination")
- }
- _termination, _terminationErr := RequestTerminationParse(readBuffer)
- if _terminationErr != nil {
- return nil, errors.Wrap(_terminationErr, "Error parsing 'termination' field of RequestEmpty")
- }
- termination := _termination.(RequestTermination)
- if closeErr := readBuffer.CloseContext("termination"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for termination")
- }
-
if closeErr := readBuffer.CloseContext("RequestEmpty"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for RequestEmpty")
}
// Create a partially initialized instance
_child := &_RequestEmpty{
- Termination: termination,
_Request: &_Request{
- Srchk: srchk,
+ Srchk: srchk,
+ MessageLength: messageLength,
},
}
_child._Request._RequestChildRequirements = _child
@@ -167,18 +134,6 @@ func (m *_RequestEmpty) Serialize(writeBuffer utils.WriteBuffer) error {
return errors.Wrap(pushErr, "Error pushing for RequestEmpty")
}
- // Simple Field (termination)
- if pushErr := writeBuffer.PushContext("termination"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for termination")
- }
- _terminationErr := writeBuffer.WriteSerializable(m.GetTermination())
- if popErr := writeBuffer.PopContext("termination"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for termination")
- }
- if _terminationErr != nil {
- return errors.Wrap(_terminationErr, "Error serializing 'termination' field")
- }
-
if popErr := writeBuffer.PopContext("RequestEmpty"); popErr != nil {
return errors.Wrap(popErr, "Error popping for RequestEmpty")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestNull.go b/plc4go/protocols/cbus/readwrite/model/RequestNull.go
index f9901ecf7..b9818c99e 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestNull.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestNull.go
@@ -35,8 +35,6 @@ type RequestNull interface {
utils.LengthAware
utils.Serializable
Request
- // GetTermination returns Termination (property field)
- GetTermination() RequestTermination
}
// RequestNullExactly can be used when we want exactly this type and not a type which fulfills RequestNull.
@@ -49,7 +47,6 @@ type RequestNullExactly interface {
// _RequestNull is the data-structure of this message
type _RequestNull struct {
*_Request
- Termination RequestTermination
}
///////////////////////////////////////////////////////////
@@ -62,27 +59,15 @@ type _RequestNull struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_RequestNull) InitializeParent(parent Request, peekedByte byte) {
+func (m *_RequestNull) InitializeParent(parent Request, peekedByte RequestType, termination RequestTermination) {
m.PeekedByte = peekedByte
+ m.Termination = termination
}
func (m *_RequestNull) GetParent() Request {
return m._Request
}
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-/////////////////////// Accessors for property fields.
-///////////////////////
-
-func (m *_RequestNull) GetTermination() RequestTermination {
- return m.Termination
-}
-
-///////////////////////
-///////////////////////
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
/////////////////////// Accessors for const fields.
@@ -98,10 +83,9 @@ func (m *_RequestNull) GetNullIndicator() uint32 {
///////////////////////////////////////////////////////////
// NewRequestNull factory function for _RequestNull
-func NewRequestNull(termination RequestTermination, peekedByte byte, srchk bool) *_RequestNull {
+func NewRequestNull(peekedByte RequestType, termination RequestTermination, srchk bool, messageLength uint16) *_RequestNull {
_result := &_RequestNull{
- Termination: termination,
- _Request: NewRequest(peekedByte, srchk),
+ _Request: NewRequest(peekedByte, termination, srchk, messageLength),
}
_result._Request._RequestChildRequirements = _result
return _result
@@ -132,9 +116,6 @@ func (m *_RequestNull) GetLengthInBitsConditional(lastItem bool) uint16 {
// Const Field (nullIndicator)
lengthInBits += 32
- // Simple field (termination)
- lengthInBits += m.Termination.GetLengthInBits()
-
return lengthInBits
}
@@ -142,7 +123,7 @@ func (m *_RequestNull) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func RequestNullParse(readBuffer utils.ReadBuffer, srchk bool) (RequestNull, error) {
+func RequestNullParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16) (RequestNull, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("RequestNull"); pullErr != nil {
@@ -160,28 +141,15 @@ func RequestNullParse(readBuffer utils.ReadBuffer, srchk bool) (RequestNull, err
return nil, errors.New("Expected constant value " + fmt.Sprintf("%d", RequestNull_NULLINDICATOR) + " but got " + fmt.Sprintf("%d", nullIndicator))
}
- // Simple Field (termination)
- if pullErr := readBuffer.PullContext("termination"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for termination")
- }
- _termination, _terminationErr := RequestTerminationParse(readBuffer)
- if _terminationErr != nil {
- return nil, errors.Wrap(_terminationErr, "Error parsing 'termination' field of RequestNull")
- }
- termination := _termination.(RequestTermination)
- if closeErr := readBuffer.CloseContext("termination"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for termination")
- }
-
if closeErr := readBuffer.CloseContext("RequestNull"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for RequestNull")
}
// Create a partially initialized instance
_child := &_RequestNull{
- Termination: termination,
_Request: &_Request{
- Srchk: srchk,
+ Srchk: srchk,
+ MessageLength: messageLength,
},
}
_child._Request._RequestChildRequirements = _child
@@ -202,18 +170,6 @@ func (m *_RequestNull) Serialize(writeBuffer utils.WriteBuffer) error {
return errors.Wrap(_nullIndicatorErr, "Error serializing 'nullIndicator' field")
}
- // Simple Field (termination)
- if pushErr := writeBuffer.PushContext("termination"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for termination")
- }
- _terminationErr := writeBuffer.WriteSerializable(m.GetTermination())
- if popErr := writeBuffer.PopContext("termination"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for termination")
- }
- if _terminationErr != nil {
- return errors.Wrap(_terminationErr, "Error serializing 'termination' field")
- }
-
if popErr := writeBuffer.PopContext("RequestNull"); popErr != nil {
return errors.Wrap(popErr, "Error popping for RequestNull")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestReset.go b/plc4go/protocols/cbus/readwrite/model/RequestReset.go
index e6b585ff5..feda68998 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestReset.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestReset.go
@@ -35,8 +35,6 @@ type RequestReset interface {
utils.LengthAware
utils.Serializable
Request
- // GetTermination returns Termination (property field)
- GetTermination() RequestTermination
}
// RequestResetExactly can be used when we want exactly this type and not a type which fulfills RequestReset.
@@ -49,7 +47,6 @@ type RequestResetExactly interface {
// _RequestReset is the data-structure of this message
type _RequestReset struct {
*_Request
- Termination RequestTermination
}
///////////////////////////////////////////////////////////
@@ -62,27 +59,15 @@ type _RequestReset struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_RequestReset) InitializeParent(parent Request, peekedByte byte) {
+func (m *_RequestReset) InitializeParent(parent Request, peekedByte RequestType, termination RequestTermination) {
m.PeekedByte = peekedByte
+ m.Termination = termination
}
func (m *_RequestReset) GetParent() Request {
return m._Request
}
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-/////////////////////// Accessors for property fields.
-///////////////////////
-
-func (m *_RequestReset) GetTermination() RequestTermination {
- return m.Termination
-}
-
-///////////////////////
-///////////////////////
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
/////////////////////// Accessors for const fields.
@@ -98,10 +83,9 @@ func (m *_RequestReset) GetTilde() byte {
///////////////////////////////////////////////////////////
// NewRequestReset factory function for _RequestReset
-func NewRequestReset(termination RequestTermination, peekedByte byte, srchk bool) *_RequestReset {
+func NewRequestReset(peekedByte RequestType, termination RequestTermination, srchk bool, messageLength uint16) *_RequestReset {
_result := &_RequestReset{
- Termination: termination,
- _Request: NewRequest(peekedByte, srchk),
+ _Request: NewRequest(peekedByte, termination, srchk, messageLength),
}
_result._Request._RequestChildRequirements = _result
return _result
@@ -132,9 +116,6 @@ func (m *_RequestReset) GetLengthInBitsConditional(lastItem bool) uint16 {
// Const Field (tilde)
lengthInBits += 8
- // Simple field (termination)
- lengthInBits += m.Termination.GetLengthInBits()
-
return lengthInBits
}
@@ -142,7 +123,7 @@ func (m *_RequestReset) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func RequestResetParse(readBuffer utils.ReadBuffer, srchk bool) (RequestReset, error) {
+func RequestResetParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16) (RequestReset, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("RequestReset"); pullErr != nil {
@@ -160,28 +141,15 @@ func RequestResetParse(readBuffer utils.ReadBuffer, srchk bool) (RequestReset, e
return nil, errors.New("Expected constant value " + fmt.Sprintf("%d", RequestReset_TILDE) + " but got " + fmt.Sprintf("%d", tilde))
}
- // Simple Field (termination)
- if pullErr := readBuffer.PullContext("termination"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for termination")
- }
- _termination, _terminationErr := RequestTerminationParse(readBuffer)
- if _terminationErr != nil {
- return nil, errors.Wrap(_terminationErr, "Error parsing 'termination' field of RequestReset")
- }
- termination := _termination.(RequestTermination)
- if closeErr := readBuffer.CloseContext("termination"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for termination")
- }
-
if closeErr := readBuffer.CloseContext("RequestReset"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for RequestReset")
}
// Create a partially initialized instance
_child := &_RequestReset{
- Termination: termination,
_Request: &_Request{
- Srchk: srchk,
+ Srchk: srchk,
+ MessageLength: messageLength,
},
}
_child._Request._RequestChildRequirements = _child
@@ -202,18 +170,6 @@ func (m *_RequestReset) Serialize(writeBuffer utils.WriteBuffer) error {
return errors.Wrap(_tildeErr, "Error serializing 'tilde' field")
}
- // Simple Field (termination)
- if pushErr := writeBuffer.PushContext("termination"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for termination")
- }
- _terminationErr := writeBuffer.WriteSerializable(m.GetTermination())
- if popErr := writeBuffer.PopContext("termination"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for termination")
- }
- if _terminationErr != nil {
- return errors.Wrap(_terminationErr, "Error serializing 'termination' field")
- }
-
if popErr := writeBuffer.PopContext("RequestReset"); popErr != nil {
return errors.Wrap(popErr, "Error popping for RequestReset")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestSmartConnectShortcut.go b/plc4go/protocols/cbus/readwrite/model/RequestSmartConnectShortcut.go
index c45c10dbe..e28580c0b 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestSmartConnectShortcut.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestSmartConnectShortcut.go
@@ -35,8 +35,6 @@ type RequestSmartConnectShortcut interface {
utils.LengthAware
utils.Serializable
Request
- // GetTermination returns Termination (property field)
- GetTermination() RequestTermination
}
// RequestSmartConnectShortcutExactly can be used when we want exactly this type and not a type which fulfills RequestSmartConnectShortcut.
@@ -49,7 +47,6 @@ type RequestSmartConnectShortcutExactly interface {
// _RequestSmartConnectShortcut is the data-structure of this message
type _RequestSmartConnectShortcut struct {
*_Request
- Termination RequestTermination
}
///////////////////////////////////////////////////////////
@@ -62,27 +59,15 @@ type _RequestSmartConnectShortcut struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_RequestSmartConnectShortcut) InitializeParent(parent Request, peekedByte byte) {
+func (m *_RequestSmartConnectShortcut) InitializeParent(parent Request, peekedByte RequestType, termination RequestTermination) {
m.PeekedByte = peekedByte
+ m.Termination = termination
}
func (m *_RequestSmartConnectShortcut) GetParent() Request {
return m._Request
}
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
-/////////////////////// Accessors for property fields.
-///////////////////////
-
-func (m *_RequestSmartConnectShortcut) GetTermination() RequestTermination {
- return m.Termination
-}
-
-///////////////////////
-///////////////////////
-///////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
/////////////////////// Accessors for const fields.
@@ -98,10 +83,9 @@ func (m *_RequestSmartConnectShortcut) GetPipe() byte {
///////////////////////////////////////////////////////////
// NewRequestSmartConnectShortcut factory function for _RequestSmartConnectShortcut
-func NewRequestSmartConnectShortcut(termination RequestTermination, peekedByte byte, srchk bool) *_RequestSmartConnectShortcut {
+func NewRequestSmartConnectShortcut(peekedByte RequestType, termination RequestTermination, srchk bool, messageLength uint16) *_RequestSmartConnectShortcut {
_result := &_RequestSmartConnectShortcut{
- Termination: termination,
- _Request: NewRequest(peekedByte, srchk),
+ _Request: NewRequest(peekedByte, termination, srchk, messageLength),
}
_result._Request._RequestChildRequirements = _result
return _result
@@ -132,9 +116,6 @@ func (m *_RequestSmartConnectShortcut) GetLengthInBitsConditional(lastItem bool)
// Const Field (pipe)
lengthInBits += 8
- // Simple field (termination)
- lengthInBits += m.Termination.GetLengthInBits()
-
return lengthInBits
}
@@ -142,7 +123,7 @@ func (m *_RequestSmartConnectShortcut) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func RequestSmartConnectShortcutParse(readBuffer utils.ReadBuffer, srchk bool) (RequestSmartConnectShortcut, error) {
+func RequestSmartConnectShortcutParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16) (RequestSmartConnectShortcut, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("RequestSmartConnectShortcut"); pullErr != nil {
@@ -160,28 +141,15 @@ func RequestSmartConnectShortcutParse(readBuffer utils.ReadBuffer, srchk bool) (
return nil, errors.New("Expected constant value " + fmt.Sprintf("%d", RequestSmartConnectShortcut_PIPE) + " but got " + fmt.Sprintf("%d", pipe))
}
- // Simple Field (termination)
- if pullErr := readBuffer.PullContext("termination"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for termination")
- }
- _termination, _terminationErr := RequestTerminationParse(readBuffer)
- if _terminationErr != nil {
- return nil, errors.Wrap(_terminationErr, "Error parsing 'termination' field of RequestSmartConnectShortcut")
- }
- termination := _termination.(RequestTermination)
- if closeErr := readBuffer.CloseContext("termination"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for termination")
- }
-
if closeErr := readBuffer.CloseContext("RequestSmartConnectShortcut"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for RequestSmartConnectShortcut")
}
// Create a partially initialized instance
_child := &_RequestSmartConnectShortcut{
- Termination: termination,
_Request: &_Request{
- Srchk: srchk,
+ Srchk: srchk,
+ MessageLength: messageLength,
},
}
_child._Request._RequestChildRequirements = _child
@@ -202,18 +170,6 @@ func (m *_RequestSmartConnectShortcut) Serialize(writeBuffer utils.WriteBuffer)
return errors.Wrap(_pipeErr, "Error serializing 'pipe' field")
}
- // Simple Field (termination)
- if pushErr := writeBuffer.PushContext("termination"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for termination")
- }
- _terminationErr := writeBuffer.WriteSerializable(m.GetTermination())
- if popErr := writeBuffer.PopContext("termination"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for termination")
- }
- if _terminationErr != nil {
- return errors.Wrap(_terminationErr, "Error serializing 'termination' field")
- }
-
if popErr := writeBuffer.PopContext("RequestSmartConnectShortcut"); popErr != nil {
return errors.Wrap(popErr, "Error popping for RequestSmartConnectShortcut")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestType.go b/plc4go/protocols/cbus/readwrite/model/RequestType.go
new file mode 100644
index 000000000..30367f234
--- /dev/null
+++ b/plc4go/protocols/cbus/readwrite/model/RequestType.go
@@ -0,0 +1,213 @@
+/*
+ * 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.
+
+// RequestType is an enum
+type RequestType uint8
+
+type IRequestType interface {
+ ControlChar() uint8
+ Serialize(writeBuffer utils.WriteBuffer) error
+}
+
+const (
+ RequestType_UNKNOWN RequestType = 0x00
+ RequestType_SMART_CONNECT_SHORTCUT RequestType = 0x7C
+ RequestType_RESET RequestType = 0x7E
+ RequestType_DIRECT_COMMAND RequestType = 0x40
+ RequestType_REQUEST_COMMAND RequestType = 0x5C
+ RequestType_NULL RequestType = 0x6E
+ RequestType_EMPTY RequestType = 0x0D
+)
+
+var RequestTypeValues []RequestType
+
+func init() {
+ _ = errors.New
+ RequestTypeValues = []RequestType{
+ RequestType_UNKNOWN,
+ RequestType_SMART_CONNECT_SHORTCUT,
+ RequestType_RESET,
+ RequestType_DIRECT_COMMAND,
+ RequestType_REQUEST_COMMAND,
+ RequestType_NULL,
+ RequestType_EMPTY,
+ }
+}
+
+func (e RequestType) ControlChar() uint8 {
+ switch e {
+ case 0x00:
+ { /* '0x00' */
+ return 0x00
+ }
+ case 0x0D:
+ { /* '0x0D' */
+ return 0x00
+ }
+ case 0x40:
+ { /* '0x40' */
+ return 0x40
+ }
+ case 0x5C:
+ { /* '0x5C' */
+ return 0x5C
+ }
+ case 0x6E:
+ { /* '0x6E' */
+ return 0x00
+ }
+ case 0x7C:
+ { /* '0x7C' */
+ return 0x7C
+ }
+ case 0x7E:
+ { /* '0x7E' */
+ return 0x7E
+ }
+ default:
+ {
+ return 0
+ }
+ }
+}
+
+func RequestTypeFirstEnumForFieldControlChar(value uint8) (RequestType, error) {
+ for _, sizeValue := range RequestTypeValues {
+ if sizeValue.ControlChar() == value {
+ return sizeValue, nil
+ }
+ }
+ return 0, errors.Errorf("enum for %v describing ControlChar not found", value)
+}
+func RequestTypeByValue(value uint8) RequestType {
+ switch value {
+ case 0x00:
+ return RequestType_UNKNOWN
+ case 0x0D:
+ return RequestType_EMPTY
+ case 0x40:
+ return RequestType_DIRECT_COMMAND
+ case 0x5C:
+ return RequestType_REQUEST_COMMAND
+ case 0x6E:
+ return RequestType_NULL
+ case 0x7C:
+ return RequestType_SMART_CONNECT_SHORTCUT
+ case 0x7E:
+ return RequestType_RESET
+ }
+ return 0
+}
+
+func RequestTypeByName(value string) (enum RequestType, ok bool) {
+ ok = true
+ switch value {
+ case "UNKNOWN":
+ enum = RequestType_UNKNOWN
+ case "EMPTY":
+ enum = RequestType_EMPTY
+ case "DIRECT_COMMAND":
+ enum = RequestType_DIRECT_COMMAND
+ case "REQUEST_COMMAND":
+ enum = RequestType_REQUEST_COMMAND
+ case "NULL":
+ enum = RequestType_NULL
+ case "SMART_CONNECT_SHORTCUT":
+ enum = RequestType_SMART_CONNECT_SHORTCUT
+ case "RESET":
+ enum = RequestType_RESET
+ default:
+ enum = 0
+ ok = false
+ }
+ return
+}
+
+func RequestTypeKnows(value uint8) bool {
+ for _, typeValue := range RequestTypeValues {
+ if uint8(typeValue) == value {
+ return true
+ }
+ }
+ return false
+}
+
+func CastRequestType(structType interface{}) RequestType {
+ castFunc := func(typ interface{}) RequestType {
+ if sRequestType, ok := typ.(RequestType); ok {
+ return sRequestType
+ }
+ return 0
+ }
+ return castFunc(structType)
+}
+
+func (m RequestType) GetLengthInBits() uint16 {
+ return 8
+}
+
+func (m RequestType) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func RequestTypeParse(readBuffer utils.ReadBuffer) (RequestType, error) {
+ val, err := readBuffer.ReadUint8("RequestType", 8)
+ if err != nil {
+ return 0, nil
+ }
+ return RequestTypeByValue(val), nil
+}
+
+func (e RequestType) Serialize(writeBuffer utils.WriteBuffer) error {
+ return writeBuffer.WriteUint8("RequestType", 8, uint8(e), utils.WithAdditionalStringRepresentation(e.PLC4XEnumName()))
+}
+
+// PLC4XEnumName returns the name that is used in code to identify this enum
+func (e RequestType) PLC4XEnumName() string {
+ switch e {
+ case RequestType_UNKNOWN:
+ return "UNKNOWN"
+ case RequestType_EMPTY:
+ return "EMPTY"
+ case RequestType_DIRECT_COMMAND:
+ return "DIRECT_COMMAND"
+ case RequestType_REQUEST_COMMAND:
+ return "REQUEST_COMMAND"
+ case RequestType_NULL:
+ return "NULL"
+ case RequestType_SMART_CONNECT_SHORTCUT:
+ return "SMART_CONNECT_SHORTCUT"
+ case RequestType_RESET:
+ return "RESET"
+ }
+ return ""
+}
+
+func (e RequestType) String() string {
+ return e.PLC4XEnumName()
+}
diff --git a/plc4go/protocols/cbus/readwrite/model/ServerErrorReply.go b/plc4go/protocols/cbus/readwrite/model/ServerErrorReply.go
index 8a074d9f5..afe48a0d3 100644
--- a/plc4go/protocols/cbus/readwrite/model/ServerErrorReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/ServerErrorReply.go
@@ -59,8 +59,9 @@ type _ServerErrorReply struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_ServerErrorReply) InitializeParent(parent Reply, peekedByte byte) {
+func (m *_ServerErrorReply) InitializeParent(parent Reply, peekedByte byte, termination ResponseTermination) {
m.PeekedByte = peekedByte
+ m.Termination = termination
}
func (m *_ServerErrorReply) GetParent() Reply {
@@ -82,9 +83,9 @@ func (m *_ServerErrorReply) GetErrorMarker() byte {
///////////////////////////////////////////////////////////
// NewServerErrorReply factory function for _ServerErrorReply
-func NewServerErrorReply(peekedByte byte) *_ServerErrorReply {
+func NewServerErrorReply(peekedByte byte, termination ResponseTermination, messageLength uint16) *_ServerErrorReply {
_result := &_ServerErrorReply{
- _Reply: NewReply(peekedByte),
+ _Reply: NewReply(peekedByte, termination, messageLength),
}
_result._Reply._ReplyChildRequirements = _result
return _result
@@ -122,7 +123,7 @@ func (m *_ServerErrorReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func ServerErrorReplyParse(readBuffer utils.ReadBuffer) (ServerErrorReply, error) {
+func ServerErrorReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (ServerErrorReply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("ServerErrorReply"); pullErr != nil {
@@ -146,7 +147,9 @@ func ServerErrorReplyParse(readBuffer utils.ReadBuffer) (ServerErrorReply, error
// Create a partially initialized instance
_child := &_ServerErrorReply{
- _Reply: &_Reply{},
+ _Reply: &_Reply{
+ MessageLength: messageLength,
+ },
}
_child._Reply._ReplyChildRequirements = _child
return _child, nil
diff --git a/plc4go/protocols/cbus/readwrite/model/StandardFormatStatusReply.go b/plc4go/protocols/cbus/readwrite/model/StandardFormatStatusReply.go
index 50f2aa7ac..9c1318357 100644
--- a/plc4go/protocols/cbus/readwrite/model/StandardFormatStatusReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/StandardFormatStatusReply.go
@@ -40,8 +40,6 @@ type StandardFormatStatusReply interface {
GetStatusBytes() []StatusByte
// GetCrc returns Crc (property field)
GetCrc() Checksum
- // GetTermination returns Termination (property field)
- GetTermination() ResponseTermination
}
// StandardFormatStatusReplyExactly can be used when we want exactly this type and not a type which fulfills StandardFormatStatusReply.
@@ -58,7 +56,6 @@ type _StandardFormatStatusReply struct {
BlockStart uint8
StatusBytes []StatusByte
Crc Checksum
- Termination ResponseTermination
}
///////////////////////////////////////////////////////////
@@ -86,18 +83,14 @@ func (m *_StandardFormatStatusReply) GetCrc() Checksum {
return m.Crc
}
-func (m *_StandardFormatStatusReply) GetTermination() ResponseTermination {
- return m.Termination
-}
-
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// NewStandardFormatStatusReply factory function for _StandardFormatStatusReply
-func NewStandardFormatStatusReply(statusHeader StatusHeader, application ApplicationIdContainer, blockStart uint8, statusBytes []StatusByte, crc Checksum, termination ResponseTermination) *_StandardFormatStatusReply {
- return &_StandardFormatStatusReply{StatusHeader: statusHeader, Application: application, BlockStart: blockStart, StatusBytes: statusBytes, Crc: crc, Termination: termination}
+func NewStandardFormatStatusReply(statusHeader StatusHeader, application ApplicationIdContainer, blockStart uint8, statusBytes []StatusByte, crc Checksum) *_StandardFormatStatusReply {
+ return &_StandardFormatStatusReply{StatusHeader: statusHeader, Application: application, BlockStart: blockStart, StatusBytes: statusBytes, Crc: crc}
}
// Deprecated: use the interface for direct cast
@@ -142,9 +135,6 @@ func (m *_StandardFormatStatusReply) GetLengthInBitsConditional(lastItem bool) u
// Simple field (crc)
lengthInBits += m.Crc.GetLengthInBits()
- // Simple field (termination)
- lengthInBits += m.Termination.GetLengthInBits()
-
return lengthInBits
}
@@ -230,25 +220,12 @@ func StandardFormatStatusReplyParse(readBuffer utils.ReadBuffer) (StandardFormat
return nil, errors.Wrap(closeErr, "Error closing for crc")
}
- // Simple Field (termination)
- if pullErr := readBuffer.PullContext("termination"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for termination")
- }
- _termination, _terminationErr := ResponseTerminationParse(readBuffer)
- if _terminationErr != nil {
- return nil, errors.Wrap(_terminationErr, "Error parsing 'termination' field of StandardFormatStatusReply")
- }
- termination := _termination.(ResponseTermination)
- if closeErr := readBuffer.CloseContext("termination"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for termination")
- }
-
if closeErr := readBuffer.CloseContext("StandardFormatStatusReply"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for StandardFormatStatusReply")
}
// Create the instance
- return NewStandardFormatStatusReply(statusHeader, application, blockStart, statusBytes, crc, termination), nil
+ return NewStandardFormatStatusReply(statusHeader, application, blockStart, statusBytes, crc), nil
}
func (m *_StandardFormatStatusReply) Serialize(writeBuffer utils.WriteBuffer) error {
@@ -315,18 +292,6 @@ func (m *_StandardFormatStatusReply) Serialize(writeBuffer utils.WriteBuffer) er
return errors.Wrap(_crcErr, "Error serializing 'crc' field")
}
- // Simple Field (termination)
- if pushErr := writeBuffer.PushContext("termination"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for termination")
- }
- _terminationErr := writeBuffer.WriteSerializable(m.GetTermination())
- if popErr := writeBuffer.PopContext("termination"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for termination")
- }
- if _terminationErr != nil {
- return errors.Wrap(_terminationErr, "Error serializing 'termination' field")
- }
-
if popErr := writeBuffer.PopContext("StandardFormatStatusReply"); popErr != nil {
return errors.Wrap(popErr, "Error popping for StandardFormatStatusReply")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusMessageToClient.go b/plc4go/protocols/cbus/readwrite/model/StandardFormatStatusReplyReply.go
similarity index 51%
copy from plc4go/protocols/cbus/readwrite/model/CBusMessageToClient.go
copy to plc4go/protocols/cbus/readwrite/model/StandardFormatStatusReplyReply.go
index 29bc0f490..af73553d9 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusMessageToClient.go
+++ b/plc4go/protocols/cbus/readwrite/model/StandardFormatStatusReplyReply.go
@@ -26,26 +26,26 @@ import (
// Code generated by code-generation. DO NOT EDIT.
-// CBusMessageToClient is the corresponding interface of CBusMessageToClient
-type CBusMessageToClient interface {
+// StandardFormatStatusReplyReply is the corresponding interface of StandardFormatStatusReplyReply
+type StandardFormatStatusReplyReply interface {
utils.LengthAware
utils.Serializable
- CBusMessage
+ Reply
// GetReply returns Reply (property field)
- GetReply() Reply
+ GetReply() StandardFormatStatusReply
}
-// CBusMessageToClientExactly can be used when we want exactly this type and not a type which fulfills CBusMessageToClient.
+// StandardFormatStatusReplyReplyExactly can be used when we want exactly this type and not a type which fulfills StandardFormatStatusReplyReply.
// This is useful for switch cases.
-type CBusMessageToClientExactly interface {
- CBusMessageToClient
- isCBusMessageToClient() bool
+type StandardFormatStatusReplyReplyExactly interface {
+ StandardFormatStatusReplyReply
+ isStandardFormatStatusReplyReply() bool
}
-// _CBusMessageToClient is the data-structure of this message
-type _CBusMessageToClient struct {
- *_CBusMessage
- Reply Reply
+// _StandardFormatStatusReplyReply is the data-structure of this message
+type _StandardFormatStatusReplyReply struct {
+ *_Reply
+ Reply StandardFormatStatusReply
}
///////////////////////////////////////////////////////////
@@ -53,19 +53,18 @@ type _CBusMessageToClient struct {
/////////////////////// Accessors for discriminator values.
///////////////////////
-func (m *_CBusMessageToClient) GetResponse() bool {
- return bool(true)
-}
-
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_CBusMessageToClient) InitializeParent(parent CBusMessage) {}
+func (m *_StandardFormatStatusReplyReply) InitializeParent(parent Reply, peekedByte byte, termination ResponseTermination) {
+ m.PeekedByte = peekedByte
+ m.Termination = termination
+}
-func (m *_CBusMessageToClient) GetParent() CBusMessage {
- return m._CBusMessage
+func (m *_StandardFormatStatusReplyReply) GetParent() Reply {
+ return m._Reply
}
///////////////////////////////////////////////////////////
@@ -73,7 +72,7 @@ func (m *_CBusMessageToClient) GetParent() CBusMessage {
/////////////////////// Accessors for property fields.
///////////////////////
-func (m *_CBusMessageToClient) GetReply() Reply {
+func (m *_StandardFormatStatusReplyReply) GetReply() StandardFormatStatusReply {
return m.Reply
}
@@ -82,36 +81,36 @@ func (m *_CBusMessageToClient) GetReply() Reply {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-// NewCBusMessageToClient factory function for _CBusMessageToClient
-func NewCBusMessageToClient(reply Reply, srchk bool) *_CBusMessageToClient {
- _result := &_CBusMessageToClient{
- Reply: reply,
- _CBusMessage: NewCBusMessage(srchk),
+// NewStandardFormatStatusReplyReply factory function for _StandardFormatStatusReplyReply
+func NewStandardFormatStatusReplyReply(reply StandardFormatStatusReply, peekedByte byte, termination ResponseTermination, messageLength uint16) *_StandardFormatStatusReplyReply {
+ _result := &_StandardFormatStatusReplyReply{
+ Reply: reply,
+ _Reply: NewReply(peekedByte, termination, messageLength),
}
- _result._CBusMessage._CBusMessageChildRequirements = _result
+ _result._Reply._ReplyChildRequirements = _result
return _result
}
// Deprecated: use the interface for direct cast
-func CastCBusMessageToClient(structType interface{}) CBusMessageToClient {
- if casted, ok := structType.(CBusMessageToClient); ok {
+func CastStandardFormatStatusReplyReply(structType interface{}) StandardFormatStatusReplyReply {
+ if casted, ok := structType.(StandardFormatStatusReplyReply); ok {
return casted
}
- if casted, ok := structType.(*CBusMessageToClient); ok {
+ if casted, ok := structType.(*StandardFormatStatusReplyReply); ok {
return *casted
}
return nil
}
-func (m *_CBusMessageToClient) GetTypeName() string {
- return "CBusMessageToClient"
+func (m *_StandardFormatStatusReplyReply) GetTypeName() string {
+ return "StandardFormatStatusReplyReply"
}
-func (m *_CBusMessageToClient) GetLengthInBits() uint16 {
+func (m *_StandardFormatStatusReplyReply) GetLengthInBits() uint16 {
return m.GetLengthInBitsConditional(false)
}
-func (m *_CBusMessageToClient) GetLengthInBitsConditional(lastItem bool) uint16 {
+func (m *_StandardFormatStatusReplyReply) GetLengthInBitsConditional(lastItem bool) uint16 {
lengthInBits := uint16(m.GetParentLengthInBits())
// Simple field (reply)
@@ -120,15 +119,15 @@ func (m *_CBusMessageToClient) GetLengthInBitsConditional(lastItem bool) uint16
return lengthInBits
}
-func (m *_CBusMessageToClient) GetLengthInBytes() uint16 {
+func (m *_StandardFormatStatusReplyReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusMessageToClientParse(readBuffer utils.ReadBuffer, response bool, srchk bool) (CBusMessageToClient, error) {
+func StandardFormatStatusReplyReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (StandardFormatStatusReplyReply, error) {
positionAware := readBuffer
_ = positionAware
- if pullErr := readBuffer.PullContext("CBusMessageToClient"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for CBusMessageToClient")
+ if pullErr := readBuffer.PullContext("StandardFormatStatusReplyReply"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for StandardFormatStatusReplyReply")
}
currentPos := positionAware.GetPos()
_ = currentPos
@@ -137,36 +136,36 @@ func CBusMessageToClientParse(readBuffer utils.ReadBuffer, response bool, srchk
if pullErr := readBuffer.PullContext("reply"); pullErr != nil {
return nil, errors.Wrap(pullErr, "Error pulling for reply")
}
- _reply, _replyErr := ReplyParse(readBuffer)
+ _reply, _replyErr := StandardFormatStatusReplyParse(readBuffer)
if _replyErr != nil {
- return nil, errors.Wrap(_replyErr, "Error parsing 'reply' field of CBusMessageToClient")
+ return nil, errors.Wrap(_replyErr, "Error parsing 'reply' field of StandardFormatStatusReplyReply")
}
- reply := _reply.(Reply)
+ reply := _reply.(StandardFormatStatusReply)
if closeErr := readBuffer.CloseContext("reply"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for reply")
}
- if closeErr := readBuffer.CloseContext("CBusMessageToClient"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for CBusMessageToClient")
+ if closeErr := readBuffer.CloseContext("StandardFormatStatusReplyReply"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for StandardFormatStatusReplyReply")
}
// Create a partially initialized instance
- _child := &_CBusMessageToClient{
+ _child := &_StandardFormatStatusReplyReply{
Reply: reply,
- _CBusMessage: &_CBusMessage{
- Srchk: srchk,
+ _Reply: &_Reply{
+ MessageLength: messageLength,
},
}
- _child._CBusMessage._CBusMessageChildRequirements = _child
+ _child._Reply._ReplyChildRequirements = _child
return _child, nil
}
-func (m *_CBusMessageToClient) Serialize(writeBuffer utils.WriteBuffer) error {
+func (m *_StandardFormatStatusReplyReply) Serialize(writeBuffer utils.WriteBuffer) error {
positionAware := writeBuffer
_ = positionAware
ser := func() error {
- if pushErr := writeBuffer.PushContext("CBusMessageToClient"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for CBusMessageToClient")
+ if pushErr := writeBuffer.PushContext("StandardFormatStatusReplyReply"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for StandardFormatStatusReplyReply")
}
// Simple Field (reply)
@@ -181,19 +180,19 @@ func (m *_CBusMessageToClient) Serialize(writeBuffer utils.WriteBuffer) error {
return errors.Wrap(_replyErr, "Error serializing 'reply' field")
}
- if popErr := writeBuffer.PopContext("CBusMessageToClient"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for CBusMessageToClient")
+ if popErr := writeBuffer.PopContext("StandardFormatStatusReplyReply"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for StandardFormatStatusReplyReply")
}
return nil
}
return m.SerializeParent(writeBuffer, m, ser)
}
-func (m *_CBusMessageToClient) isCBusMessageToClient() bool {
+func (m *_StandardFormatStatusReplyReply) isStandardFormatStatusReplyReply() bool {
return true
}
-func (m *_CBusMessageToClient) String() string {
+func (m *_StandardFormatStatusReplyReply) String() string {
if m == nil {
return "<nil>"
}
diff --git a/plc4go/protocols/cbus/readwrite/model/StaticHelper.go b/plc4go/protocols/cbus/readwrite/model/StaticHelper.go
new file mode 100644
index 000000000..6b5feee29
--- /dev/null
+++ b/plc4go/protocols/cbus/readwrite/model/StaticHelper.go
@@ -0,0 +1,81 @@
+/*
+ * 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 (
+ "encoding/hex"
+ "github.com/apache/plc4x/plc4go/internal/spi/utils"
+ "github.com/pkg/errors"
+ "github.com/rs/zerolog/log"
+)
+
+func WriteCBusCommand(writeBuffer utils.WriteBuffer, cbusCommand CBusCommand) error {
+ // TODO: maybe we use a writebuffer hex based
+ wbbb := utils.NewWriteBufferByteBased()
+ err := cbusCommand.Serialize(wbbb)
+ if err != nil {
+ return errors.Wrap(err, "Error serializing")
+ }
+ hexBytes := make([]byte, hex.EncodedLen(len(wbbb.GetBytes())))
+ n := hex.Encode(hexBytes, wbbb.GetBytes())
+ log.Debug().Msgf("%d bytes encoded", n)
+ return writeBuffer.WriteByteArray("cbusCommand", hexBytes)
+}
+
+func ReadCBusCommand(readBuffer utils.ReadBuffer, payloadLength uint16, srcchk bool) (CBusCommand, error) {
+ hexBytes, err := readBuffer.ReadByteArray("cbusCommand", int(payloadLength))
+ if err != nil {
+ return nil, errors.Wrap(err, "Error parsing")
+ }
+ rawBytes := make([]byte, hex.DecodedLen(len(hexBytes)))
+ n, err := hex.Decode(rawBytes, hexBytes)
+ if err != nil {
+ return nil, err
+ }
+ log.Debug().Msgf("%d bytes decoded", n)
+ return CBusCommandParse(utils.NewReadBufferByteBased(rawBytes), srcchk)
+}
+
+func WriteCALReply(writeBuffer utils.WriteBuffer, calReply CALReply) error {
+ // TODO: maybe we use a writebuffer hex based
+ wbbb := utils.NewWriteBufferByteBased()
+ err := calReply.Serialize(wbbb)
+ if err != nil {
+ return errors.Wrap(err, "Error serializing")
+ }
+ hexBytes := make([]byte, hex.EncodedLen(len(wbbb.GetBytes())))
+ n := hex.Encode(hexBytes, wbbb.GetBytes())
+ log.Debug().Msgf("%d bytes encoded", n)
+ return writeBuffer.WriteByteArray("calReply", hexBytes)
+}
+
+func ReadCALReply(readBuffer utils.ReadBuffer, payloadLength uint16) (CALReply, error) {
+ hexBytes, err := readBuffer.ReadByteArray("calReply", int(payloadLength))
+ if err != nil {
+ return nil, errors.Wrap(err, "Error parsing")
+ }
+ rawBytes := make([]byte, hex.DecodedLen(len(hexBytes)))
+ n, err := hex.Decode(rawBytes, hexBytes)
+ if err != nil {
+ return nil, err
+ }
+ log.Debug().Msgf("%d bytes decoded", n)
+ return CALReplyParse(utils.NewReadBufferByteBased(rawBytes))
+}
diff --git a/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go b/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go
index 9f09d1894..e010952c1 100644
--- a/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go
+++ b/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go
@@ -97,6 +97,7 @@ func Analyze(pcapFile, protocolType, filter string, onlyParse, noBytesCompare bo
log.Warn().Stringer("packetInformation", packetInformation).Err(err).Msgf("No.[%d] Error parsing package", realPacketNumber)
continue
} else {
+ log.Info().Stringer("packetInformation", packetInformation).Msgf("No.[%d] Parsed", realPacketNumber)
if verbosity > 1 {
println(parsed.(fmt.Stringer).String())
}
@@ -107,7 +108,7 @@ func Analyze(pcapFile, protocolType, filter string, onlyParse, noBytesCompare bo
serializedBytes, err := serializePackage(parsed)
if err != nil {
// TODO: write report to xml or something
- log.Warn().Stringer("packetInformation", packetInformation).Err(err).Msg("Error serializing")
+ log.Warn().Stringer("packetInformation", packetInformation).Err(err).Msgf("No.[%d] Error serializing", realPacketNumber)
continue
}
if noBytesCompare {
@@ -116,7 +117,7 @@ func Analyze(pcapFile, protocolType, filter string, onlyParse, noBytesCompare bo
}
if compareResult := bytes.Compare(payload, serializedBytes); compareResult != 0 {
// TODO: write report to xml or something
- log.Warn().Stringer("packetInformation", packetInformation).Msg("Bytes don't match")
+ log.Warn().Stringer("packetInformation", packetInformation).Msgf("No.[%d] Bytes don't match", realPacketNumber)
if verbosity > 0 {
println("Original bytes")
println(hex.Dump(payload))
diff --git a/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer/analyzer.go b/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer/analyzer.go
index ab870eb75..de8aa0a2b 100644
--- a/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer/analyzer.go
+++ b/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer/analyzer.go
@@ -37,7 +37,7 @@ func (a Analyzer) PackageParse(packetInformation common.PacketInformation, paylo
// TODO: srcchk we need to pull that out of the config
isResponse := packetInformation.DstIp.Equal(a.Client)
log.Debug().Stringer("packetInformation", packetInformation).Msgf("isResponse: %t", isResponse)
- parse, err := model.CBusMessageParse(utils.NewReadBufferByteBased(payload), isResponse, true)
+ parse, err := model.CBusMessageParse(utils.NewReadBufferByteBased(payload), isResponse, true, uint16(len(payload)))
if err != nil {
return nil, errors.Wrap(err, "Error parsing CBusCommand")
}
diff --git a/plc4j/drivers/c-bus/src/main/java/org/apache/plc4x/java/cbus/readwrite/utils/StaticHelper.java b/plc4j/drivers/c-bus/src/main/java/org/apache/plc4x/java/cbus/readwrite/utils/StaticHelper.java
new file mode 100644
index 000000000..efc96382a
--- /dev/null
+++ b/plc4j/drivers/c-bus/src/main/java/org/apache/plc4x/java/cbus/readwrite/utils/StaticHelper.java
@@ -0,0 +1,68 @@
+/*
+ * 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 org.apache.plc4x.java.cbus.readwrite.utils;
+
+import org.apache.commons.codec.DecoderException;
+import org.apache.commons.codec.binary.Hex;
+import org.apache.plc4x.java.cbus.readwrite.CALReply;
+import org.apache.plc4x.java.cbus.readwrite.CBusCommand;
+import org.apache.plc4x.java.spi.generation.*;
+
+import java.nio.charset.StandardCharsets;
+
+public class StaticHelper {
+ public static void writeCBusCommand(WriteBuffer writeBuffer, CBusCommand cbusCommand) throws SerializationException {
+ // TODO: maybe we use a writebuffer hex based
+ WriteBufferByteBased payloadWriteBuffer = new WriteBufferByteBased(cbusCommand.getLengthInBytes() * 2);
+ cbusCommand.serialize(payloadWriteBuffer);
+ byte[] hexBytes = Hex.encodeHexString(payloadWriteBuffer.getBytes()).getBytes(StandardCharsets.UTF_8);
+ writeBuffer.writeByteArray("cbusCommand", hexBytes);
+ }
+
+ public static CBusCommand readCBusCommand(ReadBuffer readBuffer, Integer payloadLength, boolean srcchk) throws ParseException {
+ byte[] hexBytes = readBuffer.readByteArray("cbusCommand", payloadLength);
+ byte[] rawBytes;
+ try {
+ rawBytes = Hex.decodeHex(new String(hexBytes));
+ } catch (DecoderException e) {
+ throw new ParseException("error getting hex", e);
+ }
+ return CBusCommand.staticParse(new ReadBufferByteBased(rawBytes), srcchk);
+ }
+
+ public static void writeCALReply(WriteBuffer writeBuffer, CALReply calReply) throws SerializationException {
+ // TODO: maybe we use a writebuffer hex based
+ WriteBufferByteBased payloadWriteBuffer = new WriteBufferByteBased(calReply.getLengthInBytes() * 2);
+ calReply.serialize(payloadWriteBuffer);
+ byte[] hexBytes = Hex.encodeHexString(payloadWriteBuffer.getBytes()).getBytes(StandardCharsets.UTF_8);
+ writeBuffer.writeByteArray("calReply", hexBytes);
+ }
+
+ public static CALReply readCALReply(ReadBuffer readBuffer, Integer payloadLength) throws ParseException {
+ byte[] hexBytes = readBuffer.readByteArray("calReply", payloadLength);
+ byte[] rawBytes;
+ try {
+ rawBytes = Hex.decodeHex(new String(hexBytes));
+ } catch (DecoderException e) {
+ throw new ParseException("error getting hex", e);
+ }
+ return CALReply.staticParse(new ReadBufferByteBased(rawBytes));
+ }
+
+}
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 c73bf2e9b..2f44b71a5 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
@@ -31,23 +31,15 @@ import static org.assertj.core.api.Assertions.assertThat;
public class RandomPackagesTest {
- static final String BACKSLASH = "5C";
- 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 {
// 4.2.9.1
@Test
void pointToPointCommandDirect() throws Exception {
- byte[] bytes = Hex.decodeHex(BACKSLASH + "0603002102D4" + CR + LF);
+ byte[] bytes = "\\0603002102D4\r".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -56,9 +48,9 @@ public class RandomPackagesTest {
// 4.2.9.1
@Test
void pointToPointCommandBridged() throws Exception {
- byte[] bytes = Hex.decodeHex(BACKSLASH + "06420903210289" + CR + LF);
+ byte[] bytes = "\\06420903210289\r".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -67,9 +59,9 @@ public class RandomPackagesTest {
// 4.2.9.2
@Test
void pointToMultiPointCommandDirect() throws Exception {
- byte[] bytes = Hex.decodeHex(BACKSLASH + "0538000108BA" + CR + LF);
+ byte[] bytes = "\\0538000108BA\r".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -78,9 +70,9 @@ public class RandomPackagesTest {
// 4.2.9.2
@Test
void pointToMultiPointCommandBridged() throws Exception {
- byte[] bytes = Hex.decodeHex(BACKSLASH + "05FF007A38004A" + CR + LF);
+ byte[] bytes = "\\05FF007A38004A\r".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -89,9 +81,9 @@ public class RandomPackagesTest {
// 4.2.9.3
@Test
void pointToPointToMultiPointCommand2() throws Exception {
- byte[] bytes = Hex.decodeHex(BACKSLASH + "03420938010871" + CR + LF);
+ byte[] bytes = "\\03420938010871\r".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -100,9 +92,9 @@ public class RandomPackagesTest {
// 4.3.3.1
@Test
void calRequest() throws Exception {
- byte[] bytes = Hex.decodeHex(BACKSLASH + "0605002102" + CR + LF);
+ byte[] bytes = "\\0605002102\r".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, false);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, false, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -111,7 +103,7 @@ public class RandomPackagesTest {
// 4.3.3.1
@Test
void calReplyNormal() throws Exception {
- byte[] bytes = Hex.decodeHex("8902312E322E363620200A" + CR + LF);
+ byte[] bytes = Hex.decodeHex("8902312E322E363620200A");
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
CALReply msg = CALReplyShort.staticParse(readBufferByteBased, false);
assertThat(msg)
@@ -121,7 +113,7 @@ public class RandomPackagesTest {
@Test
void calReplySmart() throws Exception {
- byte[] bytes = Hex.decodeHex("860593008902312E322E363620207F" + CR + LF);
+ byte[] bytes = Hex.decodeHex("860593008902312E322E363620207F");
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
CALReply msg = CALReplyLong.staticParse(readBufferByteBased, false);
assertThat(msg)
@@ -144,7 +136,7 @@ public class RandomPackagesTest {
// 7.3
@Test
void StandardFormatStatusReply1() throws Exception {
- byte[] bytes = Hex.decodeHex("D8380068AA0140550550001000000014000000000000000000CF" + CR + LF);
+ byte[] bytes = Hex.decodeHex("D8380068AA0140550550001000000014000000000000000000CF");
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
StandardFormatStatusReply msg = StandardFormatStatusReply.staticParse(readBufferByteBased, false);
assertThat(msg)
@@ -154,7 +146,7 @@ public class RandomPackagesTest {
@Test
void StandardFormatStatusReply2() throws Exception {
- byte[] bytes = Hex.decodeHex("D838580000000000000000000000000000000000000000000098" + CR + LF);
+ byte[] bytes = Hex.decodeHex("D838580000000000000000000000000000000000000000000098");
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
StandardFormatStatusReply msg = StandardFormatStatusReply.staticParse(readBufferByteBased, false);
assertThat(msg)
@@ -164,7 +156,7 @@ public class RandomPackagesTest {
@Test
void StandardFormatStatusReply3() throws Exception {
- byte[] bytes = Hex.decodeHex("D638B000000000FF00000000000000000000000000000043" + CR + LF);
+ byte[] bytes = Hex.decodeHex("D638B000000000FF00000000000000000000000000000043");
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
StandardFormatStatusReply msg = StandardFormatStatusReply.staticParse(readBufferByteBased, false);
assertThat(msg)
@@ -175,7 +167,7 @@ public class RandomPackagesTest {
// 7.4
@Test
void ExtendedFormatStatusReply1() throws Exception {
- byte[] bytes = Hex.decodeHex("F9073800AAAA000095990000000005555000000000005555555548" + CR + LF);
+ byte[] bytes = Hex.decodeHex("F9073800AAAA000095990000000005555000000000005555555548");
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
ExtendedFormatStatusReply msg = ExtendedFormatStatusReply.staticParse(readBufferByteBased, false);
assertThat(msg)
@@ -185,7 +177,7 @@ public class RandomPackagesTest {
@Test
void ExtendedFormatStatusReply2() throws Exception {
- byte[] bytes = Hex.decodeHex("F907380B0000000000005555000000000000000000000000000013" + CR + LF);
+ byte[] bytes = Hex.decodeHex("F907380B0000000000005555000000000000000000000000000013");
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
ExtendedFormatStatusReply msg = ExtendedFormatStatusReply.staticParse(readBufferByteBased, false);
assertThat(msg)
@@ -195,7 +187,7 @@ public class RandomPackagesTest {
@Test
void ExtendedFormatStatusReply3() throws Exception {
- byte[] bytes = Hex.decodeHex("f70738160000000000000000000000000000000000000000B4" + CR + LF);
+ byte[] bytes = Hex.decodeHex("f70738160000000000000000000000000000000000000000B4");
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
ExtendedFormatStatusReply msg = ExtendedFormatStatusReply.staticParse(readBufferByteBased, false);
assertThat(msg)
@@ -209,9 +201,9 @@ public class RandomPackagesTest {
@Test
void LightningOff() throws Exception {
// TODO: the section describes that on non smart mode the message doesn't have the last CR
- byte[] bytes = Hex.decodeHex(BACKSLASH + "0538000114AE" + CR);
+ byte[] bytes = "\\0538000114AE\r".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -220,21 +212,21 @@ public class RandomPackagesTest {
@Test
void LightningStatus() throws Exception {
// TODO: the section describes that on non smart mode the message doesn't have the last CR
- byte[] bytes = Hex.decodeHex(BACKSLASH + "05FF007A38004A" + CR);
+ byte[] bytes = "\\05FF007A38004A\r".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
}
- @Disabled("something is wrong here")
+ @Disabled("something is wrong here, the command requires to many bytes")
@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" + CR + LF);
+ byte[] bytes = "D83800A8AA02000000000000000000000000000000000000009C\r\n".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -244,9 +236,9 @@ 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" + CR + LF);
+ byte[] bytes = "D838580000000000000000000000000000000000000000000098\r\n".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -256,9 +248,9 @@ 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" + CR + LF);
+ byte[] bytes = "D638B0000000000000000000000000000000000000000042\r\n".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -268,9 +260,9 @@ 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" + CR + LF);
+ byte[] bytes = "86999900F8003800A8AA0200000000000000000000000000000000000000C4\r\n".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -281,9 +273,9 @@ public class RandomPackagesTest {
@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" + CR + LF);
+ byte[] bytes = "86999900F800385800000000000000000000000000000000000000000000C0\r\n".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -293,9 +285,9 @@ 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" + CR + LF);
+ byte[] bytes = "86999900F60038B000000000000000000000000000000000000000008F\r\n".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -308,9 +300,9 @@ public class RandomPackagesTest {
@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);
+ byte[] bytes = "\\0604001A3001AB\r".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -318,9 +310,9 @@ public class RandomPackagesTest {
@Test
void Reply() throws Exception {
- byte[] bytes = Hex.decodeHex("8604990082300328" + CR + LF);
+ byte[] bytes = "8604990082300328\r\n".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -334,9 +326,9 @@ public class RandomPackagesTest {
@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);
+ byte[] bytes = "\\03421B53643801149C\r".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -345,9 +337,9 @@ public class RandomPackagesTest {
@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);
+ byte[] bytes = "0565380354432101148E\r\n".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -356,26 +348,23 @@ public class RandomPackagesTest {
}
// 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);
+ byte[] bytes = "@A3300019\r".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true, bytes.length);
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);
+ byte[] bytes = "\\05380001210122012301240A25010A2601D4\r".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -388,9 +377,9 @@ public class RandomPackagesTest {
// 4.2.9.1
@Test
void pointToPointCommandDirect() throws Exception {
- byte[] bytes = Hex.decodeHex(BACKSLASH + "0538007902D4" + CR + LF);
+ byte[] bytes = "\\0538007902D4\r".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -398,4 +387,17 @@ public class RandomPackagesTest {
}
+ @Disabled
+ @Nested
+ class OwnCaptures{
+ @Test
+ void whatEverThisIs() throws Exception {
+ byte[] bytes = "\\3436303230303231303167\r".getBytes(StandardCharsets.UTF_8);
+ ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, true, bytes.length);
+ 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 e9bdecfef..4141da250 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
@@ -33,45 +33,64 @@
[simple bit pcn ]
]
-[type CBusMessage(bit response, bit srchk)
+[type CBusMessage(bit response, bit srchk, uint 16 messageLength)
[typeSwitch response
['false' *ToServer
- [simple Request('srchk') request ]
+ [simple Request('srchk', 'messageLength') request ]
]
['true' *ToClient
- [simple Reply reply ]
+ [simple Reply('messageLength') reply ]
]
]
]
-[type Request(bit srchk)
- [peek byte peekedByte ]
+[type Request(bit srchk, uint 16 messageLength)
+ [peek RequestType peekedByte ]
+ [virtual uint 16 payloadLength 'messageLength-2' ] // We substract the command itself and the termination
[typeSwitch peekedByte
- ['0x7C' *SmartConnectShortcut
+ ['SMART_CONNECT_SHORTCUT' *SmartConnectShortcut
[const byte pipe 0x7C ]
- [simple RequestTermination termination ]
]
- ['0x7E' *Reset
+ ['RESET' *Reset
[const byte tilde 0x7E ]
- [simple RequestTermination termination ]
]
- ['0x40' *DirectCommandAccess
+ ['DIRECT_COMMAND' *DirectCommandAccess(uint 16 payloadLength)
[const byte at 0x40 ]
- [simple CBusPointToPointCommand('srchk') cbusCommand ]
- [simple RequestTermination termination ]
+ // Usually you would read the command now here but we need to decode ascii first
+ //[simple CBusCommandPointToPoint('srchk') cbusCommand ]
+ [manual CBusCommand
+ cbusCommand
+ 'STATIC_CALL("readCBusCommand", readBuffer, payloadLength, srchk)'
+ 'STATIC_CALL("writeCBusCommand", writeBuffer, cbusCommand)'
+ '_value.lengthInBytes*2' ]
]
- ['0x5C' *Command
+ ['REQUEST_COMMAND' *Command(uint 16 payloadLength)
[const byte initiator 0x5C ] // 0x5C == "/"
- [simple CBusCommand('srchk') cbusCommand ]
+ // Usually you would read the command now here but we need to decode ascii first
+ //[simple CBusCommand('srchk') cbusCommand ]
+ [manual CBusCommand
+ cbusCommand
+ 'STATIC_CALL("readCBusCommand", readBuffer, payloadLength, srchk)'
+ 'STATIC_CALL("writeCBusCommand", writeBuffer, cbusCommand)'
+ '_value.lengthInBytes*2' ]
]
- ['0x6E' *Null
+ ['NULL' *Null
[const uint 32 nullIndicator 0x6E756C6C ] // "null"
- [simple RequestTermination termination ]
]
- ['0x0D' *Empty
- [simple RequestTermination termination ]
+ ['EMPTY' *Empty
]
]
+ [simple RequestTermination termination ]
+]
+
+[enum uint 8 RequestType(uint 8 controlChar)
+ ['0x00' UNKNOWN ['0x00']]
+ ['0x7C' SMART_CONNECT_SHORTCUT ['0x7C']] // control char = '|'
+ ['0x7E' RESET ['0x7E']] // control char = '~'
+ ['0x40' DIRECT_COMMAND ['0x40']] // control char = '@'
+ ['0x5C' REQUEST_COMMAND ['0x5C']] // control char = '/'
+ ['0x6E' NULL ['0x00']] // null doesn't have a "control char" so we just consume the rest
+ ['0x0D' EMPTY ['0x00']] // empty doesn't have a "control char" so we just consume the rest
]
[discriminatedType CBusCommand(bit srchk)
@@ -177,7 +196,6 @@
[simple CALData calData ]
[optional Checksum crc 'srchk' ] // checksum is optional but mspec checksum isn't
[optional Alpha alpha ]
- [simple RequestTermination termination ]
]
[discriminatedType CBusPointToMultiPointCommand(bit srchk)
@@ -198,7 +216,6 @@
[optional Alpha alpha ]
]
]
- [simple RequestTermination termination ]
]
[discriminatedType CBusPointToPointToMultipointCommand(bit srchk)
@@ -219,7 +236,6 @@
[optional Alpha alpha ]
]
]
- [simple RequestTermination termination ]
]
/*
@@ -880,29 +896,41 @@
[simple byte value]
]
-[type Reply
+[type Reply(uint 16 messageLength)
[peek byte peekedByte ]
[virtual bit isAlpha '(peekedByte >= 0x67) && (peekedByte <= 0x7A)' ]
[typeSwitch peekedByte, isAlpha
[*, 'true' ConfirmationReply
[simple Confirmation isA]
]
- ['0x2B' PowerUpReply
+ ['0x2B' PowerUpReply // is a +
[simple PowerUp isA]
]
- ['0x3D' ParameterChangeReply
+ ['0x3D' ParameterChangeReply // is a =
[simple ParameterChange isA]
]
- ['0x21' ServerErrorReply
+ ['0x21' ServerErrorReply // is a !
[const byte errorMarker 0x21 ]
]
['0x0' MonitoredSALReply
[simple MonitoredSAL isA]
]
+ ['0x0' StandardFormatStatusReplyReply
+ [simple StandardFormatStatusReply reply]
+ ]
+ ['0x0' ExtendedFormatStatusReplyReply
+ [simple ExtendedFormatStatusReply reply]
+ ]
[* CALReplyReply
- [simple CALReply isA]
+ [virtual uint 16 payloadLength 'messageLength-2' ] // We substract the termination \r\n
+ [manual CALReply
+ calReply
+ 'STATIC_CALL("readCALReply", readBuffer, payloadLength)'
+ 'STATIC_CALL("writeCALReply", writeBuffer, calReply)'
+ '_value.lengthInBytes*2' ]
]
]
+ [simple ResponseTermination termination ]
]
[type CALReply
@@ -925,7 +953,6 @@
]
[simple CALData calData ]
//[checksum byte crc '0x00' ] // TODO: Fix this
- [simple ResponseTermination termination ]
]
[type BridgeCount
@@ -964,7 +991,6 @@
]
[optional SALData salData ]
//[checksum byte crc '0x00' ] // TODO: Fix this
- [simple ResponseTermination termination ]
]
[type Confirmation
@@ -985,14 +1011,12 @@
[const byte powerUpIndicator 0x2B ] // "+"
// TODO: do we really need a static helper to peek for terminated?=
//[array uint 8 garbage terminated '0x0D' ] // read all following +
- [simple RequestTermination reqTermination ]
- [simple ResponseTermination resTermination ]
+ [simple RequestTermination reqTermination ] // TODO: maybe should be externalized
]
[type ParameterChange
[const byte specialChar1 0x3D ] // "="
[const byte specialChar2 0x3D ] // "="
- [simple ResponseTermination termination ]
]
[type ReplyNetwork
@@ -1017,7 +1041,6 @@
'statusHeader.numberOfCharacterPairs - 2' ]
[simple Checksum
crc ]
- [simple ResponseTermination termination ]
]
[type StatusHeader
@@ -1039,7 +1062,6 @@
'statusHeader.numberOfCharacterPairs - 3' ]
[simple Checksum
crc ]
- [simple ResponseTermination termination ]
]
[type ExtendedStatusHeader