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/08/16 11:13:58 UTC

[plc4x] branch develop updated: fix(plc4go/cbus): fix address string of unit info field

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 2a5b518ba fix(plc4go/cbus): fix address string of unit info field
2a5b518ba is described below

commit 2a5b518bae07c1a96341316d28c74becc9e6b0c2
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Aug 16 13:13:50 2022 +0200

    fix(plc4go/cbus): fix address string of unit info field
---
 plc4go/internal/cbus/Field.go | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/plc4go/internal/cbus/Field.go b/plc4go/internal/cbus/Field.go
index f9b151d26..e3572b59f 100644
--- a/plc4go/internal/cbus/Field.go
+++ b/plc4go/internal/cbus/Field.go
@@ -235,6 +235,7 @@ type unitInfoField struct {
 ///////////////////////////////////////
 
 func (m statusField) GetAddressString() string {
+	// TODO: this is nonsense... fix that
 	return fmt.Sprintf("%d[%d]", m.fieldType, m.numElements)
 }
 
@@ -306,6 +307,7 @@ func (c calRecallField) GetCount() uint8 {
 }
 
 func (c calRecallField) GetAddressString() string {
+	// TODO: this is nonsense... fix that
 	return fmt.Sprintf("%d[%d]", c.fieldType, c.numElements)
 }
 
@@ -353,6 +355,7 @@ func (c calIdentifyField) GetAttribute() readWriteModel.Attribute {
 }
 
 func (c calIdentifyField) GetAddressString() string {
+	// TODO: this is nonsense... fix that
 	return fmt.Sprintf("%d[%d]", c.fieldType, c.numElements)
 }
 
@@ -400,6 +403,7 @@ func (c calGetstatusField) GetCount() uint8 {
 }
 
 func (c calGetstatusField) GetAddressString() string {
+	// TODO: this is nonsense... fix that
 	return fmt.Sprintf("%d[%d]", c.fieldType, c.numElements)
 }
 
@@ -443,6 +447,7 @@ func (c calGetstatusField) String() string {
 }
 
 func (s salMonitorField) GetAddressString() string {
+	// TODO: this is nonsense... fix that
 	return fmt.Sprintf("%d/%s%s[%d]", s.fieldType, s.unitAddress, s.application, s.numElements)
 }
 
@@ -489,6 +494,7 @@ func (s salMonitorField) String() string {
 }
 
 func (m mmiMonitorField) GetAddressString() string {
+	// TODO: this is nonsense... fix that
 	return fmt.Sprintf("%d/%s%s[%d]", m.fieldType, m.unitAddress, m.application, m.numElements)
 }
 
@@ -543,7 +549,15 @@ func (u unitInfoField) GetAttribute() *readWriteModel.Attribute {
 }
 
 func (u unitInfoField) GetAddressString() string {
-	return fmt.Sprintf("%d[%d]", u.fieldType, u.numElements)
+	unitAddressString := "*"
+	if u.unitAddress != nil {
+		unitAddressString = fmt.Sprintf("%d", *u.unitAddress)
+	}
+	attributeString := "*"
+	if u.attribute != nil {
+		unitAddressString = u.attribute.String()
+	}
+	return fmt.Sprintf("cal/%s/identify=%s", unitAddressString, attributeString)
 }
 
 func (u unitInfoField) GetTypeName() string {