1 /* 2 * Copyright (c) 2021-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 FOUNDATION_DMSERVER_SCREEN_INFO_H 17 #define FOUNDATION_DMSERVER_SCREEN_INFO_H 18 19 #include <parcel.h> 20 21 #include "class_var_definition.h" 22 #include "screen.h" 23 24 namespace OHOS::Rosen { 25 enum class ScreenType : uint32_t { 26 UNDEFINED, 27 REAL, 28 VIRTUAL 29 }; 30 class ScreenInfo : public Parcelable { 31 friend class AbstractScreen; 32 friend class ScreenSession; 33 public: 34 ScreenInfo() = default; 35 ~ScreenInfo() = default; 36 WM_DISALLOW_COPY_AND_MOVE(ScreenInfo); 37 38 virtual bool Marshalling(Parcel& parcel) const override; 39 static ScreenInfo* Unmarshalling(Parcel& parcel); 40 41 DEFINE_VAR_DEFAULT_FUNC_GET_SET(std::string, Name, name, ""); 42 DEFINE_VAR_DEFAULT_FUNC_GET_SET(ScreenId, ScreenId, id, SCREEN_ID_INVALID); 43 DEFINE_VAR_DEFAULT_FUNC_GET_SET(uint32_t, VirtualWidth, virtualWidth, 0); 44 DEFINE_VAR_DEFAULT_FUNC_GET_SET(uint32_t, VirtualHeight, virtualHeight, 0); 45 DEFINE_VAR_DEFAULT_FUNC_GET_SET(float, VirtualPixelRatio, virtualPixelRatio, 1.0f); 46 DEFINE_VAR_DEFAULT_FUNC_GET_SET(ScreenId, LastParentId, lastParent, SCREEN_ID_INVALID); 47 DEFINE_VAR_DEFAULT_FUNC_GET_SET(ScreenId, ParentId, parent, SCREEN_ID_INVALID); 48 DEFINE_VAR_DEFAULT_FUNC_GET_SET(bool, IsScreenGroup, isScreenGroup, false); 49 DEFINE_VAR_DEFAULT_FUNC_GET_SET(Rotation, Rotation, rotation, Rotation::ROTATION_0); 50 DEFINE_VAR_DEFAULT_FUNC_GET_SET(Orientation, Orientation, orientation, Orientation::UNSPECIFIED); 51 DEFINE_VAR_DEFAULT_FUNC_GET_SET(ScreenSourceMode, SourceMode, sourceMode, ScreenSourceMode::SCREEN_ALONE); 52 DEFINE_VAR_DEFAULT_FUNC_GET_SET(ScreenType, Type, type, ScreenType::UNDEFINED); 53 DEFINE_VAR_DEFAULT_FUNC_GET_SET(uint32_t, ModeId, modeId, 0); 54 DEFINE_VAR_FUNC_GET(std::vector<sptr<SupportedScreenModes>>, Modes, modes); 55 protected: 56 const static uint32_t MAX_SUPPORTED_SCREEN_MODES_SIZE = 20; 57 bool InnerUnmarshalling(Parcel& parcel); 58 }; 59 } // namespace OHOS::Rosen 60 #endif // FOUNDATION_DMSERVER_DISPLAY_INFO_H 61