• 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__SRV_SENSOR_INFO_H
17 #define THERMAL__SRV_SENSOR_INFO_H
18 
19 #include <string>
20 #include <parcel.h>
21 #include <map>
22 #include "ability_info.h"
23 
24 namespace OHOS {
25 namespace PowerMgr {
26 class ThermalSrvSensorInfo : public Parcelable {
27 public:
28     ThermalSrvSensorInfo() = default;
29     explicit ThermalSrvSensorInfo(std::string &type, int32_t &temp);
30     virtual ~ThermalSrvSensorInfo() = default;
31 
GetType()32     inline const std::string &GetType() const
33     {
34         return type_;
35     }
36 
GetTemp()37     inline const int32_t &GetTemp() const
38     {
39         return temp_;
40     }
41 
SetType(const std::string & type)42     inline void SetType(const std::string &type)
43     {
44         type_ = type;
45     }
46 
SetTemp(const int32_t & temp)47     inline void SetTemp(const int32_t &temp)
48     {
49         temp_ = temp;
50     }
51     /**
52      * @brief read this Sequenceable object from a Parcel.
53      *
54      * @param inParcel Indicates the Parcel object into which the Sequenceable object has been marshaled.
55      * @return Returns true if read successed; returns false otherwise.
56      */
57     bool ReadFromParcel(Parcel &parcel);
58 
59     /**
60      * @brief Marshals this Sequenceable object into a Parcel.
61      *
62      * @param outParcel Indicates the Parcel object to which the Sequenceable object will be marshaled.
63      */
64     virtual bool Marshalling(Parcel &parcel) const override;
65 
66     /**
67      * @brief Unmarshals this Sequenceable object from a Parcel.
68      *
69      * @param inParcel Indicates the Parcel object into which the Sequenceable object has been marshaled.
70      */
71     static ThermalSrvSensorInfo *Unmarshalling(Parcel &parcel);
72 
73 private:
74     std::string type_;
75     int32_t temp_;
76 };
77 
78 enum class SensorType : uint32_t {
79     SOC = 0,
80     BATTERY,
81     SHELL,
82     SENSOR1,
83     SENSOR2,
84     SENSOR3,
85     SENSOR4,
86     SENSOR5,
87     SENSOR6,
88     SENSOR7
89 };
90 } // PowerMgr
91 } // OHOS
92 
93 #endif // THERMAL__SRV_SENSOR_INFO_H