From 276404939ea2e840b67b97fea60d42a218543184 Mon Sep 17 00:00:00 2001 From: Rohit Jadhav <69809379+jadhavrohit924@users.noreply.github.com> Date: Tue, 29 Aug 2023 07:02:27 +0530 Subject: [PATCH] Sync error code returning by SetTemperature command with spec (#28910) --- .../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