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_SERVICE_H
17 #define OHOS_DSCREEN_SINK_SERVICE_H
18 
19 #include "ipc_object_stub.h"
20 #include "system_ability.h"
21 
22 #include "dscreen_sink_stub.h"
23 #include "1.0/include/screenregionmgr.h"
24 #include "2.0/include/screenregionmgr.h"
25 
26 namespace OHOS {
27 namespace DistributedHardware {
28 class DScreenSinkService : public SystemAbility, public DScreenSinkStub,
29     public std::enable_shared_from_this<DScreenSinkService> {
30 DECLARE_SYSTEM_ABILITY(DScreenSinkService);
31 public:
32     DScreenSinkService(int32_t saId, bool runOnCreate);
33     ~DScreenSinkService() override = default;
34     int32_t InitSink(const std::string &params) override;
35     int32_t ReleaseSink() override;
36     int32_t SubscribeLocalHardware(const std::string &dhId, const std::string &param) override;
37     int32_t UnsubscribeLocalHardware(const std::string &dhId) override;
38     void DScreenNotify(const std::string &devId, int32_t eventCode, const std::string &eventContent) override;
39     int32_t Dump(int32_t fd, const std::vector<std::u16string>& args) override;
40 
41 protected:
42     void OnStart() override;
43     void OnStop() override;
44     DISALLOW_COPY_AND_MOVE(DScreenSinkService);
45 
46 private:
47     bool registerToService_ = false;
48 
49     bool Init();
50 };
51 } // namespace DistributedHardware
52 } // namespace OHOS
53 #endif