• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SENSOR_INFO_CONFIG_H
17 #define SENSOR_INFO_CONFIG_H
18 
19 #include <string>
20 #include <list>
21 #include <vector>
22 
23 namespace OHOS {
24 namespace HDI {
25 namespace Thermal {
26 namespace V1_1 {
27 struct XMLThermalZoneInfo {
28     std::string type;
29     std::string replace;
30     bool isReplace = false;
31     bool operator == (const std::string &sensorType)
32     {
33         return (this->type == sensorType);
34     }
35 };
36 
37 struct XMLThermalNodeInfo {
38     std::string type;
39     std::string path;
40     bool operator == (const std::string &sensorType)
41     {
42         return (this->type == sensorType);
43     }
44 };
45 
46 struct ReportedThermalData {
47     std::string type;
48     std::string tempPath;
49 };
50 
51 class SensorInfoConfig {
52 public:
53     SensorInfoConfig() = default;
54     ~SensorInfoConfig() = default;
55     void SetXMLThermalZoneInfo(std::vector<XMLThermalZoneInfo> &vXmlTz);
56     void SetXMLThermalNodeInfo(std::vector<XMLThermalNodeInfo> &vXmlTn);
57     void SetGroupName(const std::string &groupName);
58     void SetGroupInterval(int32_t interval);
59     std::vector<XMLThermalZoneInfo> GetXMLThermalZoneInfo();
60     std::vector<XMLThermalNodeInfo> GetXMLThermalNodeInfo();
61     int32_t GetInterval();
62     std::string GetGroupName();
63     int32_t multiple_;
64     std::list<ReportedThermalData> thermalDataList_;
65 private:
66     std::string groupName_;
67     std::int32_t interval_;
68     std::vector<XMLThermalZoneInfo> xmlTzInfoList_;
69     std::vector<XMLThermalNodeInfo> xmlTnInfoList_;
70 };
71 } // V1_1
72 } // Thermal
73 } // HDI
74 } // OHOS
75 #endif