Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tehampson committed Aug 19, 2024
1 parent 4239652 commit 6aa91f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <app/AttributeAccessInterfaceRegistry.h>

/**
* @brief CADMIN cluster implementation for handling attribute read of bridged device endpoints.
* @brief CADMIN cluster implementation for handling attribute interactions of bridged device endpoints.
*
* The current Administrator Commissioning Cluster server's zap generated code will automatically
* register an Attribute Access Interface for the root node endpoint implementation. In order to
Expand All @@ -34,7 +34,7 @@
class BridgedAdministratorCommissioning : public chip::app::AttributeAccessInterface
{
public:
// Register for the OperationalCredentials cluster on all endpoints.
// Register for the AdministratorCommissioning cluster on all endpoints.
BridgedAdministratorCommissioning() :
AttributeAccessInterface(chip::NullOptional, chip::app::Clusters::AdministratorCommissioning::Id)
{}
Expand All @@ -43,8 +43,8 @@ class BridgedAdministratorCommissioning : public chip::app::AttributeAccessInter

CHIP_ERROR Read(const chip::app::ConcreteReadAttributePath & aPath, chip::app::AttributeValueEncoder & aEncoder) override;

// We do not allow writing an attributes of a bridged device endpoint. We simply redirect write request to
// original attribut interface.
// We do not allow writing to CADMIN attributes of a bridged device endpoint. We simply redirect
// write requests to the original attribute interface.
CHIP_ERROR Write(const chip::app::ConcreteDataAttributePath & aPath, chip::app::AttributeValueDecoder & aDecoder) override
{
VerifyOrDie(mOriginalAttributeInterface);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,11 @@ using namespace chip::app::Clusters::AdministratorCommissioning;

CHIP_ERROR BridgedAdministratorCommissioning::Init()
{
// We expect to be initialized after all the embr pluggin cluster initialization have been called,
// including the AdministratorCommissioning. This expectation allows us to get and unregister the
// existing AccessAttributeInterface for AdministratorCommissioning and register ourselves so that
// we can first see if the ReadAttribute is for us.

// We expect initialization after all embr plugin clusters initialization. This allows us to unregister
// the existing AccessAttributeInterface for AdministratorCommissioning and register ourselves, ensuring
// we get the callback for reading attribute. If the read is not intended for a bridged device we will
// forward it to the original attribute interface that we are unregistering.
mOriginalAttributeInterface = AttributeAccessInterfaceRegistry::Instance().Get(0, AdministratorCommissioning::Id);
mOriginalAttributeInterface = AttributeAccessInterfaceRegistry::Instance().Get(chip::kRootEndpointId, AdministratorCommissioning::Id);
VerifyOrReturnError(mOriginalAttributeInterface, CHIP_ERROR_INTERNAL);
AttributeAccessInterfaceRegistry::Instance().Unregister(mOriginalAttributeInterface);
VerifyOrDie(AttributeAccessInterfaceRegistry::Instance().Register(this));
Expand Down

0 comments on commit 6aa91f7

Please sign in to comment.