1e0dac50fSopenharmony_ci/*
2e0dac50fSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
3e0dac50fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4e0dac50fSopenharmony_ci * you may not use this file except in compliance with the License.
5e0dac50fSopenharmony_ci * You may obtain a copy of the License at
6e0dac50fSopenharmony_ci *
7e0dac50fSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8e0dac50fSopenharmony_ci *
9e0dac50fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10e0dac50fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11e0dac50fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12e0dac50fSopenharmony_ci * See the License for the specific language governing permissions and
13e0dac50fSopenharmony_ci * limitations under the License.
14e0dac50fSopenharmony_ci */
15e0dac50fSopenharmony_ci
16e0dac50fSopenharmony_ci#ifndef OHOS_ROSEN_DISPLAY_DUMPER_H
17e0dac50fSopenharmony_ci#define OHOS_ROSEN_DISPLAY_DUMPER_H
18e0dac50fSopenharmony_ci
19e0dac50fSopenharmony_ci#include "dm_common.h"
20e0dac50fSopenharmony_ci#include "abstract_display_controller.h"
21e0dac50fSopenharmony_ci#include "abstract_screen_controller.h"
22e0dac50fSopenharmony_ci
23e0dac50fSopenharmony_cinamespace OHOS {
24e0dac50fSopenharmony_cinamespace Rosen {
25e0dac50fSopenharmony_cienum DumpType : uint32_t {
26e0dac50fSopenharmony_ci    DUMP_ALL_SCREEN = 0,
27e0dac50fSopenharmony_ci    DUMP_ALL_DISPLAY,
28e0dac50fSopenharmony_ci    DUMP_SCREEN,
29e0dac50fSopenharmony_ci    DUMP_DISPLAY,
30e0dac50fSopenharmony_ci    DUMP_NONE = 100,
31e0dac50fSopenharmony_ci};
32e0dac50fSopenharmony_ciclass DisplayDumper : public RefBase {
33e0dac50fSopenharmony_cipublic:
34e0dac50fSopenharmony_ci    DisplayDumper(const sptr<AbstractDisplayController>& abstractDisplayController,
35e0dac50fSopenharmony_ci        const sptr<AbstractScreenController>& abstractScreenController, std::recursive_mutex& mutex);
36e0dac50fSopenharmony_ci    DMError Dump(int fd, const std::vector<std::u16string>& args) const;
37e0dac50fSopenharmony_ci
38e0dac50fSopenharmony_ciprivate:
39e0dac50fSopenharmony_ci    void ShowHelpInfo(std::string& dumpInfo) const;
40e0dac50fSopenharmony_ci    void ShowIllegalArgsInfo(std::string& dumpInfo, DMError errCode) const;
41e0dac50fSopenharmony_ci
42e0dac50fSopenharmony_ci    DMError DumpInfo(const std::vector<std::string>& args, std::string& dumpInfo) const;
43e0dac50fSopenharmony_ci    DMError DumpAllScreenInfo(std::string& dumpInfo) const;
44e0dac50fSopenharmony_ci    DMError DumpScreenInfo(const sptr<AbstractScreenGroup>& screenGroup, std::string& dumpInfo) const;
45e0dac50fSopenharmony_ci    DMError DumpSpecifiedScreenInfo(ScreenId screenId, std::string& dumpInfo) const;
46e0dac50fSopenharmony_ci    DMError DumpAllDisplayInfo(std::string& dumpInfo) const;
47e0dac50fSopenharmony_ci    DMError DumpSpecifiedDisplayInfo(DisplayId displayId, std::string& dumpInfo) const;
48e0dac50fSopenharmony_ci
49e0dac50fSopenharmony_ci    bool IsValidDigitString(const std::string& idStr) const;
50e0dac50fSopenharmony_ci    std::string TransferTypeToString(ScreenType type) const;
51e0dac50fSopenharmony_ci    void GetScreenInfo(const sptr<AbstractScreen>& screen, std::ostringstream& oss) const;
52e0dac50fSopenharmony_ci    void GetDisplayInfo(const sptr<AbstractDisplay>& display, std::ostringstream& oss) const;
53e0dac50fSopenharmony_ci
54e0dac50fSopenharmony_ci    const sptr<AbstractDisplayController> abstractDisplayController_;
55e0dac50fSopenharmony_ci    const sptr<AbstractScreenController> abstractScreenController_;
56e0dac50fSopenharmony_ci    std::recursive_mutex& mutex_;
57e0dac50fSopenharmony_ci};
58e0dac50fSopenharmony_ci}
59e0dac50fSopenharmony_ci}
60e0dac50fSopenharmony_ci#endif // OHOS_ROSEN_DISPLAY_DUMPER_H