Matter SDK Coverage Report
Current view: top level - app/icd/client - CheckInHandler.h (source / functions) Coverage Total Hit
Test: SHA:b879ecb8e99e175eea0a293a888bda853da2b19c Lines: 10.0 % 10 1
Test Date: 2025-01-17 19:00:11 Functions: 11.1 % 9 1

            Line data    Source code
       1              : /*
       2              :  *
       3              :  *    Copyright (c) 2023 Project CHIP Authors
       4              :  *    All rights reserved.
       5              :  *
       6              :  *    Licensed under the Apache License, Version 2.0 (the "License");
       7              :  *    you may not use this file except in compliance with the License.
       8              :  *    You may obtain a copy of the License at
       9              :  *
      10              :  *        http://www.apache.org/licenses/LICENSE-2.0
      11              :  *
      12              :  *    Unless required by applicable law or agreed to in writing, software
      13              :  *    distributed under the License is distributed on an "AS IS" BASIS,
      14              :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      15              :  *    See the License for the specific language governing permissions and
      16              :  *    limitations under the License.
      17              :  */
      18              : 
      19              : /**
      20              :  *    @file
      21              :  *      This file defines objects for a CHIP check-in message unsolicited
      22              :  *      handler
      23              :  *
      24              :  */
      25              : 
      26              : #pragma once
      27              : 
      28              : #include <app-common/zap-generated/cluster-objects.h>
      29              : #include <app/CommandSender.h>
      30              : #include <app/OperationalSessionSetup.h>
      31              : #include <app/icd/client/CheckInDelegate.h>
      32              : #include <app/icd/client/DefaultICDClientStorage.h>
      33              : #include <lib/support/logging/CHIPLogging.h>
      34              : #include <messaging/ExchangeContext.h>
      35              : #include <messaging/ExchangeMgr.h>
      36              : 
      37              : namespace chip {
      38              : namespace app {
      39              : class InteractionModelEngine;
      40              : class CheckInHandler : public Messaging::ExchangeDelegate, public Messaging::UnsolicitedMessageHandler
      41              : {
      42              : 
      43              : public:
      44              :     CHIP_ERROR Init(Messaging::ExchangeManager * exchangeManager, ICDClientStorage * clientStorage, CheckInDelegate * delegate,
      45              :                     InteractionModelEngine * engine);
      46              :     void Shutdown();
      47              : 
      48              :     CheckInHandler();
      49              : 
      50            1 :     virtual ~CheckInHandler() = default;
      51              : 
      52              : protected:
      53              :     // ExchangeDelegate
      54              :     CHIP_ERROR
      55              :     OnMessageReceived(Messaging::ExchangeContext * ec, const PayloadHeader & payloadHeader,
      56              :                       System::PacketBufferHandle && payload) override;
      57              : 
      58              :     // UnsolicitedMessageHandler
      59              :     CHIP_ERROR OnUnsolicitedMessageReceived(const PayloadHeader & payloadHeader, ExchangeDelegate *& newDelegate) override;
      60              : 
      61              :     // TODO : Follow up to check if this really needs to be a pure virtual function in Exchange delegate
      62              :     // https://github.com/project-chip/connectedhomeip/issues/31322
      63              :     void OnResponseTimeout(Messaging::ExchangeContext * ec) override;
      64              : 
      65            0 :     Messaging::ExchangeMessageDispatch & GetMessageDispatch() override { return CheckInExchangeDispatch::Instance(); }
      66              : 
      67              : private:
      68              :     class CheckInExchangeDispatch : public Messaging::ExchangeMessageDispatch
      69              :     {
      70              :     public:
      71            0 :         static ExchangeMessageDispatch & Instance()
      72              :         {
      73            0 :             static CheckInExchangeDispatch instance;
      74            0 :             return instance;
      75              :         }
      76              : 
      77            0 :         CheckInExchangeDispatch() {}
      78            0 :         ~CheckInExchangeDispatch() override {}
      79              : 
      80              :     protected:
      81            0 :         bool MessagePermitted(Protocols::Id, uint8_t type) override
      82              :         {
      83            0 :             return type == to_underlying(Protocols::SecureChannel::MsgType::ICD_CheckIn);
      84              :         }
      85            0 :         bool IsEncryptionRequired() const override { return false; }
      86              :     };
      87              : 
      88              :     Messaging::ExchangeManager * mpExchangeManager = nullptr;
      89              :     CheckInDelegate * mpCheckInDelegate            = nullptr;
      90              :     ICDClientStorage * mpICDClientStorage          = nullptr;
      91              :     InteractionModelEngine * mpImEngine            = nullptr;
      92              : };
      93              : 
      94              : } // namespace app
      95              : } // namespace chip
        

Generated by: LCOV version 2.0-1