You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/07/12 18:12:30 UTC
[plc4x] 02/02: feat(cbus): added parameter relevant types
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit de2ad06146e7e44119630dd1217248b8007446fb
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Jul 12 20:12:21 2022 +0200
feat(cbus): added parameter relevant types
---
plc4go/protocols/cbus/readwrite/ParserHelper.go | 18 ++
plc4go/protocols/cbus/readwrite/XmlParserHelper.go | 18 ++
.../cbus/readwrite/model/ApplicationAddress1.go | 183 ++++++++++++
.../cbus/readwrite/model/ApplicationAddress2.go | 183 ++++++++++++
.../cbus/readwrite/model/BaudRateSelector.go | 161 ++++++++++
.../cbus/readwrite/model/CustomManufacturer.go | 157 ++++++++++
.../protocols/cbus/readwrite/model/CustomTypes.go | 157 ++++++++++
.../cbus/readwrite/model/InterfaceOptions1.go | 328 ++++++++++++++++++++
.../model/InterfaceOptions1PowerUpSettings.go | 168 +++++++++++
.../cbus/readwrite/model/InterfaceOptions2.go | 332 +++++++++++++++++++++
.../cbus/readwrite/model/InterfaceOptions3.go | 330 ++++++++++++++++++++
.../protocols/cbus/readwrite/model/SerialNumber.go | 229 ++++++++++++++
.../src/main/resources/protocols/cbus/c-bus.mspec | 75 +++++
13 files changed, 2339 insertions(+)
diff --git a/plc4go/protocols/cbus/readwrite/ParserHelper.go b/plc4go/protocols/cbus/readwrite/ParserHelper.go
index 6fdb1cdc4..6a3c6dcbe 100644
--- a/plc4go/protocols/cbus/readwrite/ParserHelper.go
+++ b/plc4go/protocols/cbus/readwrite/ParserHelper.go
@@ -35,6 +35,10 @@ func (m CbusParserHelper) Parse(typeName string, arguments []string, io utils.Re
case "CALData":
var requestContext model.RequestContext
return model.CALDataParse(io, requestContext)
+ case "ApplicationAddress2":
+ return model.ApplicationAddress2Parse(io)
+ case "ApplicationAddress1":
+ return model.ApplicationAddress1Parse(io)
case "Checksum":
return model.ChecksumParse(io)
case "RequestContext":
@@ -43,6 +47,8 @@ func (m CbusParserHelper) Parse(typeName string, arguments []string, io utils.Re
var cBusOptions model.CBusOptions
var requestContext model.RequestContext
return model.CALReplyParse(io, cBusOptions, requestContext)
+ case "CustomManufacturer":
+ return model.CustomManufacturerParse(io)
case "NetworkRoute":
return model.NetworkRouteParse(io)
case "NetworkNumber":
@@ -101,6 +107,8 @@ func (m CbusParserHelper) Parse(typeName string, arguments []string, io utils.Re
return model.ReplyParse(io, cBusOptions, replyLength, requestContext)
case "SerialInterfaceAddress":
return model.SerialInterfaceAddressParse(io)
+ case "InterfaceOptions1PowerUpSettings":
+ return model.InterfaceOptions1PowerUpSettingsParse(io)
case "BridgeAddress":
return model.BridgeAddressParse(io)
case "MonitoredSAL":
@@ -112,8 +120,12 @@ func (m CbusParserHelper) Parse(typeName string, arguments []string, io utils.Re
return model.StatusByteParse(io)
case "ReplyNetwork":
return model.ReplyNetworkParse(io)
+ case "SerialNumber":
+ return model.SerialNumberParse(io)
case "ExtendedStatusHeader":
return model.ExtendedStatusHeaderParse(io)
+ case "CustomTypes":
+ return model.CustomTypesParse(io)
case "CommandHeader":
return model.CommandHeaderParse(io)
case "Confirmation":
@@ -125,6 +137,12 @@ func (m CbusParserHelper) Parse(typeName string, arguments []string, io utils.Re
return model.StatusHeaderParse(io)
case "StatusRequest":
return model.StatusRequestParse(io)
+ case "InterfaceOptions3":
+ return model.InterfaceOptions3Parse(io)
+ case "InterfaceOptions1":
+ return model.InterfaceOptions1Parse(io)
+ case "InterfaceOptions2":
+ return model.InterfaceOptions2Parse(io)
case "UnitAddress":
return model.UnitAddressParse(io)
case "NetworkProtocolControlInformation":
diff --git a/plc4go/protocols/cbus/readwrite/XmlParserHelper.go b/plc4go/protocols/cbus/readwrite/XmlParserHelper.go
index 85f641e49..22590809c 100644
--- a/plc4go/protocols/cbus/readwrite/XmlParserHelper.go
+++ b/plc4go/protocols/cbus/readwrite/XmlParserHelper.go
@@ -46,6 +46,10 @@ func (m CbusXmlParserHelper) Parse(typeName string, xmlString string, parserArgu
// TODO: find a way to parse the sub types
var requestContext model.RequestContext
return model.CALDataParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), requestContext)
+ case "ApplicationAddress2":
+ return model.ApplicationAddress2Parse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
+ case "ApplicationAddress1":
+ return model.ApplicationAddress1Parse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "Checksum":
return model.ChecksumParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "RequestContext":
@@ -56,6 +60,8 @@ func (m CbusXmlParserHelper) Parse(typeName string, xmlString string, parserArgu
// TODO: find a way to parse the sub types
var requestContext model.RequestContext
return model.CALReplyParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), cBusOptions, requestContext)
+ case "CustomManufacturer":
+ return model.CustomManufacturerParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "NetworkRoute":
return model.NetworkRouteParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "NetworkNumber":
@@ -121,6 +127,8 @@ func (m CbusXmlParserHelper) Parse(typeName string, xmlString string, parserArgu
return model.ReplyParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)), cBusOptions, replyLength, requestContext)
case "SerialInterfaceAddress":
return model.SerialInterfaceAddressParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
+ case "InterfaceOptions1PowerUpSettings":
+ return model.InterfaceOptions1PowerUpSettingsParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "BridgeAddress":
return model.BridgeAddressParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "MonitoredSAL":
@@ -133,8 +141,12 @@ func (m CbusXmlParserHelper) Parse(typeName string, xmlString string, parserArgu
return model.StatusByteParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "ReplyNetwork":
return model.ReplyNetworkParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
+ case "SerialNumber":
+ return model.SerialNumberParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "ExtendedStatusHeader":
return model.ExtendedStatusHeaderParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
+ case "CustomTypes":
+ return model.CustomTypesParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "CommandHeader":
return model.CommandHeaderParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "Confirmation":
@@ -147,6 +159,12 @@ func (m CbusXmlParserHelper) Parse(typeName string, xmlString string, parserArgu
return model.StatusHeaderParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "StatusRequest":
return model.StatusRequestParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
+ case "InterfaceOptions3":
+ return model.InterfaceOptions3Parse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
+ case "InterfaceOptions1":
+ return model.InterfaceOptions1Parse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
+ case "InterfaceOptions2":
+ return model.InterfaceOptions2Parse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "UnitAddress":
return model.UnitAddressParse(utils.NewXmlReadBuffer(strings.NewReader(xmlString)))
case "NetworkProtocolControlInformation":
diff --git a/plc4go/protocols/cbus/readwrite/model/ApplicationAddress1.go b/plc4go/protocols/cbus/readwrite/model/ApplicationAddress1.go
new file mode 100644
index 000000000..f8eab18fd
--- /dev/null
+++ b/plc4go/protocols/cbus/readwrite/model/ApplicationAddress1.go
@@ -0,0 +1,183 @@
+/*
+ * 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.
+
+// ApplicationAddress1 is the corresponding interface of ApplicationAddress1
+type ApplicationAddress1 interface {
+ utils.LengthAware
+ utils.Serializable
+ // GetAddress returns Address (property field)
+ GetAddress() byte
+ // GetIsWildcard returns IsWildcard (virtual field)
+ GetIsWildcard() bool
+}
+
+// ApplicationAddress1Exactly can be used when we want exactly this type and not a type which fulfills ApplicationAddress1.
+// This is useful for switch cases.
+type ApplicationAddress1Exactly interface {
+ ApplicationAddress1
+ isApplicationAddress1() bool
+}
+
+// _ApplicationAddress1 is the data-structure of this message
+type _ApplicationAddress1 struct {
+ Address byte
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *_ApplicationAddress1) GetAddress() byte {
+ return m.Address
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for virtual fields.
+///////////////////////
+
+func (m *_ApplicationAddress1) GetIsWildcard() bool {
+ return bool(bool((m.GetAddress()) == (0xFF)))
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// NewApplicationAddress1 factory function for _ApplicationAddress1
+func NewApplicationAddress1(address byte) *_ApplicationAddress1 {
+ return &_ApplicationAddress1{Address: address}
+}
+
+// Deprecated: use the interface for direct cast
+func CastApplicationAddress1(structType interface{}) ApplicationAddress1 {
+ if casted, ok := structType.(ApplicationAddress1); ok {
+ return casted
+ }
+ if casted, ok := structType.(*ApplicationAddress1); ok {
+ return *casted
+ }
+ return nil
+}
+
+func (m *_ApplicationAddress1) GetTypeName() string {
+ return "ApplicationAddress1"
+}
+
+func (m *_ApplicationAddress1) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *_ApplicationAddress1) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(0)
+
+ // Simple field (address)
+ lengthInBits += 8
+
+ // A virtual field doesn't have any in- or output.
+
+ return lengthInBits
+}
+
+func (m *_ApplicationAddress1) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func ApplicationAddress1Parse(readBuffer utils.ReadBuffer) (ApplicationAddress1, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("ApplicationAddress1"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for ApplicationAddress1")
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // Simple Field (address)
+ _address, _addressErr := readBuffer.ReadByte("address")
+ if _addressErr != nil {
+ return nil, errors.Wrap(_addressErr, "Error parsing 'address' field of ApplicationAddress1")
+ }
+ address := _address
+
+ // Virtual field
+ _isWildcard := bool((address) == (0xFF))
+ isWildcard := bool(_isWildcard)
+ _ = isWildcard
+
+ if closeErr := readBuffer.CloseContext("ApplicationAddress1"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for ApplicationAddress1")
+ }
+
+ // Create the instance
+ return NewApplicationAddress1(address), nil
+}
+
+func (m *_ApplicationAddress1) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ if pushErr := writeBuffer.PushContext("ApplicationAddress1"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for ApplicationAddress1")
+ }
+
+ // Simple Field (address)
+ address := byte(m.GetAddress())
+ _addressErr := writeBuffer.WriteByte("address", (address))
+ if _addressErr != nil {
+ return errors.Wrap(_addressErr, "Error serializing 'address' field")
+ }
+ // Virtual field
+ if _isWildcardErr := writeBuffer.WriteVirtual("isWildcard", m.GetIsWildcard()); _isWildcardErr != nil {
+ return errors.Wrap(_isWildcardErr, "Error serializing 'isWildcard' field")
+ }
+
+ if popErr := writeBuffer.PopContext("ApplicationAddress1"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for ApplicationAddress1")
+ }
+ return nil
+}
+
+func (m *_ApplicationAddress1) isApplicationAddress1() bool {
+ return true
+}
+
+func (m *_ApplicationAddress1) String() string {
+ if m == nil {
+ return "<nil>"
+ }
+ writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true)
+ if err := writeBuffer.WriteSerializable(m); err != nil {
+ return err.Error()
+ }
+ return writeBuffer.GetBox().String()
+}
diff --git a/plc4go/protocols/cbus/readwrite/model/ApplicationAddress2.go b/plc4go/protocols/cbus/readwrite/model/ApplicationAddress2.go
new file mode 100644
index 000000000..8dff674a9
--- /dev/null
+++ b/plc4go/protocols/cbus/readwrite/model/ApplicationAddress2.go
@@ -0,0 +1,183 @@
+/*
+ * 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.
+
+// ApplicationAddress2 is the corresponding interface of ApplicationAddress2
+type ApplicationAddress2 interface {
+ utils.LengthAware
+ utils.Serializable
+ // GetAddress returns Address (property field)
+ GetAddress() byte
+ // GetIsWildcard returns IsWildcard (virtual field)
+ GetIsWildcard() bool
+}
+
+// ApplicationAddress2Exactly can be used when we want exactly this type and not a type which fulfills ApplicationAddress2.
+// This is useful for switch cases.
+type ApplicationAddress2Exactly interface {
+ ApplicationAddress2
+ isApplicationAddress2() bool
+}
+
+// _ApplicationAddress2 is the data-structure of this message
+type _ApplicationAddress2 struct {
+ Address byte
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *_ApplicationAddress2) GetAddress() byte {
+ return m.Address
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for virtual fields.
+///////////////////////
+
+func (m *_ApplicationAddress2) GetIsWildcard() bool {
+ return bool(bool((m.GetAddress()) == (0xFF)))
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// NewApplicationAddress2 factory function for _ApplicationAddress2
+func NewApplicationAddress2(address byte) *_ApplicationAddress2 {
+ return &_ApplicationAddress2{Address: address}
+}
+
+// Deprecated: use the interface for direct cast
+func CastApplicationAddress2(structType interface{}) ApplicationAddress2 {
+ if casted, ok := structType.(ApplicationAddress2); ok {
+ return casted
+ }
+ if casted, ok := structType.(*ApplicationAddress2); ok {
+ return *casted
+ }
+ return nil
+}
+
+func (m *_ApplicationAddress2) GetTypeName() string {
+ return "ApplicationAddress2"
+}
+
+func (m *_ApplicationAddress2) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *_ApplicationAddress2) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(0)
+
+ // Simple field (address)
+ lengthInBits += 8
+
+ // A virtual field doesn't have any in- or output.
+
+ return lengthInBits
+}
+
+func (m *_ApplicationAddress2) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func ApplicationAddress2Parse(readBuffer utils.ReadBuffer) (ApplicationAddress2, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("ApplicationAddress2"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for ApplicationAddress2")
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // Simple Field (address)
+ _address, _addressErr := readBuffer.ReadByte("address")
+ if _addressErr != nil {
+ return nil, errors.Wrap(_addressErr, "Error parsing 'address' field of ApplicationAddress2")
+ }
+ address := _address
+
+ // Virtual field
+ _isWildcard := bool((address) == (0xFF))
+ isWildcard := bool(_isWildcard)
+ _ = isWildcard
+
+ if closeErr := readBuffer.CloseContext("ApplicationAddress2"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for ApplicationAddress2")
+ }
+
+ // Create the instance
+ return NewApplicationAddress2(address), nil
+}
+
+func (m *_ApplicationAddress2) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ if pushErr := writeBuffer.PushContext("ApplicationAddress2"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for ApplicationAddress2")
+ }
+
+ // Simple Field (address)
+ address := byte(m.GetAddress())
+ _addressErr := writeBuffer.WriteByte("address", (address))
+ if _addressErr != nil {
+ return errors.Wrap(_addressErr, "Error serializing 'address' field")
+ }
+ // Virtual field
+ if _isWildcardErr := writeBuffer.WriteVirtual("isWildcard", m.GetIsWildcard()); _isWildcardErr != nil {
+ return errors.Wrap(_isWildcardErr, "Error serializing 'isWildcard' field")
+ }
+
+ if popErr := writeBuffer.PopContext("ApplicationAddress2"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for ApplicationAddress2")
+ }
+ return nil
+}
+
+func (m *_ApplicationAddress2) isApplicationAddress2() bool {
+ return true
+}
+
+func (m *_ApplicationAddress2) String() string {
+ if m == nil {
+ return "<nil>"
+ }
+ writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true)
+ if err := writeBuffer.WriteSerializable(m); err != nil {
+ return err.Error()
+ }
+ return writeBuffer.GetBox().String()
+}
diff --git a/plc4go/protocols/cbus/readwrite/model/BaudRateSelector.go b/plc4go/protocols/cbus/readwrite/model/BaudRateSelector.go
new file mode 100644
index 000000000..fa036e416
--- /dev/null
+++ b/plc4go/protocols/cbus/readwrite/model/BaudRateSelector.go
@@ -0,0 +1,161 @@
+/*
+ * 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"
+ "github.com/rs/zerolog/log"
+)
+
+// Code generated by code-generation. DO NOT EDIT.
+
+// BaudRateSelector is an enum
+type BaudRateSelector uint8
+
+type IBaudRateSelector interface {
+ Serialize(writeBuffer utils.WriteBuffer) error
+}
+
+const (
+ BaudRateSelector_SELECTED_4800_BAUD BaudRateSelector = 0x01
+ BaudRateSelector_SELECTED_2400_BAUD BaudRateSelector = 0x02
+ BaudRateSelector_SELECTED_1200_BAUD BaudRateSelector = 0x03
+ BaudRateSelector_SELECTED_600_BAUD BaudRateSelector = 0x04
+ BaudRateSelector_SELECTED_300_BAUD BaudRateSelector = 0x05
+ BaudRateSelector_SELECTED_9600_BAUD BaudRateSelector = 0xFF
+)
+
+var BaudRateSelectorValues []BaudRateSelector
+
+func init() {
+ _ = errors.New
+ BaudRateSelectorValues = []BaudRateSelector{
+ BaudRateSelector_SELECTED_4800_BAUD,
+ BaudRateSelector_SELECTED_2400_BAUD,
+ BaudRateSelector_SELECTED_1200_BAUD,
+ BaudRateSelector_SELECTED_600_BAUD,
+ BaudRateSelector_SELECTED_300_BAUD,
+ BaudRateSelector_SELECTED_9600_BAUD,
+ }
+}
+
+func BaudRateSelectorByValue(value uint8) (enum BaudRateSelector, ok bool) {
+ switch value {
+ case 0x01:
+ return BaudRateSelector_SELECTED_4800_BAUD, true
+ case 0x02:
+ return BaudRateSelector_SELECTED_2400_BAUD, true
+ case 0x03:
+ return BaudRateSelector_SELECTED_1200_BAUD, true
+ case 0x04:
+ return BaudRateSelector_SELECTED_600_BAUD, true
+ case 0x05:
+ return BaudRateSelector_SELECTED_300_BAUD, true
+ case 0xFF:
+ return BaudRateSelector_SELECTED_9600_BAUD, true
+ }
+ return 0, false
+}
+
+func BaudRateSelectorByName(value string) (enum BaudRateSelector, ok bool) {
+ switch value {
+ case "SELECTED_4800_BAUD":
+ return BaudRateSelector_SELECTED_4800_BAUD, true
+ case "SELECTED_2400_BAUD":
+ return BaudRateSelector_SELECTED_2400_BAUD, true
+ case "SELECTED_1200_BAUD":
+ return BaudRateSelector_SELECTED_1200_BAUD, true
+ case "SELECTED_600_BAUD":
+ return BaudRateSelector_SELECTED_600_BAUD, true
+ case "SELECTED_300_BAUD":
+ return BaudRateSelector_SELECTED_300_BAUD, true
+ case "SELECTED_9600_BAUD":
+ return BaudRateSelector_SELECTED_9600_BAUD, true
+ }
+ return 0, false
+}
+
+func BaudRateSelectorKnows(value uint8) bool {
+ for _, typeValue := range BaudRateSelectorValues {
+ if uint8(typeValue) == value {
+ return true
+ }
+ }
+ return false
+}
+
+func CastBaudRateSelector(structType interface{}) BaudRateSelector {
+ castFunc := func(typ interface{}) BaudRateSelector {
+ if sBaudRateSelector, ok := typ.(BaudRateSelector); ok {
+ return sBaudRateSelector
+ }
+ return 0
+ }
+ return castFunc(structType)
+}
+
+func (m BaudRateSelector) GetLengthInBits() uint16 {
+ return 8
+}
+
+func (m BaudRateSelector) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func BaudRateSelectorParse(readBuffer utils.ReadBuffer) (BaudRateSelector, error) {
+ val, err := readBuffer.ReadUint8("BaudRateSelector", 8)
+ if err != nil {
+ return 0, errors.Wrap(err, "error reading BaudRateSelector")
+ }
+ if enum, ok := BaudRateSelectorByValue(val); !ok {
+ log.Debug().Msgf("no value %x found for RequestType", val)
+ return BaudRateSelector(val), nil
+ } else {
+ return enum, nil
+ }
+}
+
+func (e BaudRateSelector) Serialize(writeBuffer utils.WriteBuffer) error {
+ return writeBuffer.WriteUint8("BaudRateSelector", 8, uint8(e), utils.WithAdditionalStringRepresentation(e.PLC4XEnumName()))
+}
+
+// PLC4XEnumName returns the name that is used in code to identify this enum
+func (e BaudRateSelector) PLC4XEnumName() string {
+ switch e {
+ case BaudRateSelector_SELECTED_4800_BAUD:
+ return "SELECTED_4800_BAUD"
+ case BaudRateSelector_SELECTED_2400_BAUD:
+ return "SELECTED_2400_BAUD"
+ case BaudRateSelector_SELECTED_1200_BAUD:
+ return "SELECTED_1200_BAUD"
+ case BaudRateSelector_SELECTED_600_BAUD:
+ return "SELECTED_600_BAUD"
+ case BaudRateSelector_SELECTED_300_BAUD:
+ return "SELECTED_300_BAUD"
+ case BaudRateSelector_SELECTED_9600_BAUD:
+ return "SELECTED_9600_BAUD"
+ }
+ return ""
+}
+
+func (e BaudRateSelector) String() string {
+ return e.PLC4XEnumName()
+}
diff --git a/plc4go/protocols/cbus/readwrite/model/CustomManufacturer.go b/plc4go/protocols/cbus/readwrite/model/CustomManufacturer.go
new file mode 100644
index 000000000..79fd23a82
--- /dev/null
+++ b/plc4go/protocols/cbus/readwrite/model/CustomManufacturer.go
@@ -0,0 +1,157 @@
+/*
+ * 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.
+
+// CustomManufacturer is the corresponding interface of CustomManufacturer
+type CustomManufacturer interface {
+ utils.LengthAware
+ utils.Serializable
+ // GetCustomString returns CustomString (property field)
+ GetCustomString() string
+}
+
+// CustomManufacturerExactly can be used when we want exactly this type and not a type which fulfills CustomManufacturer.
+// This is useful for switch cases.
+type CustomManufacturerExactly interface {
+ CustomManufacturer
+ isCustomManufacturer() bool
+}
+
+// _CustomManufacturer is the data-structure of this message
+type _CustomManufacturer struct {
+ CustomString string
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *_CustomManufacturer) GetCustomString() string {
+ return m.CustomString
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// NewCustomManufacturer factory function for _CustomManufacturer
+func NewCustomManufacturer(customString string) *_CustomManufacturer {
+ return &_CustomManufacturer{CustomString: customString}
+}
+
+// Deprecated: use the interface for direct cast
+func CastCustomManufacturer(structType interface{}) CustomManufacturer {
+ if casted, ok := structType.(CustomManufacturer); ok {
+ return casted
+ }
+ if casted, ok := structType.(*CustomManufacturer); ok {
+ return *casted
+ }
+ return nil
+}
+
+func (m *_CustomManufacturer) GetTypeName() string {
+ return "CustomManufacturer"
+}
+
+func (m *_CustomManufacturer) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *_CustomManufacturer) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(0)
+
+ // Simple field (customString)
+ lengthInBits += uint16(int32(8))
+
+ return lengthInBits
+}
+
+func (m *_CustomManufacturer) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func CustomManufacturerParse(readBuffer utils.ReadBuffer) (CustomManufacturer, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("CustomManufacturer"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for CustomManufacturer")
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // Simple Field (customString)
+ _customString, _customStringErr := readBuffer.ReadString("customString", uint32((8)))
+ if _customStringErr != nil {
+ return nil, errors.Wrap(_customStringErr, "Error parsing 'customString' field of CustomManufacturer")
+ }
+ customString := _customString
+
+ if closeErr := readBuffer.CloseContext("CustomManufacturer"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for CustomManufacturer")
+ }
+
+ // Create the instance
+ return NewCustomManufacturer(customString), nil
+}
+
+func (m *_CustomManufacturer) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ if pushErr := writeBuffer.PushContext("CustomManufacturer"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for CustomManufacturer")
+ }
+
+ // Simple Field (customString)
+ customString := string(m.GetCustomString())
+ _customStringErr := writeBuffer.WriteString("customString", uint32((8)), "UTF-8", (customString))
+ if _customStringErr != nil {
+ return errors.Wrap(_customStringErr, "Error serializing 'customString' field")
+ }
+
+ if popErr := writeBuffer.PopContext("CustomManufacturer"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for CustomManufacturer")
+ }
+ return nil
+}
+
+func (m *_CustomManufacturer) isCustomManufacturer() bool {
+ return true
+}
+
+func (m *_CustomManufacturer) String() string {
+ if m == nil {
+ return "<nil>"
+ }
+ writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true)
+ if err := writeBuffer.WriteSerializable(m); err != nil {
+ return err.Error()
+ }
+ return writeBuffer.GetBox().String()
+}
diff --git a/plc4go/protocols/cbus/readwrite/model/CustomTypes.go b/plc4go/protocols/cbus/readwrite/model/CustomTypes.go
new file mode 100644
index 000000000..ba799df6d
--- /dev/null
+++ b/plc4go/protocols/cbus/readwrite/model/CustomTypes.go
@@ -0,0 +1,157 @@
+/*
+ * 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.
+
+// CustomTypes is the corresponding interface of CustomTypes
+type CustomTypes interface {
+ utils.LengthAware
+ utils.Serializable
+ // GetCustomString returns CustomString (property field)
+ GetCustomString() string
+}
+
+// CustomTypesExactly can be used when we want exactly this type and not a type which fulfills CustomTypes.
+// This is useful for switch cases.
+type CustomTypesExactly interface {
+ CustomTypes
+ isCustomTypes() bool
+}
+
+// _CustomTypes is the data-structure of this message
+type _CustomTypes struct {
+ CustomString string
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *_CustomTypes) GetCustomString() string {
+ return m.CustomString
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// NewCustomTypes factory function for _CustomTypes
+func NewCustomTypes(customString string) *_CustomTypes {
+ return &_CustomTypes{CustomString: customString}
+}
+
+// Deprecated: use the interface for direct cast
+func CastCustomTypes(structType interface{}) CustomTypes {
+ if casted, ok := structType.(CustomTypes); ok {
+ return casted
+ }
+ if casted, ok := structType.(*CustomTypes); ok {
+ return *casted
+ }
+ return nil
+}
+
+func (m *_CustomTypes) GetTypeName() string {
+ return "CustomTypes"
+}
+
+func (m *_CustomTypes) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *_CustomTypes) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(0)
+
+ // Simple field (customString)
+ lengthInBits += uint16(int32(8))
+
+ return lengthInBits
+}
+
+func (m *_CustomTypes) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func CustomTypesParse(readBuffer utils.ReadBuffer) (CustomTypes, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("CustomTypes"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for CustomTypes")
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // Simple Field (customString)
+ _customString, _customStringErr := readBuffer.ReadString("customString", uint32((8)))
+ if _customStringErr != nil {
+ return nil, errors.Wrap(_customStringErr, "Error parsing 'customString' field of CustomTypes")
+ }
+ customString := _customString
+
+ if closeErr := readBuffer.CloseContext("CustomTypes"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for CustomTypes")
+ }
+
+ // Create the instance
+ return NewCustomTypes(customString), nil
+}
+
+func (m *_CustomTypes) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ if pushErr := writeBuffer.PushContext("CustomTypes"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for CustomTypes")
+ }
+
+ // Simple Field (customString)
+ customString := string(m.GetCustomString())
+ _customStringErr := writeBuffer.WriteString("customString", uint32((8)), "UTF-8", (customString))
+ if _customStringErr != nil {
+ return errors.Wrap(_customStringErr, "Error serializing 'customString' field")
+ }
+
+ if popErr := writeBuffer.PopContext("CustomTypes"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for CustomTypes")
+ }
+ return nil
+}
+
+func (m *_CustomTypes) isCustomTypes() bool {
+ return true
+}
+
+func (m *_CustomTypes) String() string {
+ if m == nil {
+ return "<nil>"
+ }
+ writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true)
+ if err := writeBuffer.WriteSerializable(m); err != nil {
+ return err.Error()
+ }
+ return writeBuffer.GetBox().String()
+}
diff --git a/plc4go/protocols/cbus/readwrite/model/InterfaceOptions1.go b/plc4go/protocols/cbus/readwrite/model/InterfaceOptions1.go
new file mode 100644
index 000000000..1969fd54b
--- /dev/null
+++ b/plc4go/protocols/cbus/readwrite/model/InterfaceOptions1.go
@@ -0,0 +1,328 @@
+/*
+ * 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"
+ "github.com/rs/zerolog/log"
+)
+
+// Code generated by code-generation. DO NOT EDIT.
+
+// InterfaceOptions1 is the corresponding interface of InterfaceOptions1
+type InterfaceOptions1 interface {
+ utils.LengthAware
+ utils.Serializable
+ // GetIdmon returns Idmon (property field)
+ GetIdmon() bool
+ // GetMonitor returns Monitor (property field)
+ GetMonitor() bool
+ // GetSmart returns Smart (property field)
+ GetSmart() bool
+ // GetSrchk returns Srchk (property field)
+ GetSrchk() bool
+ // GetXonXoff returns XonXoff (property field)
+ GetXonXoff() bool
+ // GetConnect returns Connect (property field)
+ GetConnect() bool
+}
+
+// InterfaceOptions1Exactly can be used when we want exactly this type and not a type which fulfills InterfaceOptions1.
+// This is useful for switch cases.
+type InterfaceOptions1Exactly interface {
+ InterfaceOptions1
+ isInterfaceOptions1() bool
+}
+
+// _InterfaceOptions1 is the data-structure of this message
+type _InterfaceOptions1 struct {
+ Idmon bool
+ Monitor bool
+ Smart bool
+ Srchk bool
+ XonXoff bool
+ Connect bool
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *_InterfaceOptions1) GetIdmon() bool {
+ return m.Idmon
+}
+
+func (m *_InterfaceOptions1) GetMonitor() bool {
+ return m.Monitor
+}
+
+func (m *_InterfaceOptions1) GetSmart() bool {
+ return m.Smart
+}
+
+func (m *_InterfaceOptions1) GetSrchk() bool {
+ return m.Srchk
+}
+
+func (m *_InterfaceOptions1) GetXonXoff() bool {
+ return m.XonXoff
+}
+
+func (m *_InterfaceOptions1) GetConnect() bool {
+ return m.Connect
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// NewInterfaceOptions1 factory function for _InterfaceOptions1
+func NewInterfaceOptions1(idmon bool, monitor bool, smart bool, srchk bool, xonXoff bool, connect bool) *_InterfaceOptions1 {
+ return &_InterfaceOptions1{Idmon: idmon, Monitor: monitor, Smart: smart, Srchk: srchk, XonXoff: xonXoff, Connect: connect}
+}
+
+// Deprecated: use the interface for direct cast
+func CastInterfaceOptions1(structType interface{}) InterfaceOptions1 {
+ if casted, ok := structType.(InterfaceOptions1); ok {
+ return casted
+ }
+ if casted, ok := structType.(*InterfaceOptions1); ok {
+ return *casted
+ }
+ return nil
+}
+
+func (m *_InterfaceOptions1) GetTypeName() string {
+ return "InterfaceOptions1"
+}
+
+func (m *_InterfaceOptions1) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *_InterfaceOptions1) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(0)
+
+ // Reserved Field (reserved)
+ lengthInBits += 1
+
+ // Simple field (idmon)
+ lengthInBits += 1
+
+ // Simple field (monitor)
+ lengthInBits += 1
+
+ // Simple field (smart)
+ lengthInBits += 1
+
+ // Simple field (srchk)
+ lengthInBits += 1
+
+ // Simple field (xonXoff)
+ lengthInBits += 1
+
+ // Reserved Field (reserved)
+ lengthInBits += 1
+
+ // Simple field (connect)
+ lengthInBits += 1
+
+ return lengthInBits
+}
+
+func (m *_InterfaceOptions1) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func InterfaceOptions1Parse(readBuffer utils.ReadBuffer) (InterfaceOptions1, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("InterfaceOptions1"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for InterfaceOptions1")
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // 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 of InterfaceOptions1")
+ }
+ if reserved != bool(false) {
+ log.Info().Fields(map[string]interface{}{
+ "expected value": bool(false),
+ "got value": reserved,
+ }).Msg("Got unexpected response for reserved field.")
+ }
+ }
+
+ // Simple Field (idmon)
+ _idmon, _idmonErr := readBuffer.ReadBit("idmon")
+ if _idmonErr != nil {
+ return nil, errors.Wrap(_idmonErr, "Error parsing 'idmon' field of InterfaceOptions1")
+ }
+ idmon := _idmon
+
+ // Simple Field (monitor)
+ _monitor, _monitorErr := readBuffer.ReadBit("monitor")
+ if _monitorErr != nil {
+ return nil, errors.Wrap(_monitorErr, "Error parsing 'monitor' field of InterfaceOptions1")
+ }
+ monitor := _monitor
+
+ // Simple Field (smart)
+ _smart, _smartErr := readBuffer.ReadBit("smart")
+ if _smartErr != nil {
+ return nil, errors.Wrap(_smartErr, "Error parsing 'smart' field of InterfaceOptions1")
+ }
+ smart := _smart
+
+ // Simple Field (srchk)
+ _srchk, _srchkErr := readBuffer.ReadBit("srchk")
+ if _srchkErr != nil {
+ return nil, errors.Wrap(_srchkErr, "Error parsing 'srchk' field of InterfaceOptions1")
+ }
+ srchk := _srchk
+
+ // Simple Field (xonXoff)
+ _xonXoff, _xonXoffErr := readBuffer.ReadBit("xonXoff")
+ if _xonXoffErr != nil {
+ return nil, errors.Wrap(_xonXoffErr, "Error parsing 'xonXoff' field of InterfaceOptions1")
+ }
+ xonXoff := _xonXoff
+
+ // 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 of InterfaceOptions1")
+ }
+ if reserved != bool(false) {
+ log.Info().Fields(map[string]interface{}{
+ "expected value": bool(false),
+ "got value": reserved,
+ }).Msg("Got unexpected response for reserved field.")
+ }
+ }
+
+ // Simple Field (connect)
+ _connect, _connectErr := readBuffer.ReadBit("connect")
+ if _connectErr != nil {
+ return nil, errors.Wrap(_connectErr, "Error parsing 'connect' field of InterfaceOptions1")
+ }
+ connect := _connect
+
+ if closeErr := readBuffer.CloseContext("InterfaceOptions1"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for InterfaceOptions1")
+ }
+
+ // Create the instance
+ return NewInterfaceOptions1(idmon, monitor, smart, srchk, xonXoff, connect), nil
+}
+
+func (m *_InterfaceOptions1) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ if pushErr := writeBuffer.PushContext("InterfaceOptions1"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for InterfaceOptions1")
+ }
+
+ // Reserved Field (reserved)
+ {
+ _err := writeBuffer.WriteBit("reserved", bool(false))
+ if _err != nil {
+ return errors.Wrap(_err, "Error serializing 'reserved' field")
+ }
+ }
+
+ // Simple Field (idmon)
+ idmon := bool(m.GetIdmon())
+ _idmonErr := writeBuffer.WriteBit("idmon", (idmon))
+ if _idmonErr != nil {
+ return errors.Wrap(_idmonErr, "Error serializing 'idmon' field")
+ }
+
+ // Simple Field (monitor)
+ monitor := bool(m.GetMonitor())
+ _monitorErr := writeBuffer.WriteBit("monitor", (monitor))
+ if _monitorErr != nil {
+ return errors.Wrap(_monitorErr, "Error serializing 'monitor' field")
+ }
+
+ // Simple Field (smart)
+ smart := bool(m.GetSmart())
+ _smartErr := writeBuffer.WriteBit("smart", (smart))
+ if _smartErr != nil {
+ return errors.Wrap(_smartErr, "Error serializing 'smart' field")
+ }
+
+ // Simple Field (srchk)
+ srchk := bool(m.GetSrchk())
+ _srchkErr := writeBuffer.WriteBit("srchk", (srchk))
+ if _srchkErr != nil {
+ return errors.Wrap(_srchkErr, "Error serializing 'srchk' field")
+ }
+
+ // Simple Field (xonXoff)
+ xonXoff := bool(m.GetXonXoff())
+ _xonXoffErr := writeBuffer.WriteBit("xonXoff", (xonXoff))
+ if _xonXoffErr != nil {
+ return errors.Wrap(_xonXoffErr, "Error serializing 'xonXoff' field")
+ }
+
+ // Reserved Field (reserved)
+ {
+ _err := writeBuffer.WriteBit("reserved", bool(false))
+ if _err != nil {
+ return errors.Wrap(_err, "Error serializing 'reserved' field")
+ }
+ }
+
+ // Simple Field (connect)
+ connect := bool(m.GetConnect())
+ _connectErr := writeBuffer.WriteBit("connect", (connect))
+ if _connectErr != nil {
+ return errors.Wrap(_connectErr, "Error serializing 'connect' field")
+ }
+
+ if popErr := writeBuffer.PopContext("InterfaceOptions1"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for InterfaceOptions1")
+ }
+ return nil
+}
+
+func (m *_InterfaceOptions1) isInterfaceOptions1() bool {
+ return true
+}
+
+func (m *_InterfaceOptions1) String() string {
+ if m == nil {
+ return "<nil>"
+ }
+ writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true)
+ if err := writeBuffer.WriteSerializable(m); err != nil {
+ return err.Error()
+ }
+ return writeBuffer.GetBox().String()
+}
diff --git a/plc4go/protocols/cbus/readwrite/model/InterfaceOptions1PowerUpSettings.go b/plc4go/protocols/cbus/readwrite/model/InterfaceOptions1PowerUpSettings.go
new file mode 100644
index 000000000..8706fd3fe
--- /dev/null
+++ b/plc4go/protocols/cbus/readwrite/model/InterfaceOptions1PowerUpSettings.go
@@ -0,0 +1,168 @@
+/*
+ * 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.
+
+// InterfaceOptions1PowerUpSettings is the corresponding interface of InterfaceOptions1PowerUpSettings
+type InterfaceOptions1PowerUpSettings interface {
+ utils.LengthAware
+ utils.Serializable
+ // GetInterfaceOptions1 returns InterfaceOptions1 (property field)
+ GetInterfaceOptions1() InterfaceOptions1
+}
+
+// InterfaceOptions1PowerUpSettingsExactly can be used when we want exactly this type and not a type which fulfills InterfaceOptions1PowerUpSettings.
+// This is useful for switch cases.
+type InterfaceOptions1PowerUpSettingsExactly interface {
+ InterfaceOptions1PowerUpSettings
+ isInterfaceOptions1PowerUpSettings() bool
+}
+
+// _InterfaceOptions1PowerUpSettings is the data-structure of this message
+type _InterfaceOptions1PowerUpSettings struct {
+ InterfaceOptions1 InterfaceOptions1
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *_InterfaceOptions1PowerUpSettings) GetInterfaceOptions1() InterfaceOptions1 {
+ return m.InterfaceOptions1
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// NewInterfaceOptions1PowerUpSettings factory function for _InterfaceOptions1PowerUpSettings
+func NewInterfaceOptions1PowerUpSettings(interfaceOptions1 InterfaceOptions1) *_InterfaceOptions1PowerUpSettings {
+ return &_InterfaceOptions1PowerUpSettings{InterfaceOptions1: interfaceOptions1}
+}
+
+// Deprecated: use the interface for direct cast
+func CastInterfaceOptions1PowerUpSettings(structType interface{}) InterfaceOptions1PowerUpSettings {
+ if casted, ok := structType.(InterfaceOptions1PowerUpSettings); ok {
+ return casted
+ }
+ if casted, ok := structType.(*InterfaceOptions1PowerUpSettings); ok {
+ return *casted
+ }
+ return nil
+}
+
+func (m *_InterfaceOptions1PowerUpSettings) GetTypeName() string {
+ return "InterfaceOptions1PowerUpSettings"
+}
+
+func (m *_InterfaceOptions1PowerUpSettings) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *_InterfaceOptions1PowerUpSettings) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(0)
+
+ // Simple field (interfaceOptions1)
+ lengthInBits += m.InterfaceOptions1.GetLengthInBits()
+
+ return lengthInBits
+}
+
+func (m *_InterfaceOptions1PowerUpSettings) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func InterfaceOptions1PowerUpSettingsParse(readBuffer utils.ReadBuffer) (InterfaceOptions1PowerUpSettings, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("InterfaceOptions1PowerUpSettings"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for InterfaceOptions1PowerUpSettings")
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // Simple Field (interfaceOptions1)
+ if pullErr := readBuffer.PullContext("interfaceOptions1"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for interfaceOptions1")
+ }
+ _interfaceOptions1, _interfaceOptions1Err := InterfaceOptions1Parse(readBuffer)
+ if _interfaceOptions1Err != nil {
+ return nil, errors.Wrap(_interfaceOptions1Err, "Error parsing 'interfaceOptions1' field of InterfaceOptions1PowerUpSettings")
+ }
+ interfaceOptions1 := _interfaceOptions1.(InterfaceOptions1)
+ if closeErr := readBuffer.CloseContext("interfaceOptions1"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for interfaceOptions1")
+ }
+
+ if closeErr := readBuffer.CloseContext("InterfaceOptions1PowerUpSettings"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for InterfaceOptions1PowerUpSettings")
+ }
+
+ // Create the instance
+ return NewInterfaceOptions1PowerUpSettings(interfaceOptions1), nil
+}
+
+func (m *_InterfaceOptions1PowerUpSettings) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ if pushErr := writeBuffer.PushContext("InterfaceOptions1PowerUpSettings"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for InterfaceOptions1PowerUpSettings")
+ }
+
+ // Simple Field (interfaceOptions1)
+ if pushErr := writeBuffer.PushContext("interfaceOptions1"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for interfaceOptions1")
+ }
+ _interfaceOptions1Err := writeBuffer.WriteSerializable(m.GetInterfaceOptions1())
+ if popErr := writeBuffer.PopContext("interfaceOptions1"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for interfaceOptions1")
+ }
+ if _interfaceOptions1Err != nil {
+ return errors.Wrap(_interfaceOptions1Err, "Error serializing 'interfaceOptions1' field")
+ }
+
+ if popErr := writeBuffer.PopContext("InterfaceOptions1PowerUpSettings"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for InterfaceOptions1PowerUpSettings")
+ }
+ return nil
+}
+
+func (m *_InterfaceOptions1PowerUpSettings) isInterfaceOptions1PowerUpSettings() bool {
+ return true
+}
+
+func (m *_InterfaceOptions1PowerUpSettings) String() string {
+ if m == nil {
+ return "<nil>"
+ }
+ writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true)
+ if err := writeBuffer.WriteSerializable(m); err != nil {
+ return err.Error()
+ }
+ return writeBuffer.GetBox().String()
+}
diff --git a/plc4go/protocols/cbus/readwrite/model/InterfaceOptions2.go b/plc4go/protocols/cbus/readwrite/model/InterfaceOptions2.go
new file mode 100644
index 000000000..a8bb1db56
--- /dev/null
+++ b/plc4go/protocols/cbus/readwrite/model/InterfaceOptions2.go
@@ -0,0 +1,332 @@
+/*
+ * 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"
+ "github.com/rs/zerolog/log"
+)
+
+// Code generated by code-generation. DO NOT EDIT.
+
+// InterfaceOptions2 is the corresponding interface of InterfaceOptions2
+type InterfaceOptions2 interface {
+ utils.LengthAware
+ utils.Serializable
+ // GetBurden returns Burden (property field)
+ GetBurden() bool
+ // GetClockGen returns ClockGen (property field)
+ GetClockGen() bool
+}
+
+// InterfaceOptions2Exactly can be used when we want exactly this type and not a type which fulfills InterfaceOptions2.
+// This is useful for switch cases.
+type InterfaceOptions2Exactly interface {
+ InterfaceOptions2
+ isInterfaceOptions2() bool
+}
+
+// _InterfaceOptions2 is the data-structure of this message
+type _InterfaceOptions2 struct {
+ Burden bool
+ ClockGen bool
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *_InterfaceOptions2) GetBurden() bool {
+ return m.Burden
+}
+
+func (m *_InterfaceOptions2) GetClockGen() bool {
+ return m.ClockGen
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// NewInterfaceOptions2 factory function for _InterfaceOptions2
+func NewInterfaceOptions2(burden bool, clockGen bool) *_InterfaceOptions2 {
+ return &_InterfaceOptions2{Burden: burden, ClockGen: clockGen}
+}
+
+// Deprecated: use the interface for direct cast
+func CastInterfaceOptions2(structType interface{}) InterfaceOptions2 {
+ if casted, ok := structType.(InterfaceOptions2); ok {
+ return casted
+ }
+ if casted, ok := structType.(*InterfaceOptions2); ok {
+ return *casted
+ }
+ return nil
+}
+
+func (m *_InterfaceOptions2) GetTypeName() string {
+ return "InterfaceOptions2"
+}
+
+func (m *_InterfaceOptions2) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *_InterfaceOptions2) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(0)
+
+ // Reserved Field (reserved)
+ lengthInBits += 1
+
+ // Simple field (burden)
+ lengthInBits += 1
+
+ // Reserved Field (reserved)
+ lengthInBits += 1
+
+ // Reserved Field (reserved)
+ lengthInBits += 1
+
+ // Reserved Field (reserved)
+ lengthInBits += 1
+
+ // Reserved Field (reserved)
+ lengthInBits += 1
+
+ // Reserved Field (reserved)
+ lengthInBits += 1
+
+ // Simple field (clockGen)
+ lengthInBits += 1
+
+ return lengthInBits
+}
+
+func (m *_InterfaceOptions2) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func InterfaceOptions2Parse(readBuffer utils.ReadBuffer) (InterfaceOptions2, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("InterfaceOptions2"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for InterfaceOptions2")
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // 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 of InterfaceOptions2")
+ }
+ if reserved != bool(false) {
+ log.Info().Fields(map[string]interface{}{
+ "expected value": bool(false),
+ "got value": reserved,
+ }).Msg("Got unexpected response for reserved field.")
+ }
+ }
+
+ // Simple Field (burden)
+ _burden, _burdenErr := readBuffer.ReadBit("burden")
+ if _burdenErr != nil {
+ return nil, errors.Wrap(_burdenErr, "Error parsing 'burden' field of InterfaceOptions2")
+ }
+ burden := _burden
+
+ // 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 of InterfaceOptions2")
+ }
+ if reserved != bool(false) {
+ log.Info().Fields(map[string]interface{}{
+ "expected value": bool(false),
+ "got value": reserved,
+ }).Msg("Got unexpected response for reserved field.")
+ }
+ }
+
+ // 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 of InterfaceOptions2")
+ }
+ if reserved != bool(false) {
+ log.Info().Fields(map[string]interface{}{
+ "expected value": bool(false),
+ "got value": reserved,
+ }).Msg("Got unexpected response for reserved field.")
+ }
+ }
+
+ // 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 of InterfaceOptions2")
+ }
+ if reserved != bool(false) {
+ log.Info().Fields(map[string]interface{}{
+ "expected value": bool(false),
+ "got value": reserved,
+ }).Msg("Got unexpected response for reserved field.")
+ }
+ }
+
+ // 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 of InterfaceOptions2")
+ }
+ if reserved != bool(false) {
+ log.Info().Fields(map[string]interface{}{
+ "expected value": bool(false),
+ "got value": reserved,
+ }).Msg("Got unexpected response for reserved field.")
+ }
+ }
+
+ // 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 of InterfaceOptions2")
+ }
+ if reserved != bool(false) {
+ log.Info().Fields(map[string]interface{}{
+ "expected value": bool(false),
+ "got value": reserved,
+ }).Msg("Got unexpected response for reserved field.")
+ }
+ }
+
+ // Simple Field (clockGen)
+ _clockGen, _clockGenErr := readBuffer.ReadBit("clockGen")
+ if _clockGenErr != nil {
+ return nil, errors.Wrap(_clockGenErr, "Error parsing 'clockGen' field of InterfaceOptions2")
+ }
+ clockGen := _clockGen
+
+ if closeErr := readBuffer.CloseContext("InterfaceOptions2"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for InterfaceOptions2")
+ }
+
+ // Create the instance
+ return NewInterfaceOptions2(burden, clockGen), nil
+}
+
+func (m *_InterfaceOptions2) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ if pushErr := writeBuffer.PushContext("InterfaceOptions2"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for InterfaceOptions2")
+ }
+
+ // Reserved Field (reserved)
+ {
+ _err := writeBuffer.WriteBit("reserved", bool(false))
+ if _err != nil {
+ return errors.Wrap(_err, "Error serializing 'reserved' field")
+ }
+ }
+
+ // Simple Field (burden)
+ burden := bool(m.GetBurden())
+ _burdenErr := writeBuffer.WriteBit("burden", (burden))
+ if _burdenErr != nil {
+ return errors.Wrap(_burdenErr, "Error serializing 'burden' field")
+ }
+
+ // Reserved Field (reserved)
+ {
+ _err := writeBuffer.WriteBit("reserved", bool(false))
+ if _err != nil {
+ return errors.Wrap(_err, "Error serializing 'reserved' field")
+ }
+ }
+
+ // Reserved Field (reserved)
+ {
+ _err := writeBuffer.WriteBit("reserved", bool(false))
+ if _err != nil {
+ return errors.Wrap(_err, "Error serializing 'reserved' field")
+ }
+ }
+
+ // Reserved Field (reserved)
+ {
+ _err := writeBuffer.WriteBit("reserved", bool(false))
+ if _err != nil {
+ return errors.Wrap(_err, "Error serializing 'reserved' field")
+ }
+ }
+
+ // Reserved Field (reserved)
+ {
+ _err := writeBuffer.WriteBit("reserved", bool(false))
+ if _err != nil {
+ return errors.Wrap(_err, "Error serializing 'reserved' field")
+ }
+ }
+
+ // Reserved Field (reserved)
+ {
+ _err := writeBuffer.WriteBit("reserved", bool(false))
+ if _err != nil {
+ return errors.Wrap(_err, "Error serializing 'reserved' field")
+ }
+ }
+
+ // Simple Field (clockGen)
+ clockGen := bool(m.GetClockGen())
+ _clockGenErr := writeBuffer.WriteBit("clockGen", (clockGen))
+ if _clockGenErr != nil {
+ return errors.Wrap(_clockGenErr, "Error serializing 'clockGen' field")
+ }
+
+ if popErr := writeBuffer.PopContext("InterfaceOptions2"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for InterfaceOptions2")
+ }
+ return nil
+}
+
+func (m *_InterfaceOptions2) isInterfaceOptions2() bool {
+ return true
+}
+
+func (m *_InterfaceOptions2) String() string {
+ if m == nil {
+ return "<nil>"
+ }
+ writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true)
+ if err := writeBuffer.WriteSerializable(m); err != nil {
+ return err.Error()
+ }
+ return writeBuffer.GetBox().String()
+}
diff --git a/plc4go/protocols/cbus/readwrite/model/InterfaceOptions3.go b/plc4go/protocols/cbus/readwrite/model/InterfaceOptions3.go
new file mode 100644
index 000000000..5431f0b8f
--- /dev/null
+++ b/plc4go/protocols/cbus/readwrite/model/InterfaceOptions3.go
@@ -0,0 +1,330 @@
+/*
+ * 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"
+ "github.com/rs/zerolog/log"
+)
+
+// Code generated by code-generation. DO NOT EDIT.
+
+// InterfaceOptions3 is the corresponding interface of InterfaceOptions3
+type InterfaceOptions3 interface {
+ utils.LengthAware
+ utils.Serializable
+ // GetExstat returns Exstat (property field)
+ GetExstat() bool
+ // GetPun returns Pun (property field)
+ GetPun() bool
+ // GetLocalSal returns LocalSal (property field)
+ GetLocalSal() bool
+ // GetPcn returns Pcn (property field)
+ GetPcn() bool
+}
+
+// InterfaceOptions3Exactly can be used when we want exactly this type and not a type which fulfills InterfaceOptions3.
+// This is useful for switch cases.
+type InterfaceOptions3Exactly interface {
+ InterfaceOptions3
+ isInterfaceOptions3() bool
+}
+
+// _InterfaceOptions3 is the data-structure of this message
+type _InterfaceOptions3 struct {
+ Exstat bool
+ Pun bool
+ LocalSal bool
+ Pcn bool
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *_InterfaceOptions3) GetExstat() bool {
+ return m.Exstat
+}
+
+func (m *_InterfaceOptions3) GetPun() bool {
+ return m.Pun
+}
+
+func (m *_InterfaceOptions3) GetLocalSal() bool {
+ return m.LocalSal
+}
+
+func (m *_InterfaceOptions3) GetPcn() bool {
+ return m.Pcn
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// NewInterfaceOptions3 factory function for _InterfaceOptions3
+func NewInterfaceOptions3(exstat bool, pun bool, localSal bool, pcn bool) *_InterfaceOptions3 {
+ return &_InterfaceOptions3{Exstat: exstat, Pun: pun, LocalSal: localSal, Pcn: pcn}
+}
+
+// Deprecated: use the interface for direct cast
+func CastInterfaceOptions3(structType interface{}) InterfaceOptions3 {
+ if casted, ok := structType.(InterfaceOptions3); ok {
+ return casted
+ }
+ if casted, ok := structType.(*InterfaceOptions3); ok {
+ return *casted
+ }
+ return nil
+}
+
+func (m *_InterfaceOptions3) GetTypeName() string {
+ return "InterfaceOptions3"
+}
+
+func (m *_InterfaceOptions3) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *_InterfaceOptions3) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(0)
+
+ // Reserved Field (reserved)
+ lengthInBits += 1
+
+ // Reserved Field (reserved)
+ lengthInBits += 1
+
+ // Reserved Field (reserved)
+ lengthInBits += 1
+
+ // Reserved Field (reserved)
+ lengthInBits += 1
+
+ // Simple field (exstat)
+ lengthInBits += 1
+
+ // Simple field (pun)
+ lengthInBits += 1
+
+ // Simple field (localSal)
+ lengthInBits += 1
+
+ // Simple field (pcn)
+ lengthInBits += 1
+
+ return lengthInBits
+}
+
+func (m *_InterfaceOptions3) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func InterfaceOptions3Parse(readBuffer utils.ReadBuffer) (InterfaceOptions3, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("InterfaceOptions3"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for InterfaceOptions3")
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // 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 of InterfaceOptions3")
+ }
+ if reserved != bool(false) {
+ log.Info().Fields(map[string]interface{}{
+ "expected value": bool(false),
+ "got value": reserved,
+ }).Msg("Got unexpected response for reserved field.")
+ }
+ }
+
+ // 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 of InterfaceOptions3")
+ }
+ if reserved != bool(false) {
+ log.Info().Fields(map[string]interface{}{
+ "expected value": bool(false),
+ "got value": reserved,
+ }).Msg("Got unexpected response for reserved field.")
+ }
+ }
+
+ // 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 of InterfaceOptions3")
+ }
+ if reserved != bool(false) {
+ log.Info().Fields(map[string]interface{}{
+ "expected value": bool(false),
+ "got value": reserved,
+ }).Msg("Got unexpected response for reserved field.")
+ }
+ }
+
+ // 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 of InterfaceOptions3")
+ }
+ if reserved != bool(false) {
+ log.Info().Fields(map[string]interface{}{
+ "expected value": bool(false),
+ "got value": reserved,
+ }).Msg("Got unexpected response for reserved field.")
+ }
+ }
+
+ // Simple Field (exstat)
+ _exstat, _exstatErr := readBuffer.ReadBit("exstat")
+ if _exstatErr != nil {
+ return nil, errors.Wrap(_exstatErr, "Error parsing 'exstat' field of InterfaceOptions3")
+ }
+ exstat := _exstat
+
+ // Simple Field (pun)
+ _pun, _punErr := readBuffer.ReadBit("pun")
+ if _punErr != nil {
+ return nil, errors.Wrap(_punErr, "Error parsing 'pun' field of InterfaceOptions3")
+ }
+ pun := _pun
+
+ // Simple Field (localSal)
+ _localSal, _localSalErr := readBuffer.ReadBit("localSal")
+ if _localSalErr != nil {
+ return nil, errors.Wrap(_localSalErr, "Error parsing 'localSal' field of InterfaceOptions3")
+ }
+ localSal := _localSal
+
+ // Simple Field (pcn)
+ _pcn, _pcnErr := readBuffer.ReadBit("pcn")
+ if _pcnErr != nil {
+ return nil, errors.Wrap(_pcnErr, "Error parsing 'pcn' field of InterfaceOptions3")
+ }
+ pcn := _pcn
+
+ if closeErr := readBuffer.CloseContext("InterfaceOptions3"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for InterfaceOptions3")
+ }
+
+ // Create the instance
+ return NewInterfaceOptions3(exstat, pun, localSal, pcn), nil
+}
+
+func (m *_InterfaceOptions3) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ if pushErr := writeBuffer.PushContext("InterfaceOptions3"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for InterfaceOptions3")
+ }
+
+ // Reserved Field (reserved)
+ {
+ _err := writeBuffer.WriteBit("reserved", bool(false))
+ if _err != nil {
+ return errors.Wrap(_err, "Error serializing 'reserved' field")
+ }
+ }
+
+ // Reserved Field (reserved)
+ {
+ _err := writeBuffer.WriteBit("reserved", bool(false))
+ if _err != nil {
+ return errors.Wrap(_err, "Error serializing 'reserved' field")
+ }
+ }
+
+ // Reserved Field (reserved)
+ {
+ _err := writeBuffer.WriteBit("reserved", bool(false))
+ if _err != nil {
+ return errors.Wrap(_err, "Error serializing 'reserved' field")
+ }
+ }
+
+ // Reserved Field (reserved)
+ {
+ _err := writeBuffer.WriteBit("reserved", bool(false))
+ if _err != nil {
+ return errors.Wrap(_err, "Error serializing 'reserved' field")
+ }
+ }
+
+ // Simple Field (exstat)
+ exstat := bool(m.GetExstat())
+ _exstatErr := writeBuffer.WriteBit("exstat", (exstat))
+ if _exstatErr != nil {
+ return errors.Wrap(_exstatErr, "Error serializing 'exstat' field")
+ }
+
+ // Simple Field (pun)
+ pun := bool(m.GetPun())
+ _punErr := writeBuffer.WriteBit("pun", (pun))
+ if _punErr != nil {
+ return errors.Wrap(_punErr, "Error serializing 'pun' field")
+ }
+
+ // Simple Field (localSal)
+ localSal := bool(m.GetLocalSal())
+ _localSalErr := writeBuffer.WriteBit("localSal", (localSal))
+ if _localSalErr != nil {
+ return errors.Wrap(_localSalErr, "Error serializing 'localSal' field")
+ }
+
+ // Simple Field (pcn)
+ pcn := bool(m.GetPcn())
+ _pcnErr := writeBuffer.WriteBit("pcn", (pcn))
+ if _pcnErr != nil {
+ return errors.Wrap(_pcnErr, "Error serializing 'pcn' field")
+ }
+
+ if popErr := writeBuffer.PopContext("InterfaceOptions3"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for InterfaceOptions3")
+ }
+ return nil
+}
+
+func (m *_InterfaceOptions3) isInterfaceOptions3() bool {
+ return true
+}
+
+func (m *_InterfaceOptions3) String() string {
+ if m == nil {
+ return "<nil>"
+ }
+ writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true)
+ if err := writeBuffer.WriteSerializable(m); err != nil {
+ return err.Error()
+ }
+ return writeBuffer.GetBox().String()
+}
diff --git a/plc4go/protocols/cbus/readwrite/model/SerialNumber.go b/plc4go/protocols/cbus/readwrite/model/SerialNumber.go
new file mode 100644
index 000000000..ab0be1ca6
--- /dev/null
+++ b/plc4go/protocols/cbus/readwrite/model/SerialNumber.go
@@ -0,0 +1,229 @@
+/*
+ * 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.
+
+// SerialNumber is the corresponding interface of SerialNumber
+type SerialNumber interface {
+ utils.LengthAware
+ utils.Serializable
+ // GetOctet1 returns Octet1 (property field)
+ GetOctet1() byte
+ // GetOctet2 returns Octet2 (property field)
+ GetOctet2() byte
+ // GetOctet3 returns Octet3 (property field)
+ GetOctet3() byte
+ // GetOctet4 returns Octet4 (property field)
+ GetOctet4() byte
+}
+
+// SerialNumberExactly can be used when we want exactly this type and not a type which fulfills SerialNumber.
+// This is useful for switch cases.
+type SerialNumberExactly interface {
+ SerialNumber
+ isSerialNumber() bool
+}
+
+// _SerialNumber is the data-structure of this message
+type _SerialNumber struct {
+ Octet1 byte
+ Octet2 byte
+ Octet3 byte
+ Octet4 byte
+}
+
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+/////////////////////// Accessors for property fields.
+///////////////////////
+
+func (m *_SerialNumber) GetOctet1() byte {
+ return m.Octet1
+}
+
+func (m *_SerialNumber) GetOctet2() byte {
+ return m.Octet2
+}
+
+func (m *_SerialNumber) GetOctet3() byte {
+ return m.Octet3
+}
+
+func (m *_SerialNumber) GetOctet4() byte {
+ return m.Octet4
+}
+
+///////////////////////
+///////////////////////
+///////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////
+
+// NewSerialNumber factory function for _SerialNumber
+func NewSerialNumber(octet1 byte, octet2 byte, octet3 byte, octet4 byte) *_SerialNumber {
+ return &_SerialNumber{Octet1: octet1, Octet2: octet2, Octet3: octet3, Octet4: octet4}
+}
+
+// Deprecated: use the interface for direct cast
+func CastSerialNumber(structType interface{}) SerialNumber {
+ if casted, ok := structType.(SerialNumber); ok {
+ return casted
+ }
+ if casted, ok := structType.(*SerialNumber); ok {
+ return *casted
+ }
+ return nil
+}
+
+func (m *_SerialNumber) GetTypeName() string {
+ return "SerialNumber"
+}
+
+func (m *_SerialNumber) GetLengthInBits() uint16 {
+ return m.GetLengthInBitsConditional(false)
+}
+
+func (m *_SerialNumber) GetLengthInBitsConditional(lastItem bool) uint16 {
+ lengthInBits := uint16(0)
+
+ // Simple field (octet1)
+ lengthInBits += 8
+
+ // Simple field (octet2)
+ lengthInBits += 8
+
+ // Simple field (octet3)
+ lengthInBits += 8
+
+ // Simple field (octet4)
+ lengthInBits += 8
+
+ return lengthInBits
+}
+
+func (m *_SerialNumber) GetLengthInBytes() uint16 {
+ return m.GetLengthInBits() / 8
+}
+
+func SerialNumberParse(readBuffer utils.ReadBuffer) (SerialNumber, error) {
+ positionAware := readBuffer
+ _ = positionAware
+ if pullErr := readBuffer.PullContext("SerialNumber"); pullErr != nil {
+ return nil, errors.Wrap(pullErr, "Error pulling for SerialNumber")
+ }
+ currentPos := positionAware.GetPos()
+ _ = currentPos
+
+ // Simple Field (octet1)
+ _octet1, _octet1Err := readBuffer.ReadByte("octet1")
+ if _octet1Err != nil {
+ return nil, errors.Wrap(_octet1Err, "Error parsing 'octet1' field of SerialNumber")
+ }
+ octet1 := _octet1
+
+ // Simple Field (octet2)
+ _octet2, _octet2Err := readBuffer.ReadByte("octet2")
+ if _octet2Err != nil {
+ return nil, errors.Wrap(_octet2Err, "Error parsing 'octet2' field of SerialNumber")
+ }
+ octet2 := _octet2
+
+ // Simple Field (octet3)
+ _octet3, _octet3Err := readBuffer.ReadByte("octet3")
+ if _octet3Err != nil {
+ return nil, errors.Wrap(_octet3Err, "Error parsing 'octet3' field of SerialNumber")
+ }
+ octet3 := _octet3
+
+ // Simple Field (octet4)
+ _octet4, _octet4Err := readBuffer.ReadByte("octet4")
+ if _octet4Err != nil {
+ return nil, errors.Wrap(_octet4Err, "Error parsing 'octet4' field of SerialNumber")
+ }
+ octet4 := _octet4
+
+ if closeErr := readBuffer.CloseContext("SerialNumber"); closeErr != nil {
+ return nil, errors.Wrap(closeErr, "Error closing for SerialNumber")
+ }
+
+ // Create the instance
+ return NewSerialNumber(octet1, octet2, octet3, octet4), nil
+}
+
+func (m *_SerialNumber) Serialize(writeBuffer utils.WriteBuffer) error {
+ positionAware := writeBuffer
+ _ = positionAware
+ if pushErr := writeBuffer.PushContext("SerialNumber"); pushErr != nil {
+ return errors.Wrap(pushErr, "Error pushing for SerialNumber")
+ }
+
+ // Simple Field (octet1)
+ octet1 := byte(m.GetOctet1())
+ _octet1Err := writeBuffer.WriteByte("octet1", (octet1))
+ if _octet1Err != nil {
+ return errors.Wrap(_octet1Err, "Error serializing 'octet1' field")
+ }
+
+ // Simple Field (octet2)
+ octet2 := byte(m.GetOctet2())
+ _octet2Err := writeBuffer.WriteByte("octet2", (octet2))
+ if _octet2Err != nil {
+ return errors.Wrap(_octet2Err, "Error serializing 'octet2' field")
+ }
+
+ // Simple Field (octet3)
+ octet3 := byte(m.GetOctet3())
+ _octet3Err := writeBuffer.WriteByte("octet3", (octet3))
+ if _octet3Err != nil {
+ return errors.Wrap(_octet3Err, "Error serializing 'octet3' field")
+ }
+
+ // Simple Field (octet4)
+ octet4 := byte(m.GetOctet4())
+ _octet4Err := writeBuffer.WriteByte("octet4", (octet4))
+ if _octet4Err != nil {
+ return errors.Wrap(_octet4Err, "Error serializing 'octet4' field")
+ }
+
+ if popErr := writeBuffer.PopContext("SerialNumber"); popErr != nil {
+ return errors.Wrap(popErr, "Error popping for SerialNumber")
+ }
+ return nil
+}
+
+func (m *_SerialNumber) isSerialNumber() bool {
+ return true
+}
+
+func (m *_SerialNumber) String() string {
+ if m == nil {
+ return "<nil>"
+ }
+ writeBuffer := utils.NewBoxedWriteBufferWithOptions(true, true)
+ if err := writeBuffer.WriteSerializable(m); err != nil {
+ return err.Error()
+ }
+ return writeBuffer.GetBox().String()
+}
diff --git a/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec b/protocols/c-bus/src/main/resources/protocols/cbus/c-bus.mspec
index 369f0f27b..cbabc8723 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
@@ -885,6 +885,81 @@
['3' READ_ONLY ['"Read only"' ]]
]
+[type ApplicationAddress1 // Note 1
+ [simple byte address ]
+ // if wildcard is set address 2 should set to wildcard as well
+ [virtual bit isWildcard 'address == 0xFF' ]
+]
+
+[type ApplicationAddress2 // Note 1
+ [simple byte address ]
+ [virtual bit isWildcard 'address == 0xFF' ]
+]
+
+[type InterfaceOptions1 // Note 2
+ [reserved bit 'false' ]
+ [simple bit idmon ]
+ [simple bit monitor ]
+ [simple bit smart ]
+ [simple bit srchk ]
+ [simple bit xonXoff ]
+ [reserved bit 'false' ]
+ [simple bit connect ]
+]
+
+// Undefined values default to 0xFF
+[enum uint 8 BaudRateSelector
+ ['0x01' SELECTED_4800_BAUD]
+ ['0x02' SELECTED_2400_BAUD]
+ ['0x03' SELECTED_1200_BAUD]
+ ['0x04' SELECTED_600_BAUD ]
+ ['0x05' SELECTED_300_BAUD ]
+ ['0xFF' SELECTED_9600_BAUD]
+]
+
+[type InterfaceOptions2 // Note 4
+ [reserved bit 'false' ]
+ [simple bit burden ]
+ [reserved bit 'false' ]
+ [reserved bit 'false' ]
+ [reserved bit 'false' ]
+ [reserved bit 'false' ]
+ [reserved bit 'false' ]
+ [simple bit clockGen ]
+]
+
+[type InterfaceOptions1PowerUpSettings // Note 5
+ [simple InterfaceOptions1 interfaceOptions1 ]
+]
+
+[type InterfaceOptions3 // Note 6
+ [reserved bit 'false' ]
+ [reserved bit 'false' ]
+ [reserved bit 'false' ]
+ [reserved bit 'false' ]
+ [simple bit exstat ]
+ [simple bit pun ]
+ [simple bit localSal ]
+ [simple bit pcn ]
+]
+
+[type CustomManufacturer // Note 7
+ // TODO: 8 is a placeholder at the moment
+ [simple vstring '8' customString ]
+]
+
+[type SerialNumber // Note 8
+ [simple byte octet1]
+ [simple byte octet2]
+ [simple byte octet3]
+ [simple byte octet4]
+]
+
+[type CustomTypes // Note 9
+ // TODO: 8 is a placeholder at the moment
+ [simple vstring '8' customString ]
+]
+
[enum uint 8 Attribute(uint 8 bytesReturned)
['0x00' Manufacturer [ '8']]
['0x01' Type [ '8']]