LCOV - code coverage report
Current view: top level - basic_component/package_manager/inc - package_manager.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 91.7 % 12 11
Test Date: 2026-08-12 11:03:52 Functions: 90.0 % 10 9

            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_MANAGER_H
      12              : #define TSD_PACKAGE_MANAGER_H
      13              : 
      14              : #include "capability_manager.h"
      15              : #include "device_comm_agent.h"
      16              : #include "package_env_info.h"
      17              : #include "package_hash_store.h"
      18              : #include "package_process_config.h"
      19              : #include "plugin_pkg_version.h"
      20              : #include "plugin_version_manager.h"
      21              : #include "package_context.h"
      22              : #include "package_sender.h"
      23              : #include "package_check_code_service.h"
      24              : #include "package_loader.h"
      25              : #include "hdc_message_builder.h"
      26              : #include "driver/ascend_hal.h"
      27              : #include "proto/tsd_message.pb.h"
      28              : #include "basic_define.h"
      29              : 
      30              : #include <string>
      31              : 
      32              : namespace tsd {
      33              : 
      34              : class PackageManager {
      35              : public:
      36              :     PackageManager(
      37              :         uint32_t logicDeviceId, DeviceCommAgent& commAgent, CapabilityManager& capabilityMgr, uint32_t platInfoMode,
      38              :         bool isAdcEnv, uint32_t chipType);
      39          365 :     ~PackageManager() = default;
      40              : 
      41              :     // === Open 流程入口 ===
      42           19 :     TSD_StatusT LoadPackageConfigInfoToDevice(const bool hasPluginVersion)
      43              :     {
      44           19 :         return loader_.LoadPackageConfigInfoToDevice(hasPluginVersion);
      45              :     }
      46           32 :     TSD_StatusT LoadSysOpKernel() { return loader_.LoadSysOpKernel(); }
      47           29 :     TSD_StatusT LoadPackageToDeviceByConfig() { return loader_.LoadPackageToDeviceByConfig(); }
      48              : 
      49            3 :     TSD_StatusT LoadFileToDevice(
      50              :         const char_t* const filePath, const uint64_t pathLen, const char_t* const fileName, const uint64_t fileNameLen,
      51              :         const MessageContext& baseCtx)
      52              :     {
      53            3 :         return loader_.LoadFileToDevice(filePath, pathLen, fileName, fileNameLen, baseCtx);
      54              :     }
      55              : 
      56              :     // === 设备响应处理(由 ProcessModeManager 静态回调转发)===
      57           11 :     void SaveDeviceCheckCode(const HDCMessage& msg) { checkCodeSvc_.SaveDeviceCheckCode(msg); }
      58           96 :     void StoreAllPkgHashValue(const HDCMessage& msg) { hashStore_.StoreAllPkgHashValue(msg); }
      59              : 
      60              :     // === 状态管理 ===
      61              :     void ResetOnClose();
      62          262 :     uint32_t GetHostCheckCode(TsdLoadPackageType type) const { return checkCodeSvc_.GetHostCheckCode(type); }
      63           12 :     void GetAscendLatestIntallPath(std::string& pkgBasePath) const { envInfo_.GetAscendLatestIntallPath(pkgBasePath); }
      64            0 :     void HandleDevicePluginVersionRsp(const HDCMessage& msg) { pluginVersion_.HandleDevicePluginVersionRsp(msg); }
      65              : 
      66              : private:
      67              :     PackageEnvInfo envInfo_;
      68              :     PackageHashStore hashStore_;
      69              : 
      70              :     PackageContext ctx_;
      71              : 
      72              :     PluginVersionManager pluginVersion_;
      73              : 
      74              :     DeviceCommAgent& commAgent_;
      75              :     CapabilityManager& capabilityMgr_;
      76              : 
      77              :     PackageCheckCodeService checkCodeSvc_;
      78              :     PackageSender sender_;
      79              :     PackageLoader loader_;
      80              : };
      81              : 
      82              : } // namespace tsd
      83              : 
      84              : #endif // TSD_PACKAGE_MANAGER_H
        

Generated by: LCOV version 2.0-1