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 #include "socperf_server.h"
17
18 namespace OHOS {
19 namespace SOCPERF {
20 REGISTER_SYSTEM_ABILITY_BY_ID(SocPerfServer, SOC_PERF_SERVICE_SA_ID, true);
21
OnStart()22 void SocPerfServer::OnStart()
23 {
24 if (!Publish(this)) {
25 SOC_PERF_LOGE("Register SystemAbility for SocPerf FAILED.");
26 return;
27 }
28 SOC_PERF_LOGI("Register SystemAbility for SocPerf SUCCESS.");
29
30 if (!socPerf.Init()) {
31 SOC_PERF_LOGE("SocPerf Init FAILED");
32 return;
33 }
34 SOC_PERF_LOGI("SocPerf Init SUCCESS.");
35 }
36
OnStop()37 void SocPerfServer::OnStop()
38 {
39 }
40
PerfRequest(int cmdId,const std::string & msg)41 void SocPerfServer::PerfRequest(int cmdId, const std::string& msg)
42 {
43 socPerf.PerfRequest(cmdId, msg);
44 }
45
PerfRequestEx(int cmdId,bool onOffTag,const std::string & msg)46 void SocPerfServer::PerfRequestEx(int cmdId, bool onOffTag, const std::string& msg)
47 {
48 socPerf.PerfRequestEx(cmdId, onOffTag, msg);
49 }
50
PowerRequest(int cmdId,const std::string & msg)51 void SocPerfServer::PowerRequest(int cmdId, const std::string& msg)
52 {
53 socPerf.PowerRequest(cmdId, msg);
54 }
55
PowerRequestEx(int cmdId,bool onOffTag,const std::string & msg)56 void SocPerfServer::PowerRequestEx(int cmdId, bool onOffTag, const std::string& msg)
57 {
58 socPerf.PowerRequestEx(cmdId, onOffTag, msg);
59 }
60
PowerLimitBoost(bool onOffTag,const std::string & msg)61 void SocPerfServer::PowerLimitBoost(bool onOffTag, const std::string& msg)
62 {
63 socPerf.PowerLimitBoost(onOffTag, msg);
64 }
65
ThermalRequest(int cmdId,const std::string & msg)66 void SocPerfServer::ThermalRequest(int cmdId, const std::string& msg)
67 {
68 socPerf.ThermalRequest(cmdId, msg);
69 }
70
ThermalRequestEx(int cmdId,bool onOffTag,const std::string & msg)71 void SocPerfServer::ThermalRequestEx(int cmdId, bool onOffTag, const std::string& msg)
72 {
73 socPerf.ThermalRequestEx(cmdId, onOffTag, msg);
74 }
75
ThermalLimitBoost(bool onOffTag,const std::string & msg)76 void SocPerfServer::ThermalLimitBoost(bool onOffTag, const std::string& msg)
77 {
78 socPerf.ThermalLimitBoost(onOffTag, msg);
79 }
80 } // namespace SOCPERF
81 } // namespace OHOS
82