Home | History | Annotate | Download | only in proto
      1 option java_package = "org.android.btsap";
      2 option java_outer_classname = "SapApi";
      3 
      4 //
      5 // SAP Interface to RIL
      6 //
      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
     11 // fields.
     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.
     15 //
     16 
     17 // Message Header
     18 // Each SAP message stream will always be prepended with a MsgHeader
     19 message 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;
     25 }
     26 
     27 enum MsgType {
     28         UNKNOWN = 0;
     29         REQUEST = 1;
     30         RESPONSE = 2;
     31         UNSOL_RESPONSE = 3;
     32      }
     33 
     34 enum MsgId {
     35         UNKNOWN_REQ = 0;
     36 
     37         //
     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
     42         //
     43         RIL_SIM_SAP_CONNECT = 1;
     44 
     45         //
     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
     52         //
     53         RIL_SIM_SAP_DISCONNECT = 2;
     54 
     55         //
     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
     60         //
     61         RIL_SIM_SAP_APDU = 3;
     62 
     63         //
     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
     68         //
     69         RIL_SIM_SAP_TRANSFER_ATR = 4;
     70 
     71         //
     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
     76         //
     77         RIL_SIM_SAP_POWER = 5;
     78 
     79         //
     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
     84         //
     85         RIL_SIM_SAP_RESET_SIM = 6;
     86 
     87         //
     88         // For MsgType: UNSOL_RESPONSE, MsgId: RIL_SIM_SAP_STATUS, Error: RIL_E_UNUSED,
     89         //              Message: message RIL_SIM_SAP_STATUS_IND
     90         //
     91         RIL_SIM_SAP_STATUS = 7;
     92 
     93         //
     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
     98         //
     99         RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS = 8;
    100 
    101         //
    102         // For MsgType: UNSOL_RESPONSE, MsgId: RIL_SIM_SAP_ERROR_RESP, Error: RIL_E_UNUSED,
    103         //              Message: message RIL_SIM_SAP_ERROR_RSP
    104         //
    105         RIL_SIM_SAP_ERROR_RESP = 9;
    106 
    107         //
    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
    112         //
    113         RIL_SIM_SAP_SET_TRANSFER_PROTOCOL = 10;
    114      }
    115 
    116     enum Error {
    117             RIL_E_SUCCESS = 0;
    118             RIL_E_RADIO_NOT_AVAILABLE = 1;
    119             RIL_E_GENERIC_FAILURE = 2;
    120             RIL_E_REQUEST_NOT_SUPPORTED = 3;
    121             RIL_E_CANCELLED = 4;
    122             RIL_E_INVALID_PARAMETER = 5;
    123             RIL_E_UNUSED = 6;
    124     }
    125 
    126 // SAP 1.1 spec 5.1.1
    127 message RIL_SIM_SAP_CONNECT_REQ {
    128     required int32 max_message_size = 1;
    129 }
    130 
    131 // SAP 1.1 spec 5.1.2
    132 message RIL_SIM_SAP_CONNECT_RSP {
    133     enum Response {
    134         RIL_E_SUCCESS = 0;
    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;
    139     }
    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;
    144 }
    145 
    146 // SAP 1.1 spec 5.1.3
    147 message RIL_SIM_SAP_DISCONNECT_REQ {
    148      //no params
    149 }
    150 
    151 
    152 // SAP 1.1 spec 5.1.4
    153 message RIL_SIM_SAP_DISCONNECT_RSP {
    154     //no params
    155 }
    156 
    157 
    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;
    163     }
    164     required DisconnectType disconnectType = 1;
    165 }
    166 
    167 // SAP 1.1 spec 5.1.6
    168 message RIL_SIM_SAP_APDU_REQ { //handles both APDU and APDU7816
    169     enum Type {
    170         RIL_TYPE_APDU = 0;
    171         RIL_TYPE_APDU7816 = 1;
    172     }
    173     required Type type = 1;
    174     required bytes command = 2;
    175 }
    176 
    177 // SAP 1.1 spec 5.1.7
    178 message RIL_SIM_SAP_APDU_RSP { //handles both APDU and APDU7816
    179     enum Type {
    180         RIL_TYPE_APDU = 0;
    181         RIL_TYPE_APDU7816 = 1;
    182     }
    183     required Type type = 1;
    184     enum Response {
    185         RIL_E_SUCCESS = 0;
    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;
    190     }
    191     required Response response = 2;
    192     optional bytes apduResponse = 3;
    193 }
    194 
    195 // SAP 1.1 spec 5.1.8
    196 message RIL_SIM_SAP_TRANSFER_ATR_REQ {
    197     // no params
    198 }
    199 
    200 // SAP 1.1 spec 5.1.9
    201 message RIL_SIM_SAP_TRANSFER_ATR_RSP {
    202     enum Response {
    203         RIL_E_SUCCESS = 0;
    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;
    209     }
    210     required Response response = 1;
    211 
    212     optional bytes atr = 2; //must be present on SUCCESS
    213 }
    214 
    215 
    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
    219 }
    220 
    221 // SAP 1.1 spec 5.1.11 +5.1.13
    222 message RIL_SIM_SAP_POWER_RSP {
    223     enum Response {
    224         RIL_E_SUCCESS = 0;
    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;
    229     }
    230     required Response response = 1;
    231 }
    232 
    233 // SAP 1.1 spec 5.1.14
    234 message RIL_SIM_SAP_RESET_SIM_REQ {
    235     // no params
    236 }
    237 
    238 // SAP 1.1 spec 5.1.15
    239 message RIL_SIM_SAP_RESET_SIM_RSP {
    240     enum Response {
    241         RIL_E_SUCCESS = 0;
    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;
    246     }
    247     required Response response = 1;
    248 }
    249 
    250 // SAP 1.1 spec 5.1.16
    251 message RIL_SIM_SAP_STATUS_IND {
    252     enum Status {
    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;
    259     }
    260     required Status statusChange = 1;
    261 }
    262 
    263 // SAP 1.1 spec 5.1.17
    264 message RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ {
    265     //no params
    266 
    267 }
    268 
    269 // SAP 1.1 spec 5.1.18
    270 message RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP {
    271     enum Response {
    272         RIL_E_SUCCESS = 0;
    273         RIL_E_GENERIC_FAILURE = 2;
    274         RIL_E_SIM_DATA_NOT_AVAILABLE = 6;
    275     }
    276     required Response response = 1;
    277     optional int32 CardReaderStatus = 2;
    278 }
    279 
    280 // SAP 1.1 spec 5.1.19
    281 message RIL_SIM_SAP_ERROR_RSP {
    282     //no params
    283 }
    284 
    285 // SAP 1.1 spec 5.1.20
    286 message RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ {
    287     enum Protocol {
    288         t0 = 0;
    289         t1 = 1;
    290     }
    291     required Protocol protocol = 1;
    292 }
    293 
    294 // SAP 1.1 spec 5.1.21
    295 message RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP {
    296     enum Response {
    297         RIL_E_SUCCESS = 0;
    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;
    302     }
    303     required Response response = 1;
    304 }
    305