1 /*
2  * Copyright (c) 2024 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 "rs_frame_rate_linker_expected_fps_update_callback_stub.h"
17 
18 #include "ipc_callbacks/rs_iframe_rate_linker_expected_fps_update_callback_ipc_interface_code.h"
19 #include "platform/common/rs_log.h"
20 
21 namespace OHOS {
22 namespace Rosen {
23 
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)24 int RSFrameRateLinkerExpectedFpsUpdateCallbackStub::OnRemoteRequest(
25     uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option)
26 {
27     auto token = data.ReadInterfaceToken();
28     if (token != RSIFrameRateLinkerExpectedFpsUpdateCallback::GetDescriptor()) {
29         return ERR_INVALID_STATE;
30     }
31 
32     int ret = ERR_NONE;
33     switch (code) {
34         case static_cast<uint32_t>(
35             RSIFrameRateLinkerExpectedFpsUpdateCallbackInterfaceCode::ON_FRAME_RATE_LINKER_EXPECTED_FPS_UPDATE): {
36             pid_t dstPid = data.ReadInt32();
37             int32_t expectedFps = data.ReadInt32();
38             OnFrameRateLinkerExpectedFpsUpdate(dstPid, expectedFps);
39             break;
40         }
41         default: {
42             ret = IPCObjectStub::OnRemoteRequest(code, data, reply, option);
43             break;
44         }
45     }
46 
47     return ret;
48 }
49 } // namespace Rosen
50 } // namespace OHOS
51