1 /*
2  * Copyright (c) 2023-2023 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 CALCULATION_CONFIG_PARSER_H
17 #define CALCULATION_CONFIG_PARSER_H
18 
19 #include <vector>
20 
21 namespace OHOS {
22 namespace DisplayPowerMgr {
23 struct PointXy {
24     float x{-1.0f};
25     float y{-1.0f};
26 };
27 struct PointXyz {
28     float x{-1.0f};
29     float y{-1.0f};
30     float z{-1.0f};
31 };
32 namespace CalculationConfig {
33 struct Data {
34     // default value
35     float defaultBrightness{35.0f};
36     std::vector<PointXy> defaultPoints{
37         { 0.0f, 5.0f },     { 5.0f, 17.0f },     { 20.0f, 30.0f },
38         { 50.0f, 36.0f },   { 200.0f, 45.0f },   { 400.0f, 54.0f },
39         { 1000.0f, 81.0f }, { 2000.0f, 123.0f }, { 7000.0f, 255.0f }
40     };
41 };
42 }
43 class CalculationConfigParser {
44 public:
45     CalculationConfigParser() = default;
46     virtual ~CalculationConfigParser() = default;
47     CalculationConfigParser(const CalculationConfigParser&) = delete;
48     CalculationConfigParser& operator=(const CalculationConfigParser&) = delete;
49     CalculationConfigParser(CalculationConfigParser&&) = delete;
50     CalculationConfigParser& operator=(CalculationConfigParser&&) = delete;
51 
52     static bool ParseConfig(int displayId, CalculationConfig::Data& data);
53     static void PrintConfig(int displayId, const CalculationConfig::Data& data);
54 };
55 } // namespace DisplayPowerMgr
56 } // namespace OHOS
57 #endif // CALCULATION_CONFIG_PARSER_H
58