1 /*
2  * Copyright (C) 2022 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 #pragma once
17 
18 #include "GuaranteedCallback.h"
19 
20 #include <aidl/android/hardware/radio/sap/ISapCallback.h>
21 #include <android/hardware/radio/1.0/ISapCallback.h>
22 
23 namespace android::hardware::radio::compat {
24 
25 class SapCallback : public V1_0::ISapCallback {
26     GuaranteedCallback<aidl::android::hardware::radio::sap::ISapCallback,
27                        aidl::android::hardware::radio::sap::ISapCallbackDefault>
28             mCallback;
29 
30     Return<void> apduResponse(int32_t serial, V1_0::SapResultCode resultCode,
31                               const ::android::hardware::hidl_vec<uint8_t>& apduRsp) override;
32     Return<void> connectResponse(int32_t serial, V1_0::SapConnectRsp sapConnectRsp,
33                                  int32_t maxMsgSize) override;
34     Return<void> disconnectIndication(int32_t serial,
35                                       V1_0::SapDisconnectType disconnectType) override;
36     Return<void> disconnectResponse(int32_t serial) override;
37     Return<void> errorResponse(int32_t serial) override;
38     Return<void> powerResponse(int32_t serial, V1_0::SapResultCode resultCode) override;
39     Return<void> resetSimResponse(int32_t serial, V1_0::SapResultCode resultCode) override;
40     Return<void> statusIndication(int32_t serial, V1_0::SapStatus status) override;
41     Return<void> transferAtrResponse(int32_t serial, V1_0::SapResultCode resultCode,
42                                      const ::android::hardware::hidl_vec<uint8_t>& atr) override;
43     Return<void> transferCardReaderStatusResponse(int32_t serial, V1_0::SapResultCode resultCode,
44                                                   int32_t cardReaderStatus) override;
45     Return<void> transferProtocolResponse(int32_t serial, V1_0::SapResultCode resultCode) override;
46 
47   public:
48     void setResponseFunction(
49             const std::shared_ptr<aidl::android::hardware::radio::sap::ISapCallback>& callback);
50 
51     std::shared_ptr<aidl::android::hardware::radio::sap::ISapCallback> respond();
52 };
53 
54 }  // namespace android::hardware::radio::compat
55