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_DISPLAY_INFO_H 17 #define FOUNDATION_DMSERVER_DISPLAY_INFO_H 18 19 #include <cstdint> 20 #include <parcel.h> 21 22 #include "class_var_definition.h" 23 #include "display.h" 24 #include "dm_common.h" 25 #include "display_change_listener.h" 26 #include "noncopyable.h" 27 28 namespace OHOS::Rosen { 29 class DisplayInfo : public Parcelable { 30 friend class AbstractDisplay; 31 friend class ScreenSession; 32 public: 33 DisplayInfo() = default; 34 ~DisplayInfo() = default; 35 WM_DISALLOW_COPY_AND_MOVE(DisplayInfo); 36 37 virtual bool Marshalling(Parcel& parcel) const override; 38 static DisplayInfo *Unmarshalling(Parcel& parcel); 39 40 DEFINE_VAR_DEFAULT_FUNC_GET(std::string, Name, name, ""); 41 DEFINE_VAR_DEFAULT_FUNC_GET_SET(DisplayId, DisplayId, id, DISPLAY_ID_INVALID); 42 DEFINE_VAR_DEFAULT_FUNC_GET_SET(DisplayType, DisplayType, type, DisplayType::DEFAULT); 43 DEFINE_VAR_DEFAULT_FUNC_GET_SET(int32_t, Width, width, 0); 44 DEFINE_VAR_DEFAULT_FUNC_GET_SET(int32_t, Height, height, 0); 45 DEFINE_VAR_DEFAULT_FUNC_GET_SET(uint32_t, RefreshRate, refreshRate, 0); 46 DEFINE_VAR_DEFAULT_FUNC_GET_SET(ScreenId, ScreenId, screenId, SCREEN_ID_INVALID); 47 DEFINE_VAR_DEFAULT_FUNC_GET_SET(ScreenId, ScreenGroupId, screenGroupId, SCREEN_ID_INVALID); 48 DEFINE_VAR_DEFAULT_FUNC_GET_SET(float, VirtualPixelRatio, virtualPixelRatio, 1.0f); 49 DEFINE_VAR_DEFAULT_FUNC_GET_SET(float, XDpi, xDpi, 0.0f); 50 DEFINE_VAR_DEFAULT_FUNC_GET_SET(float, YDpi, yDpi, 0.0f); 51 DEFINE_VAR_DEFAULT_FUNC_GET_SET(int32_t, Dpi, dpi, 320); 52 DEFINE_VAR_DEFAULT_FUNC_GET_SET(Rotation, Rotation, rotation, Rotation::ROTATION_0); 53 DEFINE_VAR_DEFAULT_FUNC_GET_SET(Orientation, Orientation, orientation, Orientation::UNSPECIFIED); 54 DEFINE_VAR_DEFAULT_FUNC_GET_SET(int32_t, OffsetX, offsetX, 0); 55 DEFINE_VAR_DEFAULT_FUNC_GET_SET(int32_t, OffsetY, offsetY, 0); 56 DEFINE_VAR_DEFAULT_FUNC_GET(DisplayState, DisplayState, displayState, DisplayState::UNKNOWN); 57 DEFINE_VAR_DEFAULT_FUNC_GET_SET(bool, WaterfallDisplayCompressionStatus, waterfallDisplayCompressionStatus, false); 58 DEFINE_VAR_DEFAULT_FUNC_GET_SET(DisplayOrientation, DisplayOrientation, displayOrientation, 59 DisplayOrientation::UNKNOWN); 60 DEFINE_VAR_DEFAULT_FUNC_GET_SET(DisplayStateChangeType, DisplayStateChangeType, displayStateChangeType, 61 DisplayStateChangeType::UNKNOWN); 62 DEFINE_VAR_DEFAULT_FUNC_GET_SET(bool, IsDefaultVertical, isDefaultVertical, true); 63 DEFINE_VAR_DEFAULT_FUNC_GET_SET(bool, AliveStatus, alive, true); 64 }; 65 } // namespace OHOS::Rosen 66 #endif // FOUNDATION_DMSERVER_DISPLAY_INFO_H