diff --git a/plc4go/protocols/abeth/readwrite/model/CIPEncapsulationPacket.go b/plc4go/protocols/abeth/readwrite/model/CIPEncapsulationPacket.go index d51a718038a..a6f2f0b3c39 100644 --- a/plc4go/protocols/abeth/readwrite/model/CIPEncapsulationPacket.go +++ b/plc4go/protocols/abeth/readwrite/model/CIPEncapsulationPacket.go @@ -234,7 +234,7 @@ func CIPEncapsulationPacketParse(readBuffer utils.ReadBuffer) (CIPEncapsulationP log.Info().Fields(map[string]interface{}{ "expected value": uint32(0x00000000), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/abeth/readwrite/model/DF1RequestMessage.go b/plc4go/protocols/abeth/readwrite/model/DF1RequestMessage.go index 2de9399b055..452175792ab 100644 --- a/plc4go/protocols/abeth/readwrite/model/DF1RequestMessage.go +++ b/plc4go/protocols/abeth/readwrite/model/DF1RequestMessage.go @@ -186,7 +186,7 @@ func DF1RequestMessageParse(readBuffer utils.ReadBuffer) (DF1RequestMessage, err log.Info().Fields(map[string]interface{}{ "expected value": uint16(0x0000), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/abeth/readwrite/model/DF1ResponseMessage.go b/plc4go/protocols/abeth/readwrite/model/DF1ResponseMessage.go index 9c64fcdca0d..252998eed48 100644 --- a/plc4go/protocols/abeth/readwrite/model/DF1ResponseMessage.go +++ b/plc4go/protocols/abeth/readwrite/model/DF1ResponseMessage.go @@ -178,7 +178,7 @@ func DF1ResponseMessageParse(readBuffer utils.ReadBuffer, payloadLength uint16) log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -206,7 +206,7 @@ func DF1ResponseMessageParse(readBuffer utils.ReadBuffer, payloadLength uint16) log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/ads/readwrite/model/AdsAddDeviceNotificationRequest.go b/plc4go/protocols/ads/readwrite/model/AdsAddDeviceNotificationRequest.go index d65627c9d9c..5a617892118 100644 --- a/plc4go/protocols/ads/readwrite/model/AdsAddDeviceNotificationRequest.go +++ b/plc4go/protocols/ads/readwrite/model/AdsAddDeviceNotificationRequest.go @@ -251,7 +251,7 @@ func AdsAddDeviceNotificationRequestParse(readBuffer utils.ReadBuffer, commandId log.Info().Fields(map[string]interface{}{ "expected value": uint64(0x0000), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -265,7 +265,7 @@ func AdsAddDeviceNotificationRequestParse(readBuffer utils.ReadBuffer, commandId log.Info().Fields(map[string]interface{}{ "expected value": uint64(0x0000), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/ads/readwrite/model/AmsTCPPacket.go b/plc4go/protocols/ads/readwrite/model/AmsTCPPacket.go index ba575ef80ba..711e342314a 100644 --- a/plc4go/protocols/ads/readwrite/model/AmsTCPPacket.go +++ b/plc4go/protocols/ads/readwrite/model/AmsTCPPacket.go @@ -123,7 +123,7 @@ func AmsTCPPacketParse(readBuffer utils.ReadBuffer) (AmsTCPPacket, error) { log.Info().Fields(map[string]interface{}{ "expected value": uint16(0x0000), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/ads/readwrite/model/State.go b/plc4go/protocols/ads/readwrite/model/State.go index 55019316a01..8dd4dd8cedf 100644 --- a/plc4go/protocols/ads/readwrite/model/State.go +++ b/plc4go/protocols/ads/readwrite/model/State.go @@ -263,7 +263,7 @@ func StateParse(readBuffer utils.ReadBuffer) (State, error) { log.Info().Fields(map[string]interface{}{ "expected value": int8(0x0), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUAbort.go b/plc4go/protocols/bacnetip/readwrite/model/APDUAbort.go index c8ff186fc81..0c6414ca4c2 100644 --- a/plc4go/protocols/bacnetip/readwrite/model/APDUAbort.go +++ b/plc4go/protocols/bacnetip/readwrite/model/APDUAbort.go @@ -169,7 +169,7 @@ func APDUAbortParse(readBuffer utils.ReadBuffer, apduLength uint16) (APDUAbort, log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUComplexAck.go b/plc4go/protocols/bacnetip/readwrite/model/APDUComplexAck.go index 8307e97fe31..41dfd71e671 100644 --- a/plc4go/protocols/bacnetip/readwrite/model/APDUComplexAck.go +++ b/plc4go/protocols/bacnetip/readwrite/model/APDUComplexAck.go @@ -290,7 +290,7 @@ func APDUComplexAckParse(readBuffer utils.ReadBuffer, apduLength uint16) (APDUCo log.Info().Fields(map[string]interface{}{ "expected value": uint8(0), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUConfirmedRequest.go b/plc4go/protocols/bacnetip/readwrite/model/APDUConfirmedRequest.go index fdc18ce3efe..53bbe2cba5f 100644 --- a/plc4go/protocols/bacnetip/readwrite/model/APDUConfirmedRequest.go +++ b/plc4go/protocols/bacnetip/readwrite/model/APDUConfirmedRequest.go @@ -330,7 +330,7 @@ func APDUConfirmedRequestParse(readBuffer utils.ReadBuffer, apduLength uint16) ( log.Info().Fields(map[string]interface{}{ "expected value": uint8(0), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUError.go b/plc4go/protocols/bacnetip/readwrite/model/APDUError.go index e3e7aeca409..1cfbfee0606 100644 --- a/plc4go/protocols/bacnetip/readwrite/model/APDUError.go +++ b/plc4go/protocols/bacnetip/readwrite/model/APDUError.go @@ -169,7 +169,7 @@ func APDUErrorParse(readBuffer utils.ReadBuffer, apduLength uint16) (APDUError, log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUReject.go b/plc4go/protocols/bacnetip/readwrite/model/APDUReject.go index 3a50abe1684..220b5e93cf4 100644 --- a/plc4go/protocols/bacnetip/readwrite/model/APDUReject.go +++ b/plc4go/protocols/bacnetip/readwrite/model/APDUReject.go @@ -158,7 +158,7 @@ func APDURejectParse(readBuffer utils.ReadBuffer, apduLength uint16) (APDUReject log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUSegmentAck.go b/plc4go/protocols/bacnetip/readwrite/model/APDUSegmentAck.go index cbc98a41307..d135e19b770 100644 --- a/plc4go/protocols/bacnetip/readwrite/model/APDUSegmentAck.go +++ b/plc4go/protocols/bacnetip/readwrite/model/APDUSegmentAck.go @@ -191,7 +191,7 @@ func APDUSegmentAckParse(readBuffer utils.ReadBuffer, apduLength uint16) (APDUSe log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUSimpleAck.go b/plc4go/protocols/bacnetip/readwrite/model/APDUSimpleAck.go index ecffc6cbb6b..67e6d0a83bf 100644 --- a/plc4go/protocols/bacnetip/readwrite/model/APDUSimpleAck.go +++ b/plc4go/protocols/bacnetip/readwrite/model/APDUSimpleAck.go @@ -158,7 +158,7 @@ func APDUSimpleAckParse(readBuffer utils.ReadBuffer, apduLength uint16) (APDUSim log.Info().Fields(map[string]interface{}{ "expected value": uint8(0), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/bacnetip/readwrite/model/APDUUnconfirmedRequest.go b/plc4go/protocols/bacnetip/readwrite/model/APDUUnconfirmedRequest.go index 8be33d2ca60..d4156f7c1ff 100644 --- a/plc4go/protocols/bacnetip/readwrite/model/APDUUnconfirmedRequest.go +++ b/plc4go/protocols/bacnetip/readwrite/model/APDUUnconfirmedRequest.go @@ -147,7 +147,7 @@ func APDUUnconfirmedRequestParse(readBuffer utils.ReadBuffer, apduLength uint16) log.Info().Fields(map[string]interface{}{ "expected value": uint8(0), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/bacnetip/readwrite/model/NPDUControl.go b/plc4go/protocols/bacnetip/readwrite/model/NPDUControl.go index 10b83ee8545..224127ff985 100644 --- a/plc4go/protocols/bacnetip/readwrite/model/NPDUControl.go +++ b/plc4go/protocols/bacnetip/readwrite/model/NPDUControl.go @@ -170,7 +170,7 @@ func NPDUControlParse(readBuffer utils.ReadBuffer) (NPDUControl, error) { log.Info().Fields(map[string]interface{}{ "expected value": uint8(0), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -191,7 +191,7 @@ func NPDUControlParse(readBuffer utils.ReadBuffer) (NPDUControl, error) { log.Info().Fields(map[string]interface{}{ "expected value": uint8(0), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/cbus/readwrite/ParserHelper.go b/plc4go/protocols/cbus/readwrite/ParserHelper.go index d807a9be38e..5b8dd0adff8 100644 --- a/plc4go/protocols/cbus/readwrite/ParserHelper.go +++ b/plc4go/protocols/cbus/readwrite/ParserHelper.go @@ -46,6 +46,16 @@ func (m CbusParserHelper) Parse(typeName string, arguments []string, io utils.Re return model.NetworkNumberParse(io) case "StandardFormatStatusReply": return model.StandardFormatStatusReplyParse(io) + case "CBusMessage": + response, err := utils.StrToBool(arguments[0]) + if err != nil { + return nil, errors.Wrap(err, "Error parsing") + } + srchk, err := utils.StrToBool(arguments[1]) + if err != nil { + return nil, errors.Wrap(err, "Error parsing") + } + return model.CBusMessageParse(io, response, srchk) case "CBusOptions": return model.CBusOptionsParse(io) case "SALData": @@ -59,6 +69,8 @@ func (m CbusParserHelper) Parse(typeName string, arguments []string, io utils.Re case "IdentifyReplyCommand": attribute, _ := model.AttributeByName(arguments[0]) return model.IdentifyReplyCommandParse(io, attribute) + case "CBusConstants": + return model.CBusConstantsParse(io) case "BridgeCount": return model.BridgeCountParse(io) case "PowerUp": diff --git a/plc4go/protocols/cbus/readwrite/XmlParserHelper.go b/plc4go/protocols/cbus/readwrite/XmlParserHelper.go index 7e7b6f9f676..79f4224d18a 100644 --- a/plc4go/protocols/cbus/readwrite/XmlParserHelper.go +++ b/plc4go/protocols/cbus/readwrite/XmlParserHelper.go @@ -56,6 +56,10 @@ func (m CbusXmlParserHelper) Parse(typeName string, xmlString string, parserArgu return model.NetworkNumberParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "StandardFormatStatusReply": return model.StandardFormatStatusReplyParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) + case "CBusMessage": + response := parserArguments[0] == "true" + srchk := parserArguments[1] == "true" + return model.CBusMessageParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), response, srchk) case "CBusOptions": return model.CBusOptionsParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "SALData": @@ -66,6 +70,8 @@ func (m CbusXmlParserHelper) Parse(typeName string, xmlString string, parserArgu case "IdentifyReplyCommand": attribute, _ := model.AttributeByName(parserArguments[0]) return model.IdentifyReplyCommandParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), attribute) + case "CBusConstants": + return model.CBusConstantsParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "BridgeCount": return model.BridgeCountParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString))) case "PowerUp": diff --git a/plc4go/protocols/cbus/readwrite/model/ApplicationIdContainer.go b/plc4go/protocols/cbus/readwrite/model/ApplicationIdContainer.go index 52a84b79c91..6aa9878638d 100644 --- a/plc4go/protocols/cbus/readwrite/model/ApplicationIdContainer.go +++ b/plc4go/protocols/cbus/readwrite/model/ApplicationIdContainer.go @@ -228,7 +228,7 @@ const ( ApplicationIdContainer_RESERVED_BD ApplicationIdContainer = 0xBD ApplicationIdContainer_RESERVED_BE ApplicationIdContainer = 0xBE ApplicationIdContainer_RESERVED_BF ApplicationIdContainer = 0xBF - ApplicationIdContainer_RESERVED_C0 ApplicationIdContainer = 0xC0 + ApplicationIdContainer_MEDIA_TRANSPORT_C0 ApplicationIdContainer = 0xC0 ApplicationIdContainer_RESERVED_C1 ApplicationIdContainer = 0xC1 ApplicationIdContainer_RESERVED_C2 ApplicationIdContainer = 0xC2 ApplicationIdContainer_RESERVED_C3 ApplicationIdContainer = 0xC3 @@ -242,7 +242,7 @@ const ( ApplicationIdContainer_ENABLE_CONTROL_CB ApplicationIdContainer = 0xCB ApplicationIdContainer_I_HAVE_NO_IDEA_CC ApplicationIdContainer = 0xCC ApplicationIdContainer_AUDIO_AND_VIDEO_CD ApplicationIdContainer = 0xCD - ApplicationIdContainer_RESERVED_CE ApplicationIdContainer = 0xCE + ApplicationIdContainer_ERROR_REPORTING_CE ApplicationIdContainer = 0xCE ApplicationIdContainer_RESERVED_CF ApplicationIdContainer = 0xCF ApplicationIdContainer_SECURITY_D0 ApplicationIdContainer = 0xD0 ApplicationIdContainer_METERING_D1 ApplicationIdContainer = 0xD1 @@ -491,7 +491,7 @@ func init() { ApplicationIdContainer_RESERVED_BD, ApplicationIdContainer_RESERVED_BE, ApplicationIdContainer_RESERVED_BF, - ApplicationIdContainer_RESERVED_C0, + ApplicationIdContainer_MEDIA_TRANSPORT_C0, ApplicationIdContainer_RESERVED_C1, ApplicationIdContainer_RESERVED_C2, ApplicationIdContainer_RESERVED_C3, @@ -505,7 +505,7 @@ func init() { ApplicationIdContainer_ENABLE_CONTROL_CB, ApplicationIdContainer_I_HAVE_NO_IDEA_CC, ApplicationIdContainer_AUDIO_AND_VIDEO_CD, - ApplicationIdContainer_RESERVED_CE, + ApplicationIdContainer_ERROR_REPORTING_CE, ApplicationIdContainer_RESERVED_CF, ApplicationIdContainer_SECURITY_D0, ApplicationIdContainer_METERING_D1, @@ -3028,7 +3028,7 @@ func ApplicationIdContainerByValue(value uint8) ApplicationIdContainer { case 0xBF: return ApplicationIdContainer_RESERVED_BF case 0xC0: - return ApplicationIdContainer_RESERVED_C0 + return ApplicationIdContainer_MEDIA_TRANSPORT_C0 case 0xC1: return ApplicationIdContainer_RESERVED_C1 case 0xC2: @@ -3056,7 +3056,7 @@ func ApplicationIdContainerByValue(value uint8) ApplicationIdContainer { case 0xCD: return ApplicationIdContainer_AUDIO_AND_VIDEO_CD case 0xCE: - return ApplicationIdContainer_RESERVED_CE + return ApplicationIdContainer_ERROR_REPORTING_CE case 0xCF: return ApplicationIdContainer_RESERVED_CF case 0xD0: @@ -3546,8 +3546,8 @@ func ApplicationIdContainerByName(value string) (enum ApplicationIdContainer, ok enum = ApplicationIdContainer_RESERVED_BE case "RESERVED_BF": enum = ApplicationIdContainer_RESERVED_BF - case "RESERVED_C0": - enum = ApplicationIdContainer_RESERVED_C0 + case "MEDIA_TRANSPORT_C0": + enum = ApplicationIdContainer_MEDIA_TRANSPORT_C0 case "RESERVED_C1": enum = ApplicationIdContainer_RESERVED_C1 case "RESERVED_C2": @@ -3574,8 +3574,8 @@ func ApplicationIdContainerByName(value string) (enum ApplicationIdContainer, ok enum = ApplicationIdContainer_I_HAVE_NO_IDEA_CC case "AUDIO_AND_VIDEO_CD": enum = ApplicationIdContainer_AUDIO_AND_VIDEO_CD - case "RESERVED_CE": - enum = ApplicationIdContainer_RESERVED_CE + case "ERROR_REPORTING_CE": + enum = ApplicationIdContainer_ERROR_REPORTING_CE case "RESERVED_CF": enum = ApplicationIdContainer_RESERVED_CF case "SECURITY_D0": @@ -4107,8 +4107,8 @@ func (e ApplicationIdContainer) PLC4XEnumName() string { return "RESERVED_BE" case ApplicationIdContainer_RESERVED_BF: return "RESERVED_BF" - case ApplicationIdContainer_RESERVED_C0: - return "RESERVED_C0" + case ApplicationIdContainer_MEDIA_TRANSPORT_C0: + return "MEDIA_TRANSPORT_C0" case ApplicationIdContainer_RESERVED_C1: return "RESERVED_C1" case ApplicationIdContainer_RESERVED_C2: @@ -4135,8 +4135,8 @@ func (e ApplicationIdContainer) PLC4XEnumName() string { return "I_HAVE_NO_IDEA_CC" case ApplicationIdContainer_AUDIO_AND_VIDEO_CD: return "AUDIO_AND_VIDEO_CD" - case ApplicationIdContainer_RESERVED_CE: - return "RESERVED_CE" + case ApplicationIdContainer_ERROR_REPORTING_CE: + return "ERROR_REPORTING_CE" case ApplicationIdContainer_RESERVED_CF: return "RESERVED_CF" case ApplicationIdContainer_SECURITY_D0: diff --git a/plc4go/protocols/cbus/readwrite/model/CALReplyLong.go b/plc4go/protocols/cbus/readwrite/model/CALReplyLong.go index ccf1302092a..492c7db069a 100644 --- a/plc4go/protocols/cbus/readwrite/model/CALReplyLong.go +++ b/plc4go/protocols/cbus/readwrite/model/CALReplyLong.go @@ -232,7 +232,7 @@ func CALReplyLongParse(readBuffer utils.ReadBuffer) (CALReplyLong, error) { log.Info().Fields(map[string]interface{}{ "expected value": byte(0x86), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommand.go b/plc4go/protocols/cbus/readwrite/model/CBusCommand.go index 5f7e2dd4f1e..0150558c48b 100644 --- a/plc4go/protocols/cbus/readwrite/model/CBusCommand.go +++ b/plc4go/protocols/cbus/readwrite/model/CBusCommand.go @@ -20,16 +20,12 @@ package model import ( - "fmt" "github.com/apache/plc4x/plc4go/internal/spi/utils" "github.com/pkg/errors" ) // Code generated by code-generation. DO NOT EDIT. -// Constant values. -const CBusCommand_INITIATOR byte = 0x5C - // CBusCommand is the corresponding interface of CBusCommand type CBusCommand interface { utils.LengthAware @@ -98,19 +94,6 @@ func (m *_CBusCommand) GetDestinationAddressType() DestinationAddressType { return CastDestinationAddressType(m.GetHeader().GetDestinationAddressType()) } -/////////////////////// -/////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////// -/////////////////////// Accessors for const fields. -/////////////////////// - -func (m *_CBusCommand) GetInitiator() byte { - return CBusCommand_INITIATOR -} - /////////////////////// /////////////////////// /////////////////////////////////////////////////////////// @@ -139,9 +122,6 @@ func (m *_CBusCommand) GetTypeName() string { func (m *_CBusCommand) GetParentLengthInBits() uint16 { lengthInBits := uint16(0) - // Const Field (initiator) - lengthInBits += 8 - // Simple field (header) lengthInBits += m.Header.GetLengthInBits() @@ -163,15 +143,6 @@ func CBusCommandParse(readBuffer utils.ReadBuffer, srchk bool) (CBusCommand, err currentPos := positionAware.GetPos() _ = currentPos - // Const Field (initiator) - initiator, _initiatorErr := readBuffer.ReadByte("initiator") - if _initiatorErr != nil { - return nil, errors.Wrap(_initiatorErr, "Error parsing 'initiator' field") - } - if initiator != CBusCommand_INITIATOR { - return nil, errors.New("Expected constant value " + fmt.Sprintf("%d", CBusCommand_INITIATOR) + " but got " + fmt.Sprintf("%d", initiator)) - } - // Simple Field (header) if pullErr := readBuffer.PullContext("header"); pullErr != nil { return nil, errors.Wrap(pullErr, "Error pulling for header") @@ -234,12 +205,6 @@ func (pm *_CBusCommand) SerializeParent(writeBuffer utils.WriteBuffer, child CBu return errors.Wrap(pushErr, "Error pushing for CBusCommand") } - // Const Field (initiator) - _initiatorErr := writeBuffer.WriteByte("initiator", 0x5C) - if _initiatorErr != nil { - return errors.Wrap(_initiatorErr, "Error serializing 'initiator' field") - } - // Simple Field (header) if pushErr := writeBuffer.PushContext("header"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for header") diff --git a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointStatus.go b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointStatus.go index 715c7cc0eba..e548f7feefa 100644 --- a/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointStatus.go +++ b/plc4go/protocols/cbus/readwrite/model/CBusCommandPointToPointToMultiPointStatus.go @@ -202,7 +202,7 @@ func CBusCommandPointToPointToMultiPointStatusParse(readBuffer utils.ReadBuffer, log.Info().Fields(map[string]interface{}{ "expected value": byte(0xFF), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/cbus/readwrite/model/CBusConstants.go b/plc4go/protocols/cbus/readwrite/model/CBusConstants.go new file mode 100644 index 00000000000..7bd1a0daa66 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/CBusConstants.go @@ -0,0 +1,159 @@ +/* + * 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 ( + "fmt" + "github.com/apache/plc4x/plc4go/internal/spi/utils" + "github.com/pkg/errors" +) + +// Code generated by code-generation. DO NOT EDIT. + +// Constant values. +const CBusConstants_CBUSTCPDEFAULTPORT uint16 = uint16(10001) + +// CBusConstants is the corresponding interface of CBusConstants +type CBusConstants interface { + utils.LengthAware + utils.Serializable +} + +// CBusConstantsExactly can be used when we want exactly this type and not a type which fulfills CBusConstants. +// This is useful for switch cases. +type CBusConstantsExactly interface { + CBusConstants + isCBusConstants() bool +} + +// _CBusConstants is the data-structure of this message +type _CBusConstants struct { +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for const fields. +/////////////////////// + +func (m *_CBusConstants) GetCbusTcpDefaultPort() uint16 { + return CBusConstants_CBUSTCPDEFAULTPORT +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewCBusConstants factory function for _CBusConstants +func NewCBusConstants() *_CBusConstants { + return &_CBusConstants{} +} + +// Deprecated: use the interface for direct cast +func CastCBusConstants(structType interface{}) CBusConstants { + if casted, ok := structType.(CBusConstants); ok { + return casted + } + if casted, ok := structType.(*CBusConstants); ok { + return *casted + } + return nil +} + +func (m *_CBusConstants) GetTypeName() string { + return "CBusConstants" +} + +func (m *_CBusConstants) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_CBusConstants) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(0) + + // Const Field (cbusTcpDefaultPort) + lengthInBits += 16 + + return lengthInBits +} + +func (m *_CBusConstants) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func CBusConstantsParse(readBuffer utils.ReadBuffer) (CBusConstants, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("CBusConstants"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for CBusConstants") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Const Field (cbusTcpDefaultPort) + cbusTcpDefaultPort, _cbusTcpDefaultPortErr := readBuffer.ReadUint16("cbusTcpDefaultPort", 16) + if _cbusTcpDefaultPortErr != nil { + return nil, errors.Wrap(_cbusTcpDefaultPortErr, "Error parsing 'cbusTcpDefaultPort' field") + } + if cbusTcpDefaultPort != CBusConstants_CBUSTCPDEFAULTPORT { + return nil, errors.New("Expected constant value " + fmt.Sprintf("%d", CBusConstants_CBUSTCPDEFAULTPORT) + " but got " + fmt.Sprintf("%d", cbusTcpDefaultPort)) + } + + if closeErr := readBuffer.CloseContext("CBusConstants"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for CBusConstants") + } + + // Create the instance + return NewCBusConstants(), nil +} + +func (m *_CBusConstants) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("CBusConstants"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for CBusConstants") + } + + // Const Field (cbusTcpDefaultPort) + _cbusTcpDefaultPortErr := writeBuffer.WriteUint16("cbusTcpDefaultPort", 16, 10001) + if _cbusTcpDefaultPortErr != nil { + return errors.Wrap(_cbusTcpDefaultPortErr, "Error serializing 'cbusTcpDefaultPort' field") + } + + if popErr := writeBuffer.PopContext("CBusConstants"); popErr != nil { + return errors.Wrap(popErr, "Error popping for CBusConstants") + } + return nil +} + +func (m *_CBusConstants) isCBusConstants() bool { + return true +} + +func (m *_CBusConstants) String() string { + if m == nil { + return "" + } + 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/CBusHeader.go b/plc4go/protocols/cbus/readwrite/model/CBusHeader.go index d968e04ecb8..80b13159744 100644 --- a/plc4go/protocols/cbus/readwrite/model/CBusHeader.go +++ b/plc4go/protocols/cbus/readwrite/model/CBusHeader.go @@ -22,7 +22,6 @@ package model import ( "github.com/apache/plc4x/plc4go/internal/spi/utils" "github.com/pkg/errors" - "github.com/rs/zerolog/log" ) // Code generated by code-generation. DO NOT EDIT. @@ -33,6 +32,10 @@ type CBusHeader interface { utils.Serializable // GetPriorityClass returns PriorityClass (property field) GetPriorityClass() PriorityClass + // GetDpReservedManagement returns DpReservedManagement (property field) + GetDpReservedManagement() bool + // GetRcReservedManagement returns RcReservedManagement (property field) + GetRcReservedManagement() uint8 // GetDestinationAddressType returns DestinationAddressType (property field) GetDestinationAddressType() DestinationAddressType } @@ -47,6 +50,8 @@ type CBusHeaderExactly interface { // _CBusHeader is the data-structure of this message type _CBusHeader struct { PriorityClass PriorityClass + DpReservedManagement bool + RcReservedManagement uint8 DestinationAddressType DestinationAddressType } @@ -59,6 +64,14 @@ func (m *_CBusHeader) GetPriorityClass() PriorityClass { return m.PriorityClass } +func (m *_CBusHeader) GetDpReservedManagement() bool { + return m.DpReservedManagement +} + +func (m *_CBusHeader) GetRcReservedManagement() uint8 { + return m.RcReservedManagement +} + func (m *_CBusHeader) GetDestinationAddressType() DestinationAddressType { return m.DestinationAddressType } @@ -69,8 +82,8 @@ func (m *_CBusHeader) GetDestinationAddressType() DestinationAddressType { /////////////////////////////////////////////////////////// // NewCBusHeader factory function for _CBusHeader -func NewCBusHeader(priorityClass PriorityClass, destinationAddressType DestinationAddressType) *_CBusHeader { - return &_CBusHeader{PriorityClass: priorityClass, DestinationAddressType: destinationAddressType} +func NewCBusHeader(priorityClass PriorityClass, dpReservedManagement bool, rcReservedManagement uint8, destinationAddressType DestinationAddressType) *_CBusHeader { + return &_CBusHeader{PriorityClass: priorityClass, DpReservedManagement: dpReservedManagement, RcReservedManagement: rcReservedManagement, DestinationAddressType: destinationAddressType} } // Deprecated: use the interface for direct cast @@ -98,10 +111,10 @@ func (m *_CBusHeader) GetLengthInBitsConditional(lastItem bool) uint16 { // Simple field (priorityClass) lengthInBits += 2 - // Reserved Field (reserved) + // Simple field (dpReservedManagement) lengthInBits += 1 - // Reserved Field (reserved) + // Simple field (rcReservedManagement) lengthInBits += 2 // Simple field (destinationAddressType) @@ -136,33 +149,19 @@ func CBusHeaderParse(readBuffer utils.ReadBuffer) (CBusHeader, error) { return nil, errors.Wrap(closeErr, "Error closing for priorityClass") } - // Reserved Field (Compartmentalized so the "reserved" variable can't leak) - { - reserved, _err := readBuffer.ReadBit("reserved") - if _err != nil { - return nil, errors.Wrap(_err, "Error parsing 'reserved' field") - } - if reserved != bool(false) { - log.Info().Fields(map[string]interface{}{ - "expected value": bool(false), - "got value": reserved, - }).Msg("Got unexpected response.") - } - } - - // Reserved Field (Compartmentalized so the "reserved" variable can't leak) - { - reserved, _err := readBuffer.ReadUint8("reserved", 2) - if _err != nil { - return nil, errors.Wrap(_err, "Error parsing 'reserved' field") - } - if reserved != uint8(0) { - log.Info().Fields(map[string]interface{}{ - "expected value": uint8(0), - "got value": reserved, - }).Msg("Got unexpected response.") - } + // Simple Field (dpReservedManagement) + _dpReservedManagement, _dpReservedManagementErr := readBuffer.ReadBit("dpReservedManagement") + if _dpReservedManagementErr != nil { + return nil, errors.Wrap(_dpReservedManagementErr, "Error parsing 'dpReservedManagement' field") + } + dpReservedManagement := _dpReservedManagement + + // Simple Field (rcReservedManagement) + _rcReservedManagement, _rcReservedManagementErr := readBuffer.ReadUint8("rcReservedManagement", 2) + if _rcReservedManagementErr != nil { + return nil, errors.Wrap(_rcReservedManagementErr, "Error parsing 'rcReservedManagement' field") } + rcReservedManagement := _rcReservedManagement // Simple Field (destinationAddressType) if pullErr := readBuffer.PullContext("destinationAddressType"); pullErr != nil { @@ -182,7 +181,7 @@ func CBusHeaderParse(readBuffer utils.ReadBuffer) (CBusHeader, error) { } // Create the instance - return NewCBusHeader(priorityClass, destinationAddressType), nil + return NewCBusHeader(priorityClass, dpReservedManagement, rcReservedManagement, destinationAddressType), nil } func (m *_CBusHeader) Serialize(writeBuffer utils.WriteBuffer) error { @@ -204,20 +203,18 @@ func (m *_CBusHeader) Serialize(writeBuffer utils.WriteBuffer) error { return errors.Wrap(_priorityClassErr, "Error serializing 'priorityClass' field") } - // Reserved Field (reserved) - { - _err := writeBuffer.WriteBit("reserved", bool(false)) - if _err != nil { - return errors.Wrap(_err, "Error serializing 'reserved' field") - } + // Simple Field (dpReservedManagement) + dpReservedManagement := bool(m.GetDpReservedManagement()) + _dpReservedManagementErr := writeBuffer.WriteBit("dpReservedManagement", (dpReservedManagement)) + if _dpReservedManagementErr != nil { + return errors.Wrap(_dpReservedManagementErr, "Error serializing 'dpReservedManagement' field") } - // Reserved Field (reserved) - { - _err := writeBuffer.WriteUint8("reserved", 2, uint8(0)) - if _err != nil { - return errors.Wrap(_err, "Error serializing 'reserved' field") - } + // Simple Field (rcReservedManagement) + rcReservedManagement := uint8(m.GetRcReservedManagement()) + _rcReservedManagementErr := writeBuffer.WriteUint8("rcReservedManagement", 2, (rcReservedManagement)) + if _rcReservedManagementErr != nil { + return errors.Wrap(_rcReservedManagementErr, "Error serializing 'rcReservedManagement' field") } // Simple Field (destinationAddressType) diff --git a/plc4go/protocols/cbus/readwrite/model/CBusMessage.go b/plc4go/protocols/cbus/readwrite/model/CBusMessage.go new file mode 100644 index 00000000000..c5c066c7139 --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/CBusMessage.go @@ -0,0 +1,178 @@ +/* + * 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. + +// CBusMessage is the corresponding interface of CBusMessage +type CBusMessage interface { + utils.LengthAware + utils.Serializable + // GetResponse returns Response (discriminator field) + GetResponse() bool +} + +// CBusMessageExactly can be used when we want exactly this type and not a type which fulfills CBusMessage. +// This is useful for switch cases. +type CBusMessageExactly interface { + CBusMessage + isCBusMessage() bool +} + +// _CBusMessage is the data-structure of this message +type _CBusMessage struct { + _CBusMessageChildRequirements + + // Arguments. + Srchk bool +} + +type _CBusMessageChildRequirements interface { + utils.Serializable + GetLengthInBits() uint16 + GetLengthInBitsConditional(lastItem bool) uint16 + GetResponse() bool +} + +type CBusMessageParent interface { + SerializeParent(writeBuffer utils.WriteBuffer, child CBusMessage, serializeChildFunction func() error) error + GetTypeName() string +} + +type CBusMessageChild interface { + utils.Serializable + InitializeParent(parent CBusMessage) + GetParent() *CBusMessage + + GetTypeName() string + CBusMessage +} + +// NewCBusMessage factory function for _CBusMessage +func NewCBusMessage(srchk bool) *_CBusMessage { + return &_CBusMessage{Srchk: srchk} +} + +// Deprecated: use the interface for direct cast +func CastCBusMessage(structType interface{}) CBusMessage { + if casted, ok := structType.(CBusMessage); ok { + return casted + } + if casted, ok := structType.(*CBusMessage); ok { + return *casted + } + return nil +} + +func (m *_CBusMessage) GetTypeName() string { + return "CBusMessage" +} + +func (m *_CBusMessage) GetParentLengthInBits() uint16 { + lengthInBits := uint16(0) + + return lengthInBits +} + +func (m *_CBusMessage) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func CBusMessageParse(readBuffer utils.ReadBuffer, response bool, srchk bool) (CBusMessage, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("CBusMessage"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for CBusMessage") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Switch Field (Depending on the discriminator values, passes the instantiation to a sub-type) + type CBusMessageChildSerializeRequirement interface { + CBusMessage + InitializeParent(CBusMessage) + GetParent() CBusMessage + } + var _childTemp interface{} + var _child CBusMessageChildSerializeRequirement + var typeSwitchError error + switch { + case response == bool(false): // CBusMessageToServer + _childTemp, typeSwitchError = CBusMessageToServerParse(readBuffer, response, srchk) + case response == bool(true): // CBusMessageToClient + _childTemp, typeSwitchError = CBusMessageToClientParse(readBuffer, response, srchk) + default: + // TODO: return actual type + typeSwitchError = errors.New("Unmapped type") + } + if typeSwitchError != nil { + return nil, errors.Wrap(typeSwitchError, "Error parsing sub-type for type-switch.") + } + _child = _childTemp.(CBusMessageChildSerializeRequirement) + + if closeErr := readBuffer.CloseContext("CBusMessage"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for CBusMessage") + } + + // Finish initializing + _child.InitializeParent(_child) + return _child, nil +} + +func (pm *_CBusMessage) SerializeParent(writeBuffer utils.WriteBuffer, child CBusMessage, serializeChildFunction func() error) error { + // We redirect all calls through client as some methods are only implemented there + m := child + _ = m + positionAware := writeBuffer + _ = positionAware + if pushErr := writeBuffer.PushContext("CBusMessage"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for CBusMessage") + } + + // Switch field (Depending on the discriminator values, passes the serialization to a sub-type) + if _typeSwitchErr := serializeChildFunction(); _typeSwitchErr != nil { + return errors.Wrap(_typeSwitchErr, "Error serializing sub-type field") + } + + if popErr := writeBuffer.PopContext("CBusMessage"); popErr != nil { + return errors.Wrap(popErr, "Error popping for CBusMessage") + } + return nil +} + +func (m *_CBusMessage) isCBusMessage() bool { + return true +} + +func (m *_CBusMessage) String() string { + if m == nil { + return "" + } + 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/CBusMessageToClient.go b/plc4go/protocols/cbus/readwrite/model/CBusMessageToClient.go new file mode 100644 index 00000000000..9943c38b00f --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/CBusMessageToClient.go @@ -0,0 +1,205 @@ +/* + * 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. + +// CBusMessageToClient is the corresponding interface of CBusMessageToClient +type CBusMessageToClient interface { + utils.LengthAware + utils.Serializable + CBusMessage + // GetConfirmation returns Confirmation (property field) + GetConfirmation() Confirmation +} + +// CBusMessageToClientExactly can be used when we want exactly this type and not a type which fulfills CBusMessageToClient. +// This is useful for switch cases. +type CBusMessageToClientExactly interface { + CBusMessageToClient + isCBusMessageToClient() bool +} + +// _CBusMessageToClient is the data-structure of this message +type _CBusMessageToClient struct { + *_CBusMessage + Confirmation Confirmation +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_CBusMessageToClient) GetResponse() bool { + return bool(true) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_CBusMessageToClient) InitializeParent(parent CBusMessage) {} + +func (m *_CBusMessageToClient) GetParent() CBusMessage { + return m._CBusMessage +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_CBusMessageToClient) GetConfirmation() Confirmation { + return m.Confirmation +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewCBusMessageToClient factory function for _CBusMessageToClient +func NewCBusMessageToClient(confirmation Confirmation, srchk bool) *_CBusMessageToClient { + _result := &_CBusMessageToClient{ + Confirmation: confirmation, + _CBusMessage: NewCBusMessage(srchk), + } + _result._CBusMessage._CBusMessageChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastCBusMessageToClient(structType interface{}) CBusMessageToClient { + if casted, ok := structType.(CBusMessageToClient); ok { + return casted + } + if casted, ok := structType.(*CBusMessageToClient); ok { + return *casted + } + return nil +} + +func (m *_CBusMessageToClient) GetTypeName() string { + return "CBusMessageToClient" +} + +func (m *_CBusMessageToClient) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_CBusMessageToClient) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (confirmation) + lengthInBits += m.Confirmation.GetLengthInBits() + + return lengthInBits +} + +func (m *_CBusMessageToClient) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func CBusMessageToClientParse(readBuffer utils.ReadBuffer, response bool, srchk bool) (CBusMessageToClient, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("CBusMessageToClient"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for CBusMessageToClient") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (confirmation) + if pullErr := readBuffer.PullContext("confirmation"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for confirmation") + } + _confirmation, _confirmationErr := ConfirmationParse(readBuffer) + if _confirmationErr != nil { + return nil, errors.Wrap(_confirmationErr, "Error parsing 'confirmation' field") + } + confirmation := _confirmation.(Confirmation) + if closeErr := readBuffer.CloseContext("confirmation"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for confirmation") + } + + if closeErr := readBuffer.CloseContext("CBusMessageToClient"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for CBusMessageToClient") + } + + // Create a partially initialized instance + _child := &_CBusMessageToClient{ + Confirmation: confirmation, + _CBusMessage: &_CBusMessage{ + Srchk: srchk, + }, + } + _child._CBusMessage._CBusMessageChildRequirements = _child + return _child, nil +} + +func (m *_CBusMessageToClient) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("CBusMessageToClient"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for CBusMessageToClient") + } + + // Simple Field (confirmation) + if pushErr := writeBuffer.PushContext("confirmation"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for confirmation") + } + _confirmationErr := writeBuffer.WriteSerializable(m.GetConfirmation()) + if popErr := writeBuffer.PopContext("confirmation"); popErr != nil { + return errors.Wrap(popErr, "Error popping for confirmation") + } + if _confirmationErr != nil { + return errors.Wrap(_confirmationErr, "Error serializing 'confirmation' field") + } + + if popErr := writeBuffer.PopContext("CBusMessageToClient"); popErr != nil { + return errors.Wrap(popErr, "Error popping for CBusMessageToClient") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_CBusMessageToClient) isCBusMessageToClient() bool { + return true +} + +func (m *_CBusMessageToClient) String() string { + if m == nil { + return "" + } + 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/CBusMessageToServer.go b/plc4go/protocols/cbus/readwrite/model/CBusMessageToServer.go new file mode 100644 index 00000000000..aa2468fe18e --- /dev/null +++ b/plc4go/protocols/cbus/readwrite/model/CBusMessageToServer.go @@ -0,0 +1,205 @@ +/* + * 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. + +// CBusMessageToServer is the corresponding interface of CBusMessageToServer +type CBusMessageToServer interface { + utils.LengthAware + utils.Serializable + CBusMessage + // GetCommand returns Command (property field) + GetCommand() CBusCommand +} + +// CBusMessageToServerExactly can be used when we want exactly this type and not a type which fulfills CBusMessageToServer. +// This is useful for switch cases. +type CBusMessageToServerExactly interface { + CBusMessageToServer + isCBusMessageToServer() bool +} + +// _CBusMessageToServer is the data-structure of this message +type _CBusMessageToServer struct { + *_CBusMessage + Command CBusCommand +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for discriminator values. +/////////////////////// + +func (m *_CBusMessageToServer) GetResponse() bool { + return bool(false) +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +func (m *_CBusMessageToServer) InitializeParent(parent CBusMessage) {} + +func (m *_CBusMessageToServer) GetParent() CBusMessage { + return m._CBusMessage +} + +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////// Accessors for property fields. +/////////////////////// + +func (m *_CBusMessageToServer) GetCommand() CBusCommand { + return m.Command +} + +/////////////////////// +/////////////////////// +/////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////// + +// NewCBusMessageToServer factory function for _CBusMessageToServer +func NewCBusMessageToServer(command CBusCommand, srchk bool) *_CBusMessageToServer { + _result := &_CBusMessageToServer{ + Command: command, + _CBusMessage: NewCBusMessage(srchk), + } + _result._CBusMessage._CBusMessageChildRequirements = _result + return _result +} + +// Deprecated: use the interface for direct cast +func CastCBusMessageToServer(structType interface{}) CBusMessageToServer { + if casted, ok := structType.(CBusMessageToServer); ok { + return casted + } + if casted, ok := structType.(*CBusMessageToServer); ok { + return *casted + } + return nil +} + +func (m *_CBusMessageToServer) GetTypeName() string { + return "CBusMessageToServer" +} + +func (m *_CBusMessageToServer) GetLengthInBits() uint16 { + return m.GetLengthInBitsConditional(false) +} + +func (m *_CBusMessageToServer) GetLengthInBitsConditional(lastItem bool) uint16 { + lengthInBits := uint16(m.GetParentLengthInBits()) + + // Simple field (command) + lengthInBits += m.Command.GetLengthInBits() + + return lengthInBits +} + +func (m *_CBusMessageToServer) GetLengthInBytes() uint16 { + return m.GetLengthInBits() / 8 +} + +func CBusMessageToServerParse(readBuffer utils.ReadBuffer, response bool, srchk bool) (CBusMessageToServer, error) { + positionAware := readBuffer + _ = positionAware + if pullErr := readBuffer.PullContext("CBusMessageToServer"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for CBusMessageToServer") + } + currentPos := positionAware.GetPos() + _ = currentPos + + // Simple Field (command) + if pullErr := readBuffer.PullContext("command"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for command") + } + _command, _commandErr := CBusCommandParse(readBuffer, bool(srchk)) + if _commandErr != nil { + return nil, errors.Wrap(_commandErr, "Error parsing 'command' field") + } + command := _command.(CBusCommand) + if closeErr := readBuffer.CloseContext("command"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for command") + } + + if closeErr := readBuffer.CloseContext("CBusMessageToServer"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for CBusMessageToServer") + } + + // Create a partially initialized instance + _child := &_CBusMessageToServer{ + Command: command, + _CBusMessage: &_CBusMessage{ + Srchk: srchk, + }, + } + _child._CBusMessage._CBusMessageChildRequirements = _child + return _child, nil +} + +func (m *_CBusMessageToServer) Serialize(writeBuffer utils.WriteBuffer) error { + positionAware := writeBuffer + _ = positionAware + ser := func() error { + if pushErr := writeBuffer.PushContext("CBusMessageToServer"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for CBusMessageToServer") + } + + // Simple Field (command) + if pushErr := writeBuffer.PushContext("command"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for command") + } + _commandErr := writeBuffer.WriteSerializable(m.GetCommand()) + if popErr := writeBuffer.PopContext("command"); popErr != nil { + return errors.Wrap(popErr, "Error popping for command") + } + if _commandErr != nil { + return errors.Wrap(_commandErr, "Error serializing 'command' field") + } + + if popErr := writeBuffer.PopContext("CBusMessageToServer"); popErr != nil { + return errors.Wrap(popErr, "Error popping for CBusMessageToServer") + } + return nil + } + return m.SerializeParent(writeBuffer, m, ser) +} + +func (m *_CBusMessageToServer) isCBusMessageToServer() bool { + return true +} + +func (m *_CBusMessageToServer) String() string { + if m == nil { + return "" + } + 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/CBusPointToMultiPointCommandNormal.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandNormal.go index 21dd6a4e7cc..8a1fb6feb83 100644 --- a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandNormal.go +++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandNormal.go @@ -224,7 +224,7 @@ func CBusPointToMultiPointCommandNormalParse(readBuffer utils.ReadBuffer, srchk log.Info().Fields(map[string]interface{}{ "expected value": byte(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandStatus.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandStatus.go index caaf256ca39..93b743c60b5 100644 --- a/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandStatus.go +++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToMultiPointCommandStatus.go @@ -203,7 +203,7 @@ func CBusPointToMultiPointCommandStatusParse(readBuffer utils.ReadBuffer, srchk log.Info().Fields(map[string]interface{}{ "expected value": byte(0xFF), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -217,7 +217,7 @@ func CBusPointToMultiPointCommandStatusParse(readBuffer utils.ReadBuffer, srchk log.Info().Fields(map[string]interface{}{ "expected value": byte(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandDirect.go b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandDirect.go index 176c83790f4..42679214360 100644 --- a/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandDirect.go +++ b/plc4go/protocols/cbus/readwrite/model/CBusPointToPointCommandDirect.go @@ -162,7 +162,7 @@ func CBusPointToPointCommandDirectParse(readBuffer utils.ReadBuffer, srchk bool) log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/cbus/readwrite/model/ExtendedStatusHeader.go b/plc4go/protocols/cbus/readwrite/model/ExtendedStatusHeader.go index c500602af47..ef014de4e81 100644 --- a/plc4go/protocols/cbus/readwrite/model/ExtendedStatusHeader.go +++ b/plc4go/protocols/cbus/readwrite/model/ExtendedStatusHeader.go @@ -120,7 +120,7 @@ func ExtendedStatusHeaderParse(readBuffer utils.ReadBuffer) (ExtendedStatusHeade log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x7), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandExtendedDiagnosticSummary.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandExtendedDiagnosticSummary.go index d2d870ff859..6241a5d4b14 100644 --- a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandExtendedDiagnosticSummary.go +++ b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandExtendedDiagnosticSummary.go @@ -420,7 +420,7 @@ func IdentifyReplyCommandExtendedDiagnosticSummaryParse(readBuffer utils.ReadBuf log.Info().Fields(map[string]interface{}{ "expected value": uint8(0), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -434,7 +434,7 @@ func IdentifyReplyCommandExtendedDiagnosticSummaryParse(readBuffer utils.ReadBuf log.Info().Fields(map[string]interface{}{ "expected value": uint8(0), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -448,7 +448,7 @@ func IdentifyReplyCommandExtendedDiagnosticSummaryParse(readBuffer utils.ReadBuf log.Info().Fields(map[string]interface{}{ "expected value": uint8(0), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/cbus/readwrite/model/MonitoredSALLongFormSmartMode.go b/plc4go/protocols/cbus/readwrite/model/MonitoredSALLongFormSmartMode.go index 1ac92ceaa5e..ea6cde77f69 100644 --- a/plc4go/protocols/cbus/readwrite/model/MonitoredSALLongFormSmartMode.go +++ b/plc4go/protocols/cbus/readwrite/model/MonitoredSALLongFormSmartMode.go @@ -232,7 +232,7 @@ func MonitoredSALLongFormSmartModeParse(readBuffer utils.ReadBuffer) (MonitoredS log.Info().Fields(map[string]interface{}{ "expected value": byte(0x05), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/cbus/readwrite/model/NetworkProtocolControlInformation.go b/plc4go/protocols/cbus/readwrite/model/NetworkProtocolControlInformation.go index 0f82677dbbb..95eced9ac55 100644 --- a/plc4go/protocols/cbus/readwrite/model/NetworkProtocolControlInformation.go +++ b/plc4go/protocols/cbus/readwrite/model/NetworkProtocolControlInformation.go @@ -130,7 +130,7 @@ func NetworkProtocolControlInformationParse(readBuffer utils.ReadBuffer) (Networ log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x0), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/cbus/readwrite/model/NetworkRoute.go b/plc4go/protocols/cbus/readwrite/model/NetworkRoute.go index cc2d69b0af0..51d4ef0aaf6 100644 --- a/plc4go/protocols/cbus/readwrite/model/NetworkRoute.go +++ b/plc4go/protocols/cbus/readwrite/model/NetworkRoute.go @@ -22,6 +22,7 @@ package model import ( "github.com/apache/plc4x/plc4go/internal/spi/utils" "github.com/pkg/errors" + "github.com/rs/zerolog/log" ) // Code generated by code-generation. DO NOT EDIT. @@ -30,6 +31,8 @@ import ( type NetworkRoute interface { utils.LengthAware utils.Serializable + // GetReverseRouteType returns ReverseRouteType (property field) + GetReverseRouteType() RouteType // GetRouteType returns RouteType (property field) GetRouteType() RouteType // GetAdditionalBridgeAddresses returns AdditionalBridgeAddresses (property field) @@ -45,6 +48,7 @@ type NetworkRouteExactly interface { // _NetworkRoute is the data-structure of this message type _NetworkRoute struct { + ReverseRouteType RouteType RouteType RouteType AdditionalBridgeAddresses []BridgeAddress } @@ -54,6 +58,10 @@ type _NetworkRoute struct { /////////////////////// Accessors for property fields. /////////////////////// +func (m *_NetworkRoute) GetReverseRouteType() RouteType { + return m.ReverseRouteType +} + func (m *_NetworkRoute) GetRouteType() RouteType { return m.RouteType } @@ -68,8 +76,8 @@ func (m *_NetworkRoute) GetAdditionalBridgeAddresses() []BridgeAddress { /////////////////////////////////////////////////////////// // NewNetworkRoute factory function for _NetworkRoute -func NewNetworkRoute(routeType RouteType, additionalBridgeAddresses []BridgeAddress) *_NetworkRoute { - return &_NetworkRoute{RouteType: routeType, AdditionalBridgeAddresses: additionalBridgeAddresses} +func NewNetworkRoute(reverseRouteType RouteType, routeType RouteType, additionalBridgeAddresses []BridgeAddress) *_NetworkRoute { + return &_NetworkRoute{ReverseRouteType: reverseRouteType, RouteType: routeType, AdditionalBridgeAddresses: additionalBridgeAddresses} } // Deprecated: use the interface for direct cast @@ -94,8 +102,14 @@ func (m *_NetworkRoute) GetLengthInBits() uint16 { func (m *_NetworkRoute) GetLengthInBitsConditional(lastItem bool) uint16 { lengthInBits := uint16(0) + // Reserved Field (reserved) + lengthInBits += 2 + + // Simple field (reverseRouteType) + lengthInBits += 3 + // Simple field (routeType) - lengthInBits += 8 + lengthInBits += 3 // Array field if len(m.AdditionalBridgeAddresses) > 0 { @@ -121,6 +135,33 @@ func NetworkRouteParse(readBuffer utils.ReadBuffer) (NetworkRoute, error) { currentPos := positionAware.GetPos() _ = currentPos + // Reserved Field (Compartmentalized so the "reserved" variable can't leak) + { + reserved, _err := readBuffer.ReadUint8("reserved", 2) + if _err != nil { + return nil, errors.Wrap(_err, "Error parsing 'reserved' field") + } + if reserved != uint8(0x00) { + log.Info().Fields(map[string]interface{}{ + "expected value": uint8(0x00), + "got value": reserved, + }).Msg("Got unexpected response for reserved field.") + } + } + + // Simple Field (reverseRouteType) + if pullErr := readBuffer.PullContext("reverseRouteType"); pullErr != nil { + return nil, errors.Wrap(pullErr, "Error pulling for reverseRouteType") + } + _reverseRouteType, _reverseRouteTypeErr := RouteTypeParse(readBuffer) + if _reverseRouteTypeErr != nil { + return nil, errors.Wrap(_reverseRouteTypeErr, "Error parsing 'reverseRouteType' field") + } + reverseRouteType := _reverseRouteType + if closeErr := readBuffer.CloseContext("reverseRouteType"); closeErr != nil { + return nil, errors.Wrap(closeErr, "Error closing for reverseRouteType") + } + // Simple Field (routeType) if pullErr := readBuffer.PullContext("routeType"); pullErr != nil { return nil, errors.Wrap(pullErr, "Error pulling for routeType") @@ -162,7 +203,7 @@ func NetworkRouteParse(readBuffer utils.ReadBuffer) (NetworkRoute, error) { } // Create the instance - return NewNetworkRoute(routeType, additionalBridgeAddresses), nil + return NewNetworkRoute(reverseRouteType, routeType, additionalBridgeAddresses), nil } func (m *_NetworkRoute) Serialize(writeBuffer utils.WriteBuffer) error { @@ -172,6 +213,26 @@ func (m *_NetworkRoute) Serialize(writeBuffer utils.WriteBuffer) error { return errors.Wrap(pushErr, "Error pushing for NetworkRoute") } + // Reserved Field (reserved) + { + _err := writeBuffer.WriteUint8("reserved", 2, uint8(0x00)) + if _err != nil { + return errors.Wrap(_err, "Error serializing 'reserved' field") + } + } + + // Simple Field (reverseRouteType) + if pushErr := writeBuffer.PushContext("reverseRouteType"); pushErr != nil { + return errors.Wrap(pushErr, "Error pushing for reverseRouteType") + } + _reverseRouteTypeErr := writeBuffer.WriteSerializable(m.GetReverseRouteType()) + if popErr := writeBuffer.PopContext("reverseRouteType"); popErr != nil { + return errors.Wrap(popErr, "Error popping for reverseRouteType") + } + if _reverseRouteTypeErr != nil { + return errors.Wrap(_reverseRouteTypeErr, "Error serializing 'reverseRouteType' field") + } + // Simple Field (routeType) if pushErr := writeBuffer.PushContext("routeType"); pushErr != nil { return errors.Wrap(pushErr, "Error pushing for routeType") diff --git a/plc4go/protocols/cbus/readwrite/model/ReplyNetwork.go b/plc4go/protocols/cbus/readwrite/model/ReplyNetwork.go index 0ad642c14fe..0470e4e8cc2 100644 --- a/plc4go/protocols/cbus/readwrite/model/ReplyNetwork.go +++ b/plc4go/protocols/cbus/readwrite/model/ReplyNetwork.go @@ -102,7 +102,7 @@ func (m *_ReplyNetwork) GetLengthInBitsConditional(lastItem bool) uint16 { lengthInBits := uint16(0) // Simple field (routeType) - lengthInBits += 8 + lengthInBits += 3 // Array field if len(m.AdditionalBridgeAddresses) > 0 { diff --git a/plc4go/protocols/cbus/readwrite/model/RouteType.go b/plc4go/protocols/cbus/readwrite/model/RouteType.go index e6668bb947a..4982a95bba2 100644 --- a/plc4go/protocols/cbus/readwrite/model/RouteType.go +++ b/plc4go/protocols/cbus/readwrite/model/RouteType.go @@ -27,7 +27,7 @@ import ( // Code generated by code-generation. DO NOT EDIT. // RouteType is an enum -type RouteType byte +type RouteType uint8 type IRouteType interface { AdditionalBridges() uint8 @@ -35,13 +35,14 @@ type IRouteType interface { } const ( - RouteType_NoBridgeAtAll RouteType = 0x00 - RouteType_NoAdditionalBridge RouteType = 0x09 - RouteType_OneAdditionalBridge RouteType = 0x12 - RouteType_TwoAdditionalBridge RouteType = 0x1B - RouteType_ThreeAdditionalBridge RouteType = 0x24 - RouteType_FourAdditionalBridge RouteType = 0x2D - RouteType_FiveAdditionalBridge RouteType = 0x36 + RouteType_NoBridgeAtAll RouteType = 0x0 + RouteType_NoAdditionalBridge RouteType = 0x1 + RouteType_OneAdditionalBridge RouteType = 0x2 + RouteType_TwoAdditionalBridge RouteType = 0x3 + RouteType_ThreeAdditionalBridge RouteType = 0x4 + RouteType_FourAdditionalBridge RouteType = 0x5 + RouteType_FiveAdditionalBridge RouteType = 0x6 + RouteType_SixAdditionalBridge RouteType = 0x7 ) var RouteTypeValues []RouteType @@ -56,39 +57,44 @@ func init() { RouteType_ThreeAdditionalBridge, RouteType_FourAdditionalBridge, RouteType_FiveAdditionalBridge, + RouteType_SixAdditionalBridge, } } func (e RouteType) AdditionalBridges() uint8 { switch e { - case 0x00: - { /* '0x00' */ + case 0x0: + { /* '0x0' */ return 0 } - case 0x09: - { /* '0x09' */ + case 0x1: + { /* '0x1' */ return 0 } - case 0x12: - { /* '0x12' */ + case 0x2: + { /* '0x2' */ return 1 } - case 0x1B: - { /* '0x1B' */ + case 0x3: + { /* '0x3' */ return 2 } - case 0x24: - { /* '0x24' */ + case 0x4: + { /* '0x4' */ return 3 } - case 0x2D: - { /* '0x2D' */ + case 0x5: + { /* '0x5' */ return 4 } - case 0x36: - { /* '0x36' */ + case 0x6: + { /* '0x6' */ return 5 } + case 0x7: + { /* '0x7' */ + return 6 + } default: { return 0 @@ -104,22 +110,24 @@ func RouteTypeFirstEnumForFieldAdditionalBridges(value uint8) (RouteType, error) } return 0, errors.Errorf("enum for %v describing AdditionalBridges not found", value) } -func RouteTypeByValue(value byte) RouteType { +func RouteTypeByValue(value uint8) RouteType { switch value { - case 0x00: + case 0x0: return RouteType_NoBridgeAtAll - case 0x09: + case 0x1: return RouteType_NoAdditionalBridge - case 0x12: + case 0x2: return RouteType_OneAdditionalBridge - case 0x1B: + case 0x3: return RouteType_TwoAdditionalBridge - case 0x24: + case 0x4: return RouteType_ThreeAdditionalBridge - case 0x2D: + case 0x5: return RouteType_FourAdditionalBridge - case 0x36: + case 0x6: return RouteType_FiveAdditionalBridge + case 0x7: + return RouteType_SixAdditionalBridge } return 0 } @@ -141,6 +149,8 @@ func RouteTypeByName(value string) (enum RouteType, ok bool) { enum = RouteType_FourAdditionalBridge case "FiveAdditionalBridge": enum = RouteType_FiveAdditionalBridge + case "SixAdditionalBridge": + enum = RouteType_SixAdditionalBridge default: enum = 0 ok = false @@ -148,9 +158,9 @@ func RouteTypeByName(value string) (enum RouteType, ok bool) { return } -func RouteTypeKnows(value byte) bool { +func RouteTypeKnows(value uint8) bool { for _, typeValue := range RouteTypeValues { - if byte(typeValue) == value { + if uint8(typeValue) == value { return true } } @@ -168,7 +178,7 @@ func CastRouteType(structType interface{}) RouteType { } func (m RouteType) GetLengthInBits() uint16 { - return 8 + return 3 } func (m RouteType) GetLengthInBytes() uint16 { @@ -176,7 +186,7 @@ func (m RouteType) GetLengthInBytes() uint16 { } func RouteTypeParse(readBuffer utils.ReadBuffer) (RouteType, error) { - val, err := readBuffer.ReadByte("RouteType") + val, err := readBuffer.ReadUint8("RouteType", 3) if err != nil { return 0, nil } @@ -184,7 +194,7 @@ func RouteTypeParse(readBuffer utils.ReadBuffer) (RouteType, error) { } func (e RouteType) Serialize(writeBuffer utils.WriteBuffer) error { - return writeBuffer.WriteByte("RouteType", byte(e), utils.WithAdditionalStringRepresentation(e.PLC4XEnumName())) + return writeBuffer.WriteUint8("RouteType", 3, uint8(e), utils.WithAdditionalStringRepresentation(e.PLC4XEnumName())) } // PLC4XEnumName returns the name that is used in code to identify this enum @@ -204,6 +214,8 @@ func (e RouteType) PLC4XEnumName() string { return "FourAdditionalBridge" case RouteType_FiveAdditionalBridge: return "FiveAdditionalBridge" + case RouteType_SixAdditionalBridge: + return "SixAdditionalBridge" } return "" } diff --git a/plc4go/protocols/cbus/readwrite/model/StatusHeader.go b/plc4go/protocols/cbus/readwrite/model/StatusHeader.go index 122cfd261d3..09c62b64899 100644 --- a/plc4go/protocols/cbus/readwrite/model/StatusHeader.go +++ b/plc4go/protocols/cbus/readwrite/model/StatusHeader.go @@ -120,7 +120,7 @@ func StatusHeaderParse(readBuffer utils.ReadBuffer) (StatusHeader, error) { log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x3), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/cbus/readwrite/model/StatusRequestBinaryState.go b/plc4go/protocols/cbus/readwrite/model/StatusRequestBinaryState.go index 1f6fe3c684d..ec4ce3a1b70 100644 --- a/plc4go/protocols/cbus/readwrite/model/StatusRequestBinaryState.go +++ b/plc4go/protocols/cbus/readwrite/model/StatusRequestBinaryState.go @@ -148,7 +148,7 @@ func StatusRequestBinaryStateParse(readBuffer utils.ReadBuffer) (StatusRequestBi log.Info().Fields(map[string]interface{}{ "expected value": byte(0x7A), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -169,7 +169,7 @@ func StatusRequestBinaryStateParse(readBuffer utils.ReadBuffer) (StatusRequestBi log.Info().Fields(map[string]interface{}{ "expected value": byte(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/cbus/readwrite/model/StatusRequestLevel.go b/plc4go/protocols/cbus/readwrite/model/StatusRequestLevel.go index c2663b429ac..8418fe567c5 100644 --- a/plc4go/protocols/cbus/readwrite/model/StatusRequestLevel.go +++ b/plc4go/protocols/cbus/readwrite/model/StatusRequestLevel.go @@ -159,7 +159,7 @@ func StatusRequestLevelParse(readBuffer utils.ReadBuffer) (StatusRequestLevel, e log.Info().Fields(map[string]interface{}{ "expected value": byte(0x73), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -173,7 +173,7 @@ func StatusRequestLevelParse(readBuffer utils.ReadBuffer) (StatusRequestLevel, e log.Info().Fields(map[string]interface{}{ "expected value": byte(0x07), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/eip/readwrite/model/CipRRData.go b/plc4go/protocols/eip/readwrite/model/CipRRData.go index 2c0c87e9927..1319fb1aceb 100644 --- a/plc4go/protocols/eip/readwrite/model/CipRRData.go +++ b/plc4go/protocols/eip/readwrite/model/CipRRData.go @@ -158,7 +158,7 @@ func CipRRDataParse(readBuffer utils.ReadBuffer, packetLength uint16) (CipRRData log.Info().Fields(map[string]interface{}{ "expected value": uint32(0x00000000), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -172,7 +172,7 @@ func CipRRDataParse(readBuffer utils.ReadBuffer, packetLength uint16) (CipRRData log.Info().Fields(map[string]interface{}{ "expected value": uint16(0x0000), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/eip/readwrite/model/CipReadResponse.go b/plc4go/protocols/eip/readwrite/model/CipReadResponse.go index 40e22f0ffb5..726af52bdb5 100644 --- a/plc4go/protocols/eip/readwrite/model/CipReadResponse.go +++ b/plc4go/protocols/eip/readwrite/model/CipReadResponse.go @@ -182,7 +182,7 @@ func CipReadResponseParse(readBuffer utils.ReadBuffer, serviceLen uint16) (CipRe log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/eip/readwrite/model/CipUnconnectedRequest.go b/plc4go/protocols/eip/readwrite/model/CipUnconnectedRequest.go index f57c8ae10c1..31d101c6a44 100644 --- a/plc4go/protocols/eip/readwrite/model/CipUnconnectedRequest.go +++ b/plc4go/protocols/eip/readwrite/model/CipUnconnectedRequest.go @@ -207,7 +207,7 @@ func CipUnconnectedRequestParse(readBuffer utils.ReadBuffer, serviceLen uint16) log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x02), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -221,7 +221,7 @@ func CipUnconnectedRequestParse(readBuffer utils.ReadBuffer, serviceLen uint16) log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x20), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -235,7 +235,7 @@ func CipUnconnectedRequestParse(readBuffer utils.ReadBuffer, serviceLen uint16) log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x06), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -249,7 +249,7 @@ func CipUnconnectedRequestParse(readBuffer utils.ReadBuffer, serviceLen uint16) log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x24), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -263,7 +263,7 @@ func CipUnconnectedRequestParse(readBuffer utils.ReadBuffer, serviceLen uint16) log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x01), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -277,7 +277,7 @@ func CipUnconnectedRequestParse(readBuffer utils.ReadBuffer, serviceLen uint16) log.Info().Fields(map[string]interface{}{ "expected value": uint16(0x9D05), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/eip/readwrite/model/CipWriteResponse.go b/plc4go/protocols/eip/readwrite/model/CipWriteResponse.go index 488b31b4ba2..d06b46212d0 100644 --- a/plc4go/protocols/eip/readwrite/model/CipWriteResponse.go +++ b/plc4go/protocols/eip/readwrite/model/CipWriteResponse.go @@ -158,7 +158,7 @@ func CipWriteResponseParse(readBuffer utils.ReadBuffer, serviceLen uint16) (CipW log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/eip/readwrite/model/MultipleServiceResponse.go b/plc4go/protocols/eip/readwrite/model/MultipleServiceResponse.go index 09826421676..3ccf2288788 100644 --- a/plc4go/protocols/eip/readwrite/model/MultipleServiceResponse.go +++ b/plc4go/protocols/eip/readwrite/model/MultipleServiceResponse.go @@ -195,7 +195,7 @@ func MultipleServiceResponseParse(readBuffer utils.ReadBuffer, serviceLen uint16 log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x0), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/firmata/readwrite/model/FirmataCommandSetDigitalPinValue.go b/plc4go/protocols/firmata/readwrite/model/FirmataCommandSetDigitalPinValue.go index 47f8a2db2b5..3f2ca0c49a8 100644 --- a/plc4go/protocols/firmata/readwrite/model/FirmataCommandSetDigitalPinValue.go +++ b/plc4go/protocols/firmata/readwrite/model/FirmataCommandSetDigitalPinValue.go @@ -165,7 +165,7 @@ func FirmataCommandSetDigitalPinValueParse(readBuffer utils.ReadBuffer, response log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/firmata/readwrite/model/FirmataCommandSysex.go b/plc4go/protocols/firmata/readwrite/model/FirmataCommandSysex.go index 3e394626d50..7bd64e114fe 100644 --- a/plc4go/protocols/firmata/readwrite/model/FirmataCommandSysex.go +++ b/plc4go/protocols/firmata/readwrite/model/FirmataCommandSysex.go @@ -160,7 +160,7 @@ func FirmataCommandSysexParse(readBuffer utils.ReadBuffer, response bool) (Firma log.Info().Fields(map[string]interface{}{ "expected value": uint8(0xF7), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/firmata/readwrite/model/FirmataMessageSubscribeAnalogPinValue.go b/plc4go/protocols/firmata/readwrite/model/FirmataMessageSubscribeAnalogPinValue.go index e233f956d4e..f9c5a28c799 100644 --- a/plc4go/protocols/firmata/readwrite/model/FirmataMessageSubscribeAnalogPinValue.go +++ b/plc4go/protocols/firmata/readwrite/model/FirmataMessageSubscribeAnalogPinValue.go @@ -165,7 +165,7 @@ func FirmataMessageSubscribeAnalogPinValueParse(readBuffer utils.ReadBuffer, res log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/firmata/readwrite/model/FirmataMessageSubscribeDigitalPinValue.go b/plc4go/protocols/firmata/readwrite/model/FirmataMessageSubscribeDigitalPinValue.go index 8cc26dcb090..242c07a55d5 100644 --- a/plc4go/protocols/firmata/readwrite/model/FirmataMessageSubscribeDigitalPinValue.go +++ b/plc4go/protocols/firmata/readwrite/model/FirmataMessageSubscribeDigitalPinValue.go @@ -165,7 +165,7 @@ func FirmataMessageSubscribeDigitalPinValueParse(readBuffer utils.ReadBuffer, re log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtPropertyDescriptionResponse.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtPropertyDescriptionResponse.go index 90f726996eb..21d74987963 100644 --- a/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtPropertyDescriptionResponse.go +++ b/plc4go/protocols/knxnetip/readwrite/model/ApduDataExtPropertyDescriptionResponse.go @@ -255,7 +255,7 @@ func ApduDataExtPropertyDescriptionResponseParse(readBuffer utils.ReadBuffer, le log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x0), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -282,7 +282,7 @@ func ApduDataExtPropertyDescriptionResponseParse(readBuffer utils.ReadBuffer, le log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x0), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/knxnetip/readwrite/model/ApduDataGroupValueRead.go b/plc4go/protocols/knxnetip/readwrite/model/ApduDataGroupValueRead.go index 9be7883b164..1828eddac8c 100644 --- a/plc4go/protocols/knxnetip/readwrite/model/ApduDataGroupValueRead.go +++ b/plc4go/protocols/knxnetip/readwrite/model/ApduDataGroupValueRead.go @@ -126,7 +126,7 @@ func ApduDataGroupValueReadParse(readBuffer utils.ReadBuffer, dataLength uint8) log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/knxnetip/readwrite/model/ConnectionRequestInformationTunnelConnection.go b/plc4go/protocols/knxnetip/readwrite/model/ConnectionRequestInformationTunnelConnection.go index 601a64f293b..d0fb76883c4 100644 --- a/plc4go/protocols/knxnetip/readwrite/model/ConnectionRequestInformationTunnelConnection.go +++ b/plc4go/protocols/knxnetip/readwrite/model/ConnectionRequestInformationTunnelConnection.go @@ -161,7 +161,7 @@ func ConnectionRequestInformationTunnelConnectionParse(readBuffer utils.ReadBuff log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/knxnetip/readwrite/model/ConnectionStateRequest.go b/plc4go/protocols/knxnetip/readwrite/model/ConnectionStateRequest.go index 5f53aac4aa3..822510cdd88 100644 --- a/plc4go/protocols/knxnetip/readwrite/model/ConnectionStateRequest.go +++ b/plc4go/protocols/knxnetip/readwrite/model/ConnectionStateRequest.go @@ -165,7 +165,7 @@ func ConnectionStateRequestParse(readBuffer utils.ReadBuffer) (ConnectionStateRe log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/knxnetip/readwrite/model/DeviceConfigurationRequestDataBlock.go b/plc4go/protocols/knxnetip/readwrite/model/DeviceConfigurationRequestDataBlock.go index c65d0d32e6f..eff3399a6f5 100644 --- a/plc4go/protocols/knxnetip/readwrite/model/DeviceConfigurationRequestDataBlock.go +++ b/plc4go/protocols/knxnetip/readwrite/model/DeviceConfigurationRequestDataBlock.go @@ -154,7 +154,7 @@ func DeviceConfigurationRequestDataBlockParse(readBuffer utils.ReadBuffer) (Devi log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/knxnetip/readwrite/model/DeviceStatus.go b/plc4go/protocols/knxnetip/readwrite/model/DeviceStatus.go index ffc7a15e7ea..b7b8cfe6be4 100644 --- a/plc4go/protocols/knxnetip/readwrite/model/DeviceStatus.go +++ b/plc4go/protocols/knxnetip/readwrite/model/DeviceStatus.go @@ -120,7 +120,7 @@ func DeviceStatusParse(readBuffer utils.ReadBuffer) (DeviceStatus, error) { log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/knxnetip/readwrite/model/DisconnectRequest.go b/plc4go/protocols/knxnetip/readwrite/model/DisconnectRequest.go index c6f06162940..f803f00baea 100644 --- a/plc4go/protocols/knxnetip/readwrite/model/DisconnectRequest.go +++ b/plc4go/protocols/knxnetip/readwrite/model/DisconnectRequest.go @@ -165,7 +165,7 @@ func DisconnectRequestParse(readBuffer utils.ReadBuffer) (DisconnectRequest, err log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType1.go b/plc4go/protocols/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType1.go index 43ff2179073..bf81df07ab1 100644 --- a/plc4go/protocols/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType1.go +++ b/plc4go/protocols/knxnetip/readwrite/model/GroupObjectDescriptorRealisationType1.go @@ -197,7 +197,7 @@ func GroupObjectDescriptorRealisationType1Parse(readBuffer utils.ReadBuffer) (Gr log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x1), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go b/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go index 1d4fe0113f2..6f5d1db5d4d 100644 --- a/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go +++ b/plc4go/protocols/knxnetip/readwrite/model/KnxManufacturer.go @@ -628,8 +628,9 @@ const ( KnxManufacturer_M_ARIGO_SOFTWARE_GMBH KnxManufacturer = 589 KnxManufacturer_M_FEISHELEC KnxManufacturer = 590 KnxManufacturer_M_GORDIC KnxManufacturer = 591 - KnxManufacturer_M_ABB___RESERVED KnxManufacturer = 592 - KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED KnxManufacturer = 593 + KnxManufacturer_M_DELTA_ELECTRONICS KnxManufacturer = 592 + KnxManufacturer_M_ABB___RESERVED KnxManufacturer = 593 + KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED KnxManufacturer = 594 ) var KnxManufacturerValues []KnxManufacturer @@ -1229,6 +1230,7 @@ func init() { KnxManufacturer_M_ARIGO_SOFTWARE_GMBH, KnxManufacturer_M_FEISHELEC, KnxManufacturer_M_GORDIC, + KnxManufacturer_M_DELTA_ELECTRONICS, KnxManufacturer_M_ABB___RESERVED, KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED, } @@ -3430,10 +3432,14 @@ func (e KnxManufacturer) Number() uint16 { } case 592: { /* '592' */ - return 43954 + return 650 } case 593: { /* '593' */ + return 43954 + } + case 594: + { /* '594' */ return 43959 } case 6: @@ -5824,10 +5830,14 @@ func (e KnxManufacturer) Name() string { } case 592: { /* '592' */ - return "ABB - reserved" + return "Delta Electronics" } case 593: { /* '593' */ + return "ABB - reserved" + } + case 594: + { /* '594' */ return "Busch-Jaeger Elektro - reserved" } case 6: @@ -7120,8 +7130,10 @@ func KnxManufacturerByValue(value uint16) KnxManufacturer { case 591: return KnxManufacturer_M_GORDIC case 592: - return KnxManufacturer_M_ABB___RESERVED + return KnxManufacturer_M_DELTA_ELECTRONICS case 593: + return KnxManufacturer_M_ABB___RESERVED + case 594: return KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED case 6: return KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO @@ -8314,6 +8326,8 @@ func KnxManufacturerByName(value string) (enum KnxManufacturer, ok bool) { enum = KnxManufacturer_M_FEISHELEC case "M_GORDIC": enum = KnxManufacturer_M_GORDIC + case "M_DELTA_ELECTRONICS": + enum = KnxManufacturer_M_DELTA_ELECTRONICS case "M_ABB___RESERVED": enum = KnxManufacturer_M_ABB___RESERVED case "M_BUSCH_JAEGER_ELEKTRO___RESERVED": @@ -9551,6 +9565,8 @@ func (e KnxManufacturer) PLC4XEnumName() string { return "M_FEISHELEC" case KnxManufacturer_M_GORDIC: return "M_GORDIC" + case KnxManufacturer_M_DELTA_ELECTRONICS: + return "M_DELTA_ELECTRONICS" case KnxManufacturer_M_ABB___RESERVED: return "M_ABB___RESERVED" case KnxManufacturer_M_BUSCH_JAEGER_ELEKTRO___RESERVED: diff --git a/plc4go/protocols/knxnetip/readwrite/model/LPollData.go b/plc4go/protocols/knxnetip/readwrite/model/LPollData.go index 8c0e1eb75cc..4b705145405 100644 --- a/plc4go/protocols/knxnetip/readwrite/model/LPollData.go +++ b/plc4go/protocols/knxnetip/readwrite/model/LPollData.go @@ -200,7 +200,7 @@ func LPollDataParse(readBuffer utils.ReadBuffer) (LPollData, error) { log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/knxnetip/readwrite/model/TunnelingRequestDataBlock.go b/plc4go/protocols/knxnetip/readwrite/model/TunnelingRequestDataBlock.go index b2527ed604f..4f244296f32 100644 --- a/plc4go/protocols/knxnetip/readwrite/model/TunnelingRequestDataBlock.go +++ b/plc4go/protocols/knxnetip/readwrite/model/TunnelingRequestDataBlock.go @@ -154,7 +154,7 @@ func TunnelingRequestDataBlockParse(readBuffer utils.ReadBuffer) (TunnelingReque log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/s7/readwrite/model/AlarmMessageObjectQueryType.go b/plc4go/protocols/s7/readwrite/model/AlarmMessageObjectQueryType.go index a7d7707e321..f1c877d3d34 100644 --- a/plc4go/protocols/s7/readwrite/model/AlarmMessageObjectQueryType.go +++ b/plc4go/protocols/s7/readwrite/model/AlarmMessageObjectQueryType.go @@ -217,7 +217,7 @@ func AlarmMessageObjectQueryTypeParse(readBuffer utils.ReadBuffer) (AlarmMessage log.Info().Fields(map[string]interface{}{ "expected value": uint16(0x0000), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/s7/readwrite/model/S7AddressAny.go b/plc4go/protocols/s7/readwrite/model/S7AddressAny.go index 23ccf2312da..b858e6ad000 100644 --- a/plc4go/protocols/s7/readwrite/model/S7AddressAny.go +++ b/plc4go/protocols/s7/readwrite/model/S7AddressAny.go @@ -245,7 +245,7 @@ func S7AddressAnyParse(readBuffer utils.ReadBuffer) (S7AddressAny, error) { log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/s7/readwrite/model/S7Message.go b/plc4go/protocols/s7/readwrite/model/S7Message.go index 6652ccb107b..61372779d72 100644 --- a/plc4go/protocols/s7/readwrite/model/S7Message.go +++ b/plc4go/protocols/s7/readwrite/model/S7Message.go @@ -208,7 +208,7 @@ func S7MessageParse(readBuffer utils.ReadBuffer) (S7Message, error) { log.Info().Fields(map[string]interface{}{ "expected value": uint16(0x0000), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/s7/readwrite/model/S7MessageObjectRequest.go b/plc4go/protocols/s7/readwrite/model/S7MessageObjectRequest.go index 403544f02a8..2bccab8f7ff 100644 --- a/plc4go/protocols/s7/readwrite/model/S7MessageObjectRequest.go +++ b/plc4go/protocols/s7/readwrite/model/S7MessageObjectRequest.go @@ -231,7 +231,7 @@ func S7MessageObjectRequestParse(readBuffer utils.ReadBuffer, cpuFunctionType ui log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -258,7 +258,7 @@ func S7MessageObjectRequestParse(readBuffer utils.ReadBuffer, cpuFunctionType ui log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x34), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/s7/readwrite/model/S7MessageObjectResponse.go b/plc4go/protocols/s7/readwrite/model/S7MessageObjectResponse.go index 351c849580d..844ae964621 100644 --- a/plc4go/protocols/s7/readwrite/model/S7MessageObjectResponse.go +++ b/plc4go/protocols/s7/readwrite/model/S7MessageObjectResponse.go @@ -184,7 +184,7 @@ func S7MessageObjectResponseParse(readBuffer utils.ReadBuffer, cpuFunctionType u log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/s7/readwrite/model/S7ParameterModeTransition.go b/plc4go/protocols/s7/readwrite/model/S7ParameterModeTransition.go index d49ffffd531..37d75455b63 100644 --- a/plc4go/protocols/s7/readwrite/model/S7ParameterModeTransition.go +++ b/plc4go/protocols/s7/readwrite/model/S7ParameterModeTransition.go @@ -198,7 +198,7 @@ func S7ParameterModeTransitionParse(readBuffer utils.ReadBuffer, messageType uin log.Info().Fields(map[string]interface{}{ "expected value": uint16(0x0010), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/s7/readwrite/model/S7ParameterSetupCommunication.go b/plc4go/protocols/s7/readwrite/model/S7ParameterSetupCommunication.go index 6c89aeaa800..b67aeb57e31 100644 --- a/plc4go/protocols/s7/readwrite/model/S7ParameterSetupCommunication.go +++ b/plc4go/protocols/s7/readwrite/model/S7ParameterSetupCommunication.go @@ -173,7 +173,7 @@ func S7ParameterSetupCommunicationParse(readBuffer utils.ReadBuffer, messageType log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionAlarmQuery.go b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionAlarmQuery.go index 5b2d77849dc..6dbcc9256d0 100644 --- a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionAlarmQuery.go +++ b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionAlarmQuery.go @@ -276,7 +276,7 @@ func S7PayloadUserDataItemCpuFunctionAlarmQueryParse(readBuffer utils.ReadBuffer log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } @@ -303,7 +303,7 @@ func S7PayloadUserDataItemCpuFunctionAlarmQueryParse(readBuffer utils.ReadBuffer log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x34), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionAlarmQueryResponse.go b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionAlarmQueryResponse.go index 76abf307397..477d96cfbed 100644 --- a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionAlarmQueryResponse.go +++ b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionAlarmQueryResponse.go @@ -241,7 +241,7 @@ func S7PayloadUserDataItemCpuFunctionAlarmQueryResponseParse(readBuffer utils.Re log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionMsgSubscription.go b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionMsgSubscription.go index 013783ceddc..7a85987bfd3 100644 --- a/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionMsgSubscription.go +++ b/plc4go/protocols/s7/readwrite/model/S7PayloadUserDataItemCpuFunctionMsgSubscription.go @@ -202,7 +202,7 @@ func S7PayloadUserDataItemCpuFunctionMsgSubscriptionParse(readBuffer utils.ReadB log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/protocols/s7/readwrite/model/TPKTPacket.go b/plc4go/protocols/s7/readwrite/model/TPKTPacket.go index b10eac434df..0b3bb655272 100644 --- a/plc4go/protocols/s7/readwrite/model/TPKTPacket.go +++ b/plc4go/protocols/s7/readwrite/model/TPKTPacket.go @@ -152,7 +152,7 @@ func TPKTPacketParse(readBuffer utils.ReadBuffer) (TPKTPacket, error) { log.Info().Fields(map[string]interface{}{ "expected value": uint8(0x00), "got value": reserved, - }).Msg("Got unexpected response.") + }).Msg("Got unexpected response for reserved field.") } } diff --git a/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go b/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go index ee664478202..f76151fb402 100644 --- a/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go +++ b/plc4go/tools/plc4xpcapanalyzer/internal/analyzer/analyzer.go @@ -24,6 +24,7 @@ import ( "fmt" "github.com/apache/plc4x/plc4go/tools/plc4xpcapanalyzer/internal/bacnetanalyzer" "github.com/apache/plc4x/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer" + "github.com/apache/plc4x/plc4go/tools/plc4xpcapanalyzer/internal/common" "github.com/apache/plc4x/plc4go/tools/plc4xpcapanalyzer/internal/pcaphandler" "github.com/k0kubun/go-ansi" "github.com/rs/zerolog/log" @@ -38,7 +39,7 @@ func Analyze(pcapFile, protocolType, filter string, onlyParse, noBytesCompare bo defer handle.Close() log.Debug().Interface("handle", handle).Int("numberOfPackage", numberOfPackage).Msg("got handle") source := pcaphandler.GetPacketSource(handle) - var packageParse func(string, []byte) (interface{}, error) + var packageParse func(common.PacketInformation, []byte) (interface{}, error) var serializePackage func(interface{}) ([]byte, error) switch protocolType { case "bacnet": @@ -70,16 +71,18 @@ func Analyze(pcapFile, protocolType, filter string, onlyParse, noBytesCompare bo } packetTimestamp := packet.Metadata().Timestamp realPacketNumber := timestampToIndexMap[packetTimestamp] - packetInformation := fmt.Sprintf("%s: [%d] timestamp: %v", pcapFile, realPacketNumber, packetTimestamp) + description := fmt.Sprintf("%s: [%d] timestamp: %v", pcapFile, realPacketNumber, packetTimestamp) applicationLayer := packet.ApplicationLayer() if applicationLayer == nil { - log.Info().Str("packetInformation", packetInformation).Msg("No application layer") + log.Info().Str("packetInformation", description).Msg("No application layer") continue } + // TODO: extract ips if available + packetInformation := common.PacketInformation{Description: description} payload := applicationLayer.Payload() if parsed, err := packageParse(packetInformation, payload); err != nil { // TODO: write report to xml or something - log.Warn().Str("packetInformation", packetInformation).Err(err).Msg("Error parsing package") + log.Warn().Str("packetInformation", description).Err(err).Msg("Error parsing package") continue } else { if onlyParse { @@ -89,7 +92,7 @@ func Analyze(pcapFile, protocolType, filter string, onlyParse, noBytesCompare bo serializedBytes, err := serializePackage(parsed) if err != nil { // TODO: write report to xml or something - log.Warn().Str("packetInformation", packetInformation).Err(err).Msg("Error serializing") + log.Warn().Str("packetInformation", description).Err(err).Msg("Error serializing") continue } if noBytesCompare { diff --git a/plc4go/tools/plc4xpcapanalyzer/internal/bacnetanalyzer/analyzer.go b/plc4go/tools/plc4xpcapanalyzer/internal/bacnetanalyzer/analyzer.go index 46de7068db0..f614ae435e2 100644 --- a/plc4go/tools/plc4xpcapanalyzer/internal/bacnetanalyzer/analyzer.go +++ b/plc4go/tools/plc4xpcapanalyzer/internal/bacnetanalyzer/analyzer.go @@ -22,11 +22,12 @@ package bacnetanalyzer import ( "github.com/apache/plc4x/plc4go/internal/spi/utils" "github.com/apache/plc4x/plc4go/protocols/bacnetip/readwrite/model" + "github.com/apache/plc4x/plc4go/tools/plc4xpcapanalyzer/internal/common" "github.com/pkg/errors" "github.com/rs/zerolog/log" ) -func PackageParse(packetInformation string, payload []byte) (interface{}, error) { +func PackageParse(packetInformation common.PacketInformation, payload []byte) (interface{}, error) { log.Debug().Msgf("Parsing %s", packetInformation) parse, err := model.BVLCParse(utils.NewReadBufferByteBased(payload)) if err != nil { diff --git a/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer/analyzer.go b/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer/analyzer.go index e4a37381b84..9794c076f59 100644 --- a/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer/analyzer.go +++ b/plc4go/tools/plc4xpcapanalyzer/internal/cbusanalyzer/analyzer.go @@ -22,13 +22,15 @@ package cbusanalyzer import ( "github.com/apache/plc4x/plc4go/internal/spi/utils" "github.com/apache/plc4x/plc4go/protocols/cbus/readwrite/model" + "github.com/apache/plc4x/plc4go/tools/plc4xpcapanalyzer/internal/common" "github.com/pkg/errors" "github.com/rs/zerolog/log" ) -func PackageParse(packetInformation string, payload []byte) (interface{}, error) { +func PackageParse(packetInformation common.PacketInformation, payload []byte) (interface{}, error) { log.Debug().Msgf("Parsing %s", packetInformation) - parse, err := model.CBusCommandParse(utils.NewReadBufferByteBased(payload), false) + // TODO: we need a mechanic to identify the reponse. Best case is we define a "host" and the when the host is in the to field we set to true. For the srcchk we pull that out of the config + parse, err := model.CBusMessageParse(utils.NewReadBufferByteBased(payload), false, false) if err != nil { return nil, errors.Wrap(err, "Error parsing CBusCommand") } @@ -37,7 +39,7 @@ func PackageParse(packetInformation string, payload []byte) (interface{}, error) } func SerializePackage(command interface{}) ([]byte, error) { - if command, ok := command.(model.CBusCommand); !ok { + if command, ok := command.(model.CBusMessage); !ok { log.Fatal().Msgf("Unsupported type %T supplied", command) panic("unreachable statement") } else { diff --git a/plc4go/tools/plc4xpcapanalyzer/internal/common/common.go b/plc4go/tools/plc4xpcapanalyzer/internal/common/common.go new file mode 100644 index 00000000000..a6cf2e39102 --- /dev/null +++ b/plc4go/tools/plc4xpcapanalyzer/internal/common/common.go @@ -0,0 +1,24 @@ +/* + * 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 common + +type PacketInformation struct { + Description string +} 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 7ba0b76a1ee..39e776e763e 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 @@ -17,9 +17,21 @@ * under the License. */ - [type CBusConstants - [const uint 16 cbusTcpDefaultPort 10001] - ] +[type CBusConstants + [const uint 16 cbusTcpDefaultPort 10001] +] + +[type CBusMessage(bit response, bit srchk) + // TODO: we need to peek here too + [typeSwitch response + ['false' *ToServer + [simple CBusCommand('srchk') command] + ] + ['true' *ToClient + [simple Confirmation confirmation] + ] + ] +] [discriminatedType CBusCommand(bit srchk) //[const byte initiator 0x5C ] // 0x5C == "/" @@ -132,7 +144,6 @@ [peek byte peekAlpha ] [optional Alpha alpha '(peekAlpha >= 0x67) && (peekAlpha <= 0x7A)' ] // Read if the peeked byte is between 'g' and 'z' [const byte cr 0xD ] // 0xD == "" - [const byte lf 0xA ] // 0xA == "" ] [discriminatedType CBusPointToMultiPointCommand(bit srchk)