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/09/12 10:00:53 UTC

[plc4x] branch develop updated (7654a7d18 -> 28708f9bf)

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

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


    from 7654a7d18 build(deps): bump github.com/schollz/progressbar/v3 in /plc4go (#497)
     new 9d0ba2b4a fix(cbus): correct wrong name of HVAC Actuator
     new 28708f9bf feat(cbus): map sal data command type into address

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 plc4go/internal/cbus/Subscriber.go                 | 54 +++++++++++++++++++-
 .../cbus/readwrite/model/SALDataHvacActuator.go    | 58 +++++++++++-----------
 .../src/main/resources/protocols/cbus/c-bus.mspec  |  2 +-
 3 files changed, 83 insertions(+), 31 deletions(-)


[plc4x] 02/02: feat(cbus): map sal data command type into address

Posted by sr...@apache.org.
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 28708f9bf5fc6aec3f350661689d0588bc6fcf8b
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Sep 12 12:00:46 2022 +0200

    feat(cbus): map sal data command type into address
---
 plc4go/internal/cbus/Subscriber.go | 54 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 53 insertions(+), 1 deletion(-)

diff --git a/plc4go/internal/cbus/Subscriber.go b/plc4go/internal/cbus/Subscriber.go
index 3f64dcbb4..bf1806980 100644
--- a/plc4go/internal/cbus/Subscriber.go
+++ b/plc4go/internal/cbus/Subscriber.go
@@ -289,8 +289,60 @@ func (m *Subscriber) handleMonitoredSal(sal readWriteModel.MonitoredSAL) bool {
 				}
 			}
 
+			var commandType string
+			switch salData := salData.(type) {
+			case readWriteModel.SALDataAccessControlExactly:
+				commandType = salData.GetAccessControlData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataAirConditioningExactly:
+				commandType = salData.GetAirConditioningData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataAudioAndVideoExactly:
+				commandType = salData.GetAudioVideoData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataClockAndTimekeepingExactly:
+				commandType = salData.GetClockAndTimekeepingData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataEnableControlExactly:
+				commandType = salData.GetEnableControlData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataErrorReportingExactly:
+				commandType = salData.GetErrorReportingData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataFreeUsageExactly:
+				commandType = "Unknown"
+			case readWriteModel.SALDataHeatingExactly:
+				commandType = salData.GetHeatingData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataHvacActuatorExactly:
+				commandType = salData.GetHvacActuatorData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataIrrigationControlExactly:
+				commandType = salData.GetIrrigationControlData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataLightingExactly:
+				commandType = salData.GetLightingData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataMeasurementExactly:
+				commandType = salData.GetMeasurementData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataMediaTransportExactly:
+				commandType = salData.GetMediaTransportControlData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataMeteringExactly:
+				commandType = salData.GetMeteringData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataPoolsSpasPondsFountainsControlExactly:
+				commandType = salData.GetPoolsSpaPondsFountainsData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataReservedExactly:
+				commandType = "Unknown"
+			case readWriteModel.SALDataRoomControlSystemExactly:
+				panic("Not implemented yet") // TODO: implement once there
+			case readWriteModel.SALDataSecurityExactly:
+				commandType = salData.GetSecurityData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataTelephonyStatusAndControlExactly:
+				commandType = salData.GetTelephonyData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataTemperatureBroadcastExactly:
+				commandType = salData.GetTemperatureBroadcastData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataTestingExactly:
+				panic("Not implemented yet") // TODO: implement once there
+			case readWriteModel.SALDataTriggerControlExactly:
+				commandType = salData.GetTriggerControlData().GetCommandType().PLC4XEnumName()
+			case readWriteModel.SALDataVentilationExactly:
+				commandType = salData.GetVentilationData().GetCommandType().PLC4XEnumName()
+			default:
+				log.Error().Msgf("Unmapped type %T", salData)
+			}
+
 			// TODO: we need to map commands e.g. if we get a MeteringDataElectricityConsumption we can map that to MeteringDataMeasureElectricity
