Skip to content

Commit

Permalink
Update to spec change for unsupported event errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple committed Jun 7, 2023
1 parent 09dab68 commit 7a90143
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/app/reporting/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/tests/TestAclAttribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/app/tests/suites/TestEvents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 10 additions & 4 deletions src/app/util/ember-compatibility-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion zzz_generated/chip-tool/zap-generated/test/Commands.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7a90143

Please sign in to comment.