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 #define FAILURE_DEBUG_PREFIX "Sap"
18
19 #include "Sap.h"
20 #include "debug.h"
21
22 namespace aidl {
23 namespace android {
24 namespace hardware {
25 namespace radio {
26 namespace implementation {
27
Sap(std::shared_ptr<AtChannel> atChannel)28 Sap::Sap(std::shared_ptr<AtChannel> atChannel) {}
29
apduReq(const int32_t serial,sap::SapApduType,const std::vector<uint8_t> &)30 ScopedAStatus Sap::apduReq(const int32_t serial, sap::SapApduType /*type*/,
31 const std::vector<uint8_t>& /*command*/) {
32 NOT_NULL(mSapCallback)->apduResponse(
33 serial, FAILURE(sap::SapResultCode::NOT_SUPPORTED), {});
34 return ScopedAStatus::ok();
35 }
36
connectReq(const int32_t serial,const int32_t)37 ScopedAStatus Sap::connectReq(const int32_t serial, const int32_t /*maxMsgSize*/) {
38 NOT_NULL(mSapCallback)->connectResponse(
39 serial, FAILURE_V(sap::SapConnectRsp::CONNECT_FAILURE,
40 "%s", "NOT_SUPPORTED"),
41 {});
42 return ScopedAStatus::ok();
43 }
44
disconnectReq(const int32_t serial)45 ScopedAStatus Sap::disconnectReq(const int32_t serial) {
46 NOT_NULL(mSapCallback)->disconnectResponse(serial);
47 return ScopedAStatus::ok();
48 }
49
powerReq(const int32_t serial,bool)50 ScopedAStatus Sap::powerReq(const int32_t serial, bool /*state*/) {
51 NOT_NULL(mSapCallback)->powerResponse(
52 serial, FAILURE(sap::SapResultCode::NOT_SUPPORTED));
53 return ScopedAStatus::ok();
54 }
55
resetSimReq(const int32_t serial)56 ScopedAStatus Sap::resetSimReq(const int32_t serial) {
57 NOT_NULL(mSapCallback)->resetSimResponse(
58 serial, FAILURE(sap::SapResultCode::NOT_SUPPORTED));
59 return ScopedAStatus::ok();
60 }
61
setTransferProtocolReq(const int32_t serial,const sap::SapTransferProtocol)62 ScopedAStatus Sap::setTransferProtocolReq(
63 const int32_t serial, const sap::SapTransferProtocol /*transferProtocol*/) {
64 NOT_NULL(mSapCallback)->transferProtocolResponse(
65 serial, FAILURE(sap::SapResultCode::NOT_SUPPORTED));
66 return ScopedAStatus::ok();
67 }
68
transferAtrReq(const int32_t serial)69 ScopedAStatus Sap::transferAtrReq(const int32_t serial) {
70 NOT_NULL(mSapCallback)->transferAtrResponse(
71 serial, FAILURE(sap::SapResultCode::NOT_SUPPORTED), {});
72 return ScopedAStatus::ok();
73 }
74
transferCardReaderStatusReq(const int32_t serial)75 ScopedAStatus Sap::transferCardReaderStatusReq(const int32_t serial) {
76 NOT_NULL(mSapCallback)->transferCardReaderStatusResponse(
77 serial, FAILURE(sap::SapResultCode::NOT_SUPPORTED), 0);
78 return ScopedAStatus::ok();
79 }
80
atResponseSink(const AtResponsePtr &)81 void Sap::atResponseSink(const AtResponsePtr& /*response*/) {}
82
setCallback(const std::shared_ptr<sap::ISapCallback> & sapCallback)83 ScopedAStatus Sap::setCallback(const std::shared_ptr<sap::ISapCallback>& sapCallback) {
84 mSapCallback = NOT_NULL(sapCallback);
85 return ScopedAStatus::ok();
86 }
87
88 } // namespace implementation
89 } // namespace radio
90 } // namespace hardware
91 } // namespace android
92 } // namespace aidl
93