• 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 };
32 
33 class DScreenHandler : public IHardwareHandler {
34 DECLARE_SINGLE_INSTANCE_BASE(DScreenHandler);
35 public:
36     int32_t Initialize() override;
37     std::vector<DHItem> Query() override;
38     std::map<std::string, std::string> QueryExtraInfo() override;
39     bool IsSupportPlugin() override;
40     void RegisterPluginListener(std::shared_ptr<PluginListener> listener) override;
41     void UnRegisterPluginListener() override;
42     void PluginHardware(const std::string &dhId, const std::string &attr);
43     void UnPluginHardware(const std::string &dhId);
44     std::string QueryCodecInfo();
45 
46 private:
47     DScreenHandler();
48     ~DScreenHandler();
49 
50     std::shared_ptr<PluginListener> listener_ = nullptr;
51     std::string codecInfoStr_;
52     sptr<ScreenListener> screenListener_ = nullptr;
53 };
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 __attribute__((visibility("default"))) IHardwareHandler* GetHardwareHandler();
59 #ifdef __cplusplus
60 }
61 #endif
62 } // namespace DistributedHardware
63 } // namespace OHOS
64 #endif