Skip to content

Commit

Permalink
Update devicediagnosis feature
Browse files Browse the repository at this point in the history
- Rename SendState to SetLocalState, to make it clearer what it does
- Don’t trigger a notify, as setting the data will automatically do it
  • Loading branch information
DerAndereAndi committed Jan 25, 2024
1 parent 4d46945 commit db5d41b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions features/devicediagnosis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
4 changes: 2 additions & 2 deletions features/devicediagnosis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit db5d41b

Please sign in to comment.