137a09cd7Sopenharmony_ci/* 237a09cd7Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 337a09cd7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 437a09cd7Sopenharmony_ci * you may not use this file except in compliance with the License. 537a09cd7Sopenharmony_ci * You may obtain a copy of the License at 637a09cd7Sopenharmony_ci * 737a09cd7Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 837a09cd7Sopenharmony_ci * 937a09cd7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1037a09cd7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1137a09cd7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1237a09cd7Sopenharmony_ci * See the License for the specific language governing permissions and 1337a09cd7Sopenharmony_ci * limitations under the License. 1437a09cd7Sopenharmony_ci */ 1537a09cd7Sopenharmony_ci 1637a09cd7Sopenharmony_ci#ifndef THERMAL_TEST_H 1737a09cd7Sopenharmony_ci#define THERMAL_TEST_H 1837a09cd7Sopenharmony_ci 1937a09cd7Sopenharmony_ci#include <gtest/gtest.h> 2037a09cd7Sopenharmony_ci#include <string> 2137a09cd7Sopenharmony_ci 2237a09cd7Sopenharmony_cinamespace OHOS { 2337a09cd7Sopenharmony_cinamespace PowerMgr { 2437a09cd7Sopenharmony_ciconst uint32_t MAX_PATH = 256; 2537a09cd7Sopenharmony_ciconst std::string AIRPLANE_PATH = "/data/service/el0/thermal/config/airplane"; 2637a09cd7Sopenharmony_ciconst std::string VOLUME_PATH = "/data/service/el0/thermal/config/volume"; 2737a09cd7Sopenharmony_ciconst std::string BATTERY_PATH = "/data/service/el0/thermal/sensor/battery/temp"; 2837a09cd7Sopenharmony_ciconst std::string SHELL_PATH = "/data/service/el0/thermal/sensor/shell/temp"; 2937a09cd7Sopenharmony_ciconst std::string SOC_PATH = "/data/service/el0/thermal/sensor/soc/temp"; 3037a09cd7Sopenharmony_ciconst std::string AMBIENT_PATH = "/data/service/el0/thermal/sensor/ambient/temp"; 3137a09cd7Sopenharmony_ciconst std::string PA_PATH = "/data/service/el0/thermal/sensor/pa/temp"; 3237a09cd7Sopenharmony_ciconst std::string AP_PATH = "/data/service/el0/thermal/sensor/ap/temp"; 3337a09cd7Sopenharmony_ciconst std::string CONFIG_LEVEL_PATH = "/data/service/el0/thermal/config/configLevel"; 3437a09cd7Sopenharmony_ciconst std::string LCD_PATH = "/data/service/el0/thermal/config/lcd"; 3537a09cd7Sopenharmony_ciconst std::string PROCESS_PATH = "/data/service/el0/thermal/config/process_ctrl"; 3637a09cd7Sopenharmony_ciconst std::string SHUTDOWN_PATH = "/data/service/el0/thermal/config/shut_down"; 3737a09cd7Sopenharmony_ciconst std::string CHARGER_PATH = "/data/service/el0/thermal/sensor/charger/temp"; 3837a09cd7Sopenharmony_ciconst std::string CPU_PATH = "/data/service/el0/thermal/sensor/cpu/temp"; 3937a09cd7Sopenharmony_ciconst std::string BATTERY_CAPACITY_PATH = "/data/service/el0/battery/battery/capacity"; 4037a09cd7Sopenharmony_ciconst std::string CHARGER_STATUS_PATH = "/data/service/el0/battery/ohos_charger/status"; 4137a09cd7Sopenharmony_ciconst std::string CHARGER_CURRENT_PATH = "/data/service/el0/battery/battery/current_now"; 4237a09cd7Sopenharmony_ciconst std::string VENDOR_CONFIG = "/vendor/etc/thermal_config/thermal_service_config.xml"; 4337a09cd7Sopenharmony_ciconstexpr const char* BATTERY_CHARGER_CURRENT_PATH = "/data/service/el0/thermal/cooling/battery/current"; 4437a09cd7Sopenharmony_ciconstexpr const char* SIMULATION_TEMP_DIR = "/data/service/el0/thermal/sensor/%s/temp"; 4537a09cd7Sopenharmony_ciconstexpr const char* SC_CURRENT_PATH = "/data/service/el0/thermal/config/sc_current"; 4637a09cd7Sopenharmony_ciconstexpr const char* BUCK_CURRENT_PATH = "/data/service/el0/thermal/config/buck_current"; 4737a09cd7Sopenharmony_ciconstexpr const char* SC_VOLTAGE_PATH = "/data/service/el0/thermal/config/sc_voltage"; 4837a09cd7Sopenharmony_ciconstexpr const char* BUCK_VOLTAGE_PATH = "/data/service/el0/thermal/config/buck_voltage"; 4937a09cd7Sopenharmony_ciclass ThermalTest { 5037a09cd7Sopenharmony_cipublic: 5137a09cd7Sopenharmony_ci static int32_t WriteFile(std::string path, std::string buf); 5237a09cd7Sopenharmony_ci static int32_t ReadFile(std::string path, std::string& buf); 5337a09cd7Sopenharmony_ci static int32_t ConvertInt(const std::string& value); 5437a09cd7Sopenharmony_ci static int32_t InitNode(); 5537a09cd7Sopenharmony_ci bool IsMock(const std::string& path); 5637a09cd7Sopenharmony_ci bool IsVendor(); 5737a09cd7Sopenharmony_ci static std::string GetNodeValue(const std::string& path); 5837a09cd7Sopenharmony_ci static int32_t SetNodeValue(int32_t value, const std::string& path); 5937a09cd7Sopenharmony_ci static int32_t SetNodeString(std::string str, const std::string& path); 6037a09cd7Sopenharmony_ci}; 6137a09cd7Sopenharmony_ci} // namespace PowerMgr 6237a09cd7Sopenharmony_ci} // namespace OHOS 6337a09cd7Sopenharmony_ci#endif // THERMAL_TEST_H 64