1 /* 2 * Copyright (c) 2022-2024 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 SOC_PERF_INTERFACES_INNER_API_SOCPERF_CLIENT_INCLUDE_SOCPERF_PROXY_H 17 #define SOC_PERF_INTERFACES_INNER_API_SOCPERF_CLIENT_INCLUDE_SOCPERF_PROXY_H 18 19 #include "i_socperf_service.h" 20 #include "iservice_registry.h" 21 22 namespace OHOS { 23 namespace SOCPERF { 24 class SocPerfProxy : public IRemoteProxy<ISocPerfService> { 25 public: 26 /** 27 * @brief Sending a performance request. 28 * 29 * @param cmdId Scene id defined in config file. 30 * @param msg Additional string info, which is used for other extensions. 31 */ 32 void PerfRequest(int32_t cmdId, const std::string& msg) override; 33 34 /** 35 * @brief Sending a performance request. 36 * 37 * @param cmdId Scene id defined in config file. 38 * @param onOffTag Indicates the start of end of a long-term frequency increase event. 39 * @param msg Additional string info, which is used for other extensions. 40 */ 41 void PerfRequestEx(int32_t cmdId, bool onOffTag, const std::string& msg) override; 42 43 /** 44 * @brief Sending a power limit boost request. 45 * 46 * @param onOffTag Indicates the start of end of a power limit boost event. 47 * @param msg Additional string info, which is used for other extensions. 48 */ 49 void PowerLimitBoost(bool onOffTag, const std::string& msg) override; 50 51 /** 52 * @brief Sending a thermal limit boost request. 53 * 54 * @param onOffTag Indicates the start of end of a thermal limit boost event. 55 * @param msg Additional string info, which is used for other extensions. 56 */ 57 void ThermalLimitBoost(bool onOffTag, const std::string& msg) override; 58 59 /** 60 * @brief Sending a limit request. 61 * 62 * @param clientId Used to indentify the caller of frequency limiting, such as 63 * the thermal module or power consumption module. 64 * @param configs Indicates the specific value to be limited. 65 * @param msg Additional string info, which is used for other extensions. 66 */ 67 void LimitRequest(int32_t clientId, 68 const std::vector<int32_t>& tags, const std::vector<int64_t>& configs, const std::string& msg) override; 69 70 /** 71 * @brief set socperf server status, enable or disable 72 * 73 * @param status true means enable socperfserver, false means disable socperfserver 74 * @param msg the reason why we need change socperfserver status 75 */ 76 void SetRequestStatus(bool status, const std::string& msg) override; 77 78 /** 79 * @brief set thermal level intermal for perfquest 80 * 81 * @param level thermal level 82 */ 83 void SetThermalLevel(int32_t level) override; 84 85 /** 86 * @brief send the device mode, enable or disable 87 * 88 * @param mode the mode which will to be changed 89 * @param status true means socperfserver enter the device mode, false quit the device mode 90 */ 91 void RequestDeviceMode(const std::string& mode, bool status) override; 92 93 /** 94 * @brief get cmd Id count, cmdID is trigger, its count++ 95 * @param msg the reason 96 * @return cmdId count, as 10000:xx,10001:xx 97 */ 98 std::string RequestCmdIdCount(const std::string& msg) override; 99 100 public: 101 /** 102 * @brief Construct a new SocPerfProxy object. 103 * 104 * @param impl RemoteObject. 105 */ SocPerfProxy(const sptr<IRemoteObject> & impl)106 explicit SocPerfProxy(const sptr<IRemoteObject> &impl) 107 : IRemoteProxy<ISocPerfService>(impl) {} 108 109 /** 110 * @brief Destroy the SocPerfProxy object. 111 * 112 */ ~SocPerfProxy()113 virtual ~SocPerfProxy() {} 114 115 private: 116 static inline BrokerDelegator<SocPerfProxy> delegator_; 117 }; 118 } // namespace SOCPERF 119 } // namespace OHOS 120 121 #endif // SOC_PERF_INTERFACES_INNER_API_SOCPERF_CLIENT_INCLUDE_SOCPERF_PROXY_H 122