diff --git a/src/app/CommandHandler.cpp b/src/app/CommandHandler.cpp index 7e439ddf1d1a33..9d2cc5d467e6df 100644 --- a/src/app/CommandHandler.cpp +++ b/src/app/CommandHandler.cpp @@ -566,17 +566,7 @@ TLV::TLVWriter * CommandHandler::GetCommandDataIBTLVWriter() FabricIndex CommandHandler::GetAccessingFabricIndex() const { - FabricIndex fabric = kUndefinedFabricIndex; - if (mpExchangeCtx->GetSessionHandle()->IsGroupSession()) - { - fabric = mpExchangeCtx->GetSessionHandle()->AsGroupSession()->GetFabricIndex(); - } - else - { - fabric = mpExchangeCtx->GetSessionHandle()->GetFabricIndex(); - } - - return fabric; + return mpExchangeCtx->GetSessionHandle()->GetFabricIndex(); } CommandHandler * CommandHandler::Handle::Get() diff --git a/src/app/WriteHandler.cpp b/src/app/WriteHandler.cpp index c876ae983b7b18..82d9fb55d7f3ce 100644 --- a/src/app/WriteHandler.cpp +++ b/src/app/WriteHandler.cpp @@ -479,17 +479,7 @@ CHIP_ERROR WriteHandler::AddStatus(const ConcreteAttributePath & aPath, const St FabricIndex WriteHandler::GetAccessingFabricIndex() const { - FabricIndex fabric = kUndefinedFabricIndex; - if (mpExchangeCtx->GetSessionHandle()->IsGroupSession()) - { - fabric = mpExchangeCtx->GetSessionHandle()->AsGroupSession()->GetFabricIndex(); - } - else - { - fabric = mpExchangeCtx->GetSessionHandle()->GetFabricIndex(); - } - - return fabric; + return mpExchangeCtx->GetSessionHandle()->GetFabricIndex(); } const char * WriteHandler::GetStateStr() const diff --git a/src/credentials/FabricTable.h b/src/credentials/FabricTable.h index 90086c26d22471..de258545baef14 100644 --- a/src/credentials/FabricTable.h +++ b/src/credentials/FabricTable.h @@ -42,10 +42,13 @@ namespace chip { +static constexpr FabricIndex kInvalidFabricIndex = 0; static constexpr FabricIndex kMinValidFabricIndex = 1; static constexpr FabricIndex kMaxValidFabricIndex = std::min(UINT8_MAX - 1, CHIP_CONFIG_MAX_FABRICS); static constexpr uint8_t kFabricLabelMaxLengthInBytes = 32; +static_assert(kInvalidFabricIndex < chip::kMinValidFabricIndex, "Invalid fabric index must be invalid"); + // KVS store is sensitive to length of key strings, based on the underlying // platform. Keeping them short. constexpr char kFabricTableKeyPrefix[] = "Fabric"; diff --git a/src/transport/Session.h b/src/transport/Session.h index e322ec7bde5723..1e09b7c645ca4d 100644 --- a/src/transport/Session.h +++ b/src/transport/Session.h @@ -34,10 +34,6 @@ class Session public: virtual ~Session() {} - static constexpr FabricIndex kInvalidFabricIndex = 0; - - static_assert(kInvalidFabricIndex < chip::kMinValidFabricIndex, "Invalid fabric index must be invalid"); - enum class SessionType : uint8_t { kUndefined = 0,