From 2ceb2cc1629aaf2d6aa33fcdcc2f5645fe864aca Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Fri, 2 Dec 2022 22:05:19 +0100 Subject: [PATCH] Remove EMBER_ZCL_STATUS_INVALID_VALUE --- .../barrier-control-server/barrier-control-server.cpp | 2 +- src/app/clusters/groups-server/groups-server.cpp | 2 +- src/app/clusters/ias-zone-server/ias-zone-server.cpp | 2 +- .../window-covering-server/window-covering-server.cpp | 4 ++-- src/app/tests/suites/TestCluster.yaml | 2 +- src/app/util/af-enums.h | 1 - src/app/util/attribute-table.cpp | 6 +++--- zzz_generated/chip-tool/zap-generated/test/Commands.h | 2 +- .../darwin-framework-tool/zap-generated/test/Commands.h | 4 ++-- 9 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/app/clusters/barrier-control-server/barrier-control-server.cpp b/src/app/clusters/barrier-control-server/barrier-control-server.cpp index bb7d65d29a0aa9..e310d7ba541061 100644 --- a/src/app/clusters/barrier-control-server/barrier-control-server.cpp +++ b/src/app/clusters/barrier-control-server/barrier-control-server.cpp @@ -286,7 +286,7 @@ bool emberAfBarrierControlClusterBarrierControlGoToPercentCallback( percentOpen != EMBER_ZCL_BARRIER_CONTROL_BARRIER_POSITION_CLOSED && percentOpen != EMBER_ZCL_BARRIER_CONTROL_BARRIER_POSITION_OPEN)) { - status = EMBER_ZCL_STATUS_INVALID_VALUE; + status = EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } else { diff --git a/src/app/clusters/groups-server/groups-server.cpp b/src/app/clusters/groups-server/groups-server.cpp index 523fea8a76d4d5..588220e0dc371f 100644 --- a/src/app/clusters/groups-server/groups-server.cpp +++ b/src/app/clusters/groups-server/groups-server.cpp @@ -160,7 +160,7 @@ bool emberAfGroupsClusterViewGroupCallback(app::CommandHandler * commandObj, con CHIP_ERROR err = CHIP_NO_ERROR; EmberAfStatus status = EMBER_ZCL_STATUS_NOT_FOUND; - VerifyOrExit(IsFabricGroupId(groupId), status = EMBER_ZCL_STATUS_INVALID_VALUE); + VerifyOrExit(IsFabricGroupId(groupId), status = EMBER_ZCL_STATUS_CONSTRAINT_ERROR); VerifyOrExit(nullptr != provider, status = EMBER_ZCL_STATUS_FAILURE); VerifyOrExit(provider->HasEndpoint(fabricIndex, groupId, commandPath.mEndpointId), status = EMBER_ZCL_STATUS_NOT_FOUND); diff --git a/src/app/clusters/ias-zone-server/ias-zone-server.cpp b/src/app/clusters/ias-zone-server/ias-zone-server.cpp index 92b26045175818..3b08d92d45d977 100644 --- a/src/app/clusters/ias-zone-server/ias-zone-server.cpp +++ b/src/app/clusters/ias-zone-server/ias-zone-server.cpp @@ -273,7 +273,7 @@ EmberAfStatus emberAfPluginIasZoneClusterSetEnrollmentMethod(EndpointId endpoint else if (!isValidEnrollmentMode(method)) { emberAfIasZoneClusterPrintln("Invalid IAS Zone Server Enrollment Mode: %d", method); - status = EMBER_ZCL_STATUS_INVALID_VALUE; + status = EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } else { diff --git a/src/app/clusters/window-covering-server/window-covering-server.cpp b/src/app/clusters/window-covering-server/window-covering-server.cpp index e32d75daeea49a..5955a6bb24ed12 100644 --- a/src/app/clusters/window-covering-server/window-covering-server.cpp +++ b/src/app/clusters/window-covering-server/window-covering-server.cpp @@ -841,7 +841,7 @@ bool emberAfWindowCoveringClusterGoToLiftPercentageCallback(app::CommandHandler } else { - emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_VALUE); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_CONSTRAINT_ERROR); } } else @@ -933,7 +933,7 @@ bool emberAfWindowCoveringClusterGoToTiltPercentageCallback(app::CommandHandler } else { - emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_INVALID_VALUE); + emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_CONSTRAINT_ERROR); } } else diff --git a/src/app/tests/suites/TestCluster.yaml b/src/app/tests/suites/TestCluster.yaml index ead88b5677c0af..e03a338a90e5fa 100644 --- a/src/app/tests/suites/TestCluster.yaml +++ b/src/app/tests/suites/TestCluster.yaml @@ -2965,7 +2965,7 @@ tests: "Send a command that takes an optional parameter but do not set it." command: "TestSimpleOptionalArgumentRequest" response: - error: INVALID_VALUE + error: CONSTRAINT_ERROR - label: "Send a command that takes an optional parameter but do not set it." diff --git a/src/app/util/af-enums.h b/src/app/util/af-enums.h index 09c5c3de36213d..ec12dab91d2289 100644 --- a/src/app/util/af-enums.h +++ b/src/app/util/af-enums.h @@ -37,7 +37,6 @@ enum EmberAfStatus : uint8_t EMBER_ZCL_STATUS_INVALID_COMMAND = 0x85, EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE = 0x86, EMBER_ZCL_STATUS_CONSTRAINT_ERROR = 0x87, - EMBER_ZCL_STATUS_INVALID_VALUE = 0x87, // Deprecated; same as CONSTRAINT_ERROR EMBER_ZCL_STATUS_UNSUPPORTED_WRITE = 0x88, EMBER_ZCL_STATUS_READ_ONLY = 0x88, // Deprecated; same as UNSUPPORTED_WRITE EMBER_ZCL_STATUS_RESOURCE_EXHAUSTED = 0x89, diff --git a/src/app/util/attribute-table.cpp b/src/app/util/attribute-table.cpp index 5d9b898974ea70..98b7d2ab9ddf8c 100644 --- a/src/app/util/attribute-table.cpp +++ b/src/app/util/attribute-table.cpp @@ -217,7 +217,7 @@ static bool IsNullValue(const uint8_t * data, uint16_t dataLen, bool isAttribute // - EMBER_ZCL_STATUS_INVALID_DATA_TYPE: if the data type passed in doesnt match the type // stored in the attribute table // - EMBER_ZCL_STATUS_READ_ONLY: if the attribute isnt writable -// - EMBER_ZCL_STATUS_INVALID_VALUE: if the value is set out of the allowable range for +// - EMBER_ZCL_STATUS_CONSTRAINT_ERROR: if the value is set out of the allowable range for // the attribute // - EMBER_ZCL_STATUS_SUCCESS: if the attribute was found and successfully written // @@ -272,7 +272,7 @@ EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, Attribu } // if the value the attribute is being set to is out of range - // return EMBER_ZCL_STATUS_INVALID_VALUE + // return EMBER_ZCL_STATUS_CONSTRAINT_ERROR if ((metadata->mask & ATTRIBUTE_MASK_MIN_MAX) != 0U) { EmberAfDefaultAttributeValue minv = metadata->defaultValue.ptrToMinMaxValue->minValue; @@ -309,7 +309,7 @@ EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, Attribu // null value is always in-range for a nullable attribute. (!metadata->IsNullable() || !IsNullValue(data, dataLen, isAttributeSigned))) { - return EMBER_ZCL_STATUS_INVALID_VALUE; + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } } diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 2292e0940488fc..e6f921c53748a5 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -52952,7 +52952,7 @@ class TestClusterSuite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER)); break; case 374: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_VALUE)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; case 375: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 995d011966626f..af4c59a07376d9 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -77629,7 +77629,7 @@ class TestCluster : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER)); break; case 374: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_INVALID_VALUE)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; case 375: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -87303,7 +87303,7 @@ class TestCluster : public TestCommandBridge { ? err.code : EMBER_ZCL_STATUS_FAILURE) : 0, - EMBER_ZCL_STATUS_INVALID_VALUE)); + EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); NextTest(); }];