-			address[fieldName] = fmt.Sprintf("sal/%s/%s", applicationString, "TODO")
+			address[fieldName] = fmt.Sprintf("sal/%s/%s", applicationString, commandType)
 
 			rbvb := spiValues.NewWriteBufferPlcValueBased()
 			err := salData.Serialize(rbvb)


[plc4x] 01/02: fix(cbus): correct wrong name of HVAC Actuator

Posted by sr...@apache.org.
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 9d0ba2b4a029093a6ffc9b6216410aaeeeae9466
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Mon Sep 12 12:00:28 2022 +0200

    fix(cbus): correct wrong name of HVAC Actuator
---
 .../cbus/readwrite/model/SALDataHvacActuator.go    | 58 +++++++++++-----------
 .../src/main/resources/protocols/cbus/c-bus.mspec  |  2 +-
 2 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/plc4go/protocols/cbus/readwrite/model/SALDataHvacActuator.go b/plc4go/protocols/cbus/readwrite/model/SALDataHvacActuator.go
index 473cc8c56..3c266a421 100644
--- a/plc4go/protocols/cbus/readwrite/model/SALDataHvacActuator.go
+++ b/plc4go/protocols/cbus/readwrite/model/SALDataHvacActuator.go
@@ -31,8 +31,8 @@ type SALDataHvacActuator interface {
 	utils.LengthAware
 	utils.Serializable
 	SALData
-	// GetVentilationData returns VentilationData (property field)
-	GetVentilationData() LightingData
+	// GetHvacActuatorData returns HvacActuatorData (property field)
+	GetHvacActuatorData() LightingData
 }
 
 // SALDataHvacActuatorExactly can be used when we want exactly this type and not a type which fulfills SALDataHvacActuator.
