1 /* 2 * Copyright (C) 2025 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 #pragma once 18 #include <memory> 19 20 #include <aidl/android/hardware/radio/sap/BnSap.h> 21 #include "AtChannel.h" 22 #include "AtResponse.h" 23 24 namespace aidl { 25 namespace android { 26 namespace hardware { 27 namespace radio { 28 namespace implementation { 29 using ::ndk::ScopedAStatus; 30 31 struct Sap : public sap::BnSap { 32 Sap(std::shared_ptr<AtChannel> atChannel); 33 34 ScopedAStatus apduReq(int32_t serial, sap::SapApduType type, 35 const std::vector<uint8_t>& command) override; 36 ScopedAStatus connectReq(int32_t serial, int32_t maxMsgSize) override; 37 ScopedAStatus disconnectReq(int32_t serial) override; 38 ScopedAStatus powerReq(int32_t serial, bool state) override; 39 ScopedAStatus resetSimReq(int32_t serial) override; 40 ScopedAStatus setTransferProtocolReq( 41 int32_t serial, sap::SapTransferProtocol transferProtocol) override; 42 ScopedAStatus transferAtrReq(int32_t serial) override; 43 ScopedAStatus transferCardReaderStatusReq(int32_t serial) override; 44 45 void atResponseSink(const AtResponsePtr& response); 46 47 ScopedAStatus setCallback(const std::shared_ptr<sap::ISapCallback>& sapCallback) override; 48 49 private: 50 std::shared_ptr<sap::ISapCallback> mSapCallback; 51 }; 52 53 } // namespace implementation 54 } // namespace radio 55 } // namespace hardware 56 } // namespace android 57 } // namespace aidl 58