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 DISPLAY_AUTO_BRIGHTNESS_H 17 #define DISPLAY_AUTO_BRIGHTNESS_H 18 19 #include <cinttypes> 20 21 namespace OHOS { 22 namespace DisplayPowerMgr { 23 class DisplayAutoBrightness { 24 public: 25 static uint32_t CalculateAutoBrightness(float scalar); 26 27 private: 28 enum TransformNodeType { 29 TRANSFORM_NODE_TYPE_START = 0, 30 TRANSFORM_NODE_TYPE_FIRST, 31 TRANSFORM_NODE_TYPE_SECOND, 32 TRANSFORM_NODE_TYPE_LAST, 33 TRANSFORM_NODE_TYPE_END 34 }; 35 36 struct TransformNode { 37 float lux; 38 uint32_t brightness; 39 }; 40 41 static const float LUX_MIN; 42 static const float LUX_MAX; 43 static const uint32_t BRIGHTNESS_MIN; 44 static const uint32_t BRIGHTNESS_MAX; 45 static const float TRANSFORM_NODE_LUX_START; 46 static const float TRANSFORM_NODE_LUX_FIRST; 47 static const float TRANSFORM_NODE_LUX_SECOND; 48 static const float TRANSFORM_NODE_BRIGHTNESS_FIRST_PER; 49 static const float TRANSFORM_NODE_BRIGHTNESS_SECOND_PER; 50 static const uint32_t TRANSFORM_NODE_BRIGHTNESS_FIRST; 51 static const uint32_t TRANSFORM_NODE_BRIGHTNESS_SECOND; 52 static const TransformNode TRANSFORM_NODE_TABLE[TRANSFORM_NODE_TYPE_END]; 53 }; 54 } // namespace PowerMgr 55 } // namespace OHOS 56 #endif // DISPLAY_AUTO_BRIGHTNESS_H