LCOV - code coverage report
Current view: top level - basic_component/package_manager/inc - package_check_code_service.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 1 1
Test Date: 2026-07-28 10:52:48 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2026 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : 
      11              : #ifndef TSD_PACKAGE_CHECK_CODE_SERVICE_H
      12              : #define TSD_PACKAGE_CHECK_CODE_SERVICE_H
      13              : 
      14              : #include "device_comm_agent.h"
      15              : #include "capability_manager.h"
      16              : #include "package_env_info.h"
      17              : #include "package_hash_store.h"
      18              : #include "hdc_message_builder.h"
      19              : #include "proto/tsd_message.pb.h"
      20              : #include "basic_define.h"
      21              : #include "inc/client_manager.h"
      22              : 
      23              : #include <string>
      24              : 
      25              : namespace tsd {
      26              : 
      27              : class PackageManager;
      28              : 
      29              : class PackageCheckCodeService {
      30              : public:
      31              :     PackageCheckCodeService(
      32              :         PackageManager& mgr, DeviceCommAgent& commAgent, CapabilityManager& capabilityMgr, PackageEnvInfo& envInfo,
      33              :         PackageHashStore& hashStore, ResponseCode& pkgRspCode, bool& getCheckCodeRetrySupport,
      34              :         std::string& loadPackageErrorMsg);
      35              :     ~PackageCheckCodeService() = default;
      36              : 
      37              :     TSD_StatusT InitTsdClient();
      38              :     TSD_StatusT WaitPkgRsp(const uint32_t timeout, const bool ignoreRecvErr = false);
      39              :     TSD_StatusT GetDeviceCheckCode();
      40              :     TSD_StatusT GetDeviceCheckCodeOnce(const HDCMessage& msg);
      41              :     TSD_StatusT GetDeviceCheckCodeRetry(const HDCMessage& msg);
      42              :     void GetDeviceCheckCodeRetrySupport();
      43              :     TSD_StatusT PrepareForCheckCode();
      44              :     TSD_StatusT GetDeviceHsPkgCheckCode(
      45              :         const uint32_t checkCode, const HDCMessage::MsgType msgType, const bool beforeSendFlag,
      46              :         const MessageContext& baseCtx);
      47              :     TSD_StatusT GetCannHsPkgCheckCode(
      48              :         const std::string& pkgPureName, const std::string& hostPkgHash, const MessageContext& baseCtx);
      49              :     void HandleNormalPackageCheckCodeRsp(const HDCMessage& msg);
      50              :     void HandleCannHsCheckCodeRsp(const HDCMessage& msg);
      51              :     void SaveDeviceCheckCode(const HDCMessage& msg);
      52          258 :     uint32_t GetHostCheckCode(TsdLoadPackageType type) const { return hostCheckCode_[static_cast<uint32_t>(type)]; }
      53              : 
      54              :     uint32_t peerCheckCode_[static_cast<uint32_t>(TsdLoadPackageType::TSD_PKG_TYPE_MAX)];
      55              :     uint32_t hostCheckCode_[static_cast<uint32_t>(TsdLoadPackageType::TSD_PKG_TYPE_MAX)];
      56              :     ResponseCode& pkgRspCode_;
      57              : 
      58              : private:
      59              :     void SetHostCheckCode(HDCMessage& msg, TsdLoadPackageType type);
      60              : 
      61              :     PackageManager& mgr_;
      62              :     DeviceCommAgent& commAgent_;
      63              :     CapabilityManager& capabilityMgr_;
      64              :     PackageEnvInfo& envInfo_;
      65              :     PackageHashStore& hashStore_;
      66              :     bool& getCheckCodeRetrySupport_;
      67              :     std::string& loadPackageErrorMsg_;
      68              : };
      69              : 
      70              : } // namespace tsd
      71              : 
      72              : #endif // TSD_PACKAGE_CHECK_CODE_SERVICE_H
        

Generated by: LCOV version 2.0-1