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_proxy.h"
17
18 namespace OHOS {
19 namespace SOCPERF {
PerfRequest(int32_t cmdId,const std::string & msg)20 void SocPerfProxy::PerfRequest(int32_t cmdId, const std::string& msg)
21 {
22 MessageParcel data;
23 MessageParcel reply;
24 MessageOption option = { MessageOption::TF_ASYNC };
25 if (!data.WriteInterfaceToken(GetDescriptor())) {
26 return;
27 }
28 data.WriteInt32(cmdId);
29 data.WriteString(msg);
30 Remote()->SendRequest(TRANS_IPC_ID_PERF_REQUEST, data, reply, option);
31 }
32
PerfRequestEx(int32_t cmdId,bool onOffTag,const std::string & msg)33 void SocPerfProxy::PerfRequestEx(int32_t cmdId, bool onOffTag, const std::string& msg)
34 {
35 MessageParcel data;
36 MessageParcel reply;
37 MessageOption option = { MessageOption::TF_ASYNC };
38 if (!data.WriteInterfaceToken(GetDescriptor())) {
39 return;
40 }
41 data.WriteInt32(cmdId);
42 data.WriteBool(onOffTag);
43 data.WriteString(msg);
44 Remote()->SendRequest(TRANS_IPC_ID_PERF_REQUEST_EX, data, reply, option);
45 }
46
PowerLimitBoost(bool onOffTag,const std::string & msg)47 void SocPerfProxy::PowerLimitBoost(bool onOffTag, const std::string& msg)
48 {
49 MessageParcel data;
50 MessageParcel reply;
51 MessageOption option = { MessageOption::TF_ASYNC };
52 if (!data.WriteInterfaceToken(GetDescriptor())) {
53 return;
54 }
55 data.WriteBool(onOffTag);
56 data.WriteString(msg);
57 Remote()->SendRequest(TRANS_IPC_ID_POWER_LIMIT_BOOST_FREQ, data, reply, option);
58 }
59
ThermalLimitBoost(bool onOffTag,const std::string & msg)60 void SocPerfProxy::ThermalLimitBoost(bool onOffTag, const std::string& msg)
61 {
62 MessageParcel data;
63 MessageParcel reply;
64 MessageOption option = { MessageOption::TF_ASYNC };
65 if (!data.WriteInterfaceToken(GetDescriptor())) {
66 return;
67 }
68 data.WriteBool(onOffTag);
69 data.WriteString(msg);
70 Remote()->SendRequest(TRANS_IPC_ID_THERMAL_LIMIT_BOOST_FREQ, data, reply, option);
71 }
72
LimitRequest(int32_t clientId,const std::vector<int32_t> & tags,const std::vector<int64_t> & configs,const std::string & msg)73 void SocPerfProxy::LimitRequest(int32_t clientId,
74 const std::vector<int32_t>& tags, const std::vector<int64_t>& configs, const std::string& msg)
75 {
76 MessageParcel data;
77 MessageParcel reply;
78 MessageOption option = { MessageOption::TF_ASYNC };
79 if (!data.WriteInterfaceToken(GetDescriptor())) {
80 return;
81 }
82 data.WriteInt32(clientId);
83 data.WriteInt32Vector(tags);
84 data.WriteInt64Vector(configs);
85 data.WriteString(msg);
86 Remote()->SendRequest(TRANS_IPC_ID_LIMIT_REQUEST, data, reply, option);
87 }
88 } // namespace SOCPERF
89 } // namespace OHOS
90