blob: 563d0661f1c1990c5a59167aea93f9bfe851d96f [file] [log] [blame]
Shuoq9823fcd2017-03-23 17:22:50 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include<sap_hidl_hal_utils.h>
18
19SapCallback::SapCallback(SapHidlTest& parent) : parent(parent) {
20}
21
22Return<void> SapCallback::connectResponse(int32_t token, SapConnectRsp /*sapConnectRsp*/,
23 int32_t /*maxMsgSize*/) {
24 sapResponseToken = token;
25 parent.notify();
26 return Void();
27}
28
29Return<void> SapCallback::disconnectResponse(int32_t token) {
30 sapResponseToken = token;
31 parent.notify();
32 return Void();
33}
34
35Return<void> SapCallback::disconnectIndication(int32_t /*token*/,
36 SapDisconnectType /*disconnectType*/) {
37 return Void();
38}
39
40Return<void> SapCallback::apduResponse(int32_t token, SapResultCode resultCode,
41 const ::android::hardware::hidl_vec<uint8_t>& /*apduRsp*/) {
42 sapResponseToken = token;
43 sapResultCode = resultCode;
44 parent.notify();
45 return Void();
46}
47
48Return<void> SapCallback::transferAtrResponse(int32_t token, SapResultCode resultCode,
49 const ::android::hardware::hidl_vec<uint8_t>& /*atr*/) {
50 sapResponseToken = token;
51 sapResultCode = resultCode;
52 parent.notify();
53 return Void();
54}
55
56Return<void> SapCallback::powerResponse(int32_t token, SapResultCode resultCode) {
57 sapResponseToken = token;
58 sapResultCode = resultCode;
59 parent.notify();
60 return Void();
61}
62
63Return<void> SapCallback::resetSimResponse(int32_t token, SapResultCode resultCode) {
64 sapResponseToken = token;
65 sapResultCode = resultCode;
66 parent.notify();
67 return Void();
68}
69
70Return<void> SapCallback::statusIndication(int32_t /*token*/, SapStatus /*status*/) {
71 return Void();
72}
73
74Return<void> SapCallback::transferCardReaderStatusResponse(int32_t token,
75 SapResultCode resultCode, int32_t /*cardReaderStatus*/) {
76 sapResponseToken = token;
77 sapResultCode = resultCode;
78 parent.notify();
79 return Void();
80}
81
82Return<void> SapCallback::errorResponse(int32_t /*token*/) {
83 return Void();
84}
85
86Return<void> SapCallback::transferProtocolResponse(int32_t token,
87 SapResultCode resultCode) {
88 sapResponseToken = token;
89 sapResultCode = resultCode;
90 parent.notify();
91 return Void();
92}