• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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_sync_transaction_controller_proxy.h"
17 
18 #include "platform/common/rs_log.h"
19 
20 namespace OHOS {
21 namespace Rosen {
RSSyncTransactionControllerProxy(const sptr<IRemoteObject> & impl)22 RSSyncTransactionControllerProxy::RSSyncTransactionControllerProxy(const sptr<IRemoteObject>& impl)
23     : IRemoteProxy<RSISyncTransactionController>(impl)
24 {
25 }
26 
WriteInterfaceToken(MessageParcel & data)27 bool RSSyncTransactionControllerProxy::WriteInterfaceToken(MessageParcel& data)
28 {
29     if (!data.WriteInterfaceToken(RSSyncTransactionControllerProxy::GetDescriptor())) {
30         ROSEN_LOGE("RSSyncTransactionControllerProxy Failed to write interface token!");
31         return false;
32     }
33 
34     return true;
35 }
36 
CreateTransactionFinished()37 void RSSyncTransactionControllerProxy::CreateTransactionFinished()
38 {
39     MessageParcel data;
40     MessageParcel reply;
41     MessageOption option(MessageOption::TF_ASYNC);
42 
43     if (!WriteInterfaceToken(data)) {
44         return;
45     }
46 
47     auto remote = Remote();
48     if (remote == nullptr) {
49         ROSEN_LOGE("remote is null!");
50         return;
51     }
52 
53     uint32_t code = static_cast<uint32_t>(RSISyncTransactionControllerInterfaceCode::CREATE_TRANSACTION_FINISHED);
54     auto ret = remote->SendRequest(code, data, reply, option);
55     if (ret != NO_ERROR) {
56         ROSEN_LOGE("Failed to send sync transaction controller request, error code:%d", ret);
57     }
58 }
59 } // namespace Rosen
60 } // namespace OHOS
61