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/10 14:20:33 UTC

[plc4x] 02/03: fix(cbus): fixed network voltage using the wrong bit size

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 21b3d63e6a5c19ef66afd547fd000a2631b2ae62
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Aug 10 15:43:47 2022 +0200

    fix(cbus): fixed network voltage using the wrong bit size
---
 .../readwrite/model/IdentifyReplyCommandNetworkVoltage.go    | 12 ++++++------
 .../c-bus/src/main/resources/protocols/cbus/c-bus.mspec      |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandNetworkVoltage.go b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandNetworkVoltage.go
index 22b2a5e3f..0845b06f3 100644
--- a/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandNetworkVoltage.go
+++ b/plc4go/protocols/cbus/readwrite/model/IdentifyReplyCommandNetworkVoltage.go
@@ -145,13 +145,13 @@ func (m *_IdentifyReplyCommandNetworkVoltage) GetLengthInBitsConditional(lastIte
 	lengthInBits := uint16(m.GetParentLengthInBits())
 
 	// Simple field (volts)
-	lengthInBits += 2
+	lengthInBits += 16
 
 	// Const Field (dot)
 	lengthInBits += 8
 
 	// Simple field (voltsDecimalPlace)
-	lengthInBits += 2
+	lengthInBits += 16
 
 	// Const Field (v)
 	lengthInBits += 8
@@ -173,7 +173,7 @@ func IdentifyReplyCommandNetworkVoltageParse(readBuffer utils.ReadBuffer, attrib
 	_ = currentPos
 
 	// Simple Field (volts)
-	_volts, _voltsErr := readBuffer.ReadString("volts", uint32(2))
+	_volts, _voltsErr := readBuffer.ReadString("volts", uint32(16))
 	if _voltsErr != nil {
 		return nil, errors.Wrap(_voltsErr, "Error parsing 'volts' field of IdentifyReplyCommandNetworkVoltage")
 	}
@@ -189,7 +189,7 @@ func IdentifyReplyCommandNetworkVoltageParse(readBuffer utils.ReadBuffer, attrib
 	}
 
 	// Simple Field (voltsDecimalPlace)
-	_voltsDecimalPlace, _voltsDecimalPlaceErr := readBuffer.ReadString("voltsDecimalPlace", uint32(2))
+	_voltsDecimalPlace, _voltsDecimalPlaceErr := readBuffer.ReadString("voltsDecimalPlace", uint32(16))
 	if _voltsDecimalPlaceErr != nil {
 		return nil, errors.Wrap(_voltsDecimalPlaceErr, "Error parsing 'voltsDecimalPlace' field of IdentifyReplyCommandNetworkVoltage")
 	}
@@ -230,7 +230,7 @@ func (m *_IdentifyReplyCommandNetworkVoltage) Serialize(writeBuffer utils.WriteB
 
 		// Simple Field (volts)
 		volts := string(m.GetVolts())
-		_voltsErr := writeBuffer.WriteString("volts", uint32(2), "UTF-8", (volts))
+		_voltsErr := writeBuffer.WriteString("volts", uint32(16), "UTF-8", (volts))
 		if _voltsErr != nil {
 			return errors.Wrap(_voltsErr, "Error serializing 'volts' field")
 		}
@@ -243,7 +243,7 @@ func (m *_IdentifyReplyCommandNetworkVoltage) Serialize(writeBuffer utils.WriteB
 
 		// Simple Field (voltsDecimalPlace)
 		voltsDecimalPlace := string(m.GetVoltsDecimalPlace())
-		_voltsDecimalPlaceErr := writeBuffer.WriteString("voltsDecimalPlace", uint32(2), "UTF-8", (voltsDecimalPlace))
+		_voltsDecimalPlaceErr := writeBuffer.WriteString("voltsDecimalPlace", uint32(16), "UTF-8", (voltsDecimalPlace))
 		if _voltsDecimalPlaceErr != nil {
 			return errors.Wrap(_voltsDecimalPlaceErr, "Error serializing 'voltsDecimalPlace' field")
 		}
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 022e5cc53..e76267854 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
@@ -1100,9 +1100,9 @@
             [array  byte        terminalLevels        count 'numBytes'       ] // TODO: check datatype
         ]
         ['NetworkVoltage'               IdentifyReplyCommandNetworkVoltage
-           [simple string 2     volts                   ]
+           [simple string 16    volts                   ]
            [const  byte         dot     0x2C            ]
-           [simple string 2     voltsDecimalPlace       ]
+           [simple string 16    voltsDecimalPlace       ]
            [const  byte         v       0x56            ]
         ]
         ['GAVValuesCurrent'             IdentifyReplyCommandGAVValuesCurrent