1 /*
2 * Copyright (c) 2025 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 #include "ui_effect_controller_client_proxy.h"
16 #include "ui_effect_controller_common.h"
17
18 namespace OHOS::Rosen {
SetParams(const sptr<UIEffectParams> & params)19 WMError UIEffectControllerClientProxy::SetParams(const sptr<UIEffectParams>& params)
20 {
21 MessageParcel data;
22 MessageParcel reply;
23 MessageOption option(MessageOption::TF_ASYNC);
24 if (!data.WriteInterfaceToken(GetDescriptor())) {
25 TLOGE(WmsLogTag::WMS_ANIMATION, "Write interfaceToken failed");
26 return WMError::WM_ERROR_IPC_FAILED;
27 }
28 if (!data.WriteStrongParcelable(params)) {
29 TLOGE(WmsLogTag::WMS_ANIMATION, "Write ui effect params failed");
30 return WMError::WM_ERROR_IPC_FAILED;
31 }
32 sptr<IRemoteObject> remote = Remote();
33 if (remote == nullptr) {
34 TLOGE(WmsLogTag::WMS_ANIMATION, "Remote is null");
35 return WMError::WM_ERROR_IPC_FAILED;
36 }
37 if (remote->SendRequest(static_cast<uint32_t>(UIEffectControllerClientMessage::TRANS_ID_UIEFFECT_SET_PARAM),
38 data, reply, option) != ERR_NONE) {
39 TLOGE(WmsLogTag::WMS_ANIMATION, "SendRequest failed");
40 return WMError::WM_ERROR_IPC_FAILED;
41 }
42 return WMError::WM_OK;
43 }
44 }