Skip to content

Commit

Permalink
Address code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 committed Feb 9, 2022
1 parent aa8077b commit 7a3f094
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 26 deletions.
12 changes: 1 addition & 11 deletions src/app/CommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
12 changes: 1 addition & 11 deletions src/app/WriteHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/credentials/FabricTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@

namespace chip {

static constexpr FabricIndex kInvalidFabricIndex = 0;
static constexpr FabricIndex kMinValidFabricIndex = 1;
static constexpr FabricIndex kMaxValidFabricIndex = std::min<FabricIndex>(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";
Expand Down
4 changes: 0 additions & 4 deletions src/transport/Session.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7a3f094

Please sign in to comment.