LCOV - code coverage report
Current view: top level - controller - DevicePairingDelegate.h (source / functions) Hit Total Coverage
Test: lcov_final.info Lines: 0 16 0.0 %
Date: 2024-02-15 08:20:41 Functions: 0 15 0.0 %

          Line data    Source code
       1             : /*
       2             :  *    Copyright (c) 2021 Project CHIP Authors
       3             :  *    All rights reserved.
       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 <controller/CommissioningDelegate.h>
      22             : #include <lib/core/CHIPError.h>
      23             : #include <lib/core/NodeId.h>
      24             : #include <lib/support/DLLUtil.h>
      25             : #include <stdint.h>
      26             : 
      27             : namespace chip {
      28             : namespace Controller {
      29             : 
      30             : /**
      31             :  * A delegate that can be notified of progress as a "pairing" (which might mean
      32             :  * "PASE session establishment" or "commissioning") proceeds.
      33             :  */
      34             : class DLL_EXPORT DevicePairingDelegate
      35             : {
      36             : public:
      37           0 :     virtual ~DevicePairingDelegate() {}
      38             : 
      39             :     enum Status : uint8_t
      40             :     {
      41             :         SecurePairingSuccess = 0,
      42             :         SecurePairingFailed,
      43             :     };
      44             : 
      45             :     /**
      46             :      * @brief
      47             :      *   Called when the pairing reaches a certain stage.
      48             :      *
      49             :      * @param status Current status of pairing
      50             :      */
      51           0 :     virtual void OnStatusUpdate(DevicePairingDelegate::Status status) {}
      52             : 
      53             :     /**
      54             :      * @brief
      55             :      *   Called when PASE session establishment is complete (with success or error)
      56             :      *
      57             :      * @param error Error cause, if any
      58             :      */
      59           0 :     virtual void OnPairingComplete(CHIP_ERROR error) {}
      60             : 
      61             :     /**
      62             :      * @brief
      63             :      *   Called when the pairing is deleted (with success or error)
      64             :      *
      65             :      * @param error Error cause, if any
      66             :      */
      67           0 :     virtual void OnPairingDeleted(CHIP_ERROR error) {}
      68             : 
      69             :     /**
      70             :      *   Called when the commissioning process is complete (with success or error)
      71             :      */
      72           0 :     virtual void OnCommissioningComplete(NodeId deviceId, CHIP_ERROR error) {}
      73           0 :     virtual void OnCommissioningSuccess(PeerId peerId) {}
      74           0 :     virtual void OnCommissioningFailure(PeerId peerId, CHIP_ERROR error, CommissioningStage stageFailed,
      75             :                                         Optional<Credentials::AttestationVerificationResult> additionalErrorInfo)
      76           0 :     {}
      77             : 
      78           0 :     virtual void OnCommissioningStatusUpdate(PeerId peerId, CommissioningStage stageCompleted, CHIP_ERROR error) {}
      79             : 
      80             :     /**
      81             :      * @brief
      82             :      *  Called with the ReadCommissioningInfo returned from the target
      83             :      */
      84           0 :     virtual void OnReadCommissioningInfo(const ReadCommissioningInfo & info) {}
      85             : 
      86             :     /**
      87             :      * @brief
      88             :      * Called when MatchingFabricInfo returned from target
      89             :      */
      90           0 :     virtual void OnFabricCheck(NodeId matchingNodeId) {}
      91             : 
      92             :     /**
      93             :      * @brief
      94             :      *  Called with the NetworkScanResponse returned from the target.
      95             :      *
      96             :      * The DeviceCommissioner will be waiting in the kNeedsNetworkCreds step and not advancing the commissioning process.
      97             :      *
      98             :      * The implementation should set the network credentials on the CommissioningParameters of the CommissioningDelegate
      99             :      * using CommissioningDelegate.SetCommissioningParameters(), and then call DeviceCommissioner.NetworkCredentialsReady()
     100             :      * in order to resume the commissioning process.
     101             :      */
     102             :     virtual void
     103           0 :     OnScanNetworksSuccess(const app::Clusters::NetworkCommissioning::Commands::ScanNetworksResponse::DecodableType & dataResponse)
     104           0 :     {}
     105             : 
     106             :     /**
     107             :      * @brief
     108             :      *  Called when the NetworkScan request fails.
     109             :      *
     110             :      * The DeviceCommissioner will be waiting in the kNeedsNetworkCreds step and not advancing the commissioning process.
     111             :      *
     112             :      * The implementation should set the network credentials on the CommissioningParameters of the CommissioningDelegate
     113             :      * using CommissioningDelegate.SetCommissioningParameters(), and then call DeviceCommissioner.NetworkCredentialsReady()
     114             :      * in order to resume the commissioning process.
     115             :      */
     116           0 :     virtual void OnScanNetworksFailure(CHIP_ERROR error) {}
     117             : 
     118             :     /**
     119             :      * @brief
     120             :      *  Called when the ICD registration information (ICD symmetric key, check-in node ID and monitored subject) is required.
     121             :      *
     122             :      * The DeviceCommissioner will be waiting in the kICDGetRegistrationInfo step and not advancing the commissioning process.
     123             :      *
     124             :      * The implementation should set the ICD registration info on the CommissioningParameters of the CommissioningDelegate
     125             :      * using CommissioningDelegate.SetCommissioningParameters(), and then call DeviceCommissioner.ICDRegistrationInfoReady()
     126             :      * in order to resume the commissioning process.
     127             :      *
     128             :      * Not called if the ICD registration info is provided up front.
     129             :      */
     130           0 :     virtual void OnICDRegistrationInfoRequired() {}
     131             : 
     132             :     /**
     133             :      * @bried
     134             :      *   Called when the registration flow for the ICD completes.
     135             :      *
     136             :      * @param[in] icdNodeId    The node id of the ICD.
     137             :      * @param[in] icdCounter   The ICD Counter received from the device.
     138             :      */
     139           0 :     virtual void OnICDRegistrationComplete(NodeId icdNodeId, uint32_t icdCounter) {}
     140             : };
     141             : 
     142             : } // namespace Controller
     143             : } // namespace chip

Generated by: LCOV version 1.14