From 7a901439cf260c3750ae0415c359da4755d338e9 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 7 Jun 2023 15:41:09 -0400 Subject: [PATCH] Update to spec change for unsupported event errors. --- src/app/reporting/Engine.cpp | 1 - src/app/tests/TestAclAttribute.cpp | 2 +- src/app/tests/suites/TestEvents.yaml | 2 +- src/app/util/ember-compatibility-functions.cpp | 14 ++++++++++---- .../chip-tool/zap-generated/test/Commands.h | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/app/reporting/Engine.cpp b/src/app/reporting/Engine.cpp index 67ffa8dce416db..684e21a83d5e11 100644 --- a/src/app/reporting/Engine.cpp +++ b/src/app/reporting/Engine.cpp @@ -311,7 +311,6 @@ CHIP_ERROR Engine::CheckAccessDeniedEventPaths(TLV::TLVWriter & aWriter, bool & if (status != Status::Success) { TLV::TLVWriter checkpoint = aWriter; - // For events, spec says to use UNSUPPORTED_EVENT err = EventReportIB::ConstructEventStatusIB(aWriter, path, StatusIB(status)); if (err != CHIP_NO_ERROR) { diff --git a/src/app/tests/TestAclAttribute.cpp b/src/app/tests/TestAclAttribute.cpp index f6478ad9faef7e..cd7d774ef3429a 100644 --- a/src/app/tests/TestAclAttribute.cpp +++ b/src/app/tests/TestAclAttribute.cpp @@ -146,7 +146,7 @@ Protocols::InteractionModel::Status CheckEventSupportStatus(const ConcreteEventP { if (aPath.mClusterId == kTestDeniedClusterId1) { - return Protocols::InteractionModel::Status::UnsupportedEvent; + return Protocols::InteractionModel::Status::UnsupportedCluster; } return Protocols::InteractionModel::Status::Success; diff --git a/src/app/tests/suites/TestEvents.yaml b/src/app/tests/suites/TestEvents.yaml index 62ec1a2453d99b..637268ecdc587d 100644 --- a/src/app/tests/suites/TestEvents.yaml +++ b/src/app/tests/suites/TestEvents.yaml @@ -38,7 +38,7 @@ tests: event: "TestEvent" endpoint: 0 response: - error: UNSUPPORTED_EVENT + error: UNSUPPORTED_CLUSTER - label: "Generate an event on the accessory" command: "TestEmitTestEventRequest" diff --git a/src/app/util/ember-compatibility-functions.cpp b/src/app/util/ember-compatibility-functions.cpp index af7cd84baf7fe6..de08342c4f18f6 100644 --- a/src/app/util/ember-compatibility-functions.cpp +++ b/src/app/util/ember-compatibility-functions.cpp @@ -1074,14 +1074,20 @@ bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint) Protocols::InteractionModel::Status CheckEventSupportStatus(const ConcreteEventPath & aPath) { using Protocols::InteractionModel::Status; -#if CHIP_CONFIG_ENABLE_EVENTLIST_ATTRIBUTE - auto * cluster = emberAfFindServerCluster(aPath.mEndpointId, aPath.mClusterId); + + const EmberAfEndpointType * type = emberAfFindEndpointType(aPath.mEndpointId); + if (type == nullptr) + { + return Status::UnsupportedEndpoint; + } + + const EmberAfCluster * cluster = emberAfFindClusterInType(type, aPath.mClusterId, CLUSTER_MASK_SERVER); if (cluster == nullptr) { - // Spec seems to say UNSUPPORTED_EVENT for this situation. - return Status::UnsupportedEvent; + return Status::UnsupportedCluster; } +#if CHIP_CONFIG_ENABLE_EVENTLIST_ATTRIBUTE for (size_t i = 0; i < cluster->eventCount; ++i) { if (cluster->eventList[i] == aPath.mEventId) diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 46e9a6bfb08a50..449f9427ca2340 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -73252,7 +73252,7 @@ class TestEventsSuite : public TestCommand switch (mTestSubStepIndex) { case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_EVENT)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER)); mTestSubStepIndex++; break; default: