From db5d41b1400666c933a382c8efc0aa904d42afdd Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Thu, 25 Jan 2024 17:05:46 +0100 Subject: [PATCH] Update devicediagnosis feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename SendState to SetLocalState, to make it clearer what it does - Don’t trigger a notify, as setting the data will automatically do it --- features/devicediagnosis.go | 4 +--- features/devicediagnosis_test.go | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/features/devicediagnosis.go b/features/devicediagnosis.go index 37a43666..a5a911b8 100644 --- a/features/devicediagnosis.go +++ b/features/devicediagnosis.go @@ -45,8 +45,6 @@ func (d *DeviceDiagnosis) GetState() (*model.DeviceDiagnosisStateDataType, error return data, nil } -func (d *DeviceDiagnosis) SendState(operatingState *model.DeviceDiagnosisStateDataType) { +func (d *DeviceDiagnosis) SetLocalState(operatingState *model.DeviceDiagnosisStateDataType) { d.featureLocal.SetData(model.FunctionTypeDeviceDiagnosisStateData, operatingState) - - _, _ = d.featureLocal.NotifyData(model.FunctionTypeDeviceDiagnosisStateData, nil, nil, false, nil, d.featureRemote) } diff --git a/features/devicediagnosis_test.go b/features/devicediagnosis_test.go index 16f9fc2f..b7b5b97a 100644 --- a/features/devicediagnosis_test.go +++ b/features/devicediagnosis_test.go @@ -75,11 +75,11 @@ func (s *DeviceDiagnosisSuite) Test_GetState() { assert.NotNil(s.T(), result) } -func (s *DeviceDiagnosisSuite) Test_SendState() { +func (s *DeviceDiagnosisSuite) Test_SetState() { data := &model.DeviceDiagnosisStateDataType{ OperatingState: util.Ptr(model.DeviceDiagnosisOperatingStateTypeNormalOperation), PowerSupplyCondition: util.Ptr(model.PowerSupplyConditionTypeGood), } - s.deviceDiagnosis.SendState(data) + s.deviceDiagnosis.SetLocalState(data) assert.NotNil(s.T(), s.sentMessage) }