Shuoq | ca02ad4 | 2017-03-23 17:22:50 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
Yuexi Ma | bb96133 | 2017-03-30 10:58:23 -0700 | [diff] [blame] | 17 | #include <sap_hidl_hal_utils.h> |
Shuoq | ca02ad4 | 2017-03-23 17:22:50 -0700 | [diff] [blame] | 18 | |
Yuexi Ma | bb96133 | 2017-03-30 10:58:23 -0700 | [diff] [blame] | 19 | SapCallback::SapCallback(SapHidlTest& parent) : parent(parent) {} |
Shuoq | ca02ad4 | 2017-03-23 17:22:50 -0700 | [diff] [blame] | 20 | |
Yuexi Ma | bb96133 | 2017-03-30 10:58:23 -0700 | [diff] [blame] | 21 | Return<void> SapCallback::connectResponse(int32_t token, |
| 22 | SapConnectRsp /*sapConnectRsp*/, |
| 23 | int32_t /*maxMsgSize*/) { |
| 24 | sapResponseToken = token; |
| 25 | parent.notify(); |
| 26 | return Void(); |
Shuoq | ca02ad4 | 2017-03-23 17:22:50 -0700 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | Return<void> SapCallback::disconnectResponse(int32_t token) { |
Yuexi Ma | bb96133 | 2017-03-30 10:58:23 -0700 | [diff] [blame] | 30 | sapResponseToken = token; |
| 31 | parent.notify(); |
| 32 | return Void(); |
Shuoq | ca02ad4 | 2017-03-23 17:22:50 -0700 | [diff] [blame] | 33 | } |
| 34 | |
Yuexi Ma | bb96133 | 2017-03-30 10:58:23 -0700 | [diff] [blame] | 35 | Return<void> SapCallback::disconnectIndication( |
| 36 | int32_t /*token*/, SapDisconnectType /*disconnectType*/) { |
| 37 | return Void(); |
Shuoq | ca02ad4 | 2017-03-23 17:22:50 -0700 | [diff] [blame] | 38 | } |
| 39 | |
Yuexi Ma | bb96133 | 2017-03-30 10:58:23 -0700 | [diff] [blame] | 40 | Return<void> SapCallback::apduResponse( |
| 41 | int32_t token, SapResultCode resultCode, |
| 42 | const ::android::hardware::hidl_vec<uint8_t>& /*apduRsp*/) { |
| 43 | sapResponseToken = token; |
| 44 | sapResultCode = resultCode; |
| 45 | parent.notify(); |
| 46 | return Void(); |
Shuoq | ca02ad4 | 2017-03-23 17:22:50 -0700 | [diff] [blame] | 47 | } |
| 48 | |
Yuexi Ma | bb96133 | 2017-03-30 10:58:23 -0700 | [diff] [blame] | 49 | Return<void> SapCallback::transferAtrResponse( |
| 50 | int32_t token, SapResultCode resultCode, |
| 51 | const ::android::hardware::hidl_vec<uint8_t>& /*atr*/) { |
| 52 | sapResponseToken = token; |
| 53 | sapResultCode = resultCode; |
| 54 | parent.notify(); |
| 55 | return Void(); |
Shuoq | ca02ad4 | 2017-03-23 17:22:50 -0700 | [diff] [blame] | 56 | } |
| 57 | |
Yuexi Ma | bb96133 | 2017-03-30 10:58:23 -0700 | [diff] [blame] | 58 | Return<void> SapCallback::powerResponse(int32_t token, |
| 59 | SapResultCode resultCode) { |
| 60 | sapResponseToken = token; |
| 61 | sapResultCode = resultCode; |
| 62 | parent.notify(); |
| 63 | return Void(); |
Shuoq | ca02ad4 | 2017-03-23 17:22:50 -0700 | [diff] [blame] | 64 | } |
| 65 | |
Yuexi Ma | bb96133 | 2017-03-30 10:58:23 -0700 | [diff] [blame] | 66 | Return<void> SapCallback::resetSimResponse(int32_t token, |
| 67 | SapResultCode resultCode) { |
| 68 | sapResponseToken = token; |
| 69 | sapResultCode = resultCode; |
| 70 | parent.notify(); |
| 71 | return Void(); |
Shuoq | ca02ad4 | 2017-03-23 17:22:50 -0700 | [diff] [blame] | 72 | } |
| 73 | |
Yuexi Ma | bb96133 | 2017-03-30 10:58:23 -0700 | [diff] [blame] | 74 | Return<void> SapCallback::statusIndication(int32_t /*token*/, |
| 75 | SapStatus /*status*/) { |
| 76 | return Void(); |
Shuoq | ca02ad4 | 2017-03-23 17:22:50 -0700 | [diff] [blame] | 77 | } |
| 78 | |
Yuexi Ma | bb96133 | 2017-03-30 10:58:23 -0700 | [diff] [blame] | 79 | Return<void> SapCallback::transferCardReaderStatusResponse( |
| 80 | int32_t token, SapResultCode resultCode, int32_t /*cardReaderStatus*/) { |
| 81 | sapResponseToken = token; |
| 82 | sapResultCode = resultCode; |
| 83 | parent.notify(); |
| 84 | return Void(); |
Shuoq | ca02ad4 | 2017-03-23 17:22:50 -0700 | [diff] [blame] | 85 | } |
| 86 | |
Yuexi Ma | bb96133 | 2017-03-30 10:58:23 -0700 | [diff] [blame] | 87 | Return<void> SapCallback::errorResponse(int32_t /*token*/) { return Void(); } |
Shuoq | ca02ad4 | 2017-03-23 17:22:50 -0700 | [diff] [blame] | 88 | |
| 89 | Return<void> SapCallback::transferProtocolResponse(int32_t token, |
Yuexi Ma | bb96133 | 2017-03-30 10:58:23 -0700 | [diff] [blame] | 90 | SapResultCode resultCode) { |
| 91 | sapResponseToken = token; |
| 92 | sapResultCode = resultCode; |
| 93 | parent.notify(); |
| 94 | return Void(); |
Shuoq | ca02ad4 | 2017-03-23 17:22:50 -0700 | [diff] [blame] | 95 | } |