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