1/*
2 * Copyright (C) 2016 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
17package android.hardware.radio@1.0;
18
19interface ISapCallback {
20    /**
21     * CONNECT_RESP from SAP 1.1 spec 5.1.2
22     *
23     * @param token Id to match req-resp. Value must match the one in req.
24     * @param sapConnectRsp Connection Status
25     * @param maxMsgSize MaxMsgSize supported by server if request cannot be fulfilled.
26     *        Valid only if connectResponse is SapConnectResponse:MSG_SIZE_TOO_LARGE.
27     */
28    oneway connectResponse(int32_t token, SapConnectRsp sapConnectRsp, int32_t maxMsgSize);
29
30    /**
31     * DISCONNECT_RESP from SAP 1.1 spec 5.1.4
32     *
33     * @param token Id to match req-resp. Value must match the one in req.
34     */
35    oneway disconnectResponse(int32_t token);
36
37    /**
38     * DISCONNECT_IND from SAP 1.1 spec 5.1.5
39     *
40     * @param token Id to match req-resp. Value must match the one in req.
41     * @param disconnectType Disconnect Type to indicate if shutdown is graceful or immediate
42     */
43    oneway disconnectIndication(int32_t token, SapDisconnectType disconnectType);
44
45    /**
46     * TRANSFER_APDU_RESP from SAP 1.1 spec 5.1.7
47     *
48     * @param token Id to match req-resp. Value must match the one in req.
49     * @param resultCode ResultCode to indicate if command was processed correctly
50     *        Possible values:
51     *        SapResultCode:SUCCESS,
52     *        SapResultCode:GENERIC_FAILURE,
53     *        SapResultCode:CARD_NOT_ACCESSSIBLE,
54     *        SapResultCode:CARD_ALREADY_POWERED_OFF,
55     *        SapResultCode:CARD_REMOVED
56     * @param apduRsp APDU Response. Valid only if command was processed correctly and no error
57     *        occurred.
58     */
59    oneway apduResponse(int32_t token,
60                        SapResultCode resultCode,
61                        vec<uint8_t> apduRsp);
62
63    /**
64     * TRANSFER_ATR_RESP from SAP 1.1 spec 5.1.9
65     *
66     * @param token Id to match req-resp. Value must match the one in req.
67     * @param resultCode ResultCode to indicate if command was processed correctly
68     *        Possible values:
69     *        SapResultCode:SUCCESS,
70     *        SapResultCode:GENERIC_FAILURE,
71     *        SapResultCode:CARD_ALREADY_POWERED_OFF,
72     *        SapResultCode:CARD_REMOVED,
73     *        SapResultCode:DATA_NOT_AVAILABLE
74     * @param atr Answer to Reset from the subscription module. Included only if no error occurred,
75     *        otherwise empty.
76     */
77    oneway transferAtrResponse(int32_t token, SapResultCode resultCode, vec<uint8_t> atr);
78
79    /**
80     * POWER_SIM_OFF_RESP and POWER_SIM_ON_RESP from SAP 1.1 spec 5.1.11 + 5.1.13
81     *
82     * @param token Id to match req-resp. Value must match the one in req.
83     * @param resultCode ResultCode to indicate if command was processed correctly
84     *        Possible values:
85     *        SapResultCode:SUCCESS,
86     *        SapResultCode:GENERIC_FAILURE,
87     *        SapResultCode:CARD_NOT_ACCESSSIBLE, (possible only for power on req)
88     *        SapResultCode:CARD_ALREADY_POWERED_OFF, (possible only for power off req)
89     *        SapResultCode:CARD_REMOVED,
90     *        SapResultCode:CARD_ALREADY_POWERED_ON (possible only for power on req)
91     */
92    oneway powerResponse(int32_t token, SapResultCode resultCode);
93
94    /**
95     * RESET_SIM_RESP from SAP 1.1 spec 5.1.15
96     *
97     * @param token Id to match req-resp. Value must match the one in req.
98     * @param resultCode ResultCode to indicate if command was processed correctly
99     *        Possible values:
100     *        SapResultCode:SUCCESS,
101     *        SapResultCode:GENERIC_FAILURE,
102     *        SapResultCode:CARD_NOT_ACCESSSIBLE,
103     *        SapResultCode:CARD_ALREADY_POWERED_OFF,
104     *        SapResultCode:CARD_REMOVED
105     */
106    oneway resetSimResponse(int32_t token, SapResultCode resultCode);
107
108    /**
109     * STATUS_IND from SAP 1.1 spec 5.1.16
110     *
111     * @param token Id to match req-resp. Value must match the one in req.
112     * @param status Parameter to indicate reason for the status change.
113     */
114    oneway statusIndication(int32_t token, SapStatus status);
115
116    /**
117     * TRANSFER_CARD_READER_STATUS_REQ from SAP 1.1 spec 5.1.18
118     *
119     * @param token Id to match req-resp. Value must match the one in req.
120     * @param resultCode ResultCode to indicate if command was processed correctly
121     *        Possible values:
122     *        SapResultCode:SUCCESS,
123     *        SapResultCode:GENERIC_FAILURE
124     *        SapResultCode:DATA_NOT_AVAILABLE
125     * @param cardReaderStatus Card Reader Status coded as described in 3GPP TS 11.14 Section 12.33
126     *        and TS 31.111 Section 8.33
127     */
128    oneway transferCardReaderStatusResponse(int32_t token,
129                                            SapResultCode resultCode,
130                                            int32_t cardReaderStatus);
131
132    /**
133     * ERROR_RESP from SAP 1.1 spec 5.1.19
134     *
135     * @param token Id to match req-resp. Value must match the one in req.
136     */
137    oneway errorResponse(int32_t token);
138
139    /**
140     * SET_TRANSPORT_PROTOCOL_RESP from SAP 1.1 spec 5.1.21
141     *
142     * @param token Id to match req-resp. Value must match the one in req.
143     * @param resultCode ResultCode to indicate if command was processed correctly
144     *        Possible values:
145     *        SapResultCode:SUCCESS
146     *        SapResultCode:NOT_SUPPORTED
147     */
148    oneway transferProtocolResponse(int32_t token, SapResultCode resultCode);
149};