• 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_SINK_HANDLER_H
17 #define OHOS_DSCREEN_SINK_HANDLER_H
18 
19 #include <mutex>
20 
21 #include "idistributed_hardware_sink.h"
22 #include "single_instance.h"
23 
24 #include "idscreen_sink.h"
25 
26 namespace OHOS {
27 namespace DistributedHardware {
28 class DScreenSinkHandler : public IDistributedHardwareSink {
29 DECLARE_SINGLE_INSTANCE_BASE(DScreenSinkHandler);
30 public:
31     int32_t InitSink(const std::string &params) override;
32     int32_t ReleaseSink() override;
33     int32_t SubscribeLocalHardware(const std::string &dhId, const std::string &param) override;
34     int32_t UnsubscribeLocalHardware(const std::string &dhId) override;
35     void OnRemoteSinkSvrDied(const wptr<IRemoteObject> &remote);
36 private:
37     class DScreenSinkSvrRecipient : public IRemoteObject::DeathRecipient {
38     public:
39         void OnRemoteDied(const wptr<IRemoteObject> &remote) override;
40     };
41 
42     DScreenSinkHandler();
43     ~DScreenSinkHandler();
44 
45     std::mutex mutex_;
46     sptr<IDScreenSink> dScreenSinkProxy_ = nullptr;
47     sptr<DScreenSinkSvrRecipient> sinkSvrRecipient_ = nullptr;
48 };
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 __attribute__((visibility("default"))) IDistributedHardwareSink *GetSinkHardwareHandler();
54 #ifdef __cplusplus
55 }
56 #endif
57 } // namespace DistributedHardware
58 } // namespace OHOS
59 #endif