1 /*
2  * Copyright (c) 2024-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 BRIGHTNESS_CONFIG_PARSER_H
17 #define BRIGHTNESS_CONFIG_PARSER_H
18 
19 #include <unordered_map>
20 
21 namespace OHOS {
22 namespace DisplayPowerMgr {
23 struct ScreenData {
24     int displayId{0};
25     int sensorId{0};  // SENSOR_TYPE_ID_AMBIENT_LIGHT = 5, SENSOR_TYPE_ID_AMBIENT_LIGHT1 = 16
26 };
27 
28 namespace BrightnessConfig {
29 struct Data {
30     std::unordered_map<int, ScreenData> displayModeMap { // UNKNOWN = 0, FULL = 1, MAIN = 2, SUB = 3, COORDINATION = 4
31         { 0, {0, 16}},
32         { 1, {0, 16}},
33         { 2, {5, 5}}
34     };
35     std::unordered_map<int, ScreenData> foldStatusModeMap { // UNKNOWN = 0, EXPAND = 1,  FOLDED = 2,  HALF_FOLD = 3;
36         { 0, { 0, 16 } },
37         { 1, { 0, 16 } },
38         { 2, { 5, 5 } },
39         { 3, { 0, 16 } }
40     };
41 };
42 }
43 class BrightnessConfigParser {
44 public:
45     BrightnessConfigParser() = default;
46     virtual ~BrightnessConfigParser() = default;
47     BrightnessConfigParser(const BrightnessConfigParser&) = delete;
48     BrightnessConfigParser& operator=(const BrightnessConfigParser&) = delete;
49     BrightnessConfigParser(BrightnessConfigParser&&) = delete;
50     BrightnessConfigParser& operator=(BrightnessConfigParser&&) = delete;
51 
52     static bool ParseConfig(BrightnessConfig::Data& data);
53     static void PrintConfig(const BrightnessConfig::Data& data);
54 };
55 } // namespace DisplayPowerMgr
56 } // namespace OHOS
57 #endif // BRIGHTNESS_CONFIG_PARSER_H
58