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_SERVICES_SERVER_INCLUDE_SOCPERF_SERVER_H 17 #define SOC_PERF_SERVICES_SERVER_INCLUDE_SOCPERF_SERVER_H 18 19 #include "singleton.h" 20 #include "socperf_stub.h" 21 #include "socperf.h" 22 #include "system_ability.h" 23 24 namespace OHOS { 25 namespace SOCPERF { 26 class SocPerfServer : public SystemAbility, public SocPerfStub, 27 public std::enable_shared_from_this<SocPerfServer> { 28 DISALLOW_COPY_AND_MOVE(SocPerfServer); 29 DECLARE_SYSTEM_ABILITY(SocPerfServer); 30 DECLARE_DELAYED_SINGLETON(SocPerfServer); 31 32 public: 33 void PerfRequest(int32_t cmdId, const std::string& msg) override; 34 void PerfRequestEx(int32_t cmdId, bool onOffTag, const std::string& msg) override; 35 void PowerLimitBoost(bool onOffTag, const std::string& msg) override; 36 void ThermalLimitBoost(bool onOffTag, const std::string& msg) override; 37 void LimitRequest(int32_t clientId, 38 const std::vector<int32_t>& tags, const std::vector<int64_t>& configs, const std::string& msg) override; 39 void SetRequestStatus(bool status, const std::string& msg) override; 40 void SetThermalLevel(int32_t level) override; 41 void RequestDeviceMode(const std::string& mode, bool status) override; 42 std::string RequestCmdIdCount(const std::string& msg) override; 43 int32_t Dump(int32_t fd, const std::vector<std::u16string>& args) override; 44 45 public: 46 SocPerfServer(int32_t systemAbilityId, bool runOnCreate); 47 48 protected: 49 void OnStart() override; 50 void OnStop() override; 51 52 private: 53 SocPerf socPerf; 54 bool AllowDump(); 55 }; 56 } // namespace SOCPERF 57 } // namespace OHOS 58 59 #endif // SOC_PERF_SERVICES_SERVER_INCLUDE_SOCPERF_SERVER_H 60