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/06 14:24:32 UTC
[plc4x] 01/02: fix(c-bus): fixed more parsing issues
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit 0b8d3cbad2ba634b7c8576c50a1ed6281a50cb1a
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Jul 6 16:12:48 2022 +0200
fix(c-bus): fixed more parsing issues
---
plc4go/protocols/cbus/readwrite/ParserHelper.go | 61 +++----
plc4go/protocols/cbus/readwrite/XmlParserHelper.go | 60 ++++---
plc4go/protocols/cbus/readwrite/model/CALData.go | 2 +-
.../cbus/readwrite/model/CALReplyReply.go | 10 +-
.../protocols/cbus/readwrite/model/CBusCommand.go | 18 +-
.../readwrite/model/CBusCommandDeviceManagement.go | 8 +-
.../model/CBusCommandPointToMultiPoint.go | 10 +-
.../readwrite/model/CBusCommandPointToPoint.go | 10 +-
.../model/CBusCommandPointToPointToMultiPoint.go | 10 +-
.../protocols/cbus/readwrite/model/CBusMessage.go | 37 +++--
.../cbus/readwrite/model/CBusMessageToClient.go | 15 +-
.../cbus/readwrite/model/CBusMessageToServer.go | 15 +-
.../protocols/cbus/readwrite/model/CBusOptions.go | 30 +++-
.../model/CBusPointToMultiPointCommand.go | 14 +-
.../model/CBusPointToMultiPointCommandStatus.go | 10 +-
.../readwrite/model/CBusPointToPointCommand.go | 14 +-
.../model/CBusPointToPointCommandDirect.go | 8 +-
.../model/CBusPointToPointCommandIndirect.go | 8 +-
.../model/CBusPointToPointToMultipointCommand.go | 16 +-
...> CBusPointToPointToMultipointCommandNormal.go} | 86 +++++-----
...> CBusPointToPointToMultipointCommandStatus.go} | 84 +++++-----
.../cbus/readwrite/model/ConfirmationReply.go | 12 +-
.../model/ExtendedFormatStatusReplyReply.go | 60 ++++---
.../cbus/readwrite/model/MonitoredSALReply.go | 84 ++++++----
...PointToMultiPointCommandNormal.go => Normal.go} | 88 +++++-----
.../protocols/cbus/readwrite/model/NormalReply.go | 94 +++++++++--
.../cbus/readwrite/model/ParameterChangeReply.go | 10 +-
.../protocols/cbus/readwrite/model/PowerUpReply.go | 10 +-
plc4go/protocols/cbus/readwrite/model/Reply.go | 14 +-
.../cbus/readwrite/model/ReplyNormalReply.go | 12 +-
plc4go/protocols/cbus/readwrite/model/Request.go | 26 +--
.../cbus/readwrite/model/RequestCommand.go | 10 +-
.../cbus/readwrite/model/RequestContext.go | 181 +++++++++++++++++++++
.../readwrite/model/RequestDirectCommandAccess.go | 8 +-
.../protocols/cbus/readwrite/model/RequestEmpty.go | 8 +-
.../protocols/cbus/readwrite/model/RequestNull.go | 8 +-
.../{RequestCommand.go => RequestObsolete.go} | 153 +++++++++--------
.../protocols/cbus/readwrite/model/RequestReset.go | 8 +-
.../readwrite/model/RequestSmartConnectShortcut.go | 8 +-
.../cbus/readwrite/model/ServerErrorReply.go | 10 +-
.../model/StandardFormatStatusReplyReply.go | 60 ++++---
.../protocols/cbus/readwrite/model/StaticHelper.go | 40 ++++-
plc4go/tools/plc4xpcapanalyzer/cmd/analyze.go | 8 +-
plc4go/tools/plc4xpcapanalyzer/cmd/root.go | 2 +-
.../internal/analyzer/analyzer.go | 24 ++-
.../internal/cbusanalyzer/analyzer.go | 53 +++++-
.../java/cbus/readwrite/utils/StaticHelper.java | 35 +++-
.../apache/plc4x/java/cbus/RandomPackagesTest.java | 51 ++++--
.../src/main/resources/protocols/cbus/c-bus.mspec | 43 ++++-
49 files changed, 1080 insertions(+), 566 deletions(-)
diff --git a/plc4go/protocols/cbus/readwrite/ParserHelper.go b/plc4go/protocols/cbus/readwrite/ParserHelper.go
index 0ae5f238a..4e36af619 100644
--- a/plc4go/protocols/cbus/readwrite/ParserHelper.go
+++ b/plc4go/protocols/cbus/readwrite/ParserHelper.go
@@ -38,16 +38,20 @@ func (m CbusParserHelper) Parse(typeName string, arguments []string, io utils.Re
return model.CALDataNormalParse(io)
case "Checksum":
return model.ChecksumParse(io)
+ case "RequestContext":
+ return model.RequestContextParse(io)
case "CALReply":
return model.CALReplyParse(io)
case "NetworkRoute":
return model.NetworkRouteParse(io)
case "NormalReply":
- replyLength, err := utils.StrToUint16(arguments[0])
+ var cBusOptions model.CBusOptions
+ replyLength, err := utils.StrToUint16(arguments[1])
if err != nil {
return nil, errors.Wrap(err, "Error parsing")
}
- return model.NormalReplyParse(io, replyLength)
+ var requestContext model.RequestContext
+ return model.NormalReplyParse(io, cBusOptions, replyLength, requestContext)
case "NetworkNumber":
return model.NetworkNumberParse(io)
case "RequestTermination":
@@ -55,19 +59,17 @@ func (m CbusParserHelper) Parse(typeName string, arguments []string, io utils.Re
case "StandardFormatStatusReply":
return model.StandardFormatStatusReplyParse(io)
case "CBusMessage":
- response, err := utils.StrToBool(arguments[0])
+ isResponse, err := utils.StrToBool(arguments[0])
if err != nil {
return nil, errors.Wrap(err, "Error parsing")
}
- srchk, err := utils.StrToBool(arguments[1])
+ var requestContext model.RequestContext
+ var cBusOptions model.CBusOptions
+ messageLength, err := utils.StrToUint16(arguments[3])
if err != nil {
return nil, errors.Wrap(err, "Error parsing")
}
- messageLength, err := utils.StrToUint16(arguments[2])
- if err != nil {
- return nil, errors.Wrap(err, "Error parsing")
- }
- return model.CBusMessageParse(io, response, srchk, messageLength)
+ return model.CBusMessageParse(io, isResponse, requestContext, cBusOptions, messageLength)
case "ResponseTermination":
return model.ResponseTerminationParse(io)
case "CBusOptions":
@@ -75,11 +77,8 @@ func (m CbusParserHelper) Parse(typeName string, arguments []string, io utils.Re
case "SALData":
return model.SALDataParse(io)
case "CBusCommand":
- srchk, err := utils.StrToBool(arguments[0])
- if err != nil {
- return nil, errors.Wrap(err, "Error parsing")
- }
- return model.CBusCommandParse(io, srchk)
+ var cBusOptions model.CBusOptions
+ return model.CBusCommandParse(io, cBusOptions)
case "IdentifyReplyCommand":
attribute, _ := model.AttributeByName(arguments[0])
return model.IdentifyReplyCommandParse(io, attribute)
@@ -90,11 +89,13 @@ func (m CbusParserHelper) Parse(typeName string, arguments []string, io utils.Re
case "PowerUp":
return model.PowerUpParse(io)
case "Reply":
- messageLength, err := utils.StrToUint16(arguments[0])
+ var cBusOptions model.CBusOptions
+ messageLength, err := utils.StrToUint16(arguments[1])
if err != nil {
return nil, errors.Wrap(err, "Error parsing")
}
- return model.ReplyParse(io, messageLength)
+ var requestContext model.RequestContext
+ return model.ReplyParse(io, cBusOptions, messageLength, requestContext)
case "SerialInterfaceAddress":
return model.SerialInterfaceAddressParse(io)
case "BridgeAddress":
@@ -114,11 +115,8 @@ func (m CbusParserHelper) Parse(typeName string, arguments []string, io utils.Re
case "Confirmation":
return model.ConfirmationParse(io)
case "CBusPointToMultiPointCommand":
- srchk, err := utils.StrToBool(arguments[0])
- if err != nil {
- return nil, errors.Wrap(err, "Error parsing")
- }
- return model.CBusPointToMultiPointCommandParse(io, srchk)
+ var cBusOptions model.CBusOptions
+ return model.CBusPointToMultiPointCommandParse(io, cBusOptions)
case "StatusHeader":
return model.StatusHeaderParse(io)
case "StatusRequest":
@@ -132,29 +130,20 @@ func (m CbusParserHelper) Parse(typeName string, arguments []string, io utils.Re
case "CBusHeader":
return model.CBusHeaderParse(io)
case "Request":
- srchk, err := utils.StrToBool(arguments[0])
- if err != nil {
- return nil, errors.Wrap(err, "Error parsing")
- }
+ var cBusOptions model.CBusOptions
messageLength, err := utils.StrToUint16(arguments[1])
if err != nil {
return nil, errors.Wrap(err, "Error parsing")
}
- return model.RequestParse(io, srchk, messageLength)
+ return model.RequestParse(io, cBusOptions, messageLength)
case "CBusPointToPointCommand":
- srchk, err := utils.StrToBool(arguments[0])
- if err != nil {
- return nil, errors.Wrap(err, "Error parsing")
- }
- return model.CBusPointToPointCommandParse(io, srchk)
+ var cBusOptions model.CBusOptions
+ return model.CBusPointToPointCommandParse(io, cBusOptions)
case "Alpha":
return model.AlphaParse(io)
case "CBusPointToPointToMultipointCommand":
- srchk, err := utils.StrToBool(arguments[0])
- if err != nil {
- return nil, errors.Wrap(err, "Error parsing")
- }
- return model.CBusPointToPointToMultipointCommandParse(io, srchk)
+ var cBusOptions model.CBusOptions
+ return model.CBusPointToPointToMultipointCommandParse(io, cBusOptions)
}
return nil, errors.Errorf("Unsupported type %s", typeName)
}
diff --git a/plc4go/protocols/cbus/readwrite/XmlParserHelper.go b/plc4go/protocols/cbus/readwrite/XmlParserHelper.go
index fa4a5c2e4..ef343b543 100644
--- a/plc4go/protocols/cbus/readwrite/XmlParserHelper.go
+++ b/plc4go/protocols/cbus/readwrite/XmlParserHelper.go
@@ -48,17 +48,23 @@ func (m CbusXmlParserHelper) Parse(typeName string, xmlString string, parserArgu
return model.CALDataNormalParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "Checksum":
return model.ChecksumParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
+ case "RequestContext":
+ return model.RequestContextParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "CALReply":
return model.CALReplyParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "NetworkRoute":
return model.NetworkRouteParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "NormalReply":
- parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 16)
+ // TODO: find a way to parse the sub types
+ var cBusOptions model.CBusOptions
+ parsedUint1, err := strconv.ParseUint(parserArguments[1], 10, 16)
if err != nil {
return nil, err
}
- replyLength := uint16(parsedUint0)
- return model.NormalReplyParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), replyLength)
+ replyLength := uint16(parsedUint1)
+ // TODO: find a way to parse the sub types
+ var requestContext model.RequestContext
+ return model.NormalReplyParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), cBusOptions, replyLength, requestContext)
case "NetworkNumber":
return model.NetworkNumberParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "RequestTermination":
@@ -66,14 +72,17 @@ func (m CbusXmlParserHelper) Parse(typeName string, xmlString string, parserArgu
case "StandardFormatStatusReply":
return model.StandardFormatStatusReplyParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "CBusMessage":
- response := parserArguments[0] == "true"
- srchk := parserArguments[1] == "true"
- parsedUint2, err := strconv.ParseUint(parserArguments[2], 10, 16)
+ isResponse := parserArguments[0] == "true"
+ // TODO: find a way to parse the sub types
+ var requestContext model.RequestContext
+ // TODO: find a way to parse the sub types
+ var cBusOptions model.CBusOptions
+ parsedUint3, err := strconv.ParseUint(parserArguments[3], 10, 16)
if err != nil {
return nil, err
}
- messageLength := uint16(parsedUint2)
- return model.CBusMessageParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), response, srchk, messageLength)
+ messageLength := uint16(parsedUint3)
+ return model.CBusMessageParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), isResponse, requestContext, cBusOptions, messageLength)
case "ResponseTermination":
return model.ResponseTerminationParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "CBusOptions":
@@ -81,8 +90,9 @@ func (m CbusXmlParserHelper) Parse(typeName string, xmlString string, parserArgu
case "SALData":
return model.SALDataParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "CBusCommand":
- srchk := parserArguments[0] == "true"
- return model.CBusCommandParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), srchk)
+ // TODO: find a way to parse the sub types
+ var cBusOptions model.CBusOptions
+ return model.CBusCommandParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), cBusOptions)
case "IdentifyReplyCommand":
attribute, _ := model.AttributeByName(parserArguments[0])
return model.IdentifyReplyCommandParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), attribute)
@@ -93,12 +103,16 @@ func (m CbusXmlParserHelper) Parse(typeName string, xmlString string, parserArgu
case "PowerUp":
return model.PowerUpParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "Reply":
- parsedUint0, err := strconv.ParseUint(parserArguments[0], 10, 16)
+ // TODO: find a way to parse the sub types
+ var cBusOptions model.CBusOptions
+ parsedUint1, err := strconv.ParseUint(parserArguments[1], 10, 16)
if err != nil {
return nil, err
}
- messageLength := uint16(parsedUint0)
- return model.ReplyParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), messageLength)
+ messageLength := uint16(parsedUint1)
+ // TODO: find a way to parse the sub types
+ var requestContext model.RequestContext
+ return model.ReplyParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), cBusOptions, messageLength, requestContext)
case "SerialInterfaceAddress":
return model.SerialInterfaceAddressParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "BridgeAddress":
@@ -118,8 +132,9 @@ func (m CbusXmlParserHelper) Parse(typeName string, xmlString string, parserArgu
case "Confirmation":
return model.ConfirmationParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "CBusPointToMultiPointCommand":
- srchk := parserArguments[0] == "true"
- return model.CBusPointToMultiPointCommandParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), srchk)
+ // TODO: find a way to parse the sub types
+ var cBusOptions model.CBusOptions
+ return model.CBusPointToMultiPointCommandParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), cBusOptions)
case "StatusHeader":
return model.StatusHeaderParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "StatusRequest":
@@ -133,21 +148,24 @@ func (m CbusXmlParserHelper) Parse(typeName string, xmlString string, parserArgu
case "CBusHeader":
return model.CBusHeaderParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "Request":
- srchk := parserArguments[0] == "true"
+ // TODO: find a way to parse the sub types
+ var cBusOptions model.CBusOptions
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)
+ return model.RequestParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), cBusOptions, messageLength)
case "CBusPointToPointCommand":
- srchk := parserArguments[0] == "true"
- return model.CBusPointToPointCommandParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), srchk)
+ // TODO: find a way to parse the sub types
+ var cBusOptions model.CBusOptions
+ return model.CBusPointToPointCommandParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), cBusOptions)
case "Alpha":
return model.AlphaParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "CBusPointToPointToMultipointCommand":
- srchk := parserArguments[0] == "true"
- return model.CBusPointToPointToMultipointCommandParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), srchk)
+ // TODO: find a way to parse the sub types
+ var cBusOptions model.CBusOptions
+ return model.CBusPointToPointToMultipointCommandParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), cBusOptions)
}
return nil, errors.Errorf("Unsupported type %s", typeName)
}
diff --git a/plc4go/protocols/cbus/readwrite/model/CALData.go b/plc4go/protocols/cbus/readwrite/model/CALData.go
index f51739209..2c0ce02c8 100644
--- a/plc4go/protocols/cbus/readwrite/model/CALData.go
+++ b/plc4go/protocols/cbus/readwrite/model/CALData.go
@@ -141,7 +141,7 @@ func CALDataParse(readBuffer utils.ReadBuffer) (CALData, error) {
switch {
case firstByte == 0xA3: // CALDataSetParameter
_childTemp, typeSwitchError = CALDataSetParameterParse(readBuffer)
- case true: // CALDataNormalValue
+ case 0 == 0: // CALDataNormalValue
_childTemp, typeSwitchError = CALDataNormalValueParse(readBuffer)
default:
typeSwitchError = errors.Errorf("Unmapped type for parameters [firstByte=%v]", firstByte)
diff --git a/plc4go/protocols/cbus/readwrite/model/CALReplyReply.go b/plc4go/protocols/cbus/readwrite/model/CALReplyReply.go
index fdeae0afa..f30e507c1 100644
--- a/plc4go/protocols/cbus/readwrite/model/CALReplyReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/CALReplyReply.go
@@ -96,10 +96,10 @@ func (m *_CALReplyReply) GetPayloadLength() uint16 {
///////////////////////////////////////////////////////////
// NewCALReplyReply factory function for _CALReplyReply
-func NewCALReplyReply(calReply CALReply, peekedByte byte, replyLength uint16) *_CALReplyReply {
+func NewCALReplyReply(calReply CALReply, peekedByte byte, cBusOptions CBusOptions, replyLength uint16, requestContext RequestContext) *_CALReplyReply {
_result := &_CALReplyReply{
CalReply: calReply,
- _NormalReply: NewNormalReply(peekedByte, replyLength),
+ _NormalReply: NewNormalReply(peekedByte, cBusOptions, replyLength, requestContext),
}
_result._NormalReply._NormalReplyChildRequirements = _result
return _result
@@ -139,7 +139,7 @@ func (m *_CALReplyReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CALReplyReplyParse(readBuffer utils.ReadBuffer, replyLength uint16) (CALReplyReply, error) {
+func CALReplyReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, replyLength uint16, requestContext RequestContext) (CALReplyReply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CALReplyReply"); pullErr != nil {
@@ -168,7 +168,9 @@ func CALReplyReplyParse(readBuffer utils.ReadBuffer, replyLength uint16) (CALRep
_child := &_CALReplyReply{
CalReply: calReply,
_NormalReply: &_NormalReply{
- ReplyLength: replyLength,
+ CBusOptions: cBusOptions,
+ ReplyLength: replyLength,
+ RequestContext: requestContext,
},
}
_child._NormalReply._NormalReplyChildRequirements = _child
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommand.go b/plc4go/protocols/cbus/readwrite/model/CBusCommand.go
index eb94f8a9b..d09d91c07 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusCommand.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusCommand.go
@@ -51,7 +51,7 @@ type _CBusCommand struct {
Header CBusHeader
// Arguments.
- Srchk bool
+ CBusOptions CBusOptions
}
type _CBusCommandChildRequirements interface {
@@ -106,8 +106,8 @@ func (m *_CBusCommand) GetDestinationAddressType() DestinationAddressType {
///////////////////////////////////////////////////////////
// NewCBusCommand factory function for _CBusCommand
-func NewCBusCommand(header CBusHeader, srchk bool) *_CBusCommand {
- return &_CBusCommand{Header: header, Srchk: srchk}
+func NewCBusCommand(header CBusHeader, cBusOptions CBusOptions) *_CBusCommand {
+ return &_CBusCommand{Header: header, CBusOptions: cBusOptions}
}
// Deprecated: use the interface for direct cast
@@ -142,7 +142,7 @@ func (m *_CBusCommand) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusCommandParse(readBuffer utils.ReadBuffer, srchk bool) (CBusCommand, error) {
+func CBusCommandParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions) (CBusCommand, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CBusCommand"); pullErr != nil {
@@ -184,14 +184,14 @@ func CBusCommandParse(readBuffer utils.ReadBuffer, srchk bool) (CBusCommand, err
var _child CBusCommandChildSerializeRequirement
var typeSwitchError error
switch {
- case true && isDeviceManagement == bool(true): // CBusCommandDeviceManagement
- _childTemp, typeSwitchError = CBusCommandDeviceManagementParse(readBuffer, srchk)
+ case 0 == 0 && isDeviceManagement == bool(true): // CBusCommandDeviceManagement
+ _childTemp, typeSwitchError = CBusCommandDeviceManagementParse(readBuffer, cBusOptions)
case destinationAddressType == DestinationAddressType_PointToPointToMultiPoint: // CBusCommandPointToPointToMultiPoint
- _childTemp, typeSwitchError = CBusCommandPointToPointToMultiPointParse(readBuffer, srchk)
+ _childTemp, typeSwitchError = CBusCommandPointToPointToMultiPointParse(readBuffer, cBusOptions)
case destinationAddressType == DestinationAddressType_PointToMultiPoint: // CBusCommandPointToMultiPoint
- _childTemp, typeSwitchError = CBusCommandPointToMultiPointParse(readBuffer, srchk)
+ _childTemp, typeSwitchError = CBusCommandPointToMultiPointParse(readBuffer, cBusOptions)
case destinationAddressType == DestinationAddressType_PointToPoint: // CBusCommandPointToPoint
- _childTemp, typeSwitchError = CBusCommandPointToPointParse(readBuffer, srchk)
+ _childTemp, typeSwitchError = CBusCommandPointToPointParse(readBuffer, cBusOptions)
default:
typeSwitchError = errors.Errorf("Unmapped type for parameters [destinationAddressType=%v, isDeviceManagement=%v]", destinationAddressType, isDeviceManagement)
}
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommandDeviceManagement.go b/plc4go/protocols/cbus/readwrite/model/CBusCommandDeviceManagement.go
index 0ad9db6f2..c298c6950 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusCommandDeviceManagement.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusCommandDeviceManagement.go
@@ -105,11 +105,11 @@ func (m *_CBusCommandDeviceManagement) GetDelimiter() byte {
///////////////////////////////////////////////////////////
// NewCBusCommandDeviceManagement factory function for _CBusCommandDeviceManagement
-func NewCBusCommandDeviceManagement(parameterNumber uint8, parameterValue byte, header CBusHeader, srchk bool) *_CBusCommandDeviceManagement {
+func NewCBusCommandDeviceManagement(parameterNumber uint8, parameterValue byte, header CBusHeader, cBusOptions CBusOptions) *_CBusCommandDeviceManagement {
_result := &_CBusCommandDeviceManagement{
ParameterNumber: parameterNumber,
ParameterValue: parameterValue,
- _CBusCommand: NewCBusCommand(header, srchk),
+ _CBusCommand: NewCBusCommand(header, cBusOptions),
}
_result._CBusCommand._CBusCommandChildRequirements = _result
return _result
@@ -153,7 +153,7 @@ func (m *_CBusCommandDeviceManagement) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusCommandDeviceManagementParse(readBuffer utils.ReadBuffer, srchk bool) (CBusCommandDeviceManagement, error) {
+func CBusCommandDeviceManagementParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions) (CBusCommandDeviceManagement, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CBusCommandDeviceManagement"); pullErr != nil {
@@ -194,7 +194,7 @@ func CBusCommandDeviceManagementParse(readBuffer utils.ReadBuffer, srchk bool) (
ParameterNumber: parameterNumber,
ParameterValue: parameterValue,
_CBusCommand: &_CBusCommand{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
},
}
_child._CBusCommand._CBusCommandChildRequirements = _child
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToMultiPoint.go b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToMultiPoint.go
index b8a5c67da..f7df5c8a4 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToMultiPoint.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToMultiPoint.go
@@ -81,10 +81,10 @@ func (m *_CBusCommandPointToMultiPoint) GetCommand() CBusPointToMultiPointComman
///////////////////////////////////////////////////////////
// NewCBusCommandPointToMultiPoint factory function for _CBusCommandPointToMultiPoint
-func NewCBusCommandPointToMultiPoint(command CBusPointToMultiPointCommand, header CBusHeader, srchk bool) *_CBusCommandPointToMultiPoint {
+func NewCBusCommandPointToMultiPoint(command CBusPointToMultiPointCommand, header CBusHeader, cBusOptions CBusOptions) *_CBusCommandPointToMultiPoint {
_result := &_CBusCommandPointToMultiPoint{
Command: command,
- _CBusCommand: NewCBusCommand(header, srchk),
+ _CBusCommand: NewCBusCommand(header, cBusOptions),
}
_result._CBusCommand._CBusCommandChildRequirements = _result
return _result
@@ -122,7 +122,7 @@ func (m *_CBusCommandPointToMultiPoint) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusCommandPointToMultiPointParse(readBuffer utils.ReadBuffer, srchk bool) (CBusCommandPointToMultiPoint, error) {
+func CBusCommandPointToMultiPointParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions) (CBusCommandPointToMultiPoint, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CBusCommandPointToMultiPoint"); pullErr != nil {
@@ -135,7 +135,7 @@ func CBusCommandPointToMultiPointParse(readBuffer utils.ReadBuffer, srchk bool)
if pullErr := readBuffer.PullContext("command"); pullErr != nil {
return nil, errors.Wrap(pullErr, "Error pulling for command")
}
- _command, _commandErr := CBusPointToMultiPointCommandParse(readBuffer, bool(srchk))
+ _command, _commandErr := CBusPointToMultiPointCommandParse(readBuffer, cBusOptions)
if _commandErr != nil {
return nil, errors.Wrap(_commandErr, "Error parsing 'command' field of CBusCommandPointToMultiPoint")
}
@@ -152,7 +152,7 @@ func CBusCommandPointToMultiPointParse(readBuffer utils.ReadBuffer, srchk bool)
_child := &_CBusCommandPointToMultiPoint{
Command: command,
_CBusCommand: &_CBusCommand{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
},
}
_child._CBusCommand._CBusCommandChildRequirements = _child
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPoint.go b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPoint.go
index a4ab06097..e4d384089 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPoint.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPoint.go
@@ -81,10 +81,10 @@ func (m *_CBusCommandPointToPoint) GetCommand() CBusPointToPointCommand {
///////////////////////////////////////////////////////////
// NewCBusCommandPointToPoint factory function for _CBusCommandPointToPoint
-func NewCBusCommandPointToPoint(command CBusPointToPointCommand, header CBusHeader, srchk bool) *_CBusCommandPointToPoint {
+func NewCBusCommandPointToPoint(command CBusPointToPointCommand, header CBusHeader, cBusOptions CBusOptions) *_CBusCommandPointToPoint {
_result := &_CBusCommandPointToPoint{
Command: command,
- _CBusCommand: NewCBusCommand(header, srchk),
+ _CBusCommand: NewCBusCommand(header, cBusOptions),
}
_result._CBusCommand._CBusCommandChildRequirements = _result
return _result
@@ -122,7 +122,7 @@ func (m *_CBusCommandPointToPoint) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusCommandPointToPointParse(readBuffer utils.ReadBuffer, srchk bool) (CBusCommandPointToPoint, error) {
+func CBusCommandPointToPointParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions) (CBusCommandPointToPoint, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CBusCommandPointToPoint"); pullErr != nil {
@@ -135,7 +135,7 @@ func CBusCommandPointToPointParse(readBuffer utils.ReadBuffer, srchk bool) (CBus
if pullErr := readBuffer.PullContext("command"); pullErr != nil {
return nil, errors.Wrap(pullErr, "Error pulling for command")
}
- _command, _commandErr := CBusPointToPointCommandParse(readBuffer, bool(srchk))
+ _command, _commandErr := CBusPointToPointCommandParse(readBuffer, cBusOptions)
if _commandErr != nil {
return nil, errors.Wrap(_commandErr, "Error parsing 'command' field of CBusCommandPointToPoint")
}
@@ -152,7 +152,7 @@ func CBusCommandPointToPointParse(readBuffer utils.ReadBuffer, srchk bool) (CBus
_child := &_CBusCommandPointToPoint{
Command: command,
_CBusCommand: &_CBusCommand{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
},
}
_child._CBusCommand._CBusCommandChildRequirements = _child
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPoint.go b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPoint.go
index 719621c29..ea9aa29aa 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPoint.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPoint.go
@@ -81,10 +81,10 @@ func (m *_CBusCommandPointToPointToMultiPoint) GetCommand() CBusPointToPointToMu
///////////////////////////////////////////////////////////
// NewCBusCommandPointToPointToMultiPoint factory function for _CBusCommandPointToPointToMultiPoint
-func NewCBusCommandPointToPointToMultiPoint(command CBusPointToPointToMultipointCommand, header CBusHeader, srchk bool) *_CBusCommandPointToPointToMultiPoint {
+func NewCBusCommandPointToPointToMultiPoint(command CBusPointToPointToMultipointCommand, header CBusHeader, cBusOptions CBusOptions) *_CBusCommandPointToPointToMultiPoint {
_result := &_CBusCommandPointToPointToMultiPoint{
Command: command,
- _CBusCommand: NewCBusCommand(header, srchk),
+ _CBusCommand: NewCBusCommand(header, cBusOptions),
}
_result._CBusCommand._CBusCommandChildRequirements = _result
return _result
@@ -122,7 +122,7 @@ func (m *_CBusCommandPointToPointToMultiPoint) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusCommandPointToPointToMultiPointParse(readBuffer utils.ReadBuffer, srchk bool) (CBusCommandPointToPointToMultiPoint, error) {
+func CBusCommandPointToPointToMultiPointParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions) (CBusCommandPointToPointToMultiPoint, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CBusCommandPointToPointToMultiPoint"); pullErr != nil {
@@ -135,7 +135,7 @@ func CBusCommandPointToPointToMultiPointParse(readBuffer utils.ReadBuffer, srchk
if pullErr := readBuffer.PullContext("command"); pullErr != nil {
return nil, errors.Wrap(pullErr, "Error pulling for command")
}
- _command, _commandErr := CBusPointToPointToMultipointCommandParse(readBuffer, bool(srchk))
+ _command, _commandErr := CBusPointToPointToMultipointCommandParse(readBuffer, cBusOptions)
if _commandErr != nil {
return nil, errors.Wrap(_commandErr, "Error parsing 'command' field of CBusCommandPointToPointToMultiPoint")
}
@@ -152,7 +152,7 @@ func CBusCommandPointToPointToMultiPointParse(readBuffer utils.ReadBuffer, srchk
_child := &_CBusCommandPointToPointToMultiPoint{
Command: command,
_CBusCommand: &_CBusCommand{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
},
}
_child._CBusCommand._CBusCommandChildRequirements = _child
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusMessage.go b/plc4go/protocols/cbus/readwrite/model/CBusMessage.go
index baa5ceebf..b6f34ef5e 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusMessage.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusMessage.go
@@ -30,8 +30,8 @@ import (
type CBusMessage interface {
utils.LengthAware
utils.Serializable
- // GetResponse returns Response (discriminator field)
- GetResponse() bool
+ // GetIsResponse returns IsResponse (discriminator field)
+ GetIsResponse() bool
}
// CBusMessageExactly can be used when we want exactly this type and not a type which fulfills CBusMessage.
@@ -46,15 +46,16 @@ type _CBusMessage struct {
_CBusMessageChildRequirements
// Arguments.
- Srchk bool
- MessageLength uint16
+ RequestContext RequestContext
+ CBusOptions CBusOptions
+ MessageLength uint16
}
type _CBusMessageChildRequirements interface {
utils.Serializable
GetLengthInBits() uint16
GetLengthInBitsConditional(lastItem bool) uint16
- GetResponse() bool
+ GetIsResponse() bool
}
type CBusMessageParent interface {
@@ -72,8 +73,8 @@ type CBusMessageChild interface {
}
// NewCBusMessage factory function for _CBusMessage
-func NewCBusMessage(srchk bool, messageLength uint16) *_CBusMessage {
- return &_CBusMessage{Srchk: srchk, MessageLength: messageLength}
+func NewCBusMessage(requestContext RequestContext, cBusOptions CBusOptions, messageLength uint16) *_CBusMessage {
+ return &_CBusMessage{RequestContext: requestContext, CBusOptions: cBusOptions, MessageLength: messageLength}
}
// Deprecated: use the interface for direct cast
@@ -101,7 +102,7 @@ func (m *_CBusMessage) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusMessageParse(readBuffer utils.ReadBuffer, response bool, srchk bool, messageLength uint16) (CBusMessage, error) {
+func CBusMessageParse(readBuffer utils.ReadBuffer, isResponse bool, requestContext RequestContext, cBusOptions CBusOptions, messageLength uint16) (CBusMessage, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CBusMessage"); pullErr != nil {
@@ -110,6 +111,16 @@ func CBusMessageParse(readBuffer utils.ReadBuffer, response bool, srchk bool, me
currentPos := positionAware.GetPos()
_ = currentPos
+ // Validation
+ if !(bool((requestContext) != (nil))) {
+ return nil, errors.WithStack(utils.ParseValidationError{"requestContext required"})
+ }
+
+ // Validation
+ if !(bool((cBusOptions) != (nil))) {
+ return nil, errors.WithStack(utils.ParseValidationError{"cBusOptions required"})
+ }
+
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
type CBusMessageChildSerializeRequirement interface {
CBusMessage
@@ -120,12 +131,12 @@ func CBusMessageParse(readBuffer utils.ReadBuffer, response bool, srchk bool, me
var _child CBusMessageChildSerializeRequirement
var typeSwitchError error
switch {
- case response == bool(false): // CBusMessageToServer
- _childTemp, typeSwitchError = CBusMessageToServerParse(readBuffer, response, srchk, messageLength)
- case response == bool(true): // CBusMessageToClient
- _childTemp, typeSwitchError = CBusMessageToClientParse(readBuffer, response, srchk, messageLength)
+ case isResponse == bool(false): // CBusMessageToServer
+ _childTemp, typeSwitchError = CBusMessageToServerParse(readBuffer, isResponse, requestContext, cBusOptions, messageLength)
+ case isResponse == bool(true): // CBusMessageToClient
+ _childTemp, typeSwitchError = CBusMessageToClientParse(readBuffer, isResponse, requestContext, cBusOptions, messageLength)
default:
- typeSwitchError = errors.Errorf("Unmapped type for parameters [response=%v]", response)
+ typeSwitchError = errors.Errorf("Unmapped type for parameters [isResponse=%v]", isResponse)
}
if typeSwitchError != nil {
return nil, errors.Wrap(typeSwitchError, "Error parsing sub-type for type-switch of CBusMessage")
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusMessageToClient.go b/plc4go/protocols/cbus/readwrite/model/CBusMessageToClient.go
index 8f130ea18..09701816d 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusMessageToClient.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusMessageToClient.go
@@ -53,7 +53,7 @@ type _CBusMessageToClient struct {
/////////////////////// Accessors for discriminator values.
///////////////////////
-func (m *_CBusMessageToClient) GetResponse() bool {
+func (m *_CBusMessageToClient) GetIsResponse() bool {
return bool(true)
}
@@ -83,10 +83,10 @@ func (m *_CBusMessageToClient) GetReply() Reply {
///////////////////////////////////////////////////////////
// NewCBusMessageToClient factory function for _CBusMessageToClient
-func NewCBusMessageToClient(reply Reply, srchk bool, messageLength uint16) *_CBusMessageToClient {
+func NewCBusMessageToClient(reply Reply, requestContext RequestContext, cBusOptions CBusOptions, messageLength uint16) *_CBusMessageToClient {
_result := &_CBusMessageToClient{
Reply: reply,
- _CBusMessage: NewCBusMessage(srchk, messageLength),
+ _CBusMessage: NewCBusMessage(requestContext, cBusOptions, 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, messageLength uint16) (CBusMessageToClient, error) {
+func CBusMessageToClientParse(readBuffer utils.ReadBuffer, isResponse bool, requestContext RequestContext, cBusOptions CBusOptions, 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, uint16(messageLength))
+ _reply, _replyErr := ReplyParse(readBuffer, cBusOptions, uint16(messageLength), requestContext)
if _replyErr != nil {
return nil, errors.Wrap(_replyErr, "Error parsing 'reply' field of CBusMessageToClient")
}
@@ -154,8 +154,9 @@ func CBusMessageToClientParse(readBuffer utils.ReadBuffer, response bool, srchk
_child := &_CBusMessageToClient{
Reply: reply,
_CBusMessage: &_CBusMessage{
- Srchk: srchk,
- MessageLength: messageLength,
+ RequestContext: requestContext,
+ CBusOptions: cBusOptions,
+ 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 4bad9d587..e4606e401 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusMessageToServer.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusMessageToServer.go
@@ -53,7 +53,7 @@ type _CBusMessageToServer struct {
/////////////////////// Accessors for discriminator values.
///////////////////////
-func (m *_CBusMessageToServer) GetResponse() bool {
+func (m *_CBusMessageToServer) GetIsResponse() bool {
return bool(false)
}
@@ -83,10 +83,10 @@ func (m *_CBusMessageToServer) GetRequest() Request {
///////////////////////////////////////////////////////////
// NewCBusMessageToServer factory function for _CBusMessageToServer
-func NewCBusMessageToServer(request Request, srchk bool, messageLength uint16) *_CBusMessageToServer {
+func NewCBusMessageToServer(request Request, requestContext RequestContext, cBusOptions CBusOptions, messageLength uint16) *_CBusMessageToServer {
_result := &_CBusMessageToServer{
Request: request,
- _CBusMessage: NewCBusMessage(srchk, messageLength),
+ _CBusMessage: NewCBusMessage(requestContext, cBusOptions, 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, messageLength uint16) (CBusMessageToServer, error) {
+func CBusMessageToServerParse(readBuffer utils.ReadBuffer, isResponse bool, requestContext RequestContext, cBusOptions CBusOptions, 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), uint16(messageLength))
+ _request, _requestErr := RequestParse(readBuffer, cBusOptions, uint16(messageLength))
if _requestErr != nil {
return nil, errors.Wrap(_requestErr, "Error parsing 'request' field of CBusMessageToServer")
}
@@ -154,8 +154,9 @@ func CBusMessageToServerParse(readBuffer utils.ReadBuffer, response bool, srchk
_child := &_CBusMessageToServer{
Request: request,
_CBusMessage: &_CBusMessage{
- Srchk: srchk,
- MessageLength: messageLength,
+ RequestContext: requestContext,
+ CBusOptions: cBusOptions,
+ MessageLength: messageLength,
},
}
_child._CBusMessage._CBusMessageChildRequirements = _child
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusOptions.go b/plc4go/protocols/cbus/readwrite/model/CBusOptions.go
index fc2f715f2..5bb9a4ecf 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusOptions.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusOptions.go
@@ -46,6 +46,8 @@ type CBusOptions interface {
GetPun() bool
// GetPcn returns Pcn (property field)
GetPcn() bool
+ // GetSrchk returns Srchk (property field)
+ GetSrchk() bool
}
// CBusOptionsExactly can be used when we want exactly this type and not a type which fulfills CBusOptions.
@@ -65,6 +67,7 @@ type _CBusOptions struct {
Monall bool
Pun bool
Pcn bool
+ Srchk bool
}
///////////////////////////////////////////////////////////
@@ -104,14 +107,18 @@ func (m *_CBusOptions) GetPcn() bool {
return m.Pcn
}
+func (m *_CBusOptions) GetSrchk() bool {
+ return m.Srchk
+}
+
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// NewCBusOptions factory function for _CBusOptions
-func NewCBusOptions(connect bool, smart bool, idmon bool, exstat bool, monitor bool, monall bool, pun bool, pcn bool) *_CBusOptions {
- return &_CBusOptions{Connect: connect, Smart: smart, Idmon: idmon, Exstat: exstat, Monitor: monitor, Monall: monall, Pun: pun, Pcn: pcn}
+func NewCBusOptions(connect bool, smart bool, idmon bool, exstat bool, monitor bool, monall bool, pun bool, pcn bool, srchk bool) *_CBusOptions {
+ return &_CBusOptions{Connect: connect, Smart: smart, Idmon: idmon, Exstat: exstat, Monitor: monitor, Monall: monall, Pun: pun, Pcn: pcn, Srchk: srchk}
}
// Deprecated: use the interface for direct cast
@@ -160,6 +167,9 @@ func (m *_CBusOptions) GetLengthInBitsConditional(lastItem bool) uint16 {
// Simple field (pcn)
lengthInBits += 1
+ // Simple field (srchk)
+ lengthInBits += 1
+
return lengthInBits
}
@@ -232,12 +242,19 @@ func CBusOptionsParse(readBuffer utils.ReadBuffer) (CBusOptions, error) {
}
pcn := _pcn
+ // Simple Field (srchk)
+ _srchk, _srchkErr := readBuffer.ReadBit("srchk")
+ if _srchkErr != nil {
+ return nil, errors.Wrap(_srchkErr, "Error parsing 'srchk' field of CBusOptions")
+ }
+ srchk := _srchk
+
if closeErr := readBuffer.CloseContext("CBusOptions"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for CBusOptions")
}
// Create the instance
- return NewCBusOptions(connect, smart, idmon, exstat, monitor, monall, pun, pcn), nil
+ return NewCBusOptions(connect, smart, idmon, exstat, monitor, monall, pun, pcn, srchk), nil
}
func (m *_CBusOptions) Serialize(writeBuffer utils.WriteBuffer) error {
@@ -303,6 +320,13 @@ func (m *_CBusOptions) Serialize(writeBuffer utils.WriteBuffer) error {
return errors.Wrap(_pcnErr, "Error serializing 'pcn' field")
}
+ // Simple Field (srchk)
+ srchk := bool(m.GetSrchk())
+ _srchkErr := writeBuffer.WriteBit("srchk", (srchk))
+ if _srchkErr != nil {
+ return errors.Wrap(_srchkErr, "Error serializing 'srchk' field")
+ }
+
if popErr := writeBuffer.PopContext("CBusOptions"); popErr != nil {
return errors.Wrap(popErr, "Error popping for CBusOptions")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommand.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommand.go
index c49b09767..1c27c8333 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommand.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommand.go
@@ -47,7 +47,7 @@ type _CBusPointToMultiPointCommand struct {
PeekedApplication byte
// Arguments.
- Srchk bool
+ CBusOptions CBusOptions
}
type _CBusPointToMultiPointCommandChildRequirements interface {
@@ -85,8 +85,8 @@ func (m *_CBusPointToMultiPointCommand) GetPeekedApplication() byte {
///////////////////////////////////////////////////////////
// NewCBusPointToMultiPointCommand factory function for _CBusPointToMultiPointCommand
-func NewCBusPointToMultiPointCommand(peekedApplication byte, srchk bool) *_CBusPointToMultiPointCommand {
- return &_CBusPointToMultiPointCommand{PeekedApplication: peekedApplication, Srchk: srchk}
+func NewCBusPointToMultiPointCommand(peekedApplication byte, cBusOptions CBusOptions) *_CBusPointToMultiPointCommand {
+ return &_CBusPointToMultiPointCommand{PeekedApplication: peekedApplication, CBusOptions: cBusOptions}
}
// Deprecated: use the interface for direct cast
@@ -114,7 +114,7 @@ func (m *_CBusPointToMultiPointCommand) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusPointToMultiPointCommandParse(readBuffer utils.ReadBuffer, srchk bool) (CBusPointToMultiPointCommand, error) {
+func CBusPointToMultiPointCommandParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions) (CBusPointToMultiPointCommand, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CBusPointToMultiPointCommand"); pullErr != nil {
@@ -143,9 +143,9 @@ func CBusPointToMultiPointCommandParse(readBuffer utils.ReadBuffer, srchk bool)
var typeSwitchError error
switch {
case peekedApplication == 0xFF: // CBusPointToMultiPointCommandStatus
- _childTemp, typeSwitchError = CBusPointToMultiPointCommandStatusParse(readBuffer, srchk)
- case true: // CBusPointToMultiPointCommandNormal
- _childTemp, typeSwitchError = CBusPointToMultiPointCommandNormalParse(readBuffer, srchk)
+ _childTemp, typeSwitchError = CBusPointToMultiPointCommandStatusParse(readBuffer, cBusOptions)
+ case 0 == 0: // Normal
+ _childTemp, typeSwitchError = NormalParse(readBuffer, cBusOptions)
default:
typeSwitchError = errors.Errorf("Unmapped type for parameters [peekedApplication=%v]", peekedApplication)
}
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandStatus.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandStatus.go
index 9ce9c1fa7..48a763b16 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandStatus.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandStatus.go
@@ -90,11 +90,11 @@ func (m *_CBusPointToMultiPointCommandStatus) GetCrc() Checksum {
///////////////////////////////////////////////////////////
// NewCBusPointToMultiPointCommandStatus factory function for _CBusPointToMultiPointCommandStatus
-func NewCBusPointToMultiPointCommandStatus(statusRequest StatusRequest, crc Checksum, peekedApplication byte, srchk bool) *_CBusPointToMultiPointCommandStatus {
+func NewCBusPointToMultiPointCommandStatus(statusRequest StatusRequest, crc Checksum, peekedApplication byte, cBusOptions CBusOptions) *_CBusPointToMultiPointCommandStatus {
_result := &_CBusPointToMultiPointCommandStatus{
StatusRequest: statusRequest,
Crc: crc,
- _CBusPointToMultiPointCommand: NewCBusPointToMultiPointCommand(peekedApplication, srchk),
+ _CBusPointToMultiPointCommand: NewCBusPointToMultiPointCommand(peekedApplication, cBusOptions),
}
_result._CBusPointToMultiPointCommand._CBusPointToMultiPointCommandChildRequirements = _result
return _result
@@ -143,7 +143,7 @@ func (m *_CBusPointToMultiPointCommandStatus) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusPointToMultiPointCommandStatusParse(readBuffer utils.ReadBuffer, srchk bool) (CBusPointToMultiPointCommandStatus, error) {
+func CBusPointToMultiPointCommandStatusParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions) (CBusPointToMultiPointCommandStatus, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CBusPointToMultiPointCommandStatus"); pullErr != nil {
@@ -195,7 +195,7 @@ func CBusPointToMultiPointCommandStatusParse(readBuffer utils.ReadBuffer, srchk
// Optional Field (crc) (Can be skipped, if a given expression evaluates to false)
var crc Checksum = nil
- if srchk {
+ if cBusOptions.GetSrchk() {
currentPos = positionAware.GetPos()
if pullErr := readBuffer.PullContext("crc"); pullErr != nil {
return nil, errors.Wrap(pullErr, "Error pulling for crc")
@@ -224,7 +224,7 @@ func CBusPointToMultiPointCommandStatusParse(readBuffer utils.ReadBuffer, srchk
StatusRequest: statusRequest,
Crc: crc,
_CBusPointToMultiPointCommand: &_CBusPointToMultiPointCommand{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
},
}
_child._CBusPointToMultiPointCommand._CBusPointToMultiPointCommandChildRequirements = _child
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommand.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommand.go
index fc8981163..7352dd8a0 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommand.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommand.go
@@ -57,7 +57,7 @@ type _CBusPointToPointCommand struct {
Crc Checksum
// Arguments.
- Srchk bool
+ CBusOptions CBusOptions
}
type _CBusPointToPointCommandChildRequirements interface {
@@ -118,8 +118,8 @@ func (m *_CBusPointToPointCommand) GetIsDirect() bool {
///////////////////////////////////////////////////////////
// NewCBusPointToPointCommand factory function for _CBusPointToPointCommand
-func NewCBusPointToPointCommand(bridgeAddressCountPeek uint16, calData CALData, crc Checksum, srchk bool) *_CBusPointToPointCommand {
- return &_CBusPointToPointCommand{BridgeAddressCountPeek: bridgeAddressCountPeek, CalData: calData, Crc: crc, Srchk: srchk}
+func NewCBusPointToPointCommand(bridgeAddressCountPeek uint16, calData CALData, crc Checksum, cBusOptions CBusOptions) *_CBusPointToPointCommand {
+ return &_CBusPointToPointCommand{BridgeAddressCountPeek: bridgeAddressCountPeek, CalData: calData, Crc: crc, CBusOptions: cBusOptions}
}
// Deprecated: use the interface for direct cast
@@ -157,7 +157,7 @@ func (m *_CBusPointToPointCommand) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusPointToPointCommandParse(readBuffer utils.ReadBuffer, srchk bool) (CBusPointToPointCommand, error) {
+func CBusPointToPointCommandParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions) (CBusPointToPointCommand, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CBusPointToPointCommand"); pullErr != nil {
@@ -191,9 +191,9 @@ func CBusPointToPointCommandParse(readBuffer utils.ReadBuffer, srchk bool) (CBus
var typeSwitchError error
switch {
case isDirect == bool(true): // CBusPointToPointCommandDirect
- _childTemp, typeSwitchError = CBusPointToPointCommandDirectParse(readBuffer, srchk)
+ _childTemp, typeSwitchError = CBusPointToPointCommandDirectParse(readBuffer, cBusOptions)
case isDirect == bool(false): // CBusPointToPointCommandIndirect
- _childTemp, typeSwitchError = CBusPointToPointCommandIndirectParse(readBuffer, srchk)
+ _childTemp, typeSwitchError = CBusPointToPointCommandIndirectParse(readBuffer, cBusOptions)
default:
typeSwitchError = errors.Errorf("Unmapped type for parameters [isDirect=%v]", isDirect)
}
@@ -217,7 +217,7 @@ func CBusPointToPointCommandParse(readBuffer utils.ReadBuffer, srchk bool) (CBus
// Optional Field (crc) (Can be skipped, if a given expression evaluates to false)
var crc Checksum = nil
- if srchk {
+ if cBusOptions.GetSrchk() {
currentPos = positionAware.GetPos()
if pullErr := readBuffer.PullContext("crc"); pullErr != nil {
return nil, errors.Wrap(pullErr, "Error pulling for crc")
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandDirect.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandDirect.go
index 40bcf5bdc..232424370 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandDirect.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandDirect.go
@@ -84,10 +84,10 @@ func (m *_CBusPointToPointCommandDirect) GetUnitAddress() UnitAddress {
///////////////////////////////////////////////////////////
// NewCBusPointToPointCommandDirect factory function for _CBusPointToPointCommandDirect
-func NewCBusPointToPointCommandDirect(unitAddress UnitAddress, bridgeAddressCountPeek uint16, calData CALData, crc Checksum, srchk bool) *_CBusPointToPointCommandDirect {
+func NewCBusPointToPointCommandDirect(unitAddress UnitAddress, bridgeAddressCountPeek uint16, calData CALData, crc Checksum, cBusOptions CBusOptions) *_CBusPointToPointCommandDirect {
_result := &_CBusPointToPointCommandDirect{
UnitAddress: unitAddress,
- _CBusPointToPointCommand: NewCBusPointToPointCommand(bridgeAddressCountPeek, calData, crc, srchk),
+ _CBusPointToPointCommand: NewCBusPointToPointCommand(bridgeAddressCountPeek, calData, crc, cBusOptions),
}
_result._CBusPointToPointCommand._CBusPointToPointCommandChildRequirements = _result
return _result
@@ -128,7 +128,7 @@ func (m *_CBusPointToPointCommandDirect) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusPointToPointCommandDirectParse(readBuffer utils.ReadBuffer, srchk bool) (CBusPointToPointCommandDirect, error) {
+func CBusPointToPointCommandDirectParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions) (CBusPointToPointCommandDirect, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CBusPointToPointCommandDirect"); pullErr != nil {
@@ -172,7 +172,7 @@ func CBusPointToPointCommandDirectParse(readBuffer utils.ReadBuffer, srchk bool)
_child := &_CBusPointToPointCommandDirect{
UnitAddress: unitAddress,
_CBusPointToPointCommand: &_CBusPointToPointCommand{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
},
}
_child._CBusPointToPointCommand._CBusPointToPointCommandChildRequirements = _child
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandIndirect.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandIndirect.go
index 28ffcce31..7dcca96c3 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandIndirect.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandIndirect.go
@@ -97,12 +97,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, srchk bool) *_CBusPointToPointCommandIndirect {
+func NewCBusPointToPointCommandIndirect(bridgeAddress BridgeAddress, networkRoute NetworkRoute, unitAddress UnitAddress, bridgeAddressCountPeek uint16, calData CALData, crc Checksum, cBusOptions CBusOptions) *_CBusPointToPointCommandIndirect {
_result := &_CBusPointToPointCommandIndirect{
BridgeAddress: bridgeAddress,
NetworkRoute: networkRoute,
UnitAddress: unitAddress,
- _CBusPointToPointCommand: NewCBusPointToPointCommand(bridgeAddressCountPeek, calData, crc, srchk),
+ _CBusPointToPointCommand: NewCBusPointToPointCommand(bridgeAddressCountPeek, calData, crc, cBusOptions),
}
_result._CBusPointToPointCommand._CBusPointToPointCommandChildRequirements = _result
return _result
@@ -146,7 +146,7 @@ func (m *_CBusPointToPointCommandIndirect) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusPointToPointCommandIndirectParse(readBuffer utils.ReadBuffer, srchk bool) (CBusPointToPointCommandIndirect, error) {
+func CBusPointToPointCommandIndirectParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions) (CBusPointToPointCommandIndirect, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CBusPointToPointCommandIndirect"); pullErr != nil {
@@ -204,7 +204,7 @@ func CBusPointToPointCommandIndirectParse(readBuffer utils.ReadBuffer, srchk boo
NetworkRoute: networkRoute,
UnitAddress: unitAddress,
_CBusPointToPointCommand: &_CBusPointToPointCommand{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
},
}
_child._CBusPointToPointCommand._CBusPointToPointCommandChildRequirements = _child
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointToMultipointCommand.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointToMultipointCommand.go
index 230c9fd32..ad8d6fcd9 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointToMultipointCommand.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointToMultipointCommand.go
@@ -53,7 +53,7 @@ type _CBusPointToPointToMultipointCommand struct {
PeekedApplication byte
// Arguments.
- Srchk bool
+ CBusOptions CBusOptions
}
type _CBusPointToPointToMultipointCommandChildRequirements interface {
@@ -99,8 +99,8 @@ func (m *_CBusPointToPointToMultipointCommand) GetPeekedApplication() byte {
///////////////////////////////////////////////////////////
// NewCBusPointToPointToMultipointCommand factory function for _CBusPointToPointToMultipointCommand
-func NewCBusPointToPointToMultipointCommand(bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, srchk bool) *_CBusPointToPointToMultipointCommand {
- return &_CBusPointToPointToMultipointCommand{BridgeAddress: bridgeAddress, NetworkRoute: networkRoute, PeekedApplication: peekedApplication, Srchk: srchk}
+func NewCBusPointToPointToMultipointCommand(bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, cBusOptions CBusOptions) *_CBusPointToPointToMultipointCommand {
+ return &_CBusPointToPointToMultipointCommand{BridgeAddress: bridgeAddress, NetworkRoute: networkRoute, PeekedApplication: peekedApplication, CBusOptions: cBusOptions}
}
// Deprecated: use the interface for direct cast
@@ -134,7 +134,7 @@ func (m *_CBusPointToPointToMultipointCommand) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusPointToPointToMultipointCommandParse(readBuffer utils.ReadBuffer, srchk bool) (CBusPointToPointToMultipointCommand, error) {
+func CBusPointToPointToMultipointCommandParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions) (CBusPointToPointToMultipointCommand, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("CBusPointToPointToMultipointCommand"); pullErr != nil {
@@ -188,10 +188,10 @@ func CBusPointToPointToMultipointCommandParse(readBuffer utils.ReadBuffer, srchk
var _child CBusPointToPointToMultipointCommandChildSerializeRequirement
var typeSwitchError error
switch {
- case peekedApplication == 0xFF: // CBusCommandPointToPointToMultiPointStatus
- _childTemp, typeSwitchError = CBusCommandPointToPointToMultiPointStatusParse(readBuffer, srchk)
- case true: // CBusCommandPointToPointToMultiPointNormal
- _childTemp, typeSwitchError = CBusCommandPointToPointToMultiPointNormalParse(readBuffer, srchk)
+ case peekedApplication == 0xFF: // CBusPointToPointToMultipointCommandStatus
+ _childTemp, typeSwitchError = CBusPointToPointToMultipointCommandStatusParse(readBuffer, cBusOptions)
+ case 0 == 0: // CBusPointToPointToMultipointCommandNormal
+ _childTemp, typeSwitchError = CBusPointToPointToMultipointCommandNormalParse(readBuffer, cBusOptions)
default:
typeSwitchError = errors.Errorf("Unmapped type for parameters [peekedApplication=%v]", peekedApplication)
}
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointNormal.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointToMultipointCommandNormal.go
similarity index 70%
rename from plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointNormal.go
rename to plc4go/protocols/cbus/readwrite/model/CBusPointToPointToMultipointCommandNormal.go
index ead1fc767..292b994f7 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointNormal.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointToMultipointCommandNormal.go
@@ -28,8 +28,8 @@ import (
// Code generated by code-generation. DO NOT EDIT.
-// CBusCommandPointToPointToMultiPointNormal is the corresponding interface of CBusCommandPointToPointToMultiPointNormal
-type CBusCommandPointToPointToMultiPointNormal interface {
+// CBusPointToPointToMultipointCommandNormal is the corresponding interface of CBusPointToPointToMultipointCommandNormal
+type CBusPointToPointToMultipointCommandNormal interface {
utils.LengthAware
utils.Serializable
CBusPointToPointToMultipointCommand
@@ -41,15 +41,15 @@ type CBusCommandPointToPointToMultiPointNormal interface {
GetCrc() Checksum
}
-// CBusCommandPointToPointToMultiPointNormalExactly can be used when we want exactly this type and not a type which fulfills CBusCommandPointToPointToMultiPointNormal.
+// CBusPointToPointToMultipointCommandNormalExactly can be used when we want exactly this type and not a type which fulfills CBusPointToPointToMultipointCommandNormal.
// This is useful for switch cases.
-type CBusCommandPointToPointToMultiPointNormalExactly interface {
- CBusCommandPointToPointToMultiPointNormal
- isCBusCommandPointToPointToMultiPointNormal() bool
+type CBusPointToPointToMultipointCommandNormalExactly interface {
+ CBusPointToPointToMultipointCommandNormal
+ isCBusPointToPointToMultipointCommandNormal() bool
}
-// _CBusCommandPointToPointToMultiPointNormal is the data-structure of this message
-type _CBusCommandPointToPointToMultiPointNormal struct {
+// _CBusPointToPointToMultipointCommandNormal is the data-structure of this message
+type _CBusPointToPointToMultipointCommandNormal struct {
*_CBusPointToPointToMultipointCommand
Application ApplicationIdContainer
SalData SALData
@@ -66,13 +66,13 @@ type _CBusCommandPointToPointToMultiPointNormal struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_CBusCommandPointToPointToMultiPointNormal) InitializeParent(parent CBusPointToPointToMultipointCommand, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte) {
+func (m *_CBusPointToPointToMultipointCommandNormal) InitializeParent(parent CBusPointToPointToMultipointCommand, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte) {
m.BridgeAddress = bridgeAddress
m.NetworkRoute = networkRoute
m.PeekedApplication = peekedApplication
}
-func (m *_CBusCommandPointToPointToMultiPointNormal) GetParent() CBusPointToPointToMultipointCommand {
+func (m *_CBusPointToPointToMultipointCommandNormal) GetParent() CBusPointToPointToMultipointCommand {
return m._CBusPointToPointToMultipointCommand
}
@@ -81,15 +81,15 @@ func (m *_CBusCommandPointToPointToMultiPointNormal) GetParent() CBusPointToPoin
/////////////////////// Accessors for property fields.
///////////////////////
-func (m *_CBusCommandPointToPointToMultiPointNormal) GetApplication() ApplicationIdContainer {
+func (m *_CBusPointToPointToMultipointCommandNormal) GetApplication() ApplicationIdContainer {
return m.Application
}
-func (m *_CBusCommandPointToPointToMultiPointNormal) GetSalData() SALData {
+func (m *_CBusPointToPointToMultipointCommandNormal) GetSalData() SALData {
return m.SalData
}
-func (m *_CBusCommandPointToPointToMultiPointNormal) GetCrc() Checksum {
+func (m *_CBusPointToPointToMultipointCommandNormal) GetCrc() Checksum {
return m.Crc
}
@@ -98,38 +98,38 @@ func (m *_CBusCommandPointToPointToMultiPointNormal) GetCrc() Checksum {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-// NewCBusCommandPointToPointToMultiPointNormal factory function for _CBusCommandPointToPointToMultiPointNormal
-func NewCBusCommandPointToPointToMultiPointNormal(application ApplicationIdContainer, salData SALData, crc Checksum, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, srchk bool) *_CBusCommandPointToPointToMultiPointNormal {
- _result := &_CBusCommandPointToPointToMultiPointNormal{
+// NewCBusPointToPointToMultipointCommandNormal factory function for _CBusPointToPointToMultipointCommandNormal
+func NewCBusPointToPointToMultipointCommandNormal(application ApplicationIdContainer, salData SALData, crc Checksum, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, cBusOptions CBusOptions) *_CBusPointToPointToMultipointCommandNormal {
+ _result := &_CBusPointToPointToMultipointCommandNormal{
Application: application,
SalData: salData,
Crc: crc,
- _CBusPointToPointToMultipointCommand: NewCBusPointToPointToMultipointCommand(bridgeAddress, networkRoute, peekedApplication, srchk),
+ _CBusPointToPointToMultipointCommand: NewCBusPointToPointToMultipointCommand(bridgeAddress, networkRoute, peekedApplication, cBusOptions),
}
_result._CBusPointToPointToMultipointCommand._CBusPointToPointToMultipointCommandChildRequirements = _result
return _result
}
// Deprecated: use the interface for direct cast
-func CastCBusCommandPointToPointToMultiPointNormal(structType interface{}) CBusCommandPointToPointToMultiPointNormal {
- if casted, ok := structType.(CBusCommandPointToPointToMultiPointNormal); ok {
+func CastCBusPointToPointToMultipointCommandNormal(structType interface{}) CBusPointToPointToMultipointCommandNormal {
+ if casted, ok := structType.(CBusPointToPointToMultipointCommandNormal); ok {
return casted
}
- if casted, ok := structType.(*CBusCommandPointToPointToMultiPointNormal); ok {
+ if casted, ok := structType.(*CBusPointToPointToMultipointCommandNormal); ok {
return *casted
}
return nil
}
-func (m *_CBusCommandPointToPointToMultiPointNormal) GetTypeName() string {
- return "CBusCommandPointToPointToMultiPointNormal"
+func (m *_CBusPointToPointToMultipointCommandNormal) GetTypeName() string {
+ return "CBusPointToPointToMultipointCommandNormal"
}
-func (m *_CBusCommandPointToPointToMultiPointNormal) GetLengthInBits() uint16 {
+func (m *_CBusPointToPointToMultipointCommandNormal) GetLengthInBits() uint16 {
return m.GetLengthInBitsConditional(false)
}
-func (m *_CBusCommandPointToPointToMultiPointNormal) GetLengthInBitsConditional(lastItem bool) uint16 {
+func (m *_CBusPointToPointToMultipointCommandNormal) GetLengthInBitsConditional(lastItem bool) uint16 {
lengthInBits := uint16(m.GetParentLengthInBits())
// Simple field (application)
@@ -146,15 +146,15 @@ func (m *_CBusCommandPointToPointToMultiPointNormal) GetLengthInBitsConditional(
return lengthInBits
}
-func (m *_CBusCommandPointToPointToMultiPointNormal) GetLengthInBytes() uint16 {
+func (m *_CBusPointToPointToMultipointCommandNormal) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusCommandPointToPointToMultiPointNormalParse(readBuffer utils.ReadBuffer, srchk bool) (CBusCommandPointToPointToMultiPointNormal, error) {
+func CBusPointToPointToMultipointCommandNormalParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions) (CBusPointToPointToMultipointCommandNormal, error) {
positionAware := readBuffer
_ = positionAware
- if pullErr := readBuffer.PullContext("CBusCommandPointToPointToMultiPointNormal"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for CBusCommandPointToPointToMultiPointNormal")
+ if pullErr := readBuffer.PullContext("CBusPointToPointToMultipointCommandNormal"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for CBusPointToPointToMultipointCommandNormal")
}
currentPos := positionAware.GetPos()
_ = currentPos
@@ -165,7 +165,7 @@ func CBusCommandPointToPointToMultiPointNormalParse(readBuffer utils.ReadBuffer,
}
_application, _applicationErr := ApplicationIdContainerParse(readBuffer)
if _applicationErr != nil {
- return nil, errors.Wrap(_applicationErr, "Error parsing 'application' field of CBusCommandPointToPointToMultiPointNormal")
+ return nil, errors.Wrap(_applicationErr, "Error parsing 'application' field of CBusPointToPointToMultipointCommandNormal")
}
application := _application
if closeErr := readBuffer.CloseContext("application"); closeErr != nil {
@@ -178,7 +178,7 @@ func CBusCommandPointToPointToMultiPointNormalParse(readBuffer utils.ReadBuffer,
}
_salData, _salDataErr := SALDataParse(readBuffer)
if _salDataErr != nil {
- return nil, errors.Wrap(_salDataErr, "Error parsing 'salData' field of CBusCommandPointToPointToMultiPointNormal")
+ return nil, errors.Wrap(_salDataErr, "Error parsing 'salData' field of CBusPointToPointToMultipointCommandNormal")
}
salData := _salData.(SALData)
if closeErr := readBuffer.CloseContext("salData"); closeErr != nil {
@@ -187,7 +187,7 @@ func CBusCommandPointToPointToMultiPointNormalParse(readBuffer utils.ReadBuffer,
// Optional Field (crc) (Can be skipped, if a given expression evaluates to false)
var crc Checksum = nil
- if srchk {
+ if cBusOptions.GetSrchk() {
currentPos = positionAware.GetPos()
if pullErr := readBuffer.PullContext("crc"); pullErr != nil {
return nil, errors.Wrap(pullErr, "Error pulling for crc")
@@ -198,7 +198,7 @@ func CBusCommandPointToPointToMultiPointNormalParse(readBuffer utils.ReadBuffer,
log.Debug().Err(_err).Msg("Resetting position because optional threw an error")
readBuffer.Reset(currentPos)
case _err != nil:
- return nil, errors.Wrap(_err, "Error parsing 'crc' field of CBusCommandPointToPointToMultiPointNormal")
+ return nil, errors.Wrap(_err, "Error parsing 'crc' field of CBusPointToPointToMultipointCommandNormal")
default:
crc = _val.(Checksum)
if closeErr := readBuffer.CloseContext("crc"); closeErr != nil {
@@ -207,29 +207,29 @@ func CBusCommandPointToPointToMultiPointNormalParse(readBuffer utils.ReadBuffer,
}
}
- if closeErr := readBuffer.CloseContext("CBusCommandPointToPointToMultiPointNormal"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for CBusCommandPointToPointToMultiPointNormal")
+ if closeErr := readBuffer.CloseContext("CBusPointToPointToMultipointCommandNormal"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for CBusPointToPointToMultipointCommandNormal")
}
// Create a partially initialized instance
- _child := &_CBusCommandPointToPointToMultiPointNormal{
+ _child := &_CBusPointToPointToMultipointCommandNormal{
Application: application,
SalData: salData,
Crc: crc,
_CBusPointToPointToMultipointCommand: &_CBusPointToPointToMultipointCommand{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
},
}
_child._CBusPointToPointToMultipointCommand._CBusPointToPointToMultipointCommandChildRequirements = _child
return _child, nil
}
-func (m *_CBusCommandPointToPointToMultiPointNormal) Serialize(writeBuffer utils.WriteBuffer) error {
+func (m *_CBusPointToPointToMultipointCommandNormal) Serialize(writeBuffer utils.WriteBuffer) error {
positionAware := writeBuffer
_ = positionAware
ser := func() error {
- if pushErr := writeBuffer.PushContext("CBusCommandPointToPointToMultiPointNormal"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for CBusCommandPointToPointToMultiPointNormal")
+ if pushErr := writeBuffer.PushContext("CBusPointToPointToMultipointCommandNormal"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for CBusPointToPointToMultipointCommandNormal")
}
// Simple Field (application)
@@ -272,19 +272,19 @@ func (m *_CBusCommandPointToPointToMultiPointNormal) Serialize(writeBuffer utils
}
}
- if popErr := writeBuffer.PopContext("CBusCommandPointToPointToMultiPointNormal"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for CBusCommandPointToPointToMultiPointNormal")
+ if popErr := writeBuffer.PopContext("CBusPointToPointToMultipointCommandNormal"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for CBusPointToPointToMultipointCommandNormal")
}
return nil
}
return m.SerializeParent(writeBuffer, m, ser)
}
-func (m *_CBusCommandPointToPointToMultiPointNormal) isCBusCommandPointToPointToMultiPointNormal() bool {
+func (m *_CBusPointToPointToMultipointCommandNormal) isCBusPointToPointToMultipointCommandNormal() bool {
return true
}
-func (m *_CBusCommandPointToPointToMultiPointNormal) String() string {
+func (m *_CBusPointToPointToMultipointCommandNormal) String() string {
if m == nil {
return "<nil>"
}
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointStatus.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointToMultipointCommandStatus.go
similarity index 69%
rename from plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointStatus.go
rename to plc4go/protocols/cbus/readwrite/model/CBusPointToPointToMultipointCommandStatus.go
index fbfc84a5c..e7a18fe62 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointStatus.go
+++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointToMultipointCommandStatus.go
@@ -28,8 +28,8 @@ import (
// Code generated by code-generation. DO NOT EDIT.
-// CBusCommandPointToPointToMultiPointStatus is the corresponding interface of CBusCommandPointToPointToMultiPointStatus
-type CBusCommandPointToPointToMultiPointStatus interface {
+// CBusPointToPointToMultipointCommandStatus is the corresponding interface of CBusPointToPointToMultipointCommandStatus
+type CBusPointToPointToMultipointCommandStatus interface {
utils.LengthAware
utils.Serializable
CBusPointToPointToMultipointCommand
@@ -39,15 +39,15 @@ type CBusCommandPointToPointToMultiPointStatus interface {
GetCrc() Checksum
}
-// CBusCommandPointToPointToMultiPointStatusExactly can be used when we want exactly this type and not a type which fulfills CBusCommandPointToPointToMultiPointStatus.
+// CBusPointToPointToMultipointCommandStatusExactly can be used when we want exactly this type and not a type which fulfills CBusPointToPointToMultipointCommandStatus.
// This is useful for switch cases.
-type CBusCommandPointToPointToMultiPointStatusExactly interface {
- CBusCommandPointToPointToMultiPointStatus
- isCBusCommandPointToPointToMultiPointStatus() bool
+type CBusPointToPointToMultipointCommandStatusExactly interface {
+ CBusPointToPointToMultipointCommandStatus
+ isCBusPointToPointToMultipointCommandStatus() bool
}
-// _CBusCommandPointToPointToMultiPointStatus is the data-structure of this message
-type _CBusCommandPointToPointToMultiPointStatus struct {
+// _CBusPointToPointToMultipointCommandStatus is the data-structure of this message
+type _CBusPointToPointToMultipointCommandStatus struct {
*_CBusPointToPointToMultipointCommand
StatusRequest StatusRequest
Crc Checksum
@@ -63,13 +63,13 @@ type _CBusCommandPointToPointToMultiPointStatus struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_CBusCommandPointToPointToMultiPointStatus) InitializeParent(parent CBusPointToPointToMultipointCommand, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte) {
+func (m *_CBusPointToPointToMultipointCommandStatus) InitializeParent(parent CBusPointToPointToMultipointCommand, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte) {
m.BridgeAddress = bridgeAddress
m.NetworkRoute = networkRoute
m.PeekedApplication = peekedApplication
}
-func (m *_CBusCommandPointToPointToMultiPointStatus) GetParent() CBusPointToPointToMultipointCommand {
+func (m *_CBusPointToPointToMultipointCommandStatus) GetParent() CBusPointToPointToMultipointCommand {
return m._CBusPointToPointToMultipointCommand
}
@@ -78,11 +78,11 @@ func (m *_CBusCommandPointToPointToMultiPointStatus) GetParent() CBusPointToPoin
/////////////////////// Accessors for property fields.
///////////////////////
-func (m *_CBusCommandPointToPointToMultiPointStatus) GetStatusRequest() StatusRequest {
+func (m *_CBusPointToPointToMultipointCommandStatus) GetStatusRequest() StatusRequest {
return m.StatusRequest
}
-func (m *_CBusCommandPointToPointToMultiPointStatus) GetCrc() Checksum {
+func (m *_CBusPointToPointToMultipointCommandStatus) GetCrc() Checksum {
return m.Crc
}
@@ -91,37 +91,37 @@ func (m *_CBusCommandPointToPointToMultiPointStatus) GetCrc() Checksum {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-// NewCBusCommandPointToPointToMultiPointStatus factory function for _CBusCommandPointToPointToMultiPointStatus
-func NewCBusCommandPointToPointToMultiPointStatus(statusRequest StatusRequest, crc Checksum, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, srchk bool) *_CBusCommandPointToPointToMultiPointStatus {
- _result := &_CBusCommandPointToPointToMultiPointStatus{
+// NewCBusPointToPointToMultipointCommandStatus factory function for _CBusPointToPointToMultipointCommandStatus
+func NewCBusPointToPointToMultipointCommandStatus(statusRequest StatusRequest, crc Checksum, bridgeAddress BridgeAddress, networkRoute NetworkRoute, peekedApplication byte, cBusOptions CBusOptions) *_CBusPointToPointToMultipointCommandStatus {
+ _result := &_CBusPointToPointToMultipointCommandStatus{
StatusRequest: statusRequest,
Crc: crc,
- _CBusPointToPointToMultipointCommand: NewCBusPointToPointToMultipointCommand(bridgeAddress, networkRoute, peekedApplication, srchk),
+ _CBusPointToPointToMultipointCommand: NewCBusPointToPointToMultipointCommand(bridgeAddress, networkRoute, peekedApplication, cBusOptions),
}
_result._CBusPointToPointToMultipointCommand._CBusPointToPointToMultipointCommandChildRequirements = _result
return _result
}
// Deprecated: use the interface for direct cast
-func CastCBusCommandPointToPointToMultiPointStatus(structType interface{}) CBusCommandPointToPointToMultiPointStatus {
- if casted, ok := structType.(CBusCommandPointToPointToMultiPointStatus); ok {
+func CastCBusPointToPointToMultipointCommandStatus(structType interface{}) CBusPointToPointToMultipointCommandStatus {
+ if casted, ok := structType.(CBusPointToPointToMultipointCommandStatus); ok {
return casted
}
- if casted, ok := structType.(*CBusCommandPointToPointToMultiPointStatus); ok {
+ if casted, ok := structType.(*CBusPointToPointToMultipointCommandStatus); ok {
return *casted
}
return nil
}
-func (m *_CBusCommandPointToPointToMultiPointStatus) GetTypeName() string {
- return "CBusCommandPointToPointToMultiPointStatus"
+func (m *_CBusPointToPointToMultipointCommandStatus) GetTypeName() string {
+ return "CBusPointToPointToMultipointCommandStatus"
}
-func (m *_CBusCommandPointToPointToMultiPointStatus) GetLengthInBits() uint16 {
+func (m *_CBusPointToPointToMultipointCommandStatus) GetLengthInBits() uint16 {
return m.GetLengthInBitsConditional(false)
}
-func (m *_CBusCommandPointToPointToMultiPointStatus) GetLengthInBitsConditional(lastItem bool) uint16 {
+func (m *_CBusPointToPointToMultipointCommandStatus) GetLengthInBitsConditional(lastItem bool) uint16 {
lengthInBits := uint16(m.GetParentLengthInBits())
// Reserved Field (reserved)
@@ -138,15 +138,15 @@ func (m *_CBusCommandPointToPointToMultiPointStatus) GetLengthInBitsConditional(
return lengthInBits
}
-func (m *_CBusCommandPointToPointToMultiPointStatus) GetLengthInBytes() uint16 {
+func (m *_CBusPointToPointToMultipointCommandStatus) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusCommandPointToPointToMultiPointStatusParse(readBuffer utils.ReadBuffer, srchk bool) (CBusCommandPointToPointToMultiPointStatus, error) {
+func CBusPointToPointToMultipointCommandStatusParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions) (CBusPointToPointToMultipointCommandStatus, error) {
positionAware := readBuffer
_ = positionAware
- if pullErr := readBuffer.PullContext("CBusCommandPointToPointToMultiPointStatus"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for CBusCommandPointToPointToMultiPointStatus")
+ if pullErr := readBuffer.PullContext("CBusPointToPointToMultipointCommandStatus"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for CBusPointToPointToMultipointCommandStatus")
}
currentPos := positionAware.GetPos()
_ = currentPos
@@ -155,7 +155,7 @@ func CBusCommandPointToPointToMultiPointStatusParse(readBuffer utils.ReadBuffer,
{
reserved, _err := readBuffer.ReadByte("reserved")
if _err != nil {
- return nil, errors.Wrap(_err, "Error parsing 'reserved' field of CBusCommandPointToPointToMultiPointStatus")
+ return nil, errors.Wrap(_err, "Error parsing 'reserved' field of CBusPointToPointToMultipointCommandStatus")
}
if reserved != byte(0xFF) {
log.Info().Fields(map[string]interface{}{
@@ -171,7 +171,7 @@ func CBusCommandPointToPointToMultiPointStatusParse(readBuffer utils.ReadBuffer,
}
_statusRequest, _statusRequestErr := StatusRequestParse(readBuffer)
if _statusRequestErr != nil {
- return nil, errors.Wrap(_statusRequestErr, "Error parsing 'statusRequest' field of CBusCommandPointToPointToMultiPointStatus")
+ return nil, errors.Wrap(_statusRequestErr, "Error parsing 'statusRequest' field of CBusPointToPointToMultipointCommandStatus")
}
statusRequest := _statusRequest.(StatusRequest)
if closeErr := readBuffer.CloseContext("statusRequest"); closeErr != nil {
@@ -180,7 +180,7 @@ func CBusCommandPointToPointToMultiPointStatusParse(readBuffer utils.ReadBuffer,
// Optional Field (crc) (Can be skipped, if a given expression evaluates to false)
var crc Checksum = nil
- if srchk {
+ if cBusOptions.GetSrchk() {
currentPos = positionAware.GetPos()
if pullErr := readBuffer.PullContext("crc"); pullErr != nil {
return nil, errors.Wrap(pullErr, "Error pulling for crc")
@@ -191,7 +191,7 @@ func CBusCommandPointToPointToMultiPointStatusParse(readBuffer utils.ReadBuffer,
log.Debug().Err(_err).Msg("Resetting position because optional threw an error")
readBuffer.Reset(currentPos)
case _err != nil:
- return nil, errors.Wrap(_err, "Error parsing 'crc' field of CBusCommandPointToPointToMultiPointStatus")
+ return nil, errors.Wrap(_err, "Error parsing 'crc' field of CBusPointToPointToMultipointCommandStatus")
default:
crc = _val.(Checksum)
if closeErr := readBuffer.CloseContext("crc"); closeErr != nil {
@@ -200,28 +200,28 @@ func CBusCommandPointToPointToMultiPointStatusParse(readBuffer utils.ReadBuffer,
}
}
- if closeErr := readBuffer.CloseContext("CBusCommandPointToPointToMultiPointStatus"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for CBusCommandPointToPointToMultiPointStatus")
+ if closeErr := readBuffer.CloseContext("CBusPointToPointToMultipointCommandStatus"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for CBusPointToPointToMultipointCommandStatus")
}
// Create a partially initialized instance
- _child := &_CBusCommandPointToPointToMultiPointStatus{
+ _child := &_CBusPointToPointToMultipointCommandStatus{
StatusRequest: statusRequest,
Crc: crc,
_CBusPointToPointToMultipointCommand: &_CBusPointToPointToMultipointCommand{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
},
}
_child._CBusPointToPointToMultipointCommand._CBusPointToPointToMultipointCommandChildRequirements = _child
return _child, nil
}
-func (m *_CBusCommandPointToPointToMultiPointStatus) Serialize(writeBuffer utils.WriteBuffer) error {
+func (m *_CBusPointToPointToMultipointCommandStatus) Serialize(writeBuffer utils.WriteBuffer) error {
positionAware := writeBuffer
_ = positionAware
ser := func() error {
- if pushErr := writeBuffer.PushContext("CBusCommandPointToPointToMultiPointStatus"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for CBusCommandPointToPointToMultiPointStatus")
+ if pushErr := writeBuffer.PushContext("CBusPointToPointToMultipointCommandStatus"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for CBusPointToPointToMultipointCommandStatus")
}
// Reserved Field (reserved)
@@ -260,19 +260,19 @@ func (m *_CBusCommandPointToPointToMultiPointStatus) Serialize(writeBuffer utils
}
}
- if popErr := writeBuffer.PopContext("CBusCommandPointToPointToMultiPointStatus"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for CBusCommandPointToPointToMultiPointStatus")
+ if popErr := writeBuffer.PopContext("CBusPointToPointToMultipointCommandStatus"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for CBusPointToPointToMultipointCommandStatus")
}
return nil
}
return m.SerializeParent(writeBuffer, m, ser)
}
-func (m *_CBusCommandPointToPointToMultiPointStatus) isCBusCommandPointToPointToMultiPointStatus() bool {
+func (m *_CBusPointToPointToMultipointCommandStatus) isCBusPointToPointToMultipointCommandStatus() bool {
return true
}
-func (m *_CBusCommandPointToPointToMultiPointStatus) String() string {
+func (m *_CBusPointToPointToMultipointCommandStatus) String() string {
if m == nil {
return "<nil>"
}
diff --git a/plc4go/protocols/cbus/readwrite/model/ConfirmationReply.go b/plc4go/protocols/cbus/readwrite/model/ConfirmationReply.go
index 50640e429..8c42f6d44 100644
--- a/plc4go/protocols/cbus/readwrite/model/ConfirmationReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/ConfirmationReply.go
@@ -90,11 +90,11 @@ func (m *_ConfirmationReply) GetEmbeddedReply() Reply {
///////////////////////////////////////////////////////////
// NewConfirmationReply factory function for _ConfirmationReply
-func NewConfirmationReply(confirmation Confirmation, embeddedReply Reply, peekedByte byte, messageLength uint16) *_ConfirmationReply {
+func NewConfirmationReply(confirmation Confirmation, embeddedReply Reply, peekedByte byte, cBusOptions CBusOptions, messageLength uint16, requestContext RequestContext) *_ConfirmationReply {
_result := &_ConfirmationReply{
Confirmation: confirmation,
EmbeddedReply: embeddedReply,
- _Reply: NewReply(peekedByte, messageLength),
+ _Reply: NewReply(peekedByte, cBusOptions, messageLength, requestContext),
}
_result._Reply._ReplyChildRequirements = _result
return _result
@@ -137,7 +137,7 @@ func (m *_ConfirmationReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func ConfirmationReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (ConfirmationReply, error) {
+func ConfirmationReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, messageLength uint16, requestContext RequestContext) (ConfirmationReply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("ConfirmationReply"); pullErr != nil {
@@ -166,7 +166,7 @@ func ConfirmationReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (
if pullErr := readBuffer.PullContext("embeddedReply"); pullErr != nil {
return nil, errors.Wrap(pullErr, "Error pulling for embeddedReply")
}
- _val, _err := ReplyParse(readBuffer, uint16(messageLength)-uint16(confirmation.GetLengthInBytes()))
+ _val, _err := ReplyParse(readBuffer, cBusOptions, uint16(messageLength)-uint16(confirmation.GetLengthInBytes()), requestContext)
switch {
case errors.Is(_err, utils.ParseAssertError{}) || errors.Is(_err, io.EOF):
log.Debug().Err(_err).Msg("Resetting position because optional threw an error")
@@ -190,7 +190,9 @@ func ConfirmationReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (
Confirmation: confirmation,
EmbeddedReply: embeddedReply,
_Reply: &_Reply{
- MessageLength: messageLength,
+ CBusOptions: cBusOptions,
+ MessageLength: messageLength,
+ RequestContext: requestContext,
},
}
_child._Reply._ReplyChildRequirements = _child
diff --git a/plc4go/protocols/cbus/readwrite/model/ExtendedFormatStatusReplyReply.go b/plc4go/protocols/cbus/readwrite/model/ExtendedFormatStatusReplyReply.go
index 17aa87ee7..2580f4b7a 100644
--- a/plc4go/protocols/cbus/readwrite/model/ExtendedFormatStatusReplyReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/ExtendedFormatStatusReplyReply.go
@@ -33,6 +33,8 @@ type ExtendedFormatStatusReplyReply interface {
NormalReply
// GetReply returns Reply (property field)
GetReply() ExtendedFormatStatusReply
+ // GetPayloadLength returns PayloadLength (virtual field)
+ GetPayloadLength() uint16
}
// ExtendedFormatStatusReplyReplyExactly can be used when we want exactly this type and not a type which fulfills ExtendedFormatStatusReplyReply.
@@ -75,16 +77,29 @@ func (m *_ExtendedFormatStatusReplyReply) GetReply() ExtendedFormatStatusReply {
return m.Reply
}
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for virtual fields.
+///////////////////////
+
+func (m *_ExtendedFormatStatusReplyReply) GetPayloadLength() uint16 {
+ return uint16(m.ReplyLength)
+}
+
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// NewExtendedFormatStatusReplyReply factory function for _ExtendedFormatStatusReplyReply
-func NewExtendedFormatStatusReplyReply(reply ExtendedFormatStatusReply, peekedByte byte, replyLength uint16) *_ExtendedFormatStatusReplyReply {
+func NewExtendedFormatStatusReplyReply(reply ExtendedFormatStatusReply, peekedByte byte, cBusOptions CBusOptions, replyLength uint16, requestContext RequestContext) *_ExtendedFormatStatusReplyReply {
_result := &_ExtendedFormatStatusReplyReply{
Reply: reply,
- _NormalReply: NewNormalReply(peekedByte, replyLength),
+ _NormalReply: NewNormalReply(peekedByte, cBusOptions, replyLength, requestContext),
}
_result._NormalReply._NormalReplyChildRequirements = _result
return _result
@@ -112,8 +127,10 @@ func (m *_ExtendedFormatStatusReplyReply) GetLengthInBits() uint16 {
func (m *_ExtendedFormatStatusReplyReply) GetLengthInBitsConditional(lastItem bool) uint16 {
lengthInBits := uint16(m.GetParentLengthInBits())
- // Simple field (reply)
- lengthInBits += m.Reply.GetLengthInBits()
+ // A virtual field doesn't have any in- or output.
+
+ // Manual Field (reply)
+ lengthInBits += uint16(int32(m.GetLengthInBytes()) * int32(int32(2)))
return lengthInBits
}
@@ -122,7 +139,7 @@ func (m *_ExtendedFormatStatusReplyReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func ExtendedFormatStatusReplyReplyParse(readBuffer utils.ReadBuffer, replyLength uint16) (ExtendedFormatStatusReplyReply, error) {
+func ExtendedFormatStatusReplyReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, replyLength uint16, requestContext RequestContext) (ExtendedFormatStatusReplyReply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("ExtendedFormatStatusReplyReply"); pullErr != nil {
@@ -131,18 +148,17 @@ func ExtendedFormatStatusReplyReplyParse(readBuffer utils.ReadBuffer, replyLengt
currentPos := positionAware.GetPos()
_ = currentPos
- // Simple Field (reply)
- if pullErr := readBuffer.PullContext("reply"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for reply")
- }
- _reply, _replyErr := ExtendedFormatStatusReplyParse(readBuffer)
+ // Virtual field
+ _payloadLength := replyLength
+ payloadLength := uint16(_payloadLength)
+ _ = payloadLength
+
+ // Manual Field (reply)
+ _reply, _replyErr := ReadExtendedFormatStatusReply(readBuffer, payloadLength)
if _replyErr != nil {
return nil, errors.Wrap(_replyErr, "Error parsing 'reply' field of ExtendedFormatStatusReplyReply")
}
reply := _reply.(ExtendedFormatStatusReply)
- if closeErr := readBuffer.CloseContext("reply"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for reply")
- }
if closeErr := readBuffer.CloseContext("ExtendedFormatStatusReplyReply"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for ExtendedFormatStatusReplyReply")
@@ -152,7 +168,9 @@ func ExtendedFormatStatusReplyReplyParse(readBuffer utils.ReadBuffer, replyLengt
_child := &_ExtendedFormatStatusReplyReply{
Reply: reply,
_NormalReply: &_NormalReply{
- ReplyLength: replyLength,
+ CBusOptions: cBusOptions,
+ ReplyLength: replyLength,
+ RequestContext: requestContext,
},
}
_child._NormalReply._NormalReplyChildRequirements = _child
@@ -166,15 +184,13 @@ func (m *_ExtendedFormatStatusReplyReply) Serialize(writeBuffer utils.WriteBuffe
if pushErr := writeBuffer.PushContext("ExtendedFormatStatusReplyReply"); pushErr != nil {
return errors.Wrap(pushErr, "Error pushing for ExtendedFormatStatusReplyReply")
}
-
- // Simple Field (reply)
- if pushErr := writeBuffer.PushContext("reply"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for reply")
- }
- _replyErr := writeBuffer.WriteSerializable(m.GetReply())
- if popErr := writeBuffer.PopContext("reply"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for reply")
+ // Virtual field
+ if _payloadLengthErr := writeBuffer.WriteVirtual("payloadLength", m.GetPayloadLength()); _payloadLengthErr != nil {
+ return errors.Wrap(_payloadLengthErr, "Error serializing 'payloadLength' field")
}
+
+ // Manual Field (reply)
+ _replyErr := WriteExtendedFormatStatusReply(writeBuffer, m.GetReply())
if _replyErr != nil {
return errors.Wrap(_replyErr, "Error serializing 'reply' field")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/MonitoredSALReply.go b/plc4go/protocols/cbus/readwrite/model/MonitoredSALReply.go
index 6e05d2404..846983555 100644
--- a/plc4go/protocols/cbus/readwrite/model/MonitoredSALReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/MonitoredSALReply.go
@@ -31,8 +31,10 @@ type MonitoredSALReply interface {
utils.LengthAware
utils.Serializable
NormalReply
- // GetIsA returns IsA (property field)
- GetIsA() MonitoredSAL
+ // GetMonitoredSAL returns MonitoredSAL (property field)
+ GetMonitoredSAL() MonitoredSAL
+ // GetPayloadLength returns PayloadLength (virtual field)
+ GetPayloadLength() uint16
}
// MonitoredSALReplyExactly can be used when we want exactly this type and not a type which fulfills MonitoredSALReply.
@@ -45,7 +47,7 @@ type MonitoredSALReplyExactly interface {
// _MonitoredSALReply is the data-structure of this message
type _MonitoredSALReply struct {
*_NormalReply
- IsA MonitoredSAL
+ MonitoredSAL MonitoredSAL
}
///////////////////////////////////////////////////////////
@@ -71,8 +73,21 @@ func (m *_MonitoredSALReply) GetParent() NormalReply {
/////////////////////// Accessors for property fields.
///////////////////////
-func (m *_MonitoredSALReply) GetIsA() MonitoredSAL {
- return m.IsA
+func (m *_MonitoredSALReply) GetMonitoredSAL() MonitoredSAL {
+ return m.MonitoredSAL
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for virtual fields.
+///////////////////////
+
+func (m *_MonitoredSALReply) GetPayloadLength() uint16 {
+ return uint16(m.ReplyLength)
}
///////////////////////
@@ -81,10 +96,10 @@ func (m *_MonitoredSALReply) GetIsA() MonitoredSAL {
///////////////////////////////////////////////////////////
// NewMonitoredSALReply factory function for _MonitoredSALReply
-func NewMonitoredSALReply(isA MonitoredSAL, peekedByte byte, replyLength uint16) *_MonitoredSALReply {
+func NewMonitoredSALReply(monitoredSAL MonitoredSAL, peekedByte byte, cBusOptions CBusOptions, replyLength uint16, requestContext RequestContext) *_MonitoredSALReply {
_result := &_MonitoredSALReply{
- IsA: isA,
- _NormalReply: NewNormalReply(peekedByte, replyLength),
+ MonitoredSAL: monitoredSAL,
+ _NormalReply: NewNormalReply(peekedByte, cBusOptions, replyLength, requestContext),
}
_result._NormalReply._NormalReplyChildRequirements = _result
return _result
@@ -112,8 +127,10 @@ func (m *_MonitoredSALReply) GetLengthInBits() uint16 {
func (m *_MonitoredSALReply) 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 (monitoredSAL)
+ lengthInBits += uint16(int32(m.GetLengthInBytes()) * int32(int32(2)))
return lengthInBits
}
@@ -122,7 +139,7 @@ func (m *_MonitoredSALReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func MonitoredSALReplyParse(readBuffer utils.ReadBuffer, replyLength uint16) (MonitoredSALReply, error) {
+func MonitoredSALReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, replyLength uint16, requestContext RequestContext) (MonitoredSALReply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("MonitoredSALReply"); pullErr != nil {
@@ -131,18 +148,17 @@ func MonitoredSALReplyParse(readBuffer utils.ReadBuffer, replyLength uint16) (Mo
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 := MonitoredSALParse(readBuffer)
- if _isAErr != nil {
- return nil, errors.Wrap(_isAErr, "Error parsing 'isA' field of MonitoredSALReply")
- }
- isA := _isA.(MonitoredSAL)
- if closeErr := readBuffer.CloseContext("isA"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for isA")
+ // Virtual field
+ _payloadLength := replyLength
+ payloadLength := uint16(_payloadLength)
+ _ = payloadLength
+
+ // Manual Field (monitoredSAL)
+ _monitoredSAL, _monitoredSALErr := ReadMonitoredSAL(readBuffer, payloadLength)
+ if _monitoredSALErr != nil {
+ return nil, errors.Wrap(_monitoredSALErr, "Error parsing 'monitoredSAL' field of MonitoredSALReply")
}
+ monitoredSAL := _monitoredSAL.(MonitoredSAL)
if closeErr := readBuffer.CloseContext("MonitoredSALReply"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for MonitoredSALReply")
@@ -150,9 +166,11 @@ func MonitoredSALReplyParse(readBuffer utils.ReadBuffer, replyLength uint16) (Mo
// Create a partially initialized instance
_child := &_MonitoredSALReply{
- IsA: isA,
+ MonitoredSAL: monitoredSAL,
_NormalReply: &_NormalReply{
- ReplyLength: replyLength,
+ CBusOptions: cBusOptions,
+ ReplyLength: replyLength,
+ RequestContext: requestContext,
},
}
_child._NormalReply._NormalReplyChildRequirements = _child
@@ -166,17 +184,15 @@ func (m *_MonitoredSALReply) Serialize(writeBuffer utils.WriteBuffer) error {
if pushErr := writeBuffer.PushContext("MonitoredSALReply"); pushErr != nil {
return errors.Wrap(pushErr, "Error pushing for MonitoredSALReply")
}
-
- // 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 (monitoredSAL)
+ _monitoredSALErr := WriteMonitoredSAL(writeBuffer, m.GetMonitoredSAL())
+ if _monitoredSALErr != nil {
+ return errors.Wrap(_monitoredSALErr, "Error serializing 'monitoredSAL' field")
}
if popErr := writeBuffer.PopContext("MonitoredSALReply"); popErr != nil {
diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandNormal.go b/plc4go/protocols/cbus/readwrite/model/Normal.go
similarity index 69%
rename from plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandNormal.go
rename to plc4go/protocols/cbus/readwrite/model/Normal.go
index 7f20c6179..34fe54a52 100644
--- a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandNormal.go
+++ b/plc4go/protocols/cbus/readwrite/model/Normal.go
@@ -28,8 +28,8 @@ import (
// Code generated by code-generation. DO NOT EDIT.
-// CBusPointToMultiPointCommandNormal is the corresponding interface of CBusPointToMultiPointCommandNormal
-type CBusPointToMultiPointCommandNormal interface {
+// Normal is the corresponding interface of Normal
+type Normal interface {
utils.LengthAware
utils.Serializable
CBusPointToMultiPointCommand
@@ -41,15 +41,15 @@ type CBusPointToMultiPointCommandNormal interface {
GetCrc() Checksum
}
-// CBusPointToMultiPointCommandNormalExactly can be used when we want exactly this type and not a type which fulfills CBusPointToMultiPointCommandNormal.
+// NormalExactly can be used when we want exactly this type and not a type which fulfills Normal.
// This is useful for switch cases.
-type CBusPointToMultiPointCommandNormalExactly interface {
- CBusPointToMultiPointCommandNormal
- isCBusPointToMultiPointCommandNormal() bool
+type NormalExactly interface {
+ Normal
+ isNormal() bool
}
-// _CBusPointToMultiPointCommandNormal is the data-structure of this message
-type _CBusPointToMultiPointCommandNormal struct {
+// _Normal is the data-structure of this message
+type _Normal struct {
*_CBusPointToMultiPointCommand
Application ApplicationIdContainer
SalData SALData
@@ -66,11 +66,11 @@ type _CBusPointToMultiPointCommandNormal struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_CBusPointToMultiPointCommandNormal) InitializeParent(parent CBusPointToMultiPointCommand, peekedApplication byte) {
+func (m *_Normal) InitializeParent(parent CBusPointToMultiPointCommand, peekedApplication byte) {
m.PeekedApplication = peekedApplication
}
-func (m *_CBusPointToMultiPointCommandNormal) GetParent() CBusPointToMultiPointCommand {
+func (m *_Normal) GetParent() CBusPointToMultiPointCommand {
return m._CBusPointToMultiPointCommand
}
@@ -79,15 +79,15 @@ func (m *_CBusPointToMultiPointCommandNormal) GetParent() CBusPointToMultiPointC
/////////////////////// Accessors for property fields.
///////////////////////
-func (m *_CBusPointToMultiPointCommandNormal) GetApplication() ApplicationIdContainer {
+func (m *_Normal) GetApplication() ApplicationIdContainer {
return m.Application
}
-func (m *_CBusPointToMultiPointCommandNormal) GetSalData() SALData {
+func (m *_Normal) GetSalData() SALData {
return m.SalData
}
-func (m *_CBusPointToMultiPointCommandNormal) GetCrc() Checksum {
+func (m *_Normal) GetCrc() Checksum {
return m.Crc
}
@@ -96,38 +96,38 @@ func (m *_CBusPointToMultiPointCommandNormal) GetCrc() Checksum {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-// NewCBusPointToMultiPointCommandNormal factory function for _CBusPointToMultiPointCommandNormal
-func NewCBusPointToMultiPointCommandNormal(application ApplicationIdContainer, salData SALData, crc Checksum, peekedApplication byte, srchk bool) *_CBusPointToMultiPointCommandNormal {
- _result := &_CBusPointToMultiPointCommandNormal{
+// NewNormal factory function for _Normal
+func NewNormal(application ApplicationIdContainer, salData SALData, crc Checksum, peekedApplication byte, cBusOptions CBusOptions) *_Normal {
+ _result := &_Normal{
Application: application,
SalData: salData,
Crc: crc,
- _CBusPointToMultiPointCommand: NewCBusPointToMultiPointCommand(peekedApplication, srchk),
+ _CBusPointToMultiPointCommand: NewCBusPointToMultiPointCommand(peekedApplication, cBusOptions),
}
_result._CBusPointToMultiPointCommand._CBusPointToMultiPointCommandChildRequirements = _result
return _result
}
// Deprecated: use the interface for direct cast
-func CastCBusPointToMultiPointCommandNormal(structType interface{}) CBusPointToMultiPointCommandNormal {
- if casted, ok := structType.(CBusPointToMultiPointCommandNormal); ok {
+func CastNormal(structType interface{}) Normal {
+ if casted, ok := structType.(Normal); ok {
return casted
}
- if casted, ok := structType.(*CBusPointToMultiPointCommandNormal); ok {
+ if casted, ok := structType.(*Normal); ok {
return *casted
}
return nil
}
-func (m *_CBusPointToMultiPointCommandNormal) GetTypeName() string {
- return "CBusPointToMultiPointCommandNormal"
+func (m *_Normal) GetTypeName() string {
+ return "Normal"
}
-func (m *_CBusPointToMultiPointCommandNormal) GetLengthInBits() uint16 {
+func (m *_Normal) GetLengthInBits() uint16 {
return m.GetLengthInBitsConditional(false)
}
-func (m *_CBusPointToMultiPointCommandNormal) GetLengthInBitsConditional(lastItem bool) uint16 {
+func (m *_Normal) GetLengthInBitsConditional(lastItem bool) uint16 {
lengthInBits := uint16(m.GetParentLengthInBits())
// Simple field (application)
@@ -147,15 +147,15 @@ func (m *_CBusPointToMultiPointCommandNormal) GetLengthInBitsConditional(lastIte
return lengthInBits
}
-func (m *_CBusPointToMultiPointCommandNormal) GetLengthInBytes() uint16 {
+func (m *_Normal) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func CBusPointToMultiPointCommandNormalParse(readBuffer utils.ReadBuffer, srchk bool) (CBusPointToMultiPointCommandNormal, error) {
+func NormalParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions) (Normal, error) {
positionAware := readBuffer
_ = positionAware
- if pullErr := readBuffer.PullContext("CBusPointToMultiPointCommandNormal"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for CBusPointToMultiPointCommandNormal")
+ if pullErr := readBuffer.PullContext("Normal"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for Normal")
}
currentPos := positionAware.GetPos()
_ = currentPos
@@ -166,7 +166,7 @@ func CBusPointToMultiPointCommandNormalParse(readBuffer utils.ReadBuffer, srchk
}
_application, _applicationErr := ApplicationIdContainerParse(readBuffer)
if _applicationErr != nil {
- return nil, errors.Wrap(_applicationErr, "Error parsing 'application' field of CBusPointToMultiPointCommandNormal")
+ return nil, errors.Wrap(_applicationErr, "Error parsing 'application' field of Normal")
}
application := _application
if closeErr := readBuffer.CloseContext("application"); closeErr != nil {
@@ -177,7 +177,7 @@ func CBusPointToMultiPointCommandNormalParse(readBuffer utils.ReadBuffer, srchk
{
reserved, _err := readBuffer.ReadByte("reserved")
if _err != nil {
- return nil, errors.Wrap(_err, "Error parsing 'reserved' field of CBusPointToMultiPointCommandNormal")
+ return nil, errors.Wrap(_err, "Error parsing 'reserved' field of Normal")
}
if reserved != byte(0x00) {
log.Info().Fields(map[string]interface{}{
@@ -193,7 +193,7 @@ func CBusPointToMultiPointCommandNormalParse(readBuffer utils.ReadBuffer, srchk
}
_salData, _salDataErr := SALDataParse(readBuffer)
if _salDataErr != nil {
- return nil, errors.Wrap(_salDataErr, "Error parsing 'salData' field of CBusPointToMultiPointCommandNormal")
+ return nil, errors.Wrap(_salDataErr, "Error parsing 'salData' field of Normal")
}
salData := _salData.(SALData)
if closeErr := readBuffer.CloseContext("salData"); closeErr != nil {
@@ -202,7 +202,7 @@ func CBusPointToMultiPointCommandNormalParse(readBuffer utils.ReadBuffer, srchk
// Optional Field (crc) (Can be skipped, if a given expression evaluates to false)
var crc Checksum = nil
- if srchk {
+ if cBusOptions.GetSrchk() {
currentPos = positionAware.GetPos()
if pullErr := readBuffer.PullContext("crc"); pullErr != nil {
return nil, errors.Wrap(pullErr, "Error pulling for crc")
@@ -213,7 +213,7 @@ func CBusPointToMultiPointCommandNormalParse(readBuffer utils.ReadBuffer, srchk
log.Debug().Err(_err).Msg("Resetting position because optional threw an error")
readBuffer.Reset(currentPos)
case _err != nil:
- return nil, errors.Wrap(_err, "Error parsing 'crc' field of CBusPointToMultiPointCommandNormal")
+ return nil, errors.Wrap(_err, "Error parsing 'crc' field of Normal")
default:
crc = _val.(Checksum)
if closeErr := readBuffer.CloseContext("crc"); closeErr != nil {
@@ -222,29 +222,29 @@ func CBusPointToMultiPointCommandNormalParse(readBuffer utils.ReadBuffer, srchk
}
}
- if closeErr := readBuffer.CloseContext("CBusPointToMultiPointCommandNormal"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for CBusPointToMultiPointCommandNormal")
+ if closeErr := readBuffer.CloseContext("Normal"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for Normal")
}
// Create a partially initialized instance
- _child := &_CBusPointToMultiPointCommandNormal{
+ _child := &_Normal{
Application: application,
SalData: salData,
Crc: crc,
_CBusPointToMultiPointCommand: &_CBusPointToMultiPointCommand{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
},
}
_child._CBusPointToMultiPointCommand._CBusPointToMultiPointCommandChildRequirements = _child
return _child, nil
}
-func (m *_CBusPointToMultiPointCommandNormal) Serialize(writeBuffer utils.WriteBuffer) error {
+func (m *_Normal) Serialize(writeBuffer utils.WriteBuffer) error {
positionAware := writeBuffer
_ = positionAware
ser := func() error {
- if pushErr := writeBuffer.PushContext("CBusPointToMultiPointCommandNormal"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for CBusPointToMultiPointCommandNormal")
+ if pushErr := writeBuffer.PushContext("Normal"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for Normal")
}
// Simple Field (application)
@@ -295,19 +295,19 @@ func (m *_CBusPointToMultiPointCommandNormal) Serialize(writeBuffer utils.WriteB
}
}
- if popErr := writeBuffer.PopContext("CBusPointToMultiPointCommandNormal"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for CBusPointToMultiPointCommandNormal")
+ if popErr := writeBuffer.PopContext("Normal"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for Normal")
}
return nil
}
return m.SerializeParent(writeBuffer, m, ser)
}
-func (m *_CBusPointToMultiPointCommandNormal) isCBusPointToMultiPointCommandNormal() bool {
+func (m *_Normal) isNormal() bool {
return true
}
-func (m *_CBusPointToMultiPointCommandNormal) String() string {
+func (m *_Normal) String() string {
if m == nil {
return "<nil>"
}
diff --git a/plc4go/protocols/cbus/readwrite/model/NormalReply.go b/plc4go/protocols/cbus/readwrite/model/NormalReply.go
index 7fdce79c5..d002d1c2c 100644
--- a/plc4go/protocols/cbus/readwrite/model/NormalReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/NormalReply.go
@@ -32,6 +32,12 @@ type NormalReply interface {
utils.Serializable
// GetPeekedByte returns PeekedByte (property field)
GetPeekedByte() byte
+ // GetSendCalCommandBefore returns SendCalCommandBefore (virtual field)
+ GetSendCalCommandBefore() bool
+ // GetSendSALStatusRequestBefore returns SendSALStatusRequestBefore (virtual field)
+ GetSendSALStatusRequestBefore() bool
+ // GetExstat returns Exstat (virtual field)
+ GetExstat() bool
}
// NormalReplyExactly can be used when we want exactly this type and not a type which fulfills NormalReply.
@@ -47,7 +53,9 @@ type _NormalReply struct {
PeekedByte byte
// Arguments.
- ReplyLength uint16
+ CBusOptions CBusOptions
+ ReplyLength uint16
+ RequestContext RequestContext
}
type _NormalReplyChildRequirements interface {
@@ -79,14 +87,35 @@ func (m *_NormalReply) GetPeekedByte() byte {
return m.PeekedByte
}
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for virtual fields.
+///////////////////////
+
+func (m *_NormalReply) GetSendCalCommandBefore() bool {
+ return bool(m.RequestContext.GetSendCalCommandBefore())
+}
+
+func (m *_NormalReply) GetSendSALStatusRequestBefore() bool {
+ return bool(m.RequestContext.GetSendSALStatusRequestBefore())
+}
+
+func (m *_NormalReply) GetExstat() bool {
+ return bool(m.CBusOptions.GetExstat())
+}
+
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// NewNormalReply factory function for _NormalReply
-func NewNormalReply(peekedByte byte, replyLength uint16) *_NormalReply {
- return &_NormalReply{PeekedByte: peekedByte, ReplyLength: replyLength}
+func NewNormalReply(peekedByte byte, cBusOptions CBusOptions, replyLength uint16, requestContext RequestContext) *_NormalReply {
+ return &_NormalReply{PeekedByte: peekedByte, CBusOptions: cBusOptions, ReplyLength: replyLength, RequestContext: requestContext}
}
// Deprecated: use the interface for direct cast
@@ -107,6 +136,12 @@ func (m *_NormalReply) GetTypeName() string {
func (m *_NormalReply) GetParentLengthInBits() uint16 {
lengthInBits := uint16(0)
+ // A virtual field doesn't have any in- or output.
+
+ // A virtual field doesn't have any in- or output.
+
+ // A virtual field doesn't have any in- or output.
+
return lengthInBits
}
@@ -114,7 +149,7 @@ func (m *_NormalReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func NormalReplyParse(readBuffer utils.ReadBuffer, replyLength uint16) (NormalReply, error) {
+func NormalReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, replyLength uint16, requestContext RequestContext) (NormalReply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("NormalReply"); pullErr != nil {
@@ -132,6 +167,21 @@ func NormalReplyParse(readBuffer utils.ReadBuffer, replyLength uint16) (NormalRe
readBuffer.Reset(currentPos)
+ // Virtual field
+ _sendCalCommandBefore := requestContext.GetSendCalCommandBefore()
+ sendCalCommandBefore := bool(_sendCalCommandBefore)
+ _ = sendCalCommandBefore
+
+ // Virtual field
+ _sendSALStatusRequestBefore := requestContext.GetSendSALStatusRequestBefore()
+ sendSALStatusRequestBefore := bool(_sendSALStatusRequestBefore)
+ _ = sendSALStatusRequestBefore
+
+ // Virtual field
+ _exstat := cBusOptions.GetExstat()
+ exstat := bool(_exstat)
+ _ = exstat
+
// Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type)
type NormalReplyChildSerializeRequirement interface {
NormalReply
@@ -143,21 +193,21 @@ func NormalReplyParse(readBuffer utils.ReadBuffer, replyLength uint16) (NormalRe
var typeSwitchError error
switch {
case peekedByte == 0x2B: // PowerUpReply
- _childTemp, typeSwitchError = PowerUpReplyParse(readBuffer, replyLength)
+ _childTemp, typeSwitchError = PowerUpReplyParse(readBuffer, cBusOptions, replyLength, requestContext)
case peekedByte == 0x3D: // ParameterChangeReply
- _childTemp, typeSwitchError = ParameterChangeReplyParse(readBuffer, replyLength)
+ _childTemp, typeSwitchError = ParameterChangeReplyParse(readBuffer, cBusOptions, replyLength, requestContext)
case peekedByte == 0x21: // ServerErrorReply
- _childTemp, typeSwitchError = ServerErrorReplyParse(readBuffer, replyLength)
- case peekedByte == 0x0: // MonitoredSALReply
- _childTemp, typeSwitchError = MonitoredSALReplyParse(readBuffer, replyLength)
- case peekedByte == 0x0: // StandardFormatStatusReplyReply
- _childTemp, typeSwitchError = StandardFormatStatusReplyReplyParse(readBuffer, replyLength)
- case peekedByte == 0x0: // ExtendedFormatStatusReplyReply
- _childTemp, typeSwitchError = ExtendedFormatStatusReplyReplyParse(readBuffer, replyLength)
- case true: // CALReplyReply
- _childTemp, typeSwitchError = CALReplyReplyParse(readBuffer, replyLength)
+ _childTemp, typeSwitchError = ServerErrorReplyParse(readBuffer, cBusOptions, replyLength, requestContext)
+ case 0 == 0 && 1 == 1 && sendSALStatusRequestBefore == bool(true) && 3 == 3: // StandardFormatStatusReplyReply
+ _childTemp, typeSwitchError = StandardFormatStatusReplyReplyParse(readBuffer, cBusOptions, replyLength, requestContext)
+ case 0 == 0 && 1 == 1 && sendSALStatusRequestBefore == bool(true) && exstat == bool(false): // ExtendedFormatStatusReplyReply
+ _childTemp, typeSwitchError = ExtendedFormatStatusReplyReplyParse(readBuffer, cBusOptions, replyLength, requestContext)
+ case 0 == 0 && sendCalCommandBefore == bool(true) && 2 == 2 && 3 == 3: // CALReplyReply
+ _childTemp, typeSwitchError = CALReplyReplyParse(readBuffer, cBusOptions, replyLength, requestContext)
+ case 0 == 0: // MonitoredSALReply
+ _childTemp, typeSwitchError = MonitoredSALReplyParse(readBuffer, cBusOptions, replyLength, requestContext)
default:
- typeSwitchError = errors.Errorf("Unmapped type for parameters [peekedByte=%v]", peekedByte)
+ typeSwitchError = errors.Errorf("Unmapped type for parameters [peekedByte=%v, sendCalCommandBefore=%v, sendSALStatusRequestBefore=%v, exstat=%v]", peekedByte, sendCalCommandBefore, sendSALStatusRequestBefore, exstat)
}
if typeSwitchError != nil {
return nil, errors.Wrap(typeSwitchError, "Error parsing sub-type for type-switch of NormalReply")
@@ -182,6 +232,18 @@ func (pm *_NormalReply) SerializeParent(writeBuffer utils.WriteBuffer, child Nor
if pushErr := writeBuffer.PushContext("NormalReply"); pushErr != nil {
return errors.Wrap(pushErr, "Error pushing for NormalReply")
}
+ // Virtual field
+ if _sendCalCommandBeforeErr := writeBuffer.WriteVirtual("sendCalCommandBefore", m.GetSendCalCommandBefore()); _sendCalCommandBeforeErr != nil {
+ return errors.Wrap(_sendCalCommandBeforeErr, "Error serializing 'sendCalCommandBefore' field")
+ }
+ // Virtual field
+ if _sendSALStatusRequestBeforeErr := writeBuffer.WriteVirtual("sendSALStatusRequestBefore", m.GetSendSALStatusRequestBefore()); _sendSALStatusRequestBeforeErr != nil {
+ return errors.Wrap(_sendSALStatusRequestBeforeErr, "Error serializing 'sendSALStatusRequestBefore' field")
+ }
+ // Virtual field
+ if _exstatErr := writeBuffer.WriteVirtual("exstat", m.GetExstat()); _exstatErr != nil {
+ return errors.Wrap(_exstatErr, "Error serializing 'exstat' field")
+ }
// Switch field (Depending on the discriminator values, passes the serialization to a sub-type)
if _typeSwitchErr := serializeChildFunction(); _typeSwitchErr != nil {
diff --git a/plc4go/protocols/cbus/readwrite/model/ParameterChangeReply.go b/plc4go/protocols/cbus/readwrite/model/ParameterChangeReply.go
index 43bbb32de..f74f9b39a 100644
--- a/plc4go/protocols/cbus/readwrite/model/ParameterChangeReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/ParameterChangeReply.go
@@ -81,10 +81,10 @@ func (m *_ParameterChangeReply) GetIsA() ParameterChange {
///////////////////////////////////////////////////////////
// NewParameterChangeReply factory function for _ParameterChangeReply
-func NewParameterChangeReply(isA ParameterChange, peekedByte byte, replyLength uint16) *_ParameterChangeReply {
+func NewParameterChangeReply(isA ParameterChange, peekedByte byte, cBusOptions CBusOptions, replyLength uint16, requestContext RequestContext) *_ParameterChangeReply {
_result := &_ParameterChangeReply{
IsA: isA,
- _NormalReply: NewNormalReply(peekedByte, replyLength),
+ _NormalReply: NewNormalReply(peekedByte, cBusOptions, replyLength, requestContext),
}
_result._NormalReply._NormalReplyChildRequirements = _result
return _result
@@ -122,7 +122,7 @@ func (m *_ParameterChangeReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func ParameterChangeReplyParse(readBuffer utils.ReadBuffer, replyLength uint16) (ParameterChangeReply, error) {
+func ParameterChangeReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, replyLength uint16, requestContext RequestContext) (ParameterChangeReply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("ParameterChangeReply"); pullErr != nil {
@@ -152,7 +152,9 @@ func ParameterChangeReplyParse(readBuffer utils.ReadBuffer, replyLength uint16)
_child := &_ParameterChangeReply{
IsA: isA,
_NormalReply: &_NormalReply{
- ReplyLength: replyLength,
+ CBusOptions: cBusOptions,
+ ReplyLength: replyLength,
+ RequestContext: requestContext,
},
}
_child._NormalReply._NormalReplyChildRequirements = _child
diff --git a/plc4go/protocols/cbus/readwrite/model/PowerUpReply.go b/plc4go/protocols/cbus/readwrite/model/PowerUpReply.go
index 99060e4d5..995171e4a 100644
--- a/plc4go/protocols/cbus/readwrite/model/PowerUpReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/PowerUpReply.go
@@ -81,10 +81,10 @@ func (m *_PowerUpReply) GetIsA() PowerUp {
///////////////////////////////////////////////////////////
// NewPowerUpReply factory function for _PowerUpReply
-func NewPowerUpReply(isA PowerUp, peekedByte byte, replyLength uint16) *_PowerUpReply {
+func NewPowerUpReply(isA PowerUp, peekedByte byte, cBusOptions CBusOptions, replyLength uint16, requestContext RequestContext) *_PowerUpReply {
_result := &_PowerUpReply{
IsA: isA,
- _NormalReply: NewNormalReply(peekedByte, replyLength),
+ _NormalReply: NewNormalReply(peekedByte, cBusOptions, replyLength, requestContext),
}
_result._NormalReply._NormalReplyChildRequirements = _result
return _result
@@ -122,7 +122,7 @@ func (m *_PowerUpReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func PowerUpReplyParse(readBuffer utils.ReadBuffer, replyLength uint16) (PowerUpReply, error) {
+func PowerUpReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, replyLength uint16, requestContext RequestContext) (PowerUpReply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("PowerUpReply"); pullErr != nil {
@@ -152,7 +152,9 @@ func PowerUpReplyParse(readBuffer utils.ReadBuffer, replyLength uint16) (PowerUp
_child := &_PowerUpReply{
IsA: isA,
_NormalReply: &_NormalReply{
- ReplyLength: replyLength,
+ CBusOptions: cBusOptions,
+ ReplyLength: replyLength,
+ RequestContext: requestContext,
},
}
_child._NormalReply._NormalReplyChildRequirements = _child
diff --git a/plc4go/protocols/cbus/readwrite/model/Reply.go b/plc4go/protocols/cbus/readwrite/model/Reply.go
index 5bb100c96..9da99b3ad 100644
--- a/plc4go/protocols/cbus/readwrite/model/Reply.go
+++ b/plc4go/protocols/cbus/readwrite/model/Reply.go
@@ -49,7 +49,9 @@ type _Reply struct {
PeekedByte byte
// Arguments.
- MessageLength uint16
+ CBusOptions CBusOptions
+ MessageLength uint16
+ RequestContext RequestContext
}
type _ReplyChildRequirements interface {
@@ -100,8 +102,8 @@ func (m *_Reply) GetIsAlpha() bool {
///////////////////////////////////////////////////////////
// NewReply factory function for _Reply
-func NewReply(peekedByte byte, messageLength uint16) *_Reply {
- return &_Reply{PeekedByte: peekedByte, MessageLength: messageLength}
+func NewReply(peekedByte byte, cBusOptions CBusOptions, messageLength uint16, requestContext RequestContext) *_Reply {
+ return &_Reply{PeekedByte: peekedByte, CBusOptions: cBusOptions, MessageLength: messageLength, RequestContext: requestContext}
}
// Deprecated: use the interface for direct cast
@@ -131,7 +133,7 @@ func (m *_Reply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func ReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (Reply, error) {
+func ReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, messageLength uint16, requestContext RequestContext) (Reply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("Reply"); pullErr != nil {
@@ -165,9 +167,9 @@ func ReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (Reply, error
var typeSwitchError error
switch {
case isAlpha == bool(true): // ConfirmationReply
- _childTemp, typeSwitchError = ConfirmationReplyParse(readBuffer, messageLength)
+ _childTemp, typeSwitchError = ConfirmationReplyParse(readBuffer, cBusOptions, messageLength, requestContext)
case isAlpha == bool(false): // ReplyNormalReply
- _childTemp, typeSwitchError = ReplyNormalReplyParse(readBuffer, messageLength)
+ _childTemp, typeSwitchError = ReplyNormalReplyParse(readBuffer, cBusOptions, messageLength, requestContext)
default:
typeSwitchError = errors.Errorf("Unmapped type for parameters [isAlpha=%v]", isAlpha)
}
diff --git a/plc4go/protocols/cbus/readwrite/model/ReplyNormalReply.go b/plc4go/protocols/cbus/readwrite/model/ReplyNormalReply.go
index 501a9ff61..8f29f6aab 100644
--- a/plc4go/protocols/cbus/readwrite/model/ReplyNormalReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/ReplyNormalReply.go
@@ -103,11 +103,11 @@ func (m *_ReplyNormalReply) GetReplyLength() uint16 {
///////////////////////////////////////////////////////////
// NewReplyNormalReply factory function for _ReplyNormalReply
-func NewReplyNormalReply(reply NormalReply, termination ResponseTermination, peekedByte byte, messageLength uint16) *_ReplyNormalReply {
+func NewReplyNormalReply(reply NormalReply, termination ResponseTermination, peekedByte byte, cBusOptions CBusOptions, messageLength uint16, requestContext RequestContext) *_ReplyNormalReply {
_result := &_ReplyNormalReply{
Reply: reply,
Termination: termination,
- _Reply: NewReply(peekedByte, messageLength),
+ _Reply: NewReply(peekedByte, cBusOptions, messageLength, requestContext),
}
_result._Reply._ReplyChildRequirements = _result
return _result
@@ -150,7 +150,7 @@ func (m *_ReplyNormalReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func ReplyNormalReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (ReplyNormalReply, error) {
+func ReplyNormalReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, messageLength uint16, requestContext RequestContext) (ReplyNormalReply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("ReplyNormalReply"); pullErr != nil {
@@ -168,7 +168,7 @@ func ReplyNormalReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (R
if pullErr := readBuffer.PullContext("reply"); pullErr != nil {
return nil, errors.Wrap(pullErr, "Error pulling for reply")
}
- _reply, _replyErr := NormalReplyParse(readBuffer, uint16(replyLength))
+ _reply, _replyErr := NormalReplyParse(readBuffer, cBusOptions, uint16(replyLength), requestContext)
if _replyErr != nil {
return nil, errors.Wrap(_replyErr, "Error parsing 'reply' field of ReplyNormalReply")
}
@@ -199,7 +199,9 @@ func ReplyNormalReplyParse(readBuffer utils.ReadBuffer, messageLength uint16) (R
Reply: reply,
Termination: termination,
_Reply: &_Reply{
- MessageLength: messageLength,
+ CBusOptions: cBusOptions,
+ MessageLength: messageLength,
+ RequestContext: requestContext,
},
}
_child._Reply._ReplyChildRequirements = _child
diff --git a/plc4go/protocols/cbus/readwrite/model/Request.go b/plc4go/protocols/cbus/readwrite/model/Request.go
index 9c1804d42..594eb2d0b 100644
--- a/plc4go/protocols/cbus/readwrite/model/Request.go
+++ b/plc4go/protocols/cbus/readwrite/model/Request.go
@@ -63,7 +63,7 @@ type _Request struct {
Termination RequestTermination
// Arguments.
- Srchk bool
+ CBusOptions CBusOptions
MessageLength uint16
}
@@ -134,7 +134,7 @@ func (m *_Request) GetPayloadLength() uint16 {
_ = startingCR
resetMode := m.ResetMode
_ = resetMode
- return uint16(uint16(uint16(uint16(m.MessageLength)-uint16(uint16(2)))) - uint16(uint16(utils.InlineIf(bool(bool((m.GetResetMode()) != (nil))), func() interface{} { return uint16(uint16(1)) }, func() interface{} { return uint16(uint16(0)) }).(uint16))))
+ return uint16(uint16(uint16(uint16(m.MessageLength)-uint16(uint16(2)))) - uint16(uint16(utils.InlineIf(bool(bool((m.GetResetMode()) != (nil))), func() interface{} { return uint16(uint16(uint16(1))) }, func() interface{} { return uint16(uint16(uint16(0))) }).(uint16))))
}
///////////////////////
@@ -143,8 +143,8 @@ func (m *_Request) GetPayloadLength() uint16 {
///////////////////////////////////////////////////////////
// NewRequest factory function for _Request
-func NewRequest(peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination, srchk bool, messageLength uint16) *_Request {
- return &_Request{PeekedByte: peekedByte, StartingCR: startingCR, ResetMode: resetMode, SecondPeek: secondPeek, Termination: termination, Srchk: srchk, MessageLength: messageLength}
+func NewRequest(peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination, cBusOptions CBusOptions, messageLength uint16) *_Request {
+ return &_Request{PeekedByte: peekedByte, StartingCR: startingCR, ResetMode: resetMode, SecondPeek: secondPeek, Termination: termination, CBusOptions: cBusOptions, MessageLength: messageLength}
}
// Deprecated: use the interface for direct cast
@@ -189,7 +189,7 @@ func (m *_Request) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func RequestParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16) (Request, error) {
+func RequestParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, messageLength uint16) (Request, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("Request"); pullErr != nil {
@@ -266,7 +266,7 @@ func RequestParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16)
_ = actualPeek
// Virtual field
- _payloadLength := uint16(uint16(uint16(messageLength)-uint16(uint16(2)))) - uint16(uint16(utils.InlineIf(bool(bool((resetMode) != (nil))), func() interface{} { return uint16(uint16(1)) }, func() interface{} { return uint16(uint16(0)) }).(uint16)))
+ _payloadLength := uint16(uint16(uint16(messageLength)-uint16(uint16(2)))) - uint16(uint16(utils.InlineIf(bool(bool((resetMode) != (nil))), func() interface{} { return uint16(uint16(uint16(1))) }, func() interface{} { return uint16(uint16(uint16(0))) }).(uint16)))
payloadLength := uint16(_payloadLength)
_ = payloadLength
@@ -281,17 +281,19 @@ func RequestParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16)
var typeSwitchError error
switch {
case actualPeek == RequestType_SMART_CONNECT_SHORTCUT: // RequestSmartConnectShortcut
- _childTemp, typeSwitchError = RequestSmartConnectShortcutParse(readBuffer, srchk, messageLength)
+ _childTemp, typeSwitchError = RequestSmartConnectShortcutParse(readBuffer, cBusOptions, messageLength)
case actualPeek == RequestType_RESET: // RequestReset
- _childTemp, typeSwitchError = RequestResetParse(readBuffer, srchk, messageLength)
+ _childTemp, typeSwitchError = RequestResetParse(readBuffer, cBusOptions, messageLength)
case actualPeek == RequestType_DIRECT_COMMAND: // RequestDirectCommandAccess
- _childTemp, typeSwitchError = RequestDirectCommandAccessParse(readBuffer, srchk, messageLength, payloadLength)
+ _childTemp, typeSwitchError = RequestDirectCommandAccessParse(readBuffer, cBusOptions, messageLength, payloadLength)
case actualPeek == RequestType_REQUEST_COMMAND: // RequestCommand
- _childTemp, typeSwitchError = RequestCommandParse(readBuffer, srchk, messageLength, payloadLength)
+ _childTemp, typeSwitchError = RequestCommandParse(readBuffer, cBusOptions, messageLength, payloadLength)
case actualPeek == RequestType_NULL: // RequestNull
- _childTemp, typeSwitchError = RequestNullParse(readBuffer, srchk, messageLength)
+ _childTemp, typeSwitchError = RequestNullParse(readBuffer, cBusOptions, messageLength)
case actualPeek == RequestType_EMPTY: // RequestEmpty
- _childTemp, typeSwitchError = RequestEmptyParse(readBuffer, srchk, messageLength)
+ _childTemp, typeSwitchError = RequestEmptyParse(readBuffer, cBusOptions, messageLength)
+ case 0 == 0: // RequestObsolete
+ _childTemp, typeSwitchError = RequestObsoleteParse(readBuffer, cBusOptions, messageLength, payloadLength)
default:
typeSwitchError = errors.Errorf("Unmapped type for parameters [actualPeek=%v]", actualPeek)
}
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestCommand.go b/plc4go/protocols/cbus/readwrite/model/RequestCommand.go
index f7f2ec876..af2c888fd 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestCommand.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestCommand.go
@@ -114,11 +114,11 @@ func (m *_RequestCommand) GetInitiator() byte {
///////////////////////////////////////////////////////////
// NewRequestCommand factory function for _RequestCommand
-func NewRequestCommand(cbusCommand CBusCommand, alpha Alpha, peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination, srchk bool, messageLength uint16, payloadLength uint16) *_RequestCommand {
+func NewRequestCommand(cbusCommand CBusCommand, alpha Alpha, peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination, cBusOptions CBusOptions, messageLength uint16, payloadLength uint16) *_RequestCommand {
_result := &_RequestCommand{
CbusCommand: cbusCommand,
Alpha: alpha,
- _Request: NewRequest(peekedByte, startingCR, resetMode, secondPeek, termination, srchk, messageLength),
+ _Request: NewRequest(peekedByte, startingCR, resetMode, secondPeek, termination, cBusOptions, messageLength),
}
_result._Request._RequestChildRequirements = _result
return _result
@@ -164,7 +164,7 @@ func (m *_RequestCommand) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func RequestCommandParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16, payloadLength uint16) (RequestCommand, error) {
+func RequestCommandParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, messageLength uint16, payloadLength uint16) (RequestCommand, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("RequestCommand"); pullErr != nil {
@@ -183,7 +183,7 @@ func RequestCommandParse(readBuffer utils.ReadBuffer, srchk bool, messageLength
}
// Manual Field (cbusCommand)
- _cbusCommand, _cbusCommandErr := ReadCBusCommand(readBuffer, payloadLength, srchk)
+ _cbusCommand, _cbusCommandErr := ReadCBusCommand(readBuffer, payloadLength, cBusOptions)
if _cbusCommandErr != nil {
return nil, errors.Wrap(_cbusCommandErr, "Error parsing 'cbusCommand' field of RequestCommand")
}
@@ -220,7 +220,7 @@ func RequestCommandParse(readBuffer utils.ReadBuffer, srchk bool, messageLength
CbusCommand: cbusCommand,
Alpha: alpha,
_Request: &_Request{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
MessageLength: messageLength,
},
}
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestContext.go b/plc4go/protocols/cbus/readwrite/model/RequestContext.go
new file mode 100644
index 000000000..e1dad04a9
--- /dev/null
+++ b/plc4go/protocols/cbus/readwrite/model/RequestContext.go
@@ -0,0 +1,181 @@
+/*
+ * 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.
+
+// RequestContext is the corresponding interface of RequestContext
+type RequestContext interface {
+ utils.LengthAware
+ utils.Serializable
+ // GetSendCalCommandBefore returns SendCalCommandBefore (property field)
+ GetSendCalCommandBefore() bool
+ // GetSendSALStatusRequestBefore returns SendSALStatusRequestBefore (property field)
+ GetSendSALStatusRequestBefore() bool
+}
+
+// RequestContextExactly can be used when we want exactly this type and not a type which fulfills RequestContext.
+// This is useful for switch cases.
+type RequestContextExactly interface {
+ RequestContext
+ isRequestContext() bool
+}
+
+// _RequestContext is the data-structure of this message
+type _RequestContext struct {
+ SendCalCommandBefore bool
+ SendSALStatusRequestBefore bool
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *_RequestContext) GetSendCalCommandBefore() bool {
+ return m.SendCalCommandBefore
+}
+
+func (m *_RequestContext) GetSendSALStatusRequestBefore() bool {
+ return m.SendSALStatusRequestBefore
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// NewRequestContext factory function for _RequestContext
+func NewRequestContext(sendCalCommandBefore bool, sendSALStatusRequestBefore bool) *_RequestContext {
+ return &_RequestContext{SendCalCommandBefore: sendCalCommandBefore, SendSALStatusRequestBefore: sendSALStatusRequestBefore}
+}
+
+// Deprecated: use the interface for direct cast
+func CastRequestContext(structType interface{}) RequestContext {
+ if casted, ok := structType.(RequestContext); ok {
+ return casted
+ }
+ if casted, ok := structType.(*RequestContext); ok {
+ return *casted
+ }
+ return nil
+}
+
+func (m *_RequestContext) GetTypeName() string {
+ return "RequestContext"
+}
+
+func (m *_RequestContext) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *_RequestContext) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(0)
+
+ // Simple field (sendCalCommandBefore)
+ lengthInBits += 1
+
+ // Simple field (sendSALStatusRequestBefore)
+ lengthInBits += 1
+
+ return lengthInBits
+}
+
+func (m *_RequestContext) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func RequestContextParse(readBuffer utils.ReadBuffer) (RequestContext, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("RequestContext"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for RequestContext")
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // Simple Field (sendCalCommandBefore)
+ _sendCalCommandBefore, _sendCalCommandBeforeErr := readBuffer.ReadBit("sendCalCommandBefore")
+ if _sendCalCommandBeforeErr != nil {
+ return nil, errors.Wrap(_sendCalCommandBeforeErr, "Error parsing 'sendCalCommandBefore' field of RequestContext")
+ }
+ sendCalCommandBefore := _sendCalCommandBefore
+
+ // Simple Field (sendSALStatusRequestBefore)
+ _sendSALStatusRequestBefore, _sendSALStatusRequestBeforeErr := readBuffer.ReadBit("sendSALStatusRequestBefore")
+ if _sendSALStatusRequestBeforeErr != nil {
+ return nil, errors.Wrap(_sendSALStatusRequestBeforeErr, "Error parsing 'sendSALStatusRequestBefore' field of RequestContext")
+ }
+ sendSALStatusRequestBefore := _sendSALStatusRequestBefore
+
+ if closeErr := readBuffer.CloseContext("RequestContext"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for RequestContext")
+ }
+
+ // Create the instance
+ return NewRequestContext(sendCalCommandBefore, sendSALStatusRequestBefore), nil
+}
+
+func (m *_RequestContext) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ if pushErr := writeBuffer.PushContext("RequestContext"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for RequestContext")
+ }
+
+ // Simple Field (sendCalCommandBefore)
+ sendCalCommandBefore := bool(m.GetSendCalCommandBefore())
+ _sendCalCommandBeforeErr := writeBuffer.WriteBit("sendCalCommandBefore", (sendCalCommandBefore))
+ if _sendCalCommandBeforeErr != nil {
+ return errors.Wrap(_sendCalCommandBeforeErr, "Error serializing 'sendCalCommandBefore' field")
+ }
+
+ // Simple Field (sendSALStatusRequestBefore)
+ sendSALStatusRequestBefore := bool(m.GetSendSALStatusRequestBefore())
+ _sendSALStatusRequestBeforeErr := writeBuffer.WriteBit("sendSALStatusRequestBefore", (sendSALStatusRequestBefore))
+ if _sendSALStatusRequestBeforeErr != nil {
+ return errors.Wrap(_sendSALStatusRequestBeforeErr, "Error serializing 'sendSALStatusRequestBefore' field")
+ }
+
+ if popErr := writeBuffer.PopContext("RequestContext"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for RequestContext")
+ }
+ return nil
+}
+
+func (m *_RequestContext) isRequestContext() bool {
+ return true
+}
+
+func (m *_RequestContext) String() string {
+ if m == nil {
+ return "<nil>"
+ }
+ writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true)
+ if err := writeBuffer.WriteSerializable(m); err != nil {
+ return err.Error()
+ }
+ return writeBuffer.GetBox().String()
+}
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestDirectCommandAccess.go b/plc4go/protocols/cbus/readwrite/model/RequestDirectCommandAccess.go
index b5672d05d..a511b30a4 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestDirectCommandAccess.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestDirectCommandAccess.go
@@ -105,10 +105,10 @@ func (m *_RequestDirectCommandAccess) GetAt() byte {
///////////////////////////////////////////////////////////
// NewRequestDirectCommandAccess factory function for _RequestDirectCommandAccess
-func NewRequestDirectCommandAccess(calData CALData, peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination, srchk bool, messageLength uint16, payloadLength uint16) *_RequestDirectCommandAccess {
+func NewRequestDirectCommandAccess(calData CALData, peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination, cBusOptions CBusOptions, messageLength uint16, payloadLength uint16) *_RequestDirectCommandAccess {
_result := &_RequestDirectCommandAccess{
CalData: calData,
- _Request: NewRequest(peekedByte, startingCR, resetMode, secondPeek, termination, srchk, messageLength),
+ _Request: NewRequest(peekedByte, startingCR, resetMode, secondPeek, termination, cBusOptions, messageLength),
}
_result._Request._RequestChildRequirements = _result
return _result
@@ -149,7 +149,7 @@ func (m *_RequestDirectCommandAccess) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func RequestDirectCommandAccessParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16, payloadLength uint16) (RequestDirectCommandAccess, error) {
+func RequestDirectCommandAccessParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, messageLength uint16, payloadLength uint16) (RequestDirectCommandAccess, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("RequestDirectCommandAccess"); pullErr != nil {
@@ -182,7 +182,7 @@ func RequestDirectCommandAccessParse(readBuffer utils.ReadBuffer, srchk bool, me
_child := &_RequestDirectCommandAccess{
CalData: calData,
_Request: &_Request{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
MessageLength: messageLength,
},
}
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestEmpty.go b/plc4go/protocols/cbus/readwrite/model/RequestEmpty.go
index 6538d8f4c..2faaf2f3e 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestEmpty.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestEmpty.go
@@ -68,9 +68,9 @@ func (m *_RequestEmpty) GetParent() Request {
}
// NewRequestEmpty factory function for _RequestEmpty
-func NewRequestEmpty(peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination, srchk bool, messageLength uint16) *_RequestEmpty {
+func NewRequestEmpty(peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination, cBusOptions CBusOptions, messageLength uint16) *_RequestEmpty {
_result := &_RequestEmpty{
- _Request: NewRequest(peekedByte, startingCR, resetMode, secondPeek, termination, srchk, messageLength),
+ _Request: NewRequest(peekedByte, startingCR, resetMode, secondPeek, termination, cBusOptions, messageLength),
}
_result._Request._RequestChildRequirements = _result
return _result
@@ -105,7 +105,7 @@ func (m *_RequestEmpty) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func RequestEmptyParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16) (RequestEmpty, error) {
+func RequestEmptyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, messageLength uint16) (RequestEmpty, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("RequestEmpty"); pullErr != nil {
@@ -121,7 +121,7 @@ func RequestEmptyParse(readBuffer utils.ReadBuffer, srchk bool, messageLength ui
// Create a partially initialized instance
_child := &_RequestEmpty{
_Request: &_Request{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
MessageLength: messageLength,
},
}
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestNull.go b/plc4go/protocols/cbus/readwrite/model/RequestNull.go
index c104d20dd..e60256990 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestNull.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestNull.go
@@ -86,9 +86,9 @@ func (m *_RequestNull) GetNullIndicator() uint32 {
///////////////////////////////////////////////////////////
// NewRequestNull factory function for _RequestNull
-func NewRequestNull(peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination, srchk bool, messageLength uint16) *_RequestNull {
+func NewRequestNull(peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination, cBusOptions CBusOptions, messageLength uint16) *_RequestNull {
_result := &_RequestNull{
- _Request: NewRequest(peekedByte, startingCR, resetMode, secondPeek, termination, srchk, messageLength),
+ _Request: NewRequest(peekedByte, startingCR, resetMode, secondPeek, termination, cBusOptions, messageLength),
}
_result._Request._RequestChildRequirements = _result
return _result
@@ -126,7 +126,7 @@ func (m *_RequestNull) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func RequestNullParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16) (RequestNull, error) {
+func RequestNullParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, messageLength uint16) (RequestNull, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("RequestNull"); pullErr != nil {
@@ -151,7 +151,7 @@ func RequestNullParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uin
// Create a partially initialized instance
_child := &_RequestNull{
_Request: &_Request{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
MessageLength: messageLength,
},
}
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestCommand.go b/plc4go/protocols/cbus/readwrite/model/RequestObsolete.go
similarity index 55%
copy from plc4go/protocols/cbus/readwrite/model/RequestCommand.go
copy to plc4go/protocols/cbus/readwrite/model/RequestObsolete.go
index f7f2ec876..c8fb98cf2 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestCommand.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestObsolete.go
@@ -20,7 +20,6 @@
package model
import (
- "fmt"
"github.com/apache/plc4x/plc4go/internal/spi/utils"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
@@ -29,32 +28,31 @@ import (
// Code generated by code-generation. DO NOT EDIT.
-// Constant values.
-const RequestCommand_INITIATOR byte = 0x5C
-
-// RequestCommand is the corresponding interface of RequestCommand
-type RequestCommand interface {
+// RequestObsolete is the corresponding interface of RequestObsolete
+type RequestObsolete interface {
utils.LengthAware
utils.Serializable
Request
- // GetCbusCommand returns CbusCommand (property field)
- GetCbusCommand() CBusCommand
+ // GetCalData returns CalData (property field)
+ GetCalData() CALData
// GetAlpha returns Alpha (property field)
GetAlpha() Alpha
+ // GetObsoletePayloadLength returns ObsoletePayloadLength (virtual field)
+ GetObsoletePayloadLength() uint16
}
-// RequestCommandExactly can be used when we want exactly this type and not a type which fulfills RequestCommand.
+// RequestObsoleteExactly can be used when we want exactly this type and not a type which fulfills RequestObsolete.
// This is useful for switch cases.
-type RequestCommandExactly interface {
- RequestCommand
- isRequestCommand() bool
+type RequestObsoleteExactly interface {
+ RequestObsolete
+ isRequestObsolete() bool
}
-// _RequestCommand is the data-structure of this message
-type _RequestCommand struct {
+// _RequestObsolete is the data-structure of this message
+type _RequestObsolete struct {
*_Request
- CbusCommand CBusCommand
- Alpha Alpha
+ CalData CALData
+ Alpha Alpha
// Arguments.
PayloadLength uint16
@@ -70,7 +68,7 @@ type _RequestCommand struct {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-func (m *_RequestCommand) InitializeParent(parent Request, peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination) {
+func (m *_RequestObsolete) InitializeParent(parent Request, peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination) {
m.PeekedByte = peekedByte
m.StartingCR = startingCR
m.ResetMode = resetMode
@@ -78,7 +76,7 @@ func (m *_RequestCommand) InitializeParent(parent Request, peekedByte RequestTyp
m.Termination = termination
}
-func (m *_RequestCommand) GetParent() Request {
+func (m *_RequestObsolete) GetParent() Request {
return m._Request
}
@@ -87,11 +85,11 @@ func (m *_RequestCommand) GetParent() Request {
/////////////////////// Accessors for property fields.
///////////////////////
-func (m *_RequestCommand) GetCbusCommand() CBusCommand {
- return m.CbusCommand
+func (m *_RequestObsolete) GetCalData() CALData {
+ return m.CalData
}
-func (m *_RequestCommand) GetAlpha() Alpha {
+func (m *_RequestObsolete) GetAlpha() Alpha {
return m.Alpha
}
@@ -101,11 +99,13 @@ func (m *_RequestCommand) GetAlpha() Alpha {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-/////////////////////// Accessors for const fields.
+/////////////////////// Accessors for virtual fields.
///////////////////////
-func (m *_RequestCommand) GetInitiator() byte {
- return RequestCommand_INITIATOR
+func (m *_RequestObsolete) GetObsoletePayloadLength() uint16 {
+ alpha := m.Alpha
+ _ = alpha
+ return uint16(uint16(m.PayloadLength) + uint16(uint16(1)))
}
///////////////////////
@@ -113,43 +113,42 @@ func (m *_RequestCommand) GetInitiator() byte {
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
-// NewRequestCommand factory function for _RequestCommand
-func NewRequestCommand(cbusCommand CBusCommand, alpha Alpha, peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination, srchk bool, messageLength uint16, payloadLength uint16) *_RequestCommand {
- _result := &_RequestCommand{
- CbusCommand: cbusCommand,
- Alpha: alpha,
- _Request: NewRequest(peekedByte, startingCR, resetMode, secondPeek, termination, srchk, messageLength),
+// NewRequestObsolete factory function for _RequestObsolete
+func NewRequestObsolete(calData CALData, alpha Alpha, peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination, cBusOptions CBusOptions, messageLength uint16, payloadLength uint16) *_RequestObsolete {
+ _result := &_RequestObsolete{
+ CalData: calData,
+ Alpha: alpha,
+ _Request: NewRequest(peekedByte, startingCR, resetMode, secondPeek, termination, cBusOptions, messageLength),
}
_result._Request._RequestChildRequirements = _result
return _result
}
// Deprecated: use the interface for direct cast
-func CastRequestCommand(structType interface{}) RequestCommand {
- if casted, ok := structType.(RequestCommand); ok {
+func CastRequestObsolete(structType interface{}) RequestObsolete {
+ if casted, ok := structType.(RequestObsolete); ok {
return casted
}
- if casted, ok := structType.(*RequestCommand); ok {
+ if casted, ok := structType.(*RequestObsolete); ok {
return *casted
}
return nil
}
-func (m *_RequestCommand) GetTypeName() string {
- return "RequestCommand"
+func (m *_RequestObsolete) GetTypeName() string {
+ return "RequestObsolete"
}
-func (m *_RequestCommand) GetLengthInBits() uint16 {
+func (m *_RequestObsolete) GetLengthInBits() uint16 {
return m.GetLengthInBitsConditional(false)
}
-func (m *_RequestCommand) GetLengthInBitsConditional(lastItem bool) uint16 {
+func (m *_RequestObsolete) GetLengthInBitsConditional(lastItem bool) uint16 {
lengthInBits := uint16(m.GetParentLengthInBits())
- // Const Field (initiator)
- lengthInBits += 8
+ // A virtual field doesn't have any in- or output.
- // Manual Field (cbusCommand)
+ // Manual Field (calData)
lengthInBits += uint16(int32(m.GetLengthInBytes()) * int32(int32(2)))
// Optional Field (alpha)
@@ -160,34 +159,30 @@ func (m *_RequestCommand) GetLengthInBitsConditional(lastItem bool) uint16 {
return lengthInBits
}
-func (m *_RequestCommand) GetLengthInBytes() uint16 {
+func (m *_RequestObsolete) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func RequestCommandParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16, payloadLength uint16) (RequestCommand, error) {
+func RequestObsoleteParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, messageLength uint16, payloadLength uint16) (RequestObsolete, error) {
positionAware := readBuffer
_ = positionAware
- if pullErr := readBuffer.PullContext("RequestCommand"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for RequestCommand")
+ if pullErr := readBuffer.PullContext("RequestObsolete"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for RequestObsolete")
}
currentPos := positionAware.GetPos()
_ = currentPos
- // Const Field (initiator)
- initiator, _initiatorErr := readBuffer.ReadByte("initiator")
- if _initiatorErr != nil {
- return nil, errors.Wrap(_initiatorErr, "Error parsing 'initiator' field of RequestCommand")
- }
- if initiator != RequestCommand_INITIATOR {
- return nil, errors.New("Expected constant value " + fmt.Sprintf("%d", RequestCommand_INITIATOR) + " but got " + fmt.Sprintf("%d", initiator))
- }
+ // Virtual field
+ _obsoletePayloadLength := uint16(payloadLength) + uint16(uint16(1))
+ obsoletePayloadLength := uint16(_obsoletePayloadLength)
+ _ = obsoletePayloadLength
- // Manual Field (cbusCommand)
- _cbusCommand, _cbusCommandErr := ReadCBusCommand(readBuffer, payloadLength, srchk)
- if _cbusCommandErr != nil {
- return nil, errors.Wrap(_cbusCommandErr, "Error parsing 'cbusCommand' field of RequestCommand")
+ // Manual Field (calData)
+ _calData, _calDataErr := ReadCALData(readBuffer, obsoletePayloadLength)
+ if _calDataErr != nil {
+ return nil, errors.Wrap(_calDataErr, "Error parsing 'calData' field of RequestObsolete")
}
- cbusCommand := _cbusCommand.(CBusCommand)
+ calData := _calData.(CALData)
// Optional Field (alpha) (Can be skipped, if a given expression evaluates to false)
var alpha Alpha = nil
@@ -202,7 +197,7 @@ func RequestCommandParse(readBuffer utils.ReadBuffer, srchk bool, messageLength
log.Debug().Err(_err).Msg("Resetting position because optional threw an error")
readBuffer.Reset(currentPos)
case _err != nil:
- return nil, errors.Wrap(_err, "Error parsing 'alpha' field of RequestCommand")
+ return nil, errors.Wrap(_err, "Error parsing 'alpha' field of RequestObsolete")
default:
alpha = _val.(Alpha)
if closeErr := readBuffer.CloseContext("alpha"); closeErr != nil {
@@ -211,16 +206,16 @@ func RequestCommandParse(readBuffer utils.ReadBuffer, srchk bool, messageLength
}
}
- if closeErr := readBuffer.CloseContext("RequestCommand"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for RequestCommand")
+ if closeErr := readBuffer.CloseContext("RequestObsolete"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for RequestObsolete")
}
// Create a partially initialized instance
- _child := &_RequestCommand{
- CbusCommand: cbusCommand,
- Alpha: alpha,
+ _child := &_RequestObsolete{
+ CalData: calData,
+ Alpha: alpha,
_Request: &_Request{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
MessageLength: messageLength,
},
}
@@ -228,24 +223,22 @@ func RequestCommandParse(readBuffer utils.ReadBuffer, srchk bool, messageLength
return _child, nil
}
-func (m *_RequestCommand) Serialize(writeBuffer utils.WriteBuffer) error {
+func (m *_RequestObsolete) Serialize(writeBuffer utils.WriteBuffer) error {
positionAware := writeBuffer
_ = positionAware
ser := func() error {
- if pushErr := writeBuffer.PushContext("RequestCommand"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for RequestCommand")
+ if pushErr := writeBuffer.PushContext("RequestObsolete"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for RequestObsolete")
}
-
- // Const Field (initiator)
- _initiatorErr := writeBuffer.WriteByte("initiator", 0x5C)
- if _initiatorErr != nil {
- return errors.Wrap(_initiatorErr, "Error serializing 'initiator' field")
+ // Virtual field
+ if _obsoletePayloadLengthErr := writeBuffer.WriteVirtual("obsoletePayloadLength", m.GetObsoletePayloadLength()); _obsoletePayloadLengthErr != nil {
+ return errors.Wrap(_obsoletePayloadLengthErr, "Error serializing 'obsoletePayloadLength' field")
}
- // Manual Field (cbusCommand)
- _cbusCommandErr := WriteCBusCommand(writeBuffer, m.GetCbusCommand())
- if _cbusCommandErr != nil {
- return errors.Wrap(_cbusCommandErr, "Error serializing 'cbusCommand' field")
+ // Manual Field (calData)
+ _calDataErr := WriteCALData(writeBuffer, m.GetCalData())
+ if _calDataErr != nil {
+ return errors.Wrap(_calDataErr, "Error serializing 'calData' field")
}
// Optional Field (alpha) (Can be skipped, if the value is null)
@@ -264,19 +257,19 @@ func (m *_RequestCommand) Serialize(writeBuffer utils.WriteBuffer) error {
}
}
- if popErr := writeBuffer.PopContext("RequestCommand"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for RequestCommand")
+ if popErr := writeBuffer.PopContext("RequestObsolete"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for RequestObsolete")
}
return nil
}
return m.SerializeParent(writeBuffer, m, ser)
}
-func (m *_RequestCommand) isRequestCommand() bool {
+func (m *_RequestObsolete) isRequestObsolete() bool {
return true
}
-func (m *_RequestCommand) String() string {
+func (m *_RequestObsolete) String() string {
if m == nil {
return "<nil>"
}
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestReset.go b/plc4go/protocols/cbus/readwrite/model/RequestReset.go
index a0d39cd58..23ce05c89 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestReset.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestReset.go
@@ -68,9 +68,9 @@ func (m *_RequestReset) GetParent() Request {
}
// NewRequestReset factory function for _RequestReset
-func NewRequestReset(peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination, srchk bool, messageLength uint16) *_RequestReset {
+func NewRequestReset(peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination, cBusOptions CBusOptions, messageLength uint16) *_RequestReset {
_result := &_RequestReset{
- _Request: NewRequest(peekedByte, startingCR, resetMode, secondPeek, termination, srchk, messageLength),
+ _Request: NewRequest(peekedByte, startingCR, resetMode, secondPeek, termination, cBusOptions, messageLength),
}
_result._Request._RequestChildRequirements = _result
return _result
@@ -105,7 +105,7 @@ func (m *_RequestReset) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func RequestResetParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16) (RequestReset, error) {
+func RequestResetParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, messageLength uint16) (RequestReset, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("RequestReset"); pullErr != nil {
@@ -121,7 +121,7 @@ func RequestResetParse(readBuffer utils.ReadBuffer, srchk bool, messageLength ui
// Create a partially initialized instance
_child := &_RequestReset{
_Request: &_Request{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
MessageLength: messageLength,
},
}
diff --git a/plc4go/protocols/cbus/readwrite/model/RequestSmartConnectShortcut.go b/plc4go/protocols/cbus/readwrite/model/RequestSmartConnectShortcut.go
index 366c5043f..d45ac5836 100644
--- a/plc4go/protocols/cbus/readwrite/model/RequestSmartConnectShortcut.go
+++ b/plc4go/protocols/cbus/readwrite/model/RequestSmartConnectShortcut.go
@@ -109,11 +109,11 @@ func (m *_RequestSmartConnectShortcut) GetPipe() byte {
///////////////////////////////////////////////////////////
// NewRequestSmartConnectShortcut factory function for _RequestSmartConnectShortcut
-func NewRequestSmartConnectShortcut(pipePeek RequestType, secondPipe *byte, peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination, srchk bool, messageLength uint16) *_RequestSmartConnectShortcut {
+func NewRequestSmartConnectShortcut(pipePeek RequestType, secondPipe *byte, peekedByte RequestType, startingCR *RequestType, resetMode *RequestType, secondPeek RequestType, termination RequestTermination, cBusOptions CBusOptions, messageLength uint16) *_RequestSmartConnectShortcut {
_result := &_RequestSmartConnectShortcut{
PipePeek: pipePeek,
SecondPipe: secondPipe,
- _Request: NewRequest(peekedByte, startingCR, resetMode, secondPeek, termination, srchk, messageLength),
+ _Request: NewRequest(peekedByte, startingCR, resetMode, secondPeek, termination, cBusOptions, messageLength),
}
_result._Request._RequestChildRequirements = _result
return _result
@@ -156,7 +156,7 @@ func (m *_RequestSmartConnectShortcut) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func RequestSmartConnectShortcutParse(readBuffer utils.ReadBuffer, srchk bool, messageLength uint16) (RequestSmartConnectShortcut, error) {
+func RequestSmartConnectShortcutParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, messageLength uint16) (RequestSmartConnectShortcut, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("RequestSmartConnectShortcut"); pullErr != nil {
@@ -208,7 +208,7 @@ func RequestSmartConnectShortcutParse(readBuffer utils.ReadBuffer, srchk bool, m
PipePeek: pipePeek,
SecondPipe: secondPipe,
_Request: &_Request{
- Srchk: srchk,
+ CBusOptions: cBusOptions,
MessageLength: messageLength,
},
}
diff --git a/plc4go/protocols/cbus/readwrite/model/ServerErrorReply.go b/plc4go/protocols/cbus/readwrite/model/ServerErrorReply.go
index 79ced7748..1681bfb2c 100644
--- a/plc4go/protocols/cbus/readwrite/model/ServerErrorReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/ServerErrorReply.go
@@ -82,9 +82,9 @@ func (m *_ServerErrorReply) GetErrorMarker() byte {
///////////////////////////////////////////////////////////
// NewServerErrorReply factory function for _ServerErrorReply
-func NewServerErrorReply(peekedByte byte, replyLength uint16) *_ServerErrorReply {
+func NewServerErrorReply(peekedByte byte, cBusOptions CBusOptions, replyLength uint16, requestContext RequestContext) *_ServerErrorReply {
_result := &_ServerErrorReply{
- _NormalReply: NewNormalReply(peekedByte, replyLength),
+ _NormalReply: NewNormalReply(peekedByte, cBusOptions, replyLength, requestContext),
}
_result._NormalReply._NormalReplyChildRequirements = _result
return _result
@@ -122,7 +122,7 @@ func (m *_ServerErrorReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func ServerErrorReplyParse(readBuffer utils.ReadBuffer, replyLength uint16) (ServerErrorReply, error) {
+func ServerErrorReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, replyLength uint16, requestContext RequestContext) (ServerErrorReply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("ServerErrorReply"); pullErr != nil {
@@ -147,7 +147,9 @@ func ServerErrorReplyParse(readBuffer utils.ReadBuffer, replyLength uint16) (Ser
// Create a partially initialized instance
_child := &_ServerErrorReply{
_NormalReply: &_NormalReply{
- ReplyLength: replyLength,
+ CBusOptions: cBusOptions,
+ ReplyLength: replyLength,
+ RequestContext: requestContext,
},
}
_child._NormalReply._NormalReplyChildRequirements = _child
diff --git a/plc4go/protocols/cbus/readwrite/model/StandardFormatStatusReplyReply.go b/plc4go/protocols/cbus/readwrite/model/StandardFormatStatusReplyReply.go
index 3ca95f13d..7e0c371fc 100644
--- a/plc4go/protocols/cbus/readwrite/model/StandardFormatStatusReplyReply.go
+++ b/plc4go/protocols/cbus/readwrite/model/StandardFormatStatusReplyReply.go
@@ -33,6 +33,8 @@ type StandardFormatStatusReplyReply interface {
NormalReply
// GetReply returns Reply (property field)
GetReply() StandardFormatStatusReply
+ // GetPayloadLength returns PayloadLength (virtual field)
+ GetPayloadLength() uint16
}
// StandardFormatStatusReplyReplyExactly can be used when we want exactly this type and not a type which fulfills StandardFormatStatusReplyReply.
@@ -75,16 +77,29 @@ func (m *_StandardFormatStatusReplyReply) GetReply() StandardFormatStatusReply {
return m.Reply
}
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for virtual fields.
+///////////////////////
+
+func (m *_StandardFormatStatusReplyReply) GetPayloadLength() uint16 {
+ return uint16(m.ReplyLength)
+}
+
///////////////////////
///////////////////////
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// NewStandardFormatStatusReplyReply factory function for _StandardFormatStatusReplyReply
-func NewStandardFormatStatusReplyReply(reply StandardFormatStatusReply, peekedByte byte, replyLength uint16) *_StandardFormatStatusReplyReply {
+func NewStandardFormatStatusReplyReply(reply StandardFormatStatusReply, peekedByte byte, cBusOptions CBusOptions, replyLength uint16, requestContext RequestContext) *_StandardFormatStatusReplyReply {
_result := &_StandardFormatStatusReplyReply{
Reply: reply,
- _NormalReply: NewNormalReply(peekedByte, replyLength),
+ _NormalReply: NewNormalReply(peekedByte, cBusOptions, replyLength, requestContext),
}
_result._NormalReply._NormalReplyChildRequirements = _result
return _result
@@ -112,8 +127,10 @@ func (m *_StandardFormatStatusReplyReply) GetLengthInBits() uint16 {
func (m *_StandardFormatStatusReplyReply) GetLengthInBitsConditional(lastItem bool) uint16 {
lengthInBits := uint16(m.GetParentLengthInBits())
- // Simple field (reply)
- lengthInBits += m.Reply.GetLengthInBits()
+ // A virtual field doesn't have any in- or output.
+
+ // Manual Field (reply)
+ lengthInBits += uint16(int32(m.GetLengthInBytes()) * int32(int32(2)))
return lengthInBits
}
@@ -122,7 +139,7 @@ func (m *_StandardFormatStatusReplyReply) GetLengthInBytes() uint16 {
return m.GetLengthInBits() / 8
}
-func StandardFormatStatusReplyReplyParse(readBuffer utils.ReadBuffer, replyLength uint16) (StandardFormatStatusReplyReply, error) {
+func StandardFormatStatusReplyReplyParse(readBuffer utils.ReadBuffer, cBusOptions CBusOptions, replyLength uint16, requestContext RequestContext) (StandardFormatStatusReplyReply, error) {
positionAware := readBuffer
_ = positionAware
if pullErr := readBuffer.PullContext("StandardFormatStatusReplyReply"); pullErr != nil {
@@ -131,18 +148,17 @@ func StandardFormatStatusReplyReplyParse(readBuffer utils.ReadBuffer, replyLengt
currentPos := positionAware.GetPos()
_ = currentPos
- // Simple Field (reply)
- if pullErr := readBuffer.PullContext("reply"); pullErr != nil {
- return nil, errors.Wrap(pullErr, "Error pulling for reply")
- }
- _reply, _replyErr := StandardFormatStatusReplyParse(readBuffer)
+ // Virtual field
+ _payloadLength := replyLength
+ payloadLength := uint16(_payloadLength)
+ _ = payloadLength
+
+ // Manual Field (reply)
+ _reply, _replyErr := ReadStandardFormatStatusReply(readBuffer, payloadLength)
if _replyErr != nil {
return nil, errors.Wrap(_replyErr, "Error parsing 'reply' field of StandardFormatStatusReplyReply")
}
reply := _reply.(StandardFormatStatusReply)
- if closeErr := readBuffer.CloseContext("reply"); closeErr != nil {
- return nil, errors.Wrap(closeErr, "Error closing for reply")
- }
if closeErr := readBuffer.CloseContext("StandardFormatStatusReplyReply"); closeErr != nil {
return nil, errors.Wrap(closeErr, "Error closing for StandardFormatStatusReplyReply")
@@ -152,7 +168,9 @@ func StandardFormatStatusReplyReplyParse(readBuffer utils.ReadBuffer, replyLengt
_child := &_StandardFormatStatusReplyReply{
Reply: reply,
_NormalReply: &_NormalReply{
- ReplyLength: replyLength,
+ CBusOptions: cBusOptions,
+ ReplyLength: replyLength,
+ RequestContext: requestContext,
},
}
_child._NormalReply._NormalReplyChildRequirements = _child
@@ -166,15 +184,13 @@ func (m *_StandardFormatStatusReplyReply) Serialize(writeBuffer utils.WriteBuffe
if pushErr := writeBuffer.PushContext("StandardFormatStatusReplyReply"); pushErr != nil {
return errors.Wrap(pushErr, "Error pushing for StandardFormatStatusReplyReply")
}
-
- // Simple Field (reply)
- if pushErr := writeBuffer.PushContext("reply"); pushErr != nil {
- return errors.Wrap(pushErr, "Error pushing for reply")
- }
- _replyErr := writeBuffer.WriteSerializable(m.GetReply())
- if popErr := writeBuffer.PopContext("reply"); popErr != nil {
- return errors.Wrap(popErr, "Error popping for reply")
+ // Virtual field
+ if _payloadLengthErr := writeBuffer.WriteVirtual("payloadLength", m.GetPayloadLength()); _payloadLengthErr != nil {
+ return errors.Wrap(_payloadLengthErr, "Error serializing 'payloadLength' field")
}
+
+ // Manual Field (reply)
+ _replyErr := WriteStandardFormatStatusReply(writeBuffer, m.GetReply())
if _replyErr != nil {
return errors.Wrap(_replyErr, "Error serializing 'reply' field")
}
diff --git a/plc4go/protocols/cbus/readwrite/model/StaticHelper.go b/plc4go/protocols/cbus/readwrite/model/StaticHelper.go
index a1115f7a9..a7bf55468 100644
--- a/plc4go/protocols/cbus/readwrite/model/StaticHelper.go
+++ b/plc4go/protocols/cbus/readwrite/model/StaticHelper.go
@@ -30,12 +30,12 @@ func WriteCBusCommand(writeBuffer utils.WriteBuffer, cbusCommand CBusCommand) er
return writeToHex("cbusCommand", writeBuffer, cbusCommand)
}
-func ReadCBusCommand(readBuffer utils.ReadBuffer, payloadLength uint16, srcchk bool) (CBusCommand, error) {
+func ReadCBusCommand(readBuffer utils.ReadBuffer, payloadLength uint16, cBusOptions CBusOptions) (CBusCommand, error) {
rawBytes, err := readBytesFromHex("cbusCommand", readBuffer, payloadLength)
if err != nil {
return nil, errors.Wrap(err, "Error getting hex")
}
- return CBusCommandParse(utils.NewReadBufferByteBased(rawBytes), srcchk)
+ return CBusCommandParse(utils.NewReadBufferByteBased(rawBytes), cBusOptions)
}
func WriteCALReply(writeBuffer utils.WriteBuffer, calReply CALReply) error {
@@ -62,6 +62,42 @@ func ReadCALData(readBuffer utils.ReadBuffer, payloadLength uint16) (CALData, er
return CALDataParse(utils.NewReadBufferByteBased(rawBytes))
}
+func WriteMonitoredSAL(writeBuffer utils.WriteBuffer, monitoredSAL MonitoredSAL) error {
+ return writeToHex("monitoredSAL", writeBuffer, monitoredSAL)
+}
+
+func ReadMonitoredSAL(readBuffer utils.ReadBuffer, payloadLength uint16) (MonitoredSAL, error) {
+ rawBytes, err := readBytesFromHex("monitoredSAL", readBuffer, payloadLength)
+ if err != nil {
+ return nil, errors.Wrap(err, "Error getting hex")
+ }
+ return MonitoredSALParse(utils.NewReadBufferByteBased(rawBytes))
+}
+
+func WriteStandardFormatStatusReply(writeBuffer utils.WriteBuffer, reply StandardFormatStatusReply) error {
+ return writeToHex("reply", writeBuffer, reply)
+}
+
+func ReadStandardFormatStatusReply(readBuffer utils.ReadBuffer, payloadLength uint16) (StandardFormatStatusReply, error) {
+ rawBytes, err := readBytesFromHex("reply", readBuffer, payloadLength)
+ if err != nil {
+ return nil, errors.Wrap(err, "Error getting hex")
+ }
+ return StandardFormatStatusReplyParse(utils.NewReadBufferByteBased(rawBytes))
+}
+
+func WriteExtendedFormatStatusReply(writeBuffer utils.WriteBuffer, reply ExtendedFormatStatusReply) error {
+ return writeToHex("reply", writeBuffer, reply)
+}
+
+func ReadExtendedFormatStatusReply(readBuffer utils.ReadBuffer, payloadLength uint16) (ExtendedFormatStatusReply, error) {
+ rawBytes, err := readBytesFromHex("reply", readBuffer, payloadLength)
+ if err != nil {
+ return nil, errors.Wrap(err, "Error getting hex")
+ }
+ return ExtendedFormatStatusReplyParse(utils.NewReadBufferByteBased(rawBytes))
+}
+
func readBytesFromHex(logicalName string, readBuffer utils.ReadBuffer, payloadLength uint16) ([]byte, error) {
if payloadLength == 0 {
return nil, errors.New("Length is 0")
diff --git a/plc4go/tools/plc4xpcapanalyzer/cmd/analyze.go b/plc4go/tools/plc4xpcapanalyzer/cmd/analyze.go
index 6da7b8f70..fe004740b 100644
--- a/plc4go/tools/plc4xpcapanalyzer/cmd/analyze.go
+++ b/plc4go/tools/plc4xpcapanalyzer/cmd/analyze.go
@@ -23,6 +23,7 @@ import (
"github.com/apache/plc4x/plc4go/tools/plc4xpcapanalyzer/internal/analyzer"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
+ "math"
"os"
"github.com/spf13/cobra"
@@ -39,6 +40,8 @@ var (
noFilter, onlyParse, noBytesCompare bool
client string
bacnetFilter string
+ startPackageNumber uint
+ packageNumberLimit uint
)
// analyzeCmd represents the analyze command
@@ -75,7 +78,8 @@ TODO: document me
} else {
log.Info().Msg("All filtering disabled")
}
- analyzer.Analyze(pcapFile, protocolType, filter, onlyParse, noBytesCompare, client, verbosity)
+ analyzer.Analyze(pcapFile, protocolType, filter, onlyParse, noBytesCompare, client, startPackageNumber, packageNumberLimit, verbosity)
+ println("Done")
},
}
@@ -87,6 +91,8 @@ func init() {
analyzeCmd.Flags().BoolVarP(&onlyParse, "onlyParse", "o", false, "only parse messaged")
analyzeCmd.Flags().BoolVarP(&noBytesCompare, "noBytesCompare", "b", false, "don't compare original bytes with serialized bytes")
analyzeCmd.Flags().StringVarP(&client, "client", "c", "", "The client ip (this is useful for protocols where request/response is different e.g. modbus, cbus)")
+ analyzeCmd.Flags().UintVarP(&startPackageNumber, "startPackageNumber", "s", 0, "Defines with what package number should be started")
+ analyzeCmd.Flags().UintVarP(&packageNumberLimit, "packageNumberLimit", "l", math.MaxUint, "Defines how many packages should be parsed")
// TODO: maybe it is smarter to convert this into subcommands because this option is only relevant to bacnet
analyzeCmd.PersistentFlags().StringVarP(&bacnetFilter, "default-bacnet-filter", "", "udp port 47808 and udp[4:2] > 29", "Defines the default filter when bacnet is selected")
// TODO: support other protocols
diff --git a/plc4go/tools/plc4xpcapanalyzer/cmd/root.go b/plc4go/tools/plc4xpcapanalyzer/cmd/root.go
index 0f532352f..3996ff458 100644
--- a/plc4go/tools/plc4xpcapanalyzer/cmd/root.go
+++ b/plc4go/tools/plc4xpcapanalyzer/cmd/root.go
@@ -59,7 +59,7 @@ func init() {
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.plc4xpcapanalyzer.yaml)")
rootCmd.PersistentFlags().StringVar(&logType, "log-type", "text", "define how the log will be evaluated")
- rootCmd.PersistentFlags().StringVar(&logLevel, "log-level", "info", "define the log Level")
+ rootCmd.PersistentFlags().StringVar(&logLevel, "log-level", "off", "define the log Level")
rootCmd.PersistentFlags().CountVarP(&verbosity, "verbose", "v", "counted verbosity")
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
diff --git a/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go b/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go
index fd73837bf..6eccceaa9 100644
--- a/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go
+++ b/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go
@@ -34,7 +34,7 @@ import (
"net"
)
-func Analyze(pcapFile, protocolType, filter string, onlyParse, noBytesCompare bool, client string, verbosity int) {
+func Analyze(pcapFile, protocolType, filter string, onlyParse, noBytesCompare bool, client string, startPackageNumber, packageNumberLimit uint, verbosity int) {
log.Info().Msgf("Analyzing pcap file '%s' with protocolType '%s' and filter '%s' now", pcapFile, protocolType, filter)
handle, numberOfPackage, timestampToIndexMap := pcaphandler.GetIndexedPcapHandle(pcapFile, filter)
@@ -69,8 +69,20 @@ func Analyze(pcapFile, protocolType, filter string, onlyParse, noBytesCompare bo
BarStart: "[",
BarEnd: "]",
}))
- failedPackages := 0
+ currentPackageNum := uint(0)
+ parseFails := 0
+ serializeFails := 0
+ compareFails := 0
for packet := range source.Packets() {
+ currentPackageNum++
+ if currentPackageNum < startPackageNumber {
+ log.Debug().Msgf("Skipping package number %d (till no. %d)", currentPackageNum, startPackageNumber)
+ continue
+ }
+ if currentPackageNum > packageNumberLimit {
+ log.Warn().Msgf("Aborting reading packages because we hit the limit of %d", packageNumberLimit)
+ break
+ }
if packet == nil {
log.Debug().Msg("Done reading packages. (nil returned)")
break
@@ -98,7 +110,7 @@ func Analyze(pcapFile, protocolType, filter string, onlyParse, noBytesCompare bo
}
payload := applicationLayer.Payload()
if parsed, err := packageParse(packetInformation, payload); err != nil {
- failedPackages++
+ parseFails++
// TODO: write report to xml or something
log.Warn().Stringer("packetInformation", packetInformation).Err(err).Msgf("No.[%d] Error parsing package", realPacketNumber)
continue
@@ -113,7 +125,7 @@ func Analyze(pcapFile, protocolType, filter string, onlyParse, noBytesCompare bo
}
serializedBytes, err := serializePackage(parsed)
if err != nil {
- failedPackages++
+ serializeFails++
// TODO: write report to xml or something
log.Warn().Stringer("packetInformation", packetInformation).Err(err).Msgf("No.[%d] Error serializing", realPacketNumber)
continue
@@ -123,7 +135,7 @@ func Analyze(pcapFile, protocolType, filter string, onlyParse, noBytesCompare bo
continue
}
if compareResult := bytes.Compare(payload, serializedBytes); compareResult != 0 {
- failedPackages++
+ compareFails++
// TODO: write report to xml or something
log.Warn().Stringer("packetInformation", packetInformation).Msgf("No.[%d] Bytes don't match", realPacketNumber)
if verbosity > 0 {
@@ -136,5 +148,5 @@ func Analyze(pcapFile, protocolType, filter string, onlyParse, noBytesCompare bo
}
}
- log.Info().Msgf("Done evaluating %d packages (%d failed)", numberOfPackage, failedPackages)
+ log.Info().Msgf("Done evaluating %d of %d packages (%d failed to parse, %d failed to serialize and %d failed in byte comparison)", currentPackageNum, numberOfPackage, parseFails, serializeFails, compareFails)
}
diff --git a/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer/analyzer.go b/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer/analyzer.go
index 429ab90c7..6f4dce543 100644
--- a/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer/analyzer.go
+++ b/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer/analyzer.go
@@ -30,23 +30,62 @@ import (
)
type Analyzer struct {
- Client net.IP
+ Client net.IP
+ requestContext model.RequestContext
+ cBusOptions model.CBusOptions
+ initialized bool
}
-func (a Analyzer) PackageParse(packetInformation common.PacketInformation, payload []byte) (interface{}, error) {
- log.Debug().Msgf("Parsing %s", packetInformation)
+func (a *Analyzer) PackageParse(packetInformation common.PacketInformation, payload []byte) (interface{}, error) {
+ if !a.initialized {
+ log.Warn().Msg("Not initialized... doing that now")
+ a.requestContext = model.NewRequestContext(false, false)
+ a.cBusOptions = model.NewCBusOptions(false, false, false, false, false, false, false, false, false)
+ a.initialized = true
+ }
+ log.Debug().Msgf("Parsing %s with requestContext\n%v\nBusOptions\n%s", packetInformation, a.requestContext, a.cBusOptions)
// 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, uint16(len(payload)))
+ parse, err := model.CBusMessageParse(utils.NewReadBufferByteBased(payload), isResponse, a.requestContext, a.cBusOptions, uint16(len(payload)))
if err != nil {
return nil, errors.Wrap(err, "Error parsing CBusCommand")
}
- log.Debug().Msgf("Parsed c-bus command %s", parse)
+ switch cBusMessage := parse.(type) {
+ case model.CBusMessageToServerExactly:
+ switch request := cBusMessage.GetRequest().(type) {
+ case model.RequestDirectCommandAccessExactly:
+ log.Debug().Msgf("No.[%d] CAL request detected", packetInformation.PacketNumber)
+ a.requestContext = model.NewRequestContext(true, false)
+ case model.RequestCommandExactly:
+ switch command := request.GetCbusCommand().(type) {
+ case model.CBusCommandDeviceManagementExactly:
+ log.Debug().Msgf("No.[%d] CAL request detected", packetInformation.PacketNumber)
+ a.requestContext = model.NewRequestContext(true, false)
+ case model.CBusCommandPointToPointExactly:
+ log.Debug().Msgf("No.[%d] CAL request detected", packetInformation.PacketNumber)
+ a.requestContext = model.NewRequestContext(true, false)
+ case model.CBusCommandPointToMultiPointExactly:
+ switch command.GetCommand().(type) {
+ case model.CBusPointToMultiPointCommandStatusExactly:
+ log.Debug().Msgf("No.[%d] SAL status request detected", packetInformation.PacketNumber)
+ a.requestContext = model.NewRequestContext(false, true)
+ }
+ case model.CBusCommandPointToPointToMultiPointExactly:
+ switch command.GetCommand().(type) {
+ case model.CBusPointToPointToMultipointCommandStatusExactly:
+ log.Debug().Msgf("No.[%d] SAL status request detected", packetInformation.PacketNumber)
+ a.requestContext = model.NewRequestContext(false, true)
+ }
+ }
+ }
+ case model.CBusMessageToClientExactly:
+ }
+ log.Debug().Msgf("Parsed c-bus command \n%v", parse)
return parse, nil
}
-func (a Analyzer) SerializePackage(message interface{}) ([]byte, error) {
+func (a *Analyzer) SerializePackage(message interface{}) ([]byte, error) {
if message, ok := message.(model.CBusMessage); !ok {
log.Fatal().Msgf("Unsupported type %T supplied", message)
panic("unreachable statement")
@@ -59,7 +98,7 @@ func (a Analyzer) SerializePackage(message interface{}) ([]byte, error) {
}
}
-func (a Analyzer) PrettyPrint(message interface{}) {
+func (a *Analyzer) PrettyPrint(message interface{}) {
if message, ok := message.(model.CBusMessage); !ok {
log.Fatal().Msgf("Unsupported type %T supplied", message)
panic("unreachable statement")
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
index ab459f6d2..4eb1bd9fb 100644
--- 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
@@ -20,10 +20,7 @@ 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.CALData;
-import org.apache.plc4x.java.cbus.readwrite.CALReply;
-import org.apache.plc4x.java.cbus.readwrite.CBusCommand;
-import org.apache.plc4x.java.cbus.readwrite.CBusOptions;
+import org.apache.plc4x.java.cbus.readwrite.*;
import org.apache.plc4x.java.spi.generation.*;
import org.apache.plc4x.java.spi.utils.Serializable;
@@ -55,10 +52,38 @@ public class StaticHelper {
}
public static CALData readCALData(ReadBuffer readBuffer, Integer payloadLength) throws ParseException {
- byte[] rawBytes = readBytesFromHex("calReply", readBuffer, payloadLength);
+ byte[] rawBytes = readBytesFromHex("calData", readBuffer, payloadLength);
return CALData.staticParse(new ReadBufferByteBased(rawBytes));
}
+ public static void writeMonitoredSAL(WriteBuffer writeBuffer, MonitoredSAL monitoredSAL) throws SerializationException {
+ writeToHex("monitoredSAL", writeBuffer, monitoredSAL, monitoredSAL.getLengthInBytes());
+ }
+
+ public static MonitoredSAL readMonitoredSAL(ReadBuffer readBuffer, Integer payloadLength) throws ParseException {
+ byte[] rawBytes = readBytesFromHex("monitoredSAL", readBuffer, payloadLength);
+ return MonitoredSAL.staticParse(new ReadBufferByteBased(rawBytes));
+ }
+
+ public static void writeStandardFormatStatusReply(WriteBuffer writeBuffer, StandardFormatStatusReply standardFormatStatusReply) throws SerializationException {
+ writeToHex("reply", writeBuffer, standardFormatStatusReply, standardFormatStatusReply.getLengthInBytes());
+ }
+
+ public static StandardFormatStatusReply readStandardFormatStatusReply(ReadBuffer readBuffer, Integer payloadLength) throws ParseException {
+ byte[] rawBytes = readBytesFromHex("reply", readBuffer, payloadLength);
+ return StandardFormatStatusReply.staticParse(new ReadBufferByteBased(rawBytes));
+ }
+
+
+ public static void writeExtendedFormatStatusReply(WriteBuffer writeBuffer, ExtendedFormatStatusReply extendedFormatStatusReply) throws SerializationException {
+ writeToHex("reply", writeBuffer, extendedFormatStatusReply, extendedFormatStatusReply.getLengthInBytes());
+ }
+
+ public static ExtendedFormatStatusReply readExtendedFormatStatusReply(ReadBuffer readBuffer, Integer payloadLength) throws ParseException {
+ byte[] rawBytes = readBytesFromHex("reply", readBuffer, payloadLength);
+ return ExtendedFormatStatusReply.staticParse(new ReadBufferByteBased(rawBytes));
+ }
+
private static byte[] readBytesFromHex(String logicalName, ReadBuffer readBuffer, Integer payloadLength) throws ParseException {
if (payloadLength == 0) {
throw new ParseException("Length is 0");
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 84b3ec7d5..be689f482 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
@@ -271,16 +271,17 @@ public class RandomPackagesTest {
// 4.3.3.2
@Nested
- class MonitoredSAL {
+ class _MonitoredSAL {
@Test
- @Disabled("Not yet implemented")
void monitoredSal() throws Exception {
byte[] bytes = "0503380079083F\r\n".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- Reply msg = Reply.staticParse(readBufferByteBased, bytes.length);
+ Reply msg = Reply.staticParse(readBufferByteBased, cBusOptions, bytes.length, requestContext);
assertThat(msg)
.isNotNull();
System.out.println(msg);
+ MonitoredSAL monitoredSAL = ((MonitoredSALReply) ((ReplyNormalReply) msg).getReply()).getMonitoredSAL();
+ System.out.println(monitoredSAL);
}
}
@@ -425,77 +426,89 @@ public class RandomPackagesTest {
System.out.println(msg);
}
- @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 = "D83800A8AA02000000000000000000000000000000000000009C\r\n".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+ requestContext = new RequestContext(false, true);
CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
+ StandardFormatStatusReply reply = ((StandardFormatStatusReplyReply) ((ReplyNormalReply) ((CBusMessageToClient) msg).getReply()).getReply()).getReply();
+ System.out.println(reply);
}
- @Disabled("something is wrong here")
@Test
void LightningStatusReply2() throws Exception {
// TODO: the section describes that on non smart mode the message doesn't have the last CR
byte[] bytes = "D838580000000000000000000000000000000000000000000098\r\n".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+ requestContext = new RequestContext(false, true);
CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
+ StandardFormatStatusReply reply = ((StandardFormatStatusReplyReply) ((ReplyNormalReply) ((CBusMessageToClient) msg).getReply()).getReply()).getReply();
+ System.out.println(reply);
}
- @Disabled("something is wrong here")
@Test
void LightningStatusReply3() throws Exception {
// TODO: the section describes that on non smart mode the message doesn't have the last CR
byte[] bytes = "D638B0000000000000000000000000000000000000000042\r\n".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+ requestContext = new RequestContext(false, true);
CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
+ StandardFormatStatusReply reply = ((StandardFormatStatusReplyReply) ((ReplyNormalReply) ((CBusMessageToClient) msg).getReply()).getReply()).getReply();
+ System.out.println(reply);
}
- @Disabled("something is wrong here")
@Test
void LightningStatusReply4() throws Exception {
// TODO: the section describes that on non smart mode the message doesn't have the last CR
byte[] bytes = "86999900F8003800A8AA0200000000000000000000000000000000000000C4\r\n".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+ requestContext = new RequestContext(false, true);
CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
+ StandardFormatStatusReply reply = ((StandardFormatStatusReplyReply) ((ReplyNormalReply) ((CBusMessageToClient) msg).getReply()).getReply()).getReply();
+ System.out.println(reply);
}
- @Disabled("something is wrong here")
@Test
void LightningStatusReply5() throws Exception {
// TODO: the section describes that on non smart mode the message doesn't have the last CR
byte[] bytes = "86999900F800385800000000000000000000000000000000000000000000C0\r\n".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+ requestContext = new RequestContext(false, true);
CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
+ StandardFormatStatusReply reply = ((StandardFormatStatusReplyReply) ((ReplyNormalReply) ((CBusMessageToClient) msg).getReply()).getReply()).getReply();
+ System.out.println(reply);
}
- @Disabled("something is wrong here")
@Test
void LightningStatusReply6() throws Exception {
// TODO: the section describes that on non smart mode the message doesn't have the last CR
byte[] bytes = "86999900F60038B000000000000000000000000000000000000000008F\r\n".getBytes(StandardCharsets.UTF_8);
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+ requestContext = new RequestContext(false, true);
CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, true, requestContext, cBusOptions, bytes.length);
assertThat(msg)
.isNotNull();
System.out.println(msg);
+ StandardFormatStatusReply reply = ((StandardFormatStatusReplyReply) ((ReplyNormalReply) ((CBusMessageToClient) msg).getReply()).getReply()).getReply();
+ System.out.println(reply);
}
}
@@ -538,14 +551,16 @@ public class RandomPackagesTest {
assertThat(msg)
.isNotNull();
System.out.println(msg);
+ CBusCommand cbusCommand = ((RequestCommand) ((CBusMessageToServer) msg).getRequest()).getCbusCommand();
+ System.out.println(cbusCommand);
}
- @Disabled("it is not clear if that is a request or reply... it fails in both variants")
+ @Disabled("the transformation from point to point to multipoint message is not yet implemented as described in 8.4... not sure if we will ever implement that")
@Test
void Reply() throws Exception {
- byte[] bytes = "0565380354432101148E\r\n".getBytes(StandardCharsets.UTF_8);
+ byte[] bytes = Hex.decodeHex("0565380354432101148E");
ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
- CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions, bytes.length);
+ CBusCommand msg = CBusCommand.staticParse(readBufferByteBased, cBusOptions);
assertThat(msg)
.isNotNull();
System.out.println(msg);
@@ -575,6 +590,7 @@ public class RandomPackagesTest {
System.out.println(msg);
}
+ // 10.2.1
@Test
void testParameterSet() throws Exception {
byte[] bytes = "@A3470011\r".getBytes(StandardCharsets.UTF_8);
@@ -584,6 +600,17 @@ public class RandomPackagesTest {
.isNotNull();
System.out.println(msg);
}
+
+ // 10.2.1
+ @Test
+ void testParameterSetObsolete() throws Exception {
+ byte[] bytes = "A3470011\r".getBytes(StandardCharsets.UTF_8);
+ ReadBufferByteBased readBufferByteBased = new ReadBufferByteBased(bytes);
+ CBusMessage msg = CBusMessage.staticParse(readBufferByteBased, false, requestContext, cBusOptions, bytes.length);
+ assertThat(msg)
+ .isNotNull();
+ System.out.println(msg);
+ }
}
@Nested
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 0e71affa8..b86b6735d 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
@@ -49,10 +49,10 @@
[simple bit srchk ]
]
-[type CBusMessage(bit response, RequestContext requestContext, CBusOptions cBusOptions, uint 16 messageLength)
+[type CBusMessage(bit isResponse, RequestContext requestContext, CBusOptions cBusOptions, uint 16 messageLength)
[validation 'requestContext != null' "requestContext required" ]
[validation 'cBusOptions != null' "cBusOptions required" ]
- [typeSwitch response
+ [typeSwitch isResponse
['false' *ToServer
[simple Request('cBusOptions', 'messageLength') request ]
]
@@ -103,6 +103,16 @@
]
['EMPTY' *Empty
]
+ // TODO: we should check if we are in basic mode
+ [* *Obsolete(uint 16 payloadLength)
+ [virtual uint 16 obsoletePayloadLength 'payloadLength+1']
+ [manual CALData
+ calData
+ 'STATIC_CALL("readCALData", readBuffer, obsoletePayloadLength)'
+ 'STATIC_CALL("writeCALData", writeBuffer, calData)'
+ '_value.lengthInBytes*2' ]
+ [optional Alpha alpha ]
+ ]
]
[simple RequestTermination termination ]
]
@@ -224,13 +234,13 @@
[discriminatedType CBusPointToMultiPointCommand(CBusOptions cBusOptions)
[peek byte peekedApplication ]
[typeSwitch peekedApplication
- ['0xFF' CBusPointToMultiPointCommandStatus
+ ['0xFF' *Status
[reserved byte '0xFF' ]
[reserved byte '0x00' ]
[simple StatusRequest statusRequest ]
[optional Checksum crc 'cBusOptions.srchk' ] // checksum is optional but mspec checksum isn't
]
- [ CBusPointToMultiPointCommandNormal
+ [ *Normal
[simple ApplicationIdContainer application ]
[reserved byte '0x00' ]
[simple SALData salData ]
@@ -244,12 +254,12 @@
[simple NetworkRoute networkRoute ]
[peek byte peekedApplication ]
[typeSwitch peekedApplication
- ['0xFF' CBusCommandPointToPointToMultiPointStatus
+ ['0xFF' *Status
[reserved byte '0xFF' ]
[simple StatusRequest statusRequest ]
[optional Checksum crc 'cBusOptions.srchk' ] // crc is optional but mspec crc isn't
]
- [ CBusCommandPointToPointToMultiPointNormal
+ [* *Normal
[simple ApplicationIdContainer application ]
[simple SALData salData ]
[optional Checksum crc 'cBusOptions.srchk' ] // crc is optional but mspec crc isn't
@@ -965,10 +975,20 @@
[const byte errorMarker 0x21 ]
]
[*, *, 'true', * StandardFormatStatusReplyReply
- [simple StandardFormatStatusReply reply ]
+ [virtual uint 16 payloadLength 'replyLength']
+ [manual StandardFormatStatusReply
+ reply
+ 'STATIC_CALL("readStandardFormatStatusReply", readBuffer, payloadLength)'
+ 'STATIC_CALL("writeStandardFormatStatusReply", writeBuffer, reply)'
+ '_value.lengthInBytes*2' ]
]
[*, *, 'true', 'false' ExtendedFormatStatusReplyReply
- [simple ExtendedFormatStatusReply reply ]
+ [virtual uint 16 payloadLength 'replyLength']
+ [manual ExtendedFormatStatusReply
+ reply
+ 'STATIC_CALL("readExtendedFormatStatusReply", readBuffer, payloadLength)'
+ 'STATIC_CALL("writeExtendedFormatStatusReply", writeBuffer, reply)'
+ '_value.lengthInBytes*2' ]
]
[*, 'true', *, * CALReplyReply
[virtual uint 16 payloadLength 'replyLength']
@@ -979,7 +999,12 @@
'_value.lengthInBytes*2' ]
]
[* MonitoredSALReply
- [simple MonitoredSAL isA ]
+ [virtual uint 16 payloadLength 'replyLength']
+ [manual MonitoredSAL
+ monitoredSAL
+ 'STATIC_CALL("readMonitoredSAL", readBuffer, payloadLength)'
+ 'STATIC_CALL("writeMonitoredSAL", writeBuffer, monitoredSAL)'
+ '_value.lengthInBytes*2' ]
]
]
]