• 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_DSCREEN_HANDLER_H
17 #define OHOS_DSCREEN_HANDLER_H
18 
19 #include "screen_manager.h"
20 
21 #include "ihardware_handler.h"
22 #include "single_instance.h"
23 
24 namespace OHOS {
25 namespace DistributedHardware {
26 class ScreenListener : public Rosen::ScreenManager::IScreenListener {
27 public:
28     void OnConnect(uint64_t screenId) override;
29     void OnDisconnect(uint64_t screenId) override;
OnChange(uint64_t screenId)30     void OnChange(uint64_t screenId) override {};
31     uint32_t ByteCalculate(uint32_t screenWidth);
32 };
33 
34 class DScreenHandler : public IHardwareHandler {
35 DECLARE_SINGLE_INSTANCE_BASE(DScreenHandler);
36 public:
37     int32_t Initialize() override;
38     std::vector<DHItem> Query() override;
39     std::map<std::string, std::string> QueryExtraInfo() override;
40     bool IsSupportPlugin() override;
41     void RegisterPluginListener(std::shared_ptr<PluginListener> listener) override;
42     void UnRegisterPluginListener() override;
43     void PluginHardware(const std::string &dhId, const std::string &attr, const std::string &subtype);
44     void UnPluginHardware(const std::string &dhId);
45     std::string QueryCodecInfo();
46 
47 private:
48     DScreenHandler();
49     ~DScreenHandler();
50 
51     std::shared_ptr<PluginListener> listener_ = nullptr;
52     std::string codecInfoStr_;
53     sptr<ScreenListener> screenListener_ = nullptr;
54 };
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 __attribute__((visibility("default"))) IHardwareHandler* GetHardwareHandler();
60 #ifdef __cplusplus
61 }
62 #endif
63 } // namespace DistributedHardware
64 } // namespace OHOS
65 #endif