@@ -45,7 +45,7 @@ type SALDataHvacActuatorExactly interface {
 // _SALDataHvacActuator is the data-structure of this message
 type _SALDataHvacActuator struct {
 	*_SALData
-	VentilationData LightingData
+	HvacActuatorData LightingData
 }
 
 ///////////////////////////////////////////////////////////
@@ -75,8 +75,8 @@ func (m *_SALDataHvacActuator) GetParent() SALData {
 /////////////////////// Accessors for property fields.
 ///////////////////////
 
-func (m *_SALDataHvacActuator) GetVentilationData() LightingData {
-	return m.VentilationData
+func (m *_SALDataHvacActuator) GetHvacActuatorData() LightingData {
+	return m.HvacActuatorData
 }
 
 ///////////////////////
@@ -85,10 +85,10 @@ func (m *_SALDataHvacActuator) GetVentilationData() LightingData {
 ///////////////////////////////////////////////////////////
 
 // NewSALDataHvacActuator factory function for _SALDataHvacActuator
-func NewSALDataHvacActuator(ventilationData LightingData, salData SALData) *_SALDataHvacActuator {
+func NewSALDataHvacActuator(hvacActuatorData LightingData, salData SALData) *_SALDataHvacActuator {
 	_result := &_SALDataHvacActuator{
-		VentilationData: ventilationData,
-		_SALData:        NewSALData(salData),
+		HvacActuatorData: hvacActuatorData,
+		_SALData:         NewSALData(salData),
 	}
 	_result._SALData._SALDataChildRequirements = _result
 	return _result
@@ -116,8 +116,8 @@ func (m *_SALDataHvacActuator) GetLengthInBits() uint16 {
 func (m *_SALDataHvacActuator) GetLengthInBitsConditional(lastItem bool) uint16 {
 	lengthInBits := uint16(m.GetParentLengthInBits())
 
-	// Simple field (ventilationData)
-	lengthInBits += m.VentilationData.GetLengthInBits()
+	// Simple field (hvacActuatorData)
+	lengthInBits += m.HvacActuatorData.GetLengthInBits()
 
 	return lengthInBits
 }
@@ -135,17 +135,17 @@ func SALDataHvacActuatorParse(readBuffer utils.ReadBuffer, applicationId Applica
 	currentPos := positionAware.GetPos()
 	_ = currentPos
 
-	// Simple Field (ventilationData)
-	if pullErr := readBuffer.PullContext("ventilationData"); pullErr != nil {
-		return nil, errors.Wrap(pullErr, "Error pulling for ventilationData")
+	// Simple Field (hvacActuatorData)
+	if pullErr := readBuffer.PullContext("hvacActuatorData"); pullErr != nil {
+		return nil, errors.Wrap(pullErr, "Error pulling for hvacActuatorData")
 	}
-	_ventilationData, _ventilationDataErr := LightingDataParse(readBuffer)
-	if _ventilationDataErr != nil {
-		return nil, errors.Wrap(_ventilationDataErr, "Error parsing 'ventilationData' field of SALDataHvacActuator")
+	_hvacActuatorData, _hvacActuatorDataErr := LightingDataParse(readBuffer)
+	if _hvacActuatorDataErr != nil {
+		return nil, errors.Wrap(_hvacActuatorDataErr, "Error parsing 'hvacActuatorData' field of SALDataHvacActuator")
 	}
-	ventilationData := _ventilationData.(LightingData)
-	if closeErr := readBuffer.CloseContext("ventilationData"); closeErr != nil {
-		return nil, errors.Wrap(closeErr, "Error closing for ventilationData")
+	hvacActuatorData := _hvacActuatorData.(LightingData)
+	if closeErr := readBuffer.CloseContext("hvacActuatorData"); closeErr != nil {
+		return nil, errors.Wrap(closeErr, "Error closing for hvacActuatorData")
 	}
 
 	if closeErr := readBuffer.CloseContext("SALDataHvacActuator"); closeErr != nil {
@@ -154,8 +154,8 @@ func SALDataHvacActuatorParse(readBuffer utils.ReadBuffer, applicationId Applica
 
 	// Create a partially initialized instance
 	_child := &_SALDataHvacActuator{
-		_SALData:        &_SALData{},
-		VentilationData: ventilationData,
+		_SALData:         &_SALData{},
+		HvacActuatorData: hvacActuatorData,
 	}
 	_child._SALData._SALDataChildRequirements = _child
 	return _child, nil
@@ -169,16 +169,16 @@ func (m *_SALDataHvacActuator) Serialize(writeBuffer utils.WriteBuffer) error {
 			return errors.Wrap(pushErr, "Error pushing for SALDataHvacActuator")
 		}
 
-		// Simple Field (ventilationData)
-		if pushErr := writeBuffer.PushContext("ventilationData"); pushErr != nil {
-			return errors.Wrap(pushErr, "Error pushing for ventilationData")
+		// Simple Field (hvacActuatorData)
+		if pushErr := writeBuffer.PushContext("hvacActuatorData"); pushErr != nil {
+			return errors.Wrap(pushErr, "Error pushing for hvacActuatorData")
 		}
-		_ventilationDataErr := writeBuffer.WriteSerializable(m.GetVentilationData())
-		if popErr := writeBuffer.PopContext("ventilationData"); popErr != nil {
-			return errors.Wrap(popErr, "Error popping for ventilationData")
+		_hvacActuatorDataErr := writeBuffer.WriteSerializable(m.GetHvacActuatorData())
+		if popErr := writeBuffer.PopContext("hvacActuatorData"); popErr != nil {
+			return errors.Wrap(popErr, "Error popping for hvacActuatorData")
 		}
-		if _ventilationDataErr != nil {
-			return errors.Wrap(_ventilationDataErr, "Error serializing 'ventilationData' field")
+		if _hvacActuatorDataErr != nil {
+			return errors.Wrap(_hvacActuatorDataErr, "Error serializing 'hvacActuatorData' field")
 		}
 
 		if popErr := writeBuffer.PopContext("SALDataHvacActuator"); popErr != nil {
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 c3418448a..371684658 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
@@ -1432,7 +1432,7 @@
         ]
         ['HVAC_ACTUATOR'                        *HvacActuator
              // Note: the documentation states that the data for hvac actuator uses LightingData
-            [simple LightingData ventilationData]
+            [simple LightingData hvacActuatorData]
         ]
     ]
     [optional SALData('applicationId') salData                                  ]