1 option java_package = "org.android.btsap";
2 option java_outer_classname = "SapApi";
5 // SAP Interface to RIL
7 // The protocol for the binary wire format to RIL shall consist of
8 // the serialized format of MsgHeader.
9 // MsgHeader payload field will contain the serialized format of
10 // the actual message being sent, as described by the type and id
12 // e.g. If type = REQUEST and id == RIL_SIM_SAP_CONNECT, payload
13 // will contain the serialized wire format of a
14 // RIL_SIM_SAP_CONNECT_REQ message.
18 // Each SAP message stream will always be prepended with a MsgHeader
20 required fixed32 token = 1; // generated dynamically
21 required MsgType type = 2;
22 required MsgId id = 3;
23 required Error error = 4;
24 required bytes payload = 5;
38 // For MsgType: REQUEST ,MsgId: RIL_SIM_SAP_CONNECT, Error: RIL_E_UNUSED,
39 // Message: message RIL_SIM_SAP_CONNECT_REQ
40 // For MsgType: RESPONSE, MsgId: RIL_SIM_SAP_CONNECT, Error:Valid errors,
41 // Message: message RIL_SIM_SAP_CONNECT_RSP
43 RIL_SIM_SAP_CONNECT = 1;
46 // For MsgType: REQUEST ,MsgId: RIL_SIM_SAP_DISCONNECT, Error: RIL_E_UNUSED,
47 // Message: message RIL_SIM_SAP_DISCONNECT_REQ
48 // For MsgType: RESPONSE, MsgId: RIL_SIM_SAP_DISCONNECT, Error:Valid errors,
49 // Message: message RIL_SIM_SAP_DISCONNECT_RSP
50 // For MsgType: UNSOL_RESPONSE, MsgId: RIL_SIM_SAP_DISCONNECT, Error: RIL_E_UNUSED,
51 // Message: message RIL_SIM_SAP_DISCONNECT_IND
53 RIL_SIM_SAP_DISCONNECT = 2;
56 // For MsgType: REQUEST ,MsgId: RIL_SIM_SAP_APDU, Error: RIL_E_UNUSED,
57 // Message: message RIL_SIM_SAP_APDU_REQ
58 // For MsgType: RESPONSE, MsgId: RIL_SIM_SAP_APDU, Error:Valid errors,
59 // Message: message RIL_SIM_SAP_APDU_RSP
64 // For MsgType: REQUEST ,MsgId: RIL_SIM_SAP_TRANSFER_ATR, Error: RIL_E_UNUSED,
65 // Message: message RIL_SIM_SAP_TRANSFER_ATR_REQ
66 // For MsgType: RESPONSE, MsgId: RIL_SIM_SAP_TRANSFER_ATR, Error:Valid errors,
67 // Message: message RIL_SIM_SAP_TRANSFER_ATR_RSP
69 RIL_SIM_SAP_TRANSFER_ATR = 4;
72 // For MsgType: REQUEST ,MsgId: RIL_SIM_SAP_POWER, Error: RIL_E_UNUSED,
73 // Message: message RIL_SIM_SAP_POWER_REQ
74 // For MsgType: RESPONSE, MsgId: RIL_SIM_SAP_POWER, Error:Valid errors,
75 // Message: message RIL_SIM_SAP_POWER_RSP
77 RIL_SIM_SAP_POWER = 5;
80 // For MsgType: REQUEST ,MsgId: RIL_SIM_SAP_RESET_SIM, Error: RIL_E_UNUSED,
81 // Message: message RIL_SIM_SAP_RESET_SIM_REQ
82 // For MsgType: RESPONSE, MsgId: RIL_SIM_SAP_RESET_SIM, Error:Valid errors,
83 // Message: message RIL_SIM_SAP_RESET_SIM_RSP
85 RIL_SIM_SAP_RESET_SIM = 6;
88 // For MsgType: UNSOL_RESPONSE, MsgId: RIL_SIM_SAP_STATUS, Error: RIL_E_UNUSED,
89 // Message: message RIL_SIM_SAP_STATUS_IND
91 RIL_SIM_SAP_STATUS = 7;
94 // For MsgType: REQUEST ,MsgId: RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, Error: RIL_E_UNUSED,
95 // Message: message RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ
96 // For MsgType: RESPONSE, MsgId: RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, Error:Valid errors,
97 // Message: message RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP
99 RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS = 8;
102 // For MsgType: UNSOL_RESPONSE, MsgId: RIL_SIM_SAP_ERROR_RESP, Error: RIL_E_UNUSED,
103 // Message: message RIL_SIM_SAP_ERROR_RSP
105 RIL_SIM_SAP_ERROR_RESP = 9;
108 // For MsgType: REQUEST ,MsgId: RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, Error: RIL_E_UNUSED,
109 // Message: message RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ
110 // For MsgType: RESPONSE, MsgId: RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, Error:Valid errors,
111 // Message: message RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP
113 RIL_SIM_SAP_SET_TRANSFER_PROTOCOL = 10;
118 RIL_E_RADIO_NOT_AVAILABLE = 1;
119 RIL_E_GENERIC_FAILURE = 2;
120 RIL_E_REQUEST_NOT_SUPPORTED = 3;
122 RIL_E_INVALID_PARAMETER = 5;
126 // SAP 1.1 spec 5.1.1
127 message RIL_SIM_SAP_CONNECT_REQ {
128 required int32 max_message_size = 1;
131 // SAP 1.1 spec 5.1.2
132 message RIL_SIM_SAP_CONNECT_RSP {
135 RIL_E_SAP_CONNECT_FAILURE = 1;
136 RIL_E_SAP_MSG_SIZE_TOO_LARGE = 2;
137 RIL_E_SAP_MSG_SIZE_TOO_SMALL = 3;
138 RIL_E_SAP_CONNECT_OK_CALL_ONGOING = 4;
140 required Response response = 1;
141 // must be present for RIL_E_SAP_MSG_SIZE_TOO_LARGE and contain the
142 // the suitable message size
143 optional int32 max_message_size = 2;
146 // SAP 1.1 spec 5.1.3
147 message RIL_SIM_SAP_DISCONNECT_REQ {
152 // SAP 1.1 spec 5.1.4
153 message RIL_SIM_SAP_DISCONNECT_RSP {
158 // SAP 1.1 spec 5.1.5
159 message RIL_SIM_SAP_DISCONNECT_IND {
160 enum DisconnectType {
161 RIL_S_DISCONNECT_TYPE_GRACEFUL = 0;
162 RIL_S_DISCONNECT_TYPE_IMMEDIATE = 1;
164 required DisconnectType disconnectType = 1;
167 // SAP 1.1 spec 5.1.6
168 message RIL_SIM_SAP_APDU_REQ { //handles both APDU and APDU7816
171 RIL_TYPE_APDU7816 = 1;
173 required Type type = 1;
174 required bytes command = 2;
177 // SAP 1.1 spec 5.1.7
178 message RIL_SIM_SAP_APDU_RSP { //handles both APDU and APDU7816
181 RIL_TYPE_APDU7816 = 1;
183 required Type type = 1;
186 RIL_E_GENERIC_FAILURE = 1;
187 RIL_E_SIM_NOT_READY = 2;
188 RIL_E_SIM_ALREADY_POWERED_OFF = 3;
189 RIL_E_SIM_ABSENT = 4;
191 required Response response = 2;
192 optional bytes apduResponse = 3;
195 // SAP 1.1 spec 5.1.8
196 message RIL_SIM_SAP_TRANSFER_ATR_REQ {
200 // SAP 1.1 spec 5.1.9
201 message RIL_SIM_SAP_TRANSFER_ATR_RSP {
204 RIL_E_GENERIC_FAILURE = 1;
205 RIL_E_SIM_ALREADY_POWERED_OFF = 3;
206 RIL_E_SIM_ALREADY_POWERED_ON = 18;
207 RIL_E_SIM_ABSENT = 4;
208 RIL_E_SIM_DATA_NOT_AVAILABLE = 6;
210 required Response response = 1;
212 optional bytes atr = 2; //must be present on SUCCESS
216 // SAP 1.1 spec 5.1.10 +5.1.12
217 message RIL_SIM_SAP_POWER_REQ {
218 required bool state = 1; //true = on, False = off
221 // SAP 1.1 spec 5.1.11 +5.1.13
222 message RIL_SIM_SAP_POWER_RSP {
225 RIL_E_GENERIC_FAILURE = 2;
226 RIL_E_SIM_ABSENT = 11;
227 RIL_E_SIM_ALREADY_POWERED_OFF = 17;
228 RIL_E_SIM_ALREADY_POWERED_ON = 18;
230 required Response response = 1;
233 // SAP 1.1 spec 5.1.14
234 message RIL_SIM_SAP_RESET_SIM_REQ {
238 // SAP 1.1 spec 5.1.15
239 message RIL_SIM_SAP_RESET_SIM_RSP {
242 RIL_E_GENERIC_FAILURE = 2;
243 RIL_E_SIM_ABSENT = 11;
244 RIL_E_SIM_NOT_READY = 16;
245 RIL_E_SIM_ALREADY_POWERED_OFF = 17;
247 required Response response = 1;
250 // SAP 1.1 spec 5.1.16
251 message RIL_SIM_SAP_STATUS_IND {
253 RIL_SIM_STATUS_UNKNOWN_ERROR = 0;
254 RIL_SIM_STATUS_CARD_RESET = 1;
255 RIL_SIM_STATUS_CARD_NOT_ACCESSIBLE = 2;
256 RIL_SIM_STATUS_CARD_REMOVED = 3;
257 RIL_SIM_STATUS_CARD_INSERTED = 4;
258 RIL_SIM_STATUS_RECOVERED = 5;
260 required Status statusChange = 1;
263 // SAP 1.1 spec 5.1.17
264 message RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ {
269 // SAP 1.1 spec 5.1.18
270 message RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP {
273 RIL_E_GENERIC_FAILURE = 2;
274 RIL_E_SIM_DATA_NOT_AVAILABLE = 6;
276 required Response response = 1;
277 optional int32 CardReaderStatus = 2;
280 // SAP 1.1 spec 5.1.19
281 message RIL_SIM_SAP_ERROR_RSP {
285 // SAP 1.1 spec 5.1.20
286 message RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ {
291 required Protocol protocol = 1;
294 // SAP 1.1 spec 5.1.21
295 message RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP {
298 RIL_E_GENERIC_FAILURE = 2;
299 RIL_E_SIM_ABSENT = 11;
300 RIL_E_SIM_NOT_READY = 16;
301 RIL_E_SIM_ALREADY_POWERED_OFF = 17;
303 required Response response = 1;