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_MAP_RELATION_H 17#define OHOS_DSCREEN_MAP_RELATION_H 18 19#include "nlohmann/json.hpp" 20 21using json = nlohmann::json; 22 23namespace OHOS { 24namespace DistributedHardware { 25struct ScreenRect { 26 int32_t startX; 27 int32_t startY; 28 uint32_t width; 29 uint32_t height; 30}; 31struct DisplayRect { 32 int32_t startX; 33 int32_t startY; 34 int32_t width; 35 int32_t height; 36}; 37 38class DScreenMapRelation { 39public: 40 void SetDisplayId(uint64_t displayId); 41 uint64_t GetDisplayId() const; 42 void SetScreenId(uint64_t screenId); 43 uint64_t GetScreenId() const; 44 void SetDisplayRect(const DisplayRect &displayRect); 45 DisplayRect& GetDisplayRect(); 46 void SetScreenRect(const ScreenRect &screenRect); 47 ScreenRect& GetScreenRect(); 48private: 49 friend void to_json(json &j, const DScreenMapRelation &dScreenMapRelation); 50 friend void from_json(const json &j, DScreenMapRelation &dScreenMapRelation); 51 52 uint64_t displayId_; 53 uint64_t screenId_; 54 DisplayRect displayRect_; 55 ScreenRect screenRect_; 56}; 57void to_json(const json &j, const DScreenMapRelation &dScreenMapRelation); 58void from_json(const json &j, DScreenMapRelation &dScreenMapRelation); 59void to_json(json &j, const DisplayRect &rect); 60void to_json(json &j, const ScreenRect &rect); 61void from_json(const json &j, DisplayRect &rect); 62void from_json(const json &j, ScreenRect &rect); 63} // namespace DistributedHardware 64} // namespace OHOS 65#endif