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