• 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_stub.h"
17 #include <cstdint>              // for int32_t
18 #include <iosfwd>               // for string
19 #include <string>               // for basic_string, operator!=, u16string
20 #include <vector>               // for vector
21 
22 
23 namespace OHOS {
24 namespace SOCPERF {
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)25 int32_t SocPerfStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
26     MessageParcel &reply, MessageOption &option)
27 {
28     auto remoteDescriptor = data.ReadInterfaceToken();
29     if (GetDescriptor() != remoteDescriptor) {
30         return ERR_INVALID_STATE;
31     }
32     switch (code) {
33         case TRANS_IPC_ID_PERF_REQUEST: {
34             int32_t cmdId = data.ReadInt32();
35             std::string msg = data.ReadString();
36             PerfRequest(cmdId, msg);
37             return 0;
38         }
39         case TRANS_IPC_ID_PERF_REQUEST_EX: {
40             int32_t cmdId = data.ReadInt32();
41             bool onOffTag = data.ReadBool();
42             std::string msg = data.ReadString();
43             PerfRequestEx(cmdId, onOffTag, msg);
44             return 0;
45         }
46         case TRANS_IPC_ID_POWER_LIMIT_BOOST_FREQ: {
47             bool onOffTag = data.ReadBool();
48             std::string msg = data.ReadString();
49             PowerLimitBoost(onOffTag, msg);
50             return 0;
51         }
52         case TRANS_IPC_ID_THERMAL_LIMIT_BOOST_FREQ: {
53             bool onOffTag = data.ReadBool();
54             std::string msg = data.ReadString();
55             ThermalLimitBoost(onOffTag, msg);
56             return 0;
57         }
58         case TRANS_IPC_ID_LIMIT_REQUEST: {
59             int32_t clientId = data.ReadInt32();
60             std::vector<int32_t> tags;
61             data.ReadInt32Vector(&tags);
62             std::vector<int64_t> configs;
63             data.ReadInt64Vector(&configs);
64             std::string msg = data.ReadString();
65             LimitRequest(clientId, tags, configs, msg);
66             return 0;
67         }
68         default:
69             return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
70     }
71 }
72 } // namespace SOCPERF
73 } // namespace OHOS
74