1 /* 2 * Copyright (c) 2022-2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_DISTRIBUTED_HARDWARE_HIDUMP_HELPER_H 17 #define OHOS_DISTRIBUTED_HARDWARE_HIDUMP_HELPER_H 18 #include <cstdint> 19 #include <set> 20 #include <string> 21 22 #include "enabled_comps_dump.h" 23 #include "device_type.h" 24 #include "impl_utils.h" 25 #include "single_instance.h" 26 27 namespace OHOS { 28 namespace DistributedHardware { 29 enum class HidumpFlag { 30 UNKNOWN = 0, 31 GET_HELP, 32 GET_LOADED_COMP_LIST, 33 GET_ENABLED_COMP_LIST, 34 GET_TASK_LIST, 35 GET_CAPABILITY_LIST, 36 }; 37 38 class HidumpHelper { 39 DECLARE_SINGLE_INSTANCE_BASE(HidumpHelper); 40 public: 41 int32_t Dump(const std::vector<std::string>& args, std::string &result); 42 43 private: 44 explicit HidumpHelper() = default; 45 ~HidumpHelper() = default; 46 47 int32_t ProcessDump(const HidumpFlag &flag, std::string &result); 48 int32_t ShowAllLoadedComps(std::string &result); 49 int32_t ShowAllEnabledComps(std::string &result); 50 int32_t ShowAllTaskInfos(std::string &result); 51 int32_t ShowAllCapabilityInfos(std::string &result); 52 int32_t ShowHelp(std::string &result); 53 int32_t ShowIllealInfomation(std::string &result); 54 void ShowLoadCompSource(const std::set<DHType> &loadedCompSource, const DHVersion &dhVersion, std::string &result); 55 void ShowLoadCompSink(const std::set<DHType> &loadedCompSink, const DHVersion &dhVersion, std::string &result); 56 }; 57 } // namespace DistributedHardware 58 } // namespace OHOS 59 #endif