• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_CAMERA_SINK_HIDUMPER_H
17 #define OHOS_DISTRIBUTED_CAMERA_SINK_HIDUMPER_H
18 
19 #include <map>
20 #include <string>
21 #include <vector>
22 
23 #include "single_instance.h"
24 
25 namespace OHOS {
26 namespace DistributedHardware {
27 class DCameraSourceDev;
28 enum class HidumpFlag {
29     UNKNOWN = 0,
30     GET_HELP,
31     GET_CAMERA_INFO,
32     GET_OPENED_INFO,
33     GET_VERSION_INFO,
34 };
35 
36 struct CameraDumpInfo {
37     std::string version;
38     int32_t camNumber;
39     std::vector<std::string> camIds;
40 };
41 
42 class DcameraSinkHidumper {
43 DECLARE_SINGLE_INSTANCE_BASE(DcameraSinkHidumper);
44 
45 public:
46     bool Dump(const std::vector<std::string>& args, std::string& result);
47 
48 private:
49     explicit DcameraSinkHidumper() = default;
50     ~DcameraSinkHidumper() = default;
51     void ShowHelp(std::string& result);
52     int32_t ShowIllegalInfomation(std::string& result);
53     int32_t ProcessDump(const std::string& args, std::string& result);
54     void SetSinkDumpInfo(CameraDumpInfo& camDumpInfo_);
55 
56     int32_t GetLocalCameraNumber(std::string& result);
57     int32_t GetOpenedCameraInfo(std::string& result);
58     int32_t GetVersionInfo(std::string& result);
59 
60 private:
61     CameraDumpInfo camDumpInfo_;
62 };
63 } // namespace DistributedHardware
64 } // namespace OHOS
65 #endif // OHOS_DISTRIBUTED_CAMERA_SINK_HIDUMPER_H