1 /*
2  * Copyright (c) 2022 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 "single_instance.h"
25 
26 namespace OHOS {
27 namespace DistributedHardware {
28 enum class HidumpFlag {
29     UNKNOWN = 0,
30     GET_HELP,
31     GET_LOADED_COMP_LIST,
32     GET_ENABLED_COMP_LIST,
33     GET_TASK_LIST,
34     GET_CAPABILITY_LIST,
35 };
36 
37 class HidumpHelper {
38 DECLARE_SINGLE_INSTANCE_BASE(HidumpHelper);
39 public:
40     int32_t Dump(const std::vector<std::string>& args, std::string &result);
41 
42 private:
43     explicit HidumpHelper() = default;
44     ~HidumpHelper() = default;
45 
46     int32_t ProcessDump(const HidumpFlag &flag, std::string &result);
47     int32_t ShowAllLoadedComps(std::string &result);
48     int32_t ShowAllEnabledComps(std::string &result);
49     int32_t ShowAllTaskInfos(std::string &result);
50     int32_t ShowAllCapabilityInfos(std::string &result);
51     int32_t ShowHelp(std::string &result);
52     int32_t ShowIllealInfomation(std::string &result);
53 };
54 } // namespace DistributedHardware
55 } // namespace OHOS
56 #endif