diff --git a/src/app/AttributeAccessInterface.h b/src/app/AttributeAccessInterface.h index 3459d00afa2cf8..8f37e9997aef65 100644 --- a/src/app/AttributeAccessInterface.h +++ b/src/app/AttributeAccessInterface.h @@ -105,7 +105,9 @@ class AttributeValueEncoder : protected TagBoundEncoder class AttributeValueDecoder { public: - AttributeValueDecoder(TLV::TLVReader & aReader) : mReader(aReader) {} + AttributeValueDecoder(TLV::TLVReader & aReader, FabricIndex aAccessingFabricIndex) : + mReader(aReader), mAccessingFabricIndex(aAccessingFabricIndex) + {} template CHIP_ERROR Decode(T & aArg) @@ -116,9 +118,15 @@ class AttributeValueDecoder bool TriedDecode() const { return mTriedDecode; } + /** + * The accessing fabric index for this write interaction. + */ + FabricIndex AccessingFabricIndex() const { return mAccessingFabricIndex; } + private: TLV::TLVReader & mReader; bool mTriedDecode = false; + const FabricIndex mAccessingFabricIndex; }; class AttributeAccessInterface diff --git a/src/app/WriteHandler.cpp b/src/app/WriteHandler.cpp index ea3ac088abe026..8dff49866367a3 100644 --- a/src/app/WriteHandler.cpp +++ b/src/app/WriteHandler.cpp @@ -252,6 +252,11 @@ CHIP_ERROR WriteHandler::AddStatus(const AttributePathParams & aAttributePathPar return err; } +FabricIndex WriteHandler::GetAccessingFabricIndex() const +{ + return mpExchangeCtx->GetSessionHandle().GetFabricIndex(); +} + const char * WriteHandler::GetStateStr() const { #if CHIP_DETAIL_LOGGING diff --git a/src/app/WriteHandler.h b/src/app/WriteHandler.h index 46ff424ebfbf5e..1b01393f41d82f 100644 --- a/src/app/WriteHandler.h +++ b/src/app/WriteHandler.h @@ -84,6 +84,8 @@ class WriteHandler return CHIP_ERROR_NOT_IMPLEMENTED; } + FabricIndex GetAccessingFabricIndex() const; + private: enum class State { diff --git a/src/app/util/ember-compatibility-functions.cpp b/src/app/util/ember-compatibility-functions.cpp index b5515fc0ece603..08a0a8ef868ac9 100644 --- a/src/app/util/ember-compatibility-functions.cpp +++ b/src/app/util/ember-compatibility-functions.cpp @@ -594,7 +594,7 @@ CHIP_ERROR WriteSingleClusterData(ClusterInfo & aClusterInfo, TLV::TLVReader & a AttributeAccessInterface * attrOverride = findAttributeAccessOverride(aClusterInfo.mEndpointId, aClusterInfo.mClusterId); if (attrOverride != nullptr) { - AttributeValueDecoder valueDecoder(aReader); + AttributeValueDecoder valueDecoder(aReader, apWriteHandler->GetAccessingFabricIndex()); ReturnErrorOnFailure(attrOverride->Write(aPath, valueDecoder)); if (valueDecoder.TriedDecode())