• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(int cmdId,const std::string & msg)20 void SocPerfProxy::PerfRequest(int 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(int cmdId,bool onOffTag,const std::string & msg)33 void SocPerfProxy::PerfRequestEx(int 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 
PowerRequest(int cmdId,const std::string & msg)47 void SocPerfProxy::PowerRequest(int cmdId, 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.WriteInt32(cmdId);
56     data.WriteString(msg);
57     Remote()->SendRequest(TRANS_IPC_ID_POWER_REQUEST, data, reply, option);
58 }
59 
PowerRequestEx(int cmdId,bool onOffTag,const std::string & msg)60 void SocPerfProxy::PowerRequestEx(int cmdId, 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.WriteInt32(cmdId);
69     data.WriteBool(onOffTag);
70     data.WriteString(msg);
71     Remote()->SendRequest(TRANS_IPC_ID_POWER_REQUEST_EX, data, reply, option);
72 }
73 
PowerLimitBoost(bool onOffTag,const std::string & msg)74 void SocPerfProxy::PowerLimitBoost(bool onOffTag, 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.WriteBool(onOffTag);
83     data.WriteString(msg);
84     Remote()->SendRequest(TRANS_IPC_ID_POWER_LIMIT_BOOST_FREQ, data, reply, option);
85 }
86 
ThermalRequest(int cmdId,const std::string & msg)87 void SocPerfProxy::ThermalRequest(int cmdId, const std::string& msg)
88 {
89     MessageParcel data;
90     MessageParcel reply;
91     MessageOption option = { MessageOption::TF_ASYNC };
92     if (!data.WriteInterfaceToken(GetDescriptor())) {
93         return;
94     }
95     data.WriteInt32(cmdId);
96     data.WriteString(msg);
97     Remote()->SendRequest(TRANS_IPC_ID_THERMAL_REQUEST, data, reply, option);
98 }
99 
ThermalRequestEx(int cmdId,bool onOffTag,const std::string & msg)100 void SocPerfProxy::ThermalRequestEx(int cmdId, bool onOffTag, const std::string& msg)
101 {
102     MessageParcel data;
103     MessageParcel reply;
104     MessageOption option = { MessageOption::TF_ASYNC };
105     if (!data.WriteInterfaceToken(GetDescriptor())) {
106         return;
107     }
108     data.WriteInt32(cmdId);
109     data.WriteBool(onOffTag);
110     data.WriteString(msg);
111     Remote()->SendRequest(TRANS_IPC_ID_THERMAL_REQUEST_EX, data, reply, option);
112 }
113 
ThermalLimitBoost(bool onOffTag,const std::string & msg)114 void SocPerfProxy::ThermalLimitBoost(bool onOffTag, const std::string& msg)
115 {
116     MessageParcel data;
117     MessageParcel reply;
118     MessageOption option = { MessageOption::TF_ASYNC };
119     if (!data.WriteInterfaceToken(GetDescriptor())) {
120         return;
121     }
122     data.WriteBool(onOffTag);
123     data.WriteString(msg);
124     Remote()->SendRequest(TRANS_IPC_ID_THERMAL_LIMIT_BOOST_FREQ, data, reply, option);
125 }
126 } // namespace SOCPERF
127 } // namespace OHOS