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_proxy.h"
17
18 #include <message_option.h>
19 #include <message_parcel.h>
20
21 #include "ipc_callbacks/rs_iframe_rate_linker_expected_fps_update_callback_ipc_interface_code.h"
22 #include "platform/common/rs_log.h"
23
24 namespace OHOS {
25 namespace Rosen {
RSFrameRateLinkerExpectedFpsUpdateCallbackProxy(const sptr<IRemoteObject> & impl)26 RSFrameRateLinkerExpectedFpsUpdateCallbackProxy::RSFrameRateLinkerExpectedFpsUpdateCallbackProxy(
27 const sptr<IRemoteObject>& impl) : IRemoteProxy<RSIFrameRateLinkerExpectedFpsUpdateCallback>(impl)
28 {
29 }
30
OnFrameRateLinkerExpectedFpsUpdate(pid_t dstPid,int32_t expectedFps)31 void RSFrameRateLinkerExpectedFpsUpdateCallbackProxy::OnFrameRateLinkerExpectedFpsUpdate(
32 pid_t dstPid, int32_t expectedFps)
33 {
34 MessageParcel data;
35 MessageParcel reply;
36 MessageOption option;
37
38 if (!data.WriteInterfaceToken(RSIFrameRateLinkerExpectedFpsUpdateCallback::GetDescriptor())) {
39 return;
40 }
41
42 option.SetFlags(MessageOption::TF_ASYNC);
43 data.WriteInt32(dstPid);
44 data.WriteInt32(expectedFps);
45 uint32_t code = static_cast<uint32_t>(
46 RSIFrameRateLinkerExpectedFpsUpdateCallbackInterfaceCode::ON_FRAME_RATE_LINKER_EXPECTED_FPS_UPDATE);
47
48 auto remote = Remote();
49 if (remote == nullptr) {
50 ROSEN_LOGE("remote is null!");
51 return;
52 }
53
54 int32_t err = remote->SendRequest(code, data, reply, option);
55 if (err != NO_ERROR) {
56 ROSEN_LOGE("RSFrameRateLinkerExpectedFpsUpdateCallbackProxy::OnFrameRateLinkerExpectedFpsUpdate"
57 " error = %{public}d", err);
58 }
59 }
60 } // namespace Rosen
61 } // namespace OHOS
62