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 THERMAL_DEVICE_MITIGATION_H 17 #define THERMAL_DEVICE_MITIGATION_H 18 19 #include <string> 20 21 namespace OHOS { 22 namespace HDI { 23 namespace Thermal { 24 namespace V1_0 { 25 class ThermalDeviceMitigation { 26 public: ThermalDeviceMitigation()27 ThermalDeviceMitigation() {}; ~ThermalDeviceMitigation()28 ~ThermalDeviceMitigation() {}; 29 int32_t ExecuteCpuRequest(uint32_t freq, const std::string &path); 30 int32_t CpuRequest(uint32_t freq); 31 int32_t GpuRequest(uint32_t freq); 32 33 int32_t ChargerRequest(uint32_t current); 34 int32_t ExecuteChargerRequest(uint32_t current, const std::string &path); 35 int32_t BatteryCurrentRequest(uint32_t current); 36 int32_t BatteryVoltageRequest(uint32_t voltage); 37 int32_t WriteSysfsFd(int32_t fd, std::string buf, size_t bytesSize); 38 int32_t OpenSysfsFile(std::string filePath, int32_t flags); 39 int32_t WriteSysfsFile(std::string filePath, std::string buf, size_t bytesSize); 40 int32_t SetFlag(bool flag); 41 private: 42 bool flag_ {false}; 43 }; 44 } // V1_0 45 } // Thermal 46 } // HDI 47 } // OHOS 48 #endif // THERMAL_DEVICE_MITIGATION_H