Matter SDK Coverage Report
Current view: top level - app/server - JointFabricAdministrator.h (source / functions) Coverage Total Hit
Test: SHA:3f9cd168e84cd831b7699126f5296f5c5498690f Lines: 100.0 % 4 4
Test Date: 2026-04-27 19:52:19 Functions: 100.0 % 2 2

            Line data    Source code
       1              : /*
       2              :  *
       3              :  *    Copyright (c) 2025 Project CHIP Authors
       4              :  *
       5              :  *    Licensed under the Apache License, Version 2.0 (the "License");
       6              :  *    you may not use this file except in compliance with the License.
       7              :  *    You may obtain a copy of the License at
       8              :  *
       9              :  *        http://www.apache.org/licenses/LICENSE-2.0
      10              :  *
      11              :  *    Unless required by applicable law or agreed to in writing, software
      12              :  *    distributed under the License is distributed on an "AS IS" BASIS,
      13              :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      14              :  *    See the License for the specific language governing permissions and
      15              :  *    limitations under the License.
      16              :  */
      17              : 
      18              : #pragma once
      19              : 
      20              : #include <app-common/zap-generated/cluster-objects.h>
      21              : #include <lib/core/CHIPPersistentStorageDelegate.h>
      22              : #include <lib/core/CHIPVendorIdentifiers.hpp>
      23              : #include <lib/core/DataModelTypes.h>
      24              : #include <lib/core/NodeId.h>
      25              : 
      26              : #include <optional>
      27              : 
      28              : namespace chip {
      29              : namespace app {
      30              : 
      31              : class JointFabricAdministrator
      32              : {
      33              : public:
      34              :     class Delegate
      35              :     {
      36              :     public:
      37              :         Delegate() {}
      38              :         virtual ~Delegate() {}
      39              : 
      40              :         virtual CHIP_ERROR GetIcacCsr(MutableByteSpan & icacCsr) { return CHIP_NO_ERROR; }
      41              :     };
      42              : 
      43              :     static JointFabricAdministrator & GetInstance()
      44              :     {
      45              :         static JointFabricAdministrator sInstance;
      46              :         return sInstance;
      47              :     }
      48              : 
      49            5 :     void SetPeerJFAdminClusterEndpointId(chip::EndpointId peerJFAdminClusterEndpointId)
      50              :     {
      51            5 :         mPeerJFAdminClusterEndpointId = peerJFAdminClusterEndpointId;
      52            5 :     }
      53              : 
      54              :     void SetVidVerificationForFabric(chip::FabricIndex fabricIndex) { mVidVerificationFabricIndex = fabricIndex; }
      55              :     void ClearVidVerificationForFabric() { mVidVerificationFabricIndex.reset(); }
      56              :     bool WasVidVerificationExecutedForFabric(chip::FabricIndex fabricIndex) const
      57              :     {
      58              :         return mVidVerificationFabricIndex.has_value() && (mVidVerificationFabricIndex.value() == fabricIndex);
      59              :     }
      60              : 
      61              :     CHIP_ERROR SetDelegate(JointFabricAdministrator::Delegate * delegate)
      62              :     {
      63              :         VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
      64              :         mDelegate = delegate;
      65              : 
      66              :         return CHIP_NO_ERROR;
      67              :     }
      68              : 
      69            2 :     chip::EndpointId GetPeerJFAdminClusterEndpointId() const { return mPeerJFAdminClusterEndpointId; }
      70              : 
      71              :     JointFabricAdministrator::Delegate * GetDelegate() { return mDelegate; }
      72              : 
      73              : private:
      74              :     chip::EndpointId mPeerJFAdminClusterEndpointId = chip::kInvalidEndpointId;
      75              :     std::optional<chip::FabricIndex> mVidVerificationFabricIndex;
      76              :     JointFabricAdministrator::Delegate * mDelegate = nullptr;
      77              : };
      78              : 
      79              : } // namespace app
      80              : } // namespace chip
        

Generated by: LCOV version 2.0-1