166f3657fSopenharmony_ci/*
266f3657fSopenharmony_ci * Copyright (c) 2022-2024 Huawei Device Co., Ltd.
366f3657fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
466f3657fSopenharmony_ci * you may not use this file except in compliance with the License.
566f3657fSopenharmony_ci * You may obtain a copy of the License at
666f3657fSopenharmony_ci *
766f3657fSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
866f3657fSopenharmony_ci *
966f3657fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1066f3657fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1166f3657fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1266f3657fSopenharmony_ci * See the License for the specific language governing permissions and
1366f3657fSopenharmony_ci * limitations under the License.
1466f3657fSopenharmony_ci */
1566f3657fSopenharmony_ci
1666f3657fSopenharmony_ci#ifndef OHOS_DSCREEN_HANDLER_H
1766f3657fSopenharmony_ci#define OHOS_DSCREEN_HANDLER_H
1866f3657fSopenharmony_ci
1966f3657fSopenharmony_ci#include "screen_manager.h"
2066f3657fSopenharmony_ci
2166f3657fSopenharmony_ci#include "ihardware_handler.h"
2266f3657fSopenharmony_ci#include "single_instance.h"
2366f3657fSopenharmony_ci
2466f3657fSopenharmony_cinamespace OHOS {
2566f3657fSopenharmony_cinamespace DistributedHardware {
2666f3657fSopenharmony_ciclass ScreenListener : public Rosen::ScreenManager::IScreenListener {
2766f3657fSopenharmony_cipublic:
2866f3657fSopenharmony_ci    void OnConnect(uint64_t screenId) override;
2966f3657fSopenharmony_ci    void OnDisconnect(uint64_t screenId) override;
3066f3657fSopenharmony_ci    void OnChange(uint64_t screenId) override {};
3166f3657fSopenharmony_ci    uint32_t ByteCalculate(uint32_t screenWidth);
3266f3657fSopenharmony_ci};
3366f3657fSopenharmony_ci
3466f3657fSopenharmony_ciclass DScreenHandler : public IHardwareHandler {
3566f3657fSopenharmony_ciDECLARE_SINGLE_INSTANCE_BASE(DScreenHandler);
3666f3657fSopenharmony_cipublic:
3766f3657fSopenharmony_ci    int32_t Initialize() override;
3866f3657fSopenharmony_ci    std::vector<DHItem> QueryMeta() override;
3966f3657fSopenharmony_ci    std::vector<DHItem> Query() override;
4066f3657fSopenharmony_ci    std::vector<DHItem> RealQuery();
4166f3657fSopenharmony_ci    std::map<std::string, std::string> QueryExtraInfo() override;
4266f3657fSopenharmony_ci    bool IsSupportPlugin() override;
4366f3657fSopenharmony_ci    void RegisterPluginListener(std::shared_ptr<PluginListener> listener) override;
4466f3657fSopenharmony_ci    void UnRegisterPluginListener() override;
4566f3657fSopenharmony_ci    void PluginHardware(const std::string &dhId, const std::string &attr, const std::string &subtype);
4666f3657fSopenharmony_ci    void UnPluginHardware(const std::string &dhId);
4766f3657fSopenharmony_ci    std::string QueryCodecInfo();
4866f3657fSopenharmony_ci
4966f3657fSopenharmony_ciprivate:
5066f3657fSopenharmony_ci    DScreenHandler();
5166f3657fSopenharmony_ci    ~DScreenHandler();
5266f3657fSopenharmony_ci
5366f3657fSopenharmony_ci    std::shared_ptr<PluginListener> listener_ = nullptr;
5466f3657fSopenharmony_ci    std::string codecInfoStr_;
5566f3657fSopenharmony_ci    sptr<ScreenListener> screenListener_ = nullptr;
5666f3657fSopenharmony_ci};
5766f3657fSopenharmony_ci
5866f3657fSopenharmony_ci#ifdef __cplusplus
5966f3657fSopenharmony_ciextern "C" {
6066f3657fSopenharmony_ci#endif
6166f3657fSopenharmony_ci__attribute__((visibility("default"))) IHardwareHandler* GetHardwareHandler();
6266f3657fSopenharmony_ci#ifdef __cplusplus
6366f3657fSopenharmony_ci}
6466f3657fSopenharmony_ci#endif
6566f3657fSopenharmony_ci} // namespace DistributedHardware
6666f3657fSopenharmony_ci} // namespace OHOS
6766f3657fSopenharmony_ci#endif