1 /* 2 * Copyright (c) 2022-2023 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_V1_0_H 17 #define OHOS_DSCREEN_SCREEN_REGION_MGR_V1_0_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 namespace V1_0 { 31 class ScreenRegionManager { 32 DECLARE_SINGLE_INSTANCE_BASE(ScreenRegionManager); 33 public: 34 int32_t ReleaseAllRegions(); 35 void HandleDScreenNotify(const std::string &remoteDevId, int32_t eventCode, const std::string &eventContent); 36 void GetScreenDumpInfo(std::string &result); 37 void PublishMessage(const DHTopic topic, const uint64_t &screenId, const std::string &remoteDevId, 38 const int32_t &windowId, std::shared_ptr<WindowProperty> windowProperty); 39 40 private: 41 ScreenRegionManager(); 42 ~ScreenRegionManager(); 43 std::map<std::string, std::shared_ptr<ScreenRegion>> screenRegions_; 44 std::mutex screenRegionsMtx_; 45 std::string localDevId_; 46 47 sptr<IDScreenSource> GetDScreenSourceSA(const std::string &devId); 48 int32_t NotifyRemoteScreenService(const std::string &remoteDevId, const std::string &dhId, 49 int32_t eventCode, const std::string &eventContent); 50 bool CheckContentJson(json &eventContentJson); 51 void HandleNotifySetUp(const std::string &remoteDevId, const std::string &eventContent); 52 void NotifyRemoteSourceSetUpResult(const std::string &remoteDevId, const std::string &dhId, 53 int32_t errCode, const std::string &errContent); 54 }; 55 } // namespace V1_0 56 } // namespace DistributedHardware 57 } // namespace OHOS 58 #endif