1 /* 2 * Copyright (c) 2024 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_CJ_DISPLAY_IMPL 17 #define OHOS_CJ_DISPLAY_IMPL 18 19 #include "display_manager.h" 20 #include "display_utils.h" 21 #include "ffi_remote_data.h" 22 23 namespace OHOS { 24 namespace Rosen { 25 class DisplayImpl final : public OHOS::FFI::FFIData { 26 public: 27 explicit DisplayImpl(const sptr<Display>& display); 28 ~DisplayImpl() override; 29 static sptr<DisplayImpl> CreateDisplayImpl(sptr<Display>& display); 30 static sptr<DisplayImpl> FindDisplayObject(uint64_t displayId); 31 uint32_t GetInfoId(); 32 char* GetName(); 33 bool GetAlive(); 34 uint32_t GetState(); 35 uint32_t GetRefreshRate(); 36 uint32_t GetRotation(); 37 uint32_t GetOrientation(); 38 int32_t GetWidth(); 39 int32_t GetHeight(); 40 float GetDensityDPI(); 41 float GetVirtualPixelRatio(); 42 float GetXDPI(); 43 float GetYDPI(); 44 RetStruct GetCutoutInfo(); GetRuntimeType()45 OHOS::FFI::RuntimeType* GetRuntimeType() override { return GetClassType(); } 46 private: 47 sptr<Display> display_ = nullptr; 48 friend class OHOS::FFI::RuntimeType; 49 friend class OHOS::FFI::TypeBase; GetClassType()50 static OHOS::FFI::RuntimeType *GetClassType() 51 { 52 static OHOS::FFI::RuntimeType runtimeType = 53 OHOS::FFI::RuntimeType::Create<OHOS::FFI::FFIData>("DisplayImpl"); 54 return &runtimeType; 55 } 56 }; 57 58 enum class DisplayStateMode : uint32_t { 59 STATE_UNKNOWN = 0, 60 STATE_OFF, 61 STATE_ON, 62 STATE_DOZE, 63 STATE_DOZE_SUSPEND, 64 STATE_VR, 65 STATE_ON_SUSPEND 66 }; 67 } 68 } 69 70 #endif // DISPLAY_DISPLAY_IMPL 71