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 LUX_HTRESHOLD_CONFIG_PARSER_H
17 #define LUX_HTRESHOLD_CONFIG_PARSER_H
18 
19 #include <string>
20 #include <unordered_map>
21 #include <vector>
22 
23 #include "calculation_config_parser.h"
24 
25 namespace OHOS {
26 namespace DisplayPowerMgr {
27 namespace LuxThresholdConfig {
28 struct Mode {
29     int brightenDebounceTime{-1};
30     int darkenDebounceTime{-1};
31     std::vector<PointXy> brightenPoints{};
32     std::vector<PointXy> darkenPoints{};
33 };
34 struct Data {
35     std::unordered_map<std::string, LuxThresholdConfig::Mode> modeArray{};
36     bool isLevelEnable{false};
37     std::vector<PointXy> brightenPointsForLevel{};
38     std::vector<PointXy> darkenPointsForLevel{};
39 };
40 }
41 class LuxThresholdConfigParser {
42 public:
43     LuxThresholdConfigParser() = default;
44     virtual ~LuxThresholdConfigParser() = default;
45     LuxThresholdConfigParser(const LuxThresholdConfigParser&) = delete;
46     LuxThresholdConfigParser& operator=(const LuxThresholdConfigParser&) = delete;
47     LuxThresholdConfigParser(LuxThresholdConfigParser&&) = delete;
48     LuxThresholdConfigParser& operator=(LuxThresholdConfigParser&&) = delete;
49 
50     static bool ParseConfig(int displayId, LuxThresholdConfig::Data& data);
51     static void PrintConfig(int displayId, const LuxThresholdConfig::Data& data);
52 };
53 } // namespace DisplayPowerMgr
54 } // namespace OHOS
55 #endif // LUX_HTRESHOLD_CONFIG_PARSER_H
56