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