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_SCREEN_REGION_MGR_H 17 #define OHOS_DSCREEN_SCREEN_REGION_MGR_H 18 19 #include <map> 20 #include <mutex> 21 22 #include "distributed_hardware_fwk_kit.h" 23 #include "single_instance.h" 24 25 #include "screenregion.h" 26 #include "idscreen_source.h" 27 28 namespace OHOS { 29 namespace DistributedHardware { 30 class ScreenRegionManager { 31 DECLARE_SINGLE_INSTANCE_BASE(ScreenRegionManager); 32 public: 33 int32_t ReleaseAllRegions(); 34 void HandleDScreenNotify(const std::string &devId, int32_t eventCode, const std::string &eventContent); 35 void GetScreenDumpInfo(std::string &result); 36 void PublishMessage(const DHTopic topic, const uint64_t &screenId, const std::string &remoteDevId, 37 const int32_t &windowId, std::shared_ptr<WindowProperty> windowProperty); 38 39 private: 40 ScreenRegionManager(); 41 ~ScreenRegionManager(); 42 std::map<std::string, std::shared_ptr<ScreenRegion>> screenRegions_; 43 std::mutex screenRegionsMtx_; 44 std::string localDevId_; 45 46 sptr<IDScreenSource> GetDScreenSourceSA(const std::string &devId); 47 int32_t NotifyRemoteScreenService(const std::string &remoteDevId, const std::string &dhId, 48 int32_t eventCode, const std::string &eventContent); 49 bool CheckContentJson(json &eventContentJson); 50 void HandleNotifySetUp(const std::string &remoteDevId, const std::string &eventContent); 51 void NotifyRemoteSourceSetUpResult(const std::string &remoteDevId, const std::string &dhId, 52 int32_t errCode, const std::string &errContent); 53 }; 54 } // namespace DistributedHardware 55 } // namespace OHOS 56 #endif