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 74976dae913edf20cf9c3d0a14909f95fa9b7cc0
Author: Sebastian Rühl <[email protected]>
AuthorDate: Fri Mar 24 17:19:23 2023 +0100

    feat(plc4go/cbus): prepare bridge support
---
 plc4go/internal/cbus/Browser.go                |   4 +-
 plc4go/internal/cbus/CBusMessageMapper.go      |   2 +-
 plc4go/internal/cbus/CBusMessageMapper_test.go | 116 +++++++++++++++++
 plc4go/internal/cbus/Reader_test.go            | 171 -------------------------
 plc4go/internal/cbus/Tag.go                    |  75 +++++++----
 plc4go/internal/cbus/TagHandler.go             |  20 +--
 6 files changed, 177 insertions(+), 211 deletions(-)

diff --git a/plc4go/internal/cbus/Browser.go b/plc4go/internal/cbus/Browser.go
index 1699e3ff59..9a032139be 100644
--- a/plc4go/internal/cbus/Browser.go
+++ b/plc4go/internal/cbus/Browser.go
@@ -116,7 +116,7 @@ func (m Browser) BrowseQuery(ctx context.Context, 
browseRequest apiModel.PlcBrow
                                }
                                readTagName := fmt.Sprintf("%s/%d/%s", 
queryName, unitAddress, attribute)
                                readRequest, _ := 
m.connection.ReadRequestBuilder().
-                                       AddTag(readTagName, 
NewCALIdentifyTag(unit, attribute, 1)).
+                                       AddTag(readTagName, 
NewCALIdentifyTag(unit, nil /*TODO: add bridge support*/, attribute, 1)).
                                        Build()
                                timeoutCtx, timeoutCancel := 
context.WithTimeout(ctx, time.Second*2)
                                requestResult := 
<-readRequest.ExecuteWithContext(timeoutCtx)
@@ -133,7 +133,7 @@ func (m Browser) BrowseQuery(ctx context.Context, 
browseRequest apiModel.PlcBrow
                                        continue unitLoop
                                }
                                queryResult := &model.DefaultPlcBrowseItem{
-                                       Tag:          NewCALIdentifyTag(unit, 
attribute, 1),
+                                       Tag:          NewCALIdentifyTag(unit, 
nil /*TODO: add bridge support*/, attribute, 1),
                                        Name:         queryName,
                                        Readable:     true,
                                        Writable:     false,
diff --git a/plc4go/internal/cbus/CBusMessageMapper.go 
b/plc4go/internal/cbus/CBusMessageMapper.go
index 6adb4bf4b4..901c75cf43 100644
--- a/plc4go/internal/cbus/CBusMessageMapper.go
+++ b/plc4go/internal/cbus/CBusMessageMapper.go
@@ -74,7 +74,7 @@ func TagToCBusMessage(tag apiModel.PlcTag, value 
apiValues.PlcValue, alphaGenera
 
                cBusMessage, supportsRead = 
readWriteModel.NewCBusMessageToServer(request, requestContext, cbusOptions), 
true
                return
-       case *calGetstatusTag:
+       case *calGetStatusTag:
                calData := 
readWriteModel.NewCALDataGetStatus(tagType.parameter, tagType.count, 
readWriteModel.CALCommandTypeContainer_CALCommandGetStatus, nil, requestContext)
                //TODO: we need support for bridged commands
                command := 
readWriteModel.NewCBusPointToPointCommandDirect(tagType.unitAddress, 0x0000, 
calData, cbusOptions)
diff --git a/plc4go/internal/cbus/CBusMessageMapper_test.go 
b/plc4go/internal/cbus/CBusMessageMapper_test.go
new file mode 100644
index 0000000000..7129d0f7e4
--- /dev/null
+++ b/plc4go/internal/cbus/CBusMessageMapper_test.go
@@ -0,0 +1,116 @@
+package cbus
+
+import (
+       apiModel "github.com/apache/plc4x/plc4go/pkg/api/model"
+       apiValues "github.com/apache/plc4x/plc4go/pkg/api/values"
+       readWriteModel 
"github.com/apache/plc4x/plc4go/protocols/cbus/readwrite/model"
+       "github.com/apache/plc4x/plc4go/spi"
+       "reflect"
+       "testing"
+)
+
+func TestMapEncodedReply(t *testing.T) {
+       type args struct {
+               transaction     *spi.RequestTransaction
+               encodedReply    readWriteModel.EncodedReply
+               tagName         string
+               addResponseCode func(name string, responseCode 
apiModel.PlcResponseCode)
+               addPlcValue     func(name string, plcValue apiValues.PlcValue)
+       }
+       tests := []struct {
+               name    string
+               args    args
+               wantErr bool
+       }{
+               {
+                       name: "empty input",
+                       args: args{
+                               transaction: func() *spi.RequestTransaction {
+                                       transactionManager := 
spi.NewRequestTransactionManager(1)
+                                       transaction := 
transactionManager.StartTransaction()
+                                       transaction.Submit(func() {
+                                               // NO-OP
+                                       })
+                                       return transaction
+                               }(),
+                               encodedReply:    nil,
+                               tagName:         "",
+                               addResponseCode: nil,
+                               addPlcValue:     nil,
+                       },
+               },
+               {
+                       name: "CALDataStatus",
+                       args: args{
+                               transaction: func() *spi.RequestTransaction {
+                                       transactionManager := 
spi.NewRequestTransactionManager(1)
+                                       transaction := 
transactionManager.StartTransaction()
+                                       transaction.Submit(func() {
+                                               // NO-OP
+                                       })
+                                       return transaction
+                               }(),
+                               encodedReply: func() 
readWriteModel.EncodedReplyCALReply {
+                                       calDataStatus := 
readWriteModel.NewCALDataStatus(readWriteModel.ApplicationIdContainer_LIGHTING_3A,
 0, nil, readWriteModel.CALCommandTypeContainer_CALCommandStatus_0Bytes, nil, 
nil)
+                                       calReplyShort := 
readWriteModel.NewCALReplyShort(0, calDataStatus, nil, nil)
+                                       return 
readWriteModel.NewEncodedReplyCALReply(calReplyShort, 0, nil, nil)
+                               }(),
+                               tagName: "someTag",
+                               addResponseCode: func(name string, responseCode 
apiModel.PlcResponseCode) {
+                                       // TODO: add assertions
+                               },
+                               addPlcValue: func(name string, plcValue 
apiValues.PlcValue) {
+                                       // TODO: add assertions
+                               },
+                       },
+               },
+       }
+       for _, tt := range tests {
+               t.Run(tt.name, func(t *testing.T) {
+                       if err := MapEncodedReply(tt.args.transaction, 
tt.args.encodedReply, tt.args.tagName, tt.args.addResponseCode, 
tt.args.addPlcValue); (err != nil) != tt.wantErr {
+                               t.Errorf("MapEncodedReply() error = %v, wantErr 
%v", err, tt.wantErr)
+                       }
+               })
+       }
+}
+
+func TestTagToCBusMessage(t *testing.T) {
+       type args struct {
+               tag            apiModel.PlcTag
+               value          apiValues.PlcValue
+               alphaGenerator *AlphaGenerator
+               messageCodec   *MessageCodec
+       }
+       tests := []struct {
+               name                  string
+               args                  args
+               wantCBusMessage       readWriteModel.CBusMessage
+               wantSupportsRead      bool
+               wantSupportsWrite     bool
+               wantSupportsSubscribe bool
+               wantErr               bool
+       }{
+               // TODO: Add test cases.
+       }
+       for _, tt := range tests {
+               t.Run(tt.name, func(t *testing.T) {
+                       gotCBusMessage, gotSupportsRead, gotSupportsWrite, 
gotSupportsSubscribe, err := TagToCBusMessage(tt.args.tag, tt.args.value, 
tt.args.alphaGenerator, tt.args.messageCodec)
+                       if (err != nil) != tt.wantErr {
+                               t.Errorf("TagToCBusMessage() error = %v, 
wantErr %v", err, tt.wantErr)
+                               return
+                       }
+                       if !reflect.DeepEqual(gotCBusMessage, 
tt.wantCBusMessage) {
+                               t.Errorf("TagToCBusMessage() gotCBusMessage = 
%v, want %v", gotCBusMessage, tt.wantCBusMessage)
+                       }
+                       if gotSupportsRead != tt.wantSupportsRead {
+                               t.Errorf("TagToCBusMessage() gotSupportsRead = 
%v, want %v", gotSupportsRead, tt.wantSupportsRead)
+                       }
+                       if gotSupportsWrite != tt.wantSupportsWrite {
+                               t.Errorf("TagToCBusMessage() gotSupportsWrite = 
%v, want %v", gotSupportsWrite, tt.wantSupportsWrite)
+                       }
+                       if gotSupportsSubscribe != tt.wantSupportsSubscribe {
+                               t.Errorf("TagToCBusMessage() 
gotSupportsSubscribe = %v, want %v", gotSupportsSubscribe, 
tt.wantSupportsSubscribe)
+                       }
+               })
+       }
+}
diff --git a/plc4go/internal/cbus/Reader_test.go 
b/plc4go/internal/cbus/Reader_test.go
deleted file mode 100644
index 3fc33eaac1..0000000000
--- a/plc4go/internal/cbus/Reader_test.go
+++ /dev/null
@@ -1,171 +0,0 @@
-package cbus
-
-import (
-       "context"
-       apiModel "github.com/apache/plc4x/plc4go/pkg/api/model"
-       apiValues "github.com/apache/plc4x/plc4go/pkg/api/values"
-       readWriteModel 
"github.com/apache/plc4x/plc4go/protocols/cbus/readwrite/model"
-       "github.com/apache/plc4x/plc4go/spi"
-       "reflect"
-       "testing"
-)
-
-func TestNewReader(t *testing.T) {
-       type args struct {
-               tpduGenerator *AlphaGenerator
-               messageCodec  spi.MessageCodec
-               tm            *spi.RequestTransactionManager
-       }
-       tests := []struct {
-               name string
-               args args
-               want *Reader
-       }{
-               // TODO: Add test cases.
-       }
-       for _, tt := range tests {
-               t.Run(tt.name, func(t *testing.T) {
-                       if got := NewReader(tt.args.tpduGenerator, 
tt.args.messageCodec, tt.args.tm); !reflect.DeepEqual(got, tt.want) {
-                               t.Errorf("NewReader() = %v, want %v", got, 
tt.want)
-                       }
-               })
-       }
-}
-
-func TestReader_Read(t *testing.T) {
-       type fields struct {
-               alphaGenerator *AlphaGenerator
-               messageCodec   spi.MessageCodec
-               tm             *spi.RequestTransactionManager
-       }
-       type args struct {
-               ctx         context.Context
-               readRequest apiModel.PlcReadRequest
-       }
-       tests := []struct {
-               name   string
-               fields fields
-               args   args
-               want   <-chan apiModel.PlcReadRequestResult
-       }{
-               // TODO: Add test cases.
-       }
-       for _, tt := range tests {
-               t.Run(tt.name, func(t *testing.T) {
-                       m := &Reader{
-                               alphaGenerator: tt.fields.alphaGenerator,
-                               messageCodec:   tt.fields.messageCodec,
-                               tm:             tt.fields.tm,
-                       }
-                       if got := m.Read(tt.args.ctx, tt.args.readRequest); 
!reflect.DeepEqual(got, tt.want) {
-                               t.Errorf("Read() = %v, want %v", got, tt.want)
-                       }
-               })
-       }
-}
-
-func TestReader_readSync(t *testing.T) {
-       type fields struct {
-               alphaGenerator *AlphaGenerator
-               messageCodec   spi.MessageCodec
-               tm             *spi.RequestTransactionManager
-       }
-       type args struct {
-               ctx         context.Context
-               readRequest apiModel.PlcReadRequest
-               result      chan apiModel.PlcReadRequestResult
-       }
-       tests := []struct {
-               name   string
-               fields fields
-               args   args
-       }{
-               // TODO: Add test cases.
-       }
-       for _, tt := range tests {
-               t.Run(tt.name, func(t *testing.T) {
-                       m := &Reader{
-                               alphaGenerator: tt.fields.alphaGenerator,
-                               messageCodec:   tt.fields.messageCodec,
-                               tm:             tt.fields.tm,
-                       }
-                       m.readSync(tt.args.ctx, tt.args.readRequest, 
tt.args.result)
-               })
-       }
-}
-
-func TestReader_mapEncodedReply(t *testing.T) {
-       type fields struct {
-               alphaGenerator *AlphaGenerator
-               messageCodec   spi.MessageCodec
-               tm             *spi.RequestTransactionManager
-       }
-       type args struct {
-               transaction     *spi.RequestTransaction
-               encodedReply    readWriteModel.EncodedReply
-               tagName         string
-               addResponseCode func(name string, responseCode 
apiModel.PlcResponseCode)
-               addPlcValue     func(name string, plcValue apiValues.PlcValue)
-       }
-       tests := []struct {
-               name    string
-               fields  fields
-               args    args
-               wantErr bool
-       }{
-               {
-                       name: "empty input",
-                       args: args{
-                               transaction: func() *spi.RequestTransaction {
-                                       transactionManager := 
spi.NewRequestTransactionManager(1)
-                                       transaction := 
transactionManager.StartTransaction()
-                                       transaction.Submit(func() {
-                                               // NO-OP
-                                       })
-                                       return transaction
-                               }(),
-                               encodedReply:    nil,
-                               tagName:         "",
-                               addResponseCode: nil,
-                               addPlcValue:     nil,
-                       },
-               },
-               {
-                       name: "CALDataStatus",
-                       args: args{
-                               transaction: func() *spi.RequestTransaction {
-                                       transactionManager := 
spi.NewRequestTransactionManager(1)
-                                       transaction := 
transactionManager.StartTransaction()
-                                       transaction.Submit(func() {
-                                               // NO-OP
-                                       })
-                                       return transaction
-                               }(),
-                               encodedReply: func() 
readWriteModel.EncodedReplyCALReply {
-                                       calDataStatus := 
readWriteModel.NewCALDataStatus(readWriteModel.ApplicationIdContainer_LIGHTING_3A,
 0, nil, readWriteModel.CALCommandTypeContainer_CALCommandStatus_0Bytes, nil, 
nil)
-                                       calReplyShort := 
readWriteModel.NewCALReplyShort(0, calDataStatus, nil, nil)
-                                       return 
readWriteModel.NewEncodedReplyCALReply(calReplyShort, 0, nil, nil)
-                               }(),
-                               tagName: "someTag",
-                               addResponseCode: func(name string, responseCode 
apiModel.PlcResponseCode) {
-                                       // TODO: add assertions
-                               },
-                               addPlcValue: func(name string, plcValue 
apiValues.PlcValue) {
-                                       // TODO: add assertions
-                               },
-                       },
-               },
-       }
-       for _, tt := range tests {
-               t.Run(tt.name, func(t *testing.T) {
-                       m := &Reader{
-                               alphaGenerator: tt.fields.alphaGenerator,
-                               messageCodec:   tt.fields.messageCodec,
-                               tm:             tt.fields.tm,
-                       }
-                       if err := m.mapEncodedReply(tt.args.transaction, 
tt.args.encodedReply, tt.args.tagName, tt.args.addResponseCode, 
tt.args.addPlcValue); (err != nil) != tt.wantErr {
-                               t.Errorf("mapEncodedReply() error = %v, wantErr 
%v", err, tt.wantErr)
-                       }
-               })
-       }
-}
diff --git a/plc4go/internal/cbus/Tag.go b/plc4go/internal/cbus/Tag.go
index 31320e293d..373fc5bd73 100644
--- a/plc4go/internal/cbus/Tag.go
+++ b/plc4go/internal/cbus/Tag.go
@@ -74,6 +74,7 @@ func NewStatusTag(statusRequestType StatusRequestType, 
startingGroupAddressLabel
 }
 
 type CalTag interface {
+       GetBridgeAddresses() []readWriteModel.BridgeAddress
        GetUnitAddress() readWriteModel.UnitAddress
 }
 
@@ -86,9 +87,9 @@ type CALRecallTag interface {
        GetCount() uint8
 }
 
-func NewCALRecallTag(unitAddress readWriteModel.UnitAddress, parameter 
readWriteModel.Parameter, count uint8, numElements uint16) CALRecallTag {
+func NewCALRecallTag(unitAddress readWriteModel.UnitAddress, bridgeAddresses 
[]readWriteModel.BridgeAddress, parameter readWriteModel.Parameter, count 
uint8, numElements uint16) CALRecallTag {
        return &calRecallTag{
-               calTag:      calTag{unitAddress: unitAddress},
+               calTag:      calTag{bridgeAddresses, unitAddress},
                tagType:     CAL_RECALL,
                parameter:   parameter,
                count:       count,
@@ -104,17 +105,17 @@ type CALIdentifyTag interface {
        GetAttribute() readWriteModel.Attribute
 }
 
-func NewCALIdentifyTag(unitAddress readWriteModel.UnitAddress, attribute 
readWriteModel.Attribute, numElements uint16) CALIdentifyTag {
+func NewCALIdentifyTag(unitAddress readWriteModel.UnitAddress, bridgeAddresses 
[]readWriteModel.BridgeAddress, attribute readWriteModel.Attribute, numElements 
uint16) CALIdentifyTag {
        return &calIdentifyTag{
-               calTag:      calTag{unitAddress: unitAddress},
+               calTag:      calTag{bridgeAddresses, unitAddress},
                tagType:     CAL_IDENTIFY,
                attribute:   attribute,
                numElements: numElements,
        }
 }
 
-// CALGetstatusTag can be used to get device/network management tags
-type CALGetstatusTag interface {
+// CALGetStatusTag can be used to get device/network management tags
+type CALGetStatusTag interface {
        Tag
        CalTag
 
@@ -122,9 +123,9 @@ type CALGetstatusTag interface {
        GetCount() uint8
 }
 
-func NewCALGetstatusTag(unitAddress readWriteModel.UnitAddress, parameter 
readWriteModel.Parameter, count uint8, numElements uint16) CALGetstatusTag {
-       return &calGetstatusTag{
-               calTag:      calTag{unitAddress: unitAddress},
+func NewCALGetStatusTag(unitAddress readWriteModel.UnitAddress, 
bridgeAddresses []readWriteModel.BridgeAddress, parameter 
readWriteModel.Parameter, count uint8, numElements uint16) CALGetStatusTag {
+       return &calGetStatusTag{
+               calTag:      calTag{bridgeAddresses, unitAddress},
                tagType:     CAL_RECALL,
                parameter:   parameter,
                count:       count,
@@ -198,7 +199,8 @@ type statusTag struct {
 }
 
 type calTag struct {
-       unitAddress readWriteModel.UnitAddress
+       bridgeAddresses []readWriteModel.BridgeAddress
+       unitAddress     readWriteModel.UnitAddress
 }
 
 type calRecallTag struct {
@@ -216,7 +218,7 @@ type calIdentifyTag struct {
        numElements uint16
 }
 
-type calGetstatusTag struct {
+type calGetStatusTag struct {
        calTag
        tagType     TagType
        parameter   readWriteModel.Parameter
@@ -302,7 +304,7 @@ func (s statusTag) Serialize() ([]byte, error) {
        return wb.GetBytes(), nil
 }
 
-func (s statusTag) SerializeWithWriteBuffer(ctx context.Context, writeBuffer 
utils.WriteBuffer) error {
+func (s statusTag) SerializeWithWriteBuffer(_ context.Context, writeBuffer 
utils.WriteBuffer) error {
        if err := writeBuffer.PushContext(s.tagType.GetName()); err != nil {
                return err
        }
@@ -333,6 +335,10 @@ func (s statusTag) String() string {
        return writeBuffer.GetBox().String()
 }
 
+func (c calTag) GetBridgeAddresses() []readWriteModel.BridgeAddress {
+       return c.bridgeAddresses
+}
+
 func (c calTag) GetUnitAddress() readWriteModel.UnitAddress {
        return c.unitAddress
 }
@@ -346,6 +352,19 @@ func (c calTag) Serialize() ([]byte, error) {
 }
 
 func (c calTag) SerializeWithWriteBuffer(ctx context.Context, writeBuffer 
utils.WriteBuffer) error {
+       if len(c.bridgeAddresses) > 0 {
+               if err := writeBuffer.PushContext("bridgeAddresses"); err != 
nil {
+                       return err
+               }
+               for _, address := range c.bridgeAddresses {
+                       if err := address.SerializeWithWriteBuffer(ctx, 
writeBuffer); err != nil {
+                               return err
+                       }
+               }
+               if err := writeBuffer.PopContext("bridgeAddresses"); err != nil 
{
+                       return err
+               }
+       }
        if unitAddress := c.unitAddress; unitAddress != nil {
                return c.unitAddress.SerializeWithWriteBuffer(ctx, writeBuffer)
        }
@@ -388,8 +407,8 @@ func (c calRecallTag) GetArrayInfo() []model.ArrayInfo {
        return []model.ArrayInfo{}
 }
 
-func (s calRecallTag) GetTagType() TagType {
-       return s.tagType
+func (c calRecallTag) GetTagType() TagType {
+       return c.tagType
 }
 
 func (c calRecallTag) Serialize() ([]byte, error) {
@@ -455,8 +474,8 @@ func (c calIdentifyTag) GetArrayInfo() []model.ArrayInfo {
        return []model.ArrayInfo{}
 }
 
-func (s calIdentifyTag) GetTagType() TagType {
-       return s.tagType
+func (c calIdentifyTag) GetTagType() TagType {
+       return c.tagType
 }
 
 func (c calIdentifyTag) Serialize() ([]byte, error) {
@@ -494,23 +513,23 @@ func (c calIdentifyTag) String() string {
        return writeBuffer.GetBox().String()
 }
 
-func (c calGetstatusTag) GetParameter() readWriteModel.Parameter {
+func (c calGetStatusTag) GetParameter() readWriteModel.Parameter {
        return c.parameter
 }
 
-func (c calGetstatusTag) GetCount() uint8 {
+func (c calGetStatusTag) GetCount() uint8 {
        return c.count
 }
 
-func (c calGetstatusTag) GetAddressString() string {
+func (c calGetStatusTag) GetAddressString() string {
        return fmt.Sprintf("cal/getstatus=%s, %d", c.parameter, c.GetCount())
 }
 
-func (c calGetstatusTag) GetValueType() values.PlcValueType {
+func (c calGetStatusTag) GetValueType() values.PlcValueType {
        return values.Struct
 }
 
-func (c calGetstatusTag) GetArrayInfo() []model.ArrayInfo {
+func (c calGetStatusTag) GetArrayInfo() []model.ArrayInfo {
        if c.count != 1 {
                return []model.ArrayInfo{
                        model2.DefaultArrayInfo{
@@ -522,11 +541,11 @@ func (c calGetstatusTag) GetArrayInfo() []model.ArrayInfo 
{
        return []model.ArrayInfo{}
 }
 
-func (s calGetstatusTag) GetTagType() TagType {
-       return s.tagType
+func (c calGetStatusTag) GetTagType() TagType {
+       return c.tagType
 }
 
-func (c calGetstatusTag) Serialize() ([]byte, error) {
+func (c calGetStatusTag) Serialize() ([]byte, error) {
        wb := 
utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.BigEndian))
        if err := c.SerializeWithWriteBuffer(context.Background(), wb); err != 
nil {
                return nil, err
@@ -534,7 +553,7 @@ func (c calGetstatusTag) Serialize() ([]byte, error) {
        return wb.GetBytes(), nil
 }
 
-func (c calGetstatusTag) SerializeWithWriteBuffer(ctx context.Context, 
writeBuffer utils.WriteBuffer) error {
+func (c calGetStatusTag) SerializeWithWriteBuffer(ctx context.Context, 
writeBuffer utils.WriteBuffer) error {
        if err := writeBuffer.PushContext(c.tagType.GetName()); err != nil {
                return err
        }
@@ -557,7 +576,7 @@ func (c calGetstatusTag) SerializeWithWriteBuffer(ctx 
context.Context, writeBuff
        return nil
 }
 
-func (c calGetstatusTag) String() string {
+func (c calGetStatusTag) String() string {
        writeBuffer := utils.NewWriteBufferBoxBasedWithOptions(true, true)
        if err := writeBuffer.WriteSerializable(context.Background(), c); err 
!= nil {
                return err.Error()
@@ -738,8 +757,8 @@ func (m mmiMonitorTag) GetArrayInfo() []model.ArrayInfo {
        return []model.ArrayInfo{}
 }
 
-func (s mmiMonitorTag) GetTagType() TagType {
-       return s.tagType
+func (m mmiMonitorTag) GetTagType() TagType {
+       return m.tagType
 }
 
 func (m mmiMonitorTag) GetUnitAddress() *readWriteModel.UnitAddress {
diff --git a/plc4go/internal/cbus/TagHandler.go 
b/plc4go/internal/cbus/TagHandler.go
index 7bbac27efa..f6d4900f07 100644
--- a/plc4go/internal/cbus/TagHandler.go
+++ b/plc4go/internal/cbus/TagHandler.go
@@ -72,7 +72,7 @@ type TagHandler struct {
 func NewTagHandler() TagHandler {
        return TagHandler{
                statusRequestPattern: 
regexp.MustCompile(`^status/(?P<statusRequestType>(?P<binary>binary)|level=0x(?P<startingGroupAddressLabel>00|20|40|60|80|A0|C0|E0))/(?P<application>.*)`),
-               calPattern:           
regexp.MustCompile(`^cal/(?P<unitAddress>.+)/(?P<calType>reset|recall=\[(?P<recallParamNo>\w+),
 
?(?P<recallCount>\d+)]|identify=(?P<identifyAttribute>\w+)|getstatus=(?P<getstatusParamNo>\w+),
 ?(?P<getstatusCount>\d+)|write=\[(?P<writeParamNo>\w+), 
?(?P<writeCode>0[xX][0-9a-fA-F][0-9a-fA-F])]|identifyReply=(?P<replyAttribute>\w+)|reply=(?P<replyParamNo>\w+)|status=(?P<statusApplication>.*)|statusExtended=(?P<statusExtendedApplication>.*))`),
+               calPattern:           
regexp.MustCompile(`^cal/(?P<unitAddress>.+)/(?P<calType>reset|recall=\[(?P<recallParamNo>\w+),
 
?(?P<recallCount>\d+)]|identify=(?P<identifyAttribute>\w+)|getStatus=(?P<getStatusParamNo>\w+),
 ?(?P<getStatusCount>\d+)|write=\[(?P<writeParamNo>\w+), 
?(?P<writeCode>0[xX][0-9a-fA-F][0-9a-fA-F])]|identifyReply=(?P<replyAttribute>\w+)|reply=(?P<replyParamNo>\w+)|status=(?P<statusApplication>.*)|statusExtended=(?P<statusExtendedApplication>.*))`),
                salPattern:           
regexp.MustCompile(`^sal/(?P<application>.*)/(?P<salCommand>.*)`),
                salMonitorPattern:    
regexp.MustCompile(`^salmonitor/(?P<unitAddress>.+)/(?P<application>.+)`),
                mmiMonitorPattern:    
regexp.MustCompile(`^mmimonitor/(?P<unitAddress>.+)/(?P<application>.+)`),
@@ -181,6 +181,8 @@ func (m TagHandler) handleCalPattern(match 
map[string]string) (model.PlcTag, err
                }
                unitAddress = readWriteModel.NewUnitAddress(byte(atoi))
        }
+       var bridgeAddresses []readWriteModel.BridgeAddress
+       // TODO: extract bridge addresses
 
        calTypeArgument := match["calType"]
        switch {
@@ -216,7 +218,7 @@ func (m TagHandler) handleCalPattern(match 
map[string]string) (model.PlcTag, err
                        return nil, errors.Wrap(err, "recallCount not a valid 
number")
                }
                count = uint8(atoi)
-               return NewCALRecallTag(unitAddress, recalParamNo, count, 1), nil
+               return NewCALRecallTag(unitAddress, bridgeAddresses, 
recalParamNo, count, 1), nil
        case strings.HasPrefix(calTypeArgument, "identify="):
                var attribute readWriteModel.Attribute
                attributeArgument := match["identifyAttribute"]
@@ -240,10 +242,10 @@ func (m TagHandler) handleCalPattern(match 
map[string]string) (model.PlcTag, err
                                attribute = parameterByName
                        }
                }
-               return NewCALIdentifyTag(unitAddress, attribute, 1), nil
-       case strings.HasPrefix(calTypeArgument, "getstatus="):
+               return NewCALIdentifyTag(unitAddress, bridgeAddresses, 
attribute, 1), nil
+       case strings.HasPrefix(calTypeArgument, "getStatus="):
                var recalParamNo readWriteModel.Parameter
-               recallParamNoArgument := match["getstatusParamNo"]
+               recallParamNoArgument := match["getStatusParamNo"]
                if strings.HasPrefix(recallParamNoArgument, "0x") {
                        decodedHex, err := 
hex.DecodeString(recallParamNoArgument[2:])
                        if err != nil {
@@ -259,18 +261,18 @@ func (m TagHandler) handleCalPattern(match 
map[string]string) (model.PlcTag, err
                        } else {
                                parameterByName, ok := 
readWriteModel.ParameterByName(recallParamNoArgument)
                                if !ok {
-                                       return nil, errors.Errorf("Unknown 
getstatusParamNo %s", recallParamNoArgument)
+                                       return nil, errors.Errorf("Unknown 
getStatusParamNo %s", recallParamNoArgument)
                                }
                                recalParamNo = parameterByName
                        }
                }
                var count uint8
-               atoi, err := strconv.ParseUint(match["getstatusCount"], 10, 8)
+               atoi, err := strconv.ParseUint(match["getStatusCount"], 10, 8)
                if err != nil {
-                       return nil, errors.Wrap(err, "getstatusCount not a 
valid number")
+                       return nil, errors.Wrap(err, "getStatusCount not a 
valid number")
                }
                count = uint8(atoi)
-               return NewCALGetstatusTag(unitAddress, recalParamNo, count, 1), 
nil
+               return NewCALGetStatusTag(unitAddress, bridgeAddresses, 
recalParamNo, count, 1), nil
        case strings.HasPrefix(calTypeArgument, "write="):
                panic("Not implemented") // TODO: implement me
        case strings.HasPrefix(calTypeArgument, "identifyReply="):

Reply via email to