• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 THERMAL_CONFIG_BASE_INFO_H
17 #define THERMAL_CONFIG_BASE_INFO_H
18 
19 #include <string>
20 #include <vector>
21 #include <map>
22 
23 namespace OHOS {
24 namespace PowerMgr {
25 namespace {
26 using BaseInfoMap = std::map<std::string, std::string>;
27 constexpr const char* HISTORY_TEMP_COUNT_TAG = "history_temp_count";
28 constexpr const char* SENSORS_TYPE_TAG = "temperature_query_enum";
29 }
30 
31 struct BaseItem {
32     std::string tag;
33     std::string value;
34 };
35 
36 class ThermalConfigBaseInfo {
37 public:
38     bool Init();
39     void Dump();
40 
GetHistoryTempCount()41     uint32_t GetHistoryTempCount()
42     {
43         return historyTempCount_;
44     }
45 
GetSensorsType()46     std::vector<std::string> GetSensorsType() const
47     {
48         return sensorsType_;
49     }
50 
SetBaseInfo(BaseInfoMap & baseinfo)51     void SetBaseInfo(BaseInfoMap &baseinfo)
52     {
53         baseItems_ = baseinfo;
54     }
55 
56 private:
57     void SetHistoryTempCount();
58     void SetSensorsType();
59 
60     uint32_t historyTempCount_;
61     std::string sensorType_;
62     std::vector<std::string> sensorsType_;
63     BaseInfoMap baseItems_;
64 };
65 } // namespace PowerMgr
66 } // namespace OHOS
67 
68 #endif //  THERMAL_CONFIG_BASE_INFO_H