1 /*
2 * Copyright (C) 2022 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 "nfc_basic_proxy.h"
16
17 #include "loghelper.h"
18
19 namespace OHOS {
20 namespace NFC {
SendRequestExpectReplyInt(uint32_t cmd,MessageParcel & data,MessageOption & option,int & result)21 int NfcBasicProxy::SendRequestExpectReplyInt(uint32_t cmd, MessageParcel& data, MessageOption& option, int& result)
22 {
23 MessageParcel reply;
24 int ret = remoteObj_->SendRequest(cmd, data, reply, option);
25 if (ret == ERR_NONE) {
26 result = reply.ReadInt32();
27 }
28 InfoLog("SendRequestExpectReplyInt, cmd %{public}d, ret %{public}d, reply %{public}d", cmd, ret, result);
29 return ret;
30 }
31
SendRequestExpectReplyBool(uint32_t cmd,MessageParcel & data,MessageOption & option,bool & result)32 int NfcBasicProxy::SendRequestExpectReplyBool(uint32_t cmd, MessageParcel& data, MessageOption& option, bool& result)
33 {
34 MessageParcel reply;
35 int32_t ret = remoteObj_->SendRequest(cmd, data, reply, option);
36 if (ret == ERR_NONE) {
37 result = reply.ReadBool();
38 }
39 InfoLog("SendRequestExpectReplyBool, cmd %{public}d, ret %{public}d, reply %{public}d", cmd, ret, result);
40 return ret;
41 }
42
SendRequestExpectReplyNone(uint32_t cmd,MessageParcel & data,MessageOption & option)43 int NfcBasicProxy::SendRequestExpectReplyNone(uint32_t cmd, MessageParcel& data, MessageOption& option)
44 {
45 MessageParcel reply;
46 int32_t ret = remoteObj_->SendRequest(cmd, data, reply, option);
47 InfoLog("SendRequestExpectReplyNone, cmd %{public}d, ret %{public}d", cmd, ret);
48 return ret;
49 }
50 } // namespace NFC
51 } // namespace OHOS
52