From 14251c65671efed2ef0d4f989416327a69e1f403 Mon Sep 17 00:00:00 2001 From: Rohit Jadhav Date: Sat, 26 Aug 2023 20:22:08 +0530 Subject: [PATCH] Sync error code returning by SetTemperature command with spec --- .../temperature-control-server.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/app/clusters/temperature-control-server/temperature-control-server.cpp b/src/app/clusters/temperature-control-server/temperature-control-server.cpp index 16e2124f56df8f..cdfd9099e71711 100644 --- a/src/app/clusters/temperature-control-server/temperature-control-server.cpp +++ b/src/app/clusters/temperature-control-server/temperature-control-server.cpp @@ -172,7 +172,13 @@ bool emberAfTemperatureControlClusterSetTemperatureCallback(app::CommandHandler emberAfStatus = TemperatureSetpoint::Set(endpoint, targetTemperature.Value()); if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS) { - status = app::ToInteractionModelStatus(emberAfStatus); + /** + * If the server is unable to execute the command at the time the command is received + * by the server (e.g. due to the design of a device it cannot accept a change in its + * temperature setting after it has begun operation), then the server SHALL respond + * with a status code of INVALID_IN_STATE, and discard the command. + **/ + status = Status::InvalidInState; } } else @@ -200,7 +206,13 @@ bool emberAfTemperatureControlClusterSetTemperatureCallback(app::CommandHandler emberAfStatus = SelectedTemperatureLevel::Set(endpoint, targetTemperatureLevel.Value()); if (emberAfStatus != EMBER_ZCL_STATUS_SUCCESS) { - status = app::ToInteractionModelStatus(emberAfStatus); + /** + * If the server is unable to execute the command at the time the command is received + * by the server (e.g. due to the design of a device it cannot accept a change in its + * temperature setting after it has begun operation), then the server SHALL respond + * with a status code of INVALID_IN_STATE, and discard the command. + **/ + status = Status::InvalidInState; } } else