1 /*
2 * Copyright (C) 2025-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 "raw_parcel_callback_proxy.h"
16 #include "telephony_log_wrapper.h"
17
18 namespace OHOS {
19 namespace Telephony {
20 BrokerDelegator<RawParcelCallbackProxy> RawParcelCallbackProxy::delegator_;
Transfer(std::function<void (MessageParcel &)> writer,MessageParcel & data)21 void RawParcelCallbackProxy::Transfer(std::function<void(MessageParcel&)> writer, MessageParcel &data)
22 {
23 MessageOption option{MessageOption::TF_ASYNC};
24 MessageParcel reply;
25 sptr<IRemoteObject> remote = Remote();
26 if (remote == nullptr) {
27 TELEPHONY_LOGE("remote is nullptr!");
28 return;
29 }
30 if (!data.WriteInterfaceToken(GetDescriptor())) {
31 TELEPHONY_LOGE("write interface token failed");
32 return;
33 }
34 if (writer) {
35 writer(data);
36 }
37 remote->SendRequest(0, data, reply, option);
38 }
39 } // namespace Telephony
40 } // namespace OHOS