Skip to content

Commit

Permalink
[Pump-server] Add unsupported operation mode handling in pump server (#…
Browse files Browse the repository at this point in the history
…20154)

* Updated pump server to handle unsupported operation modes

* Remove empty states and adjusted default

* remove whitespaces

Co-authored-by: Mathias K. Garbus <mgarbus@grundfos.com>
  • Loading branch information
2 people authored and pull[bot] committed Feb 15, 2024
1 parent c47a605 commit 1417952
Showing 1 changed file with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,9 @@ chip::Protocols::InteractionModel::Status MatterPumpConfigurationAndControlClust
{
case Attributes::ControlMode::Id: {
PumpControlMode controlMode;
NumericAttributeTraits<PumpControlMode>::StorageType storage;
memcpy(&storage, value, size);
controlMode = NumericAttributeTraits<PumpControlMode>::StorageToWorking(storage);
NumericAttributeTraits<PumpControlMode>::StorageType tmp;
memcpy(&tmp, value, size);
controlMode = NumericAttributeTraits<PumpControlMode>::StorageToWorking(tmp);
switch (controlMode)
{
case PumpControlMode::kConstantFlow:
Expand Down Expand Up @@ -389,8 +389,31 @@ chip::Protocols::InteractionModel::Status MatterPumpConfigurationAndControlClust
}
}
break;

case Attributes::OperationMode::Id:
// TODO: Implement checks on the Operation Mode values
PumpOperationMode operationMode;
NumericAttributeTraits<PumpOperationMode>::StorageType tmp;
memcpy(&tmp, value, size);
operationMode = NumericAttributeTraits<PumpOperationMode>::StorageToWorking(tmp);

switch (operationMode)
{
case PumpOperationMode::kMinimum:
if (!IsFeatureSupported(attributePath.mEndpointId, Attributes::MinConstSpeed::Get, Attributes::MaxConstSpeed::Get))
{
status = Protocols::InteractionModel::Status::ConstraintError;
}
break;
case PumpOperationMode::kMaximum:
if (!IsFeatureSupported(attributePath.mEndpointId, Attributes::MinConstSpeed::Get, Attributes::MaxConstSpeed::Get))
{
status = Protocols::InteractionModel::Status::ConstraintError;
}
break;
default:
status = Protocols::InteractionModel::Status::Success;
}

break;
default:
status = Protocols::InteractionModel::Status::Success;
Expand Down

0 comments on commit 1417952

Please sign in to comment.