• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006 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 #ifndef ANDROID_RIL_H
18 #define ANDROID_RIL_H 1
19 
20 #include <stdlib.h>
21 #include <stdint.h>
22 #include <telephony/ril_cdma_sms.h>
23 #include <telephony/ril_nv_items.h>
24 #include <telephony/ril_msim.h>
25 
26 #ifndef FEATURE_UNIT_TEST
27 #include <sys/time.h>
28 #endif /* !FEATURE_UNIT_TEST */
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 
35 #if defined(ANDROID_SIM_COUNT_2)
36 #define SIM_COUNT 2
37 #elif defined(ANDROID_SIM_COUNT_3)
38 #define SIM_COUNT 3
39 #elif defined(ANDROID_SIM_COUNT_4)
40 #define SIM_COUNT 4
41 #else
42 #define SIM_COUNT 1
43 #endif
44 
45 #ifndef ANDROID_MULTI_SIM
46 #define SIM_COUNT 1
47 #endif
48 
49 #define RIL_VERSION 10     /* Current version */
50 #define RIL_VERSION_MIN 6 /* Minimum RIL_VERSION supported */
51 
52 #define CDMA_ALPHA_INFO_BUFFER_LENGTH 64
53 #define CDMA_NUMBER_INFO_BUFFER_LENGTH 81
54 
55 #define MAX_RILDS 3
56 #define MAX_SOCKET_NAME_LENGTH 6
57 #define MAX_CLIENT_ID_LENGTH 2
58 #define MAX_DEBUG_SOCKET_NAME_LENGTH 12
59 #define MAX_QEMU_PIPE_NAME_LENGTH  11
60 
61 typedef void * RIL_Token;
62 
63 typedef enum {
64     RIL_SOCKET_1,
65 #if (SIM_COUNT >= 2)
66     RIL_SOCKET_2,
67 #if (SIM_COUNT >= 3)
68     RIL_SOCKET_3,
69 #endif
70 #if (SIM_COUNT >= 4)
71     RIL_SOCKET_4,
72 #endif
73 #endif
74     RIL_SOCKET_NUM
75 } RIL_SOCKET_ID;
76 
77 
78 typedef enum {
79     RIL_E_SUCCESS = 0,
80     RIL_E_RADIO_NOT_AVAILABLE = 1,     /* If radio did not start or is resetting */
81     RIL_E_GENERIC_FAILURE = 2,
82     RIL_E_PASSWORD_INCORRECT = 3,      /* for PIN/PIN2 methods only! */
83     RIL_E_SIM_PIN2 = 4,                /* Operation requires SIM PIN2 to be entered */
84     RIL_E_SIM_PUK2 = 5,                /* Operation requires SIM PIN2 to be entered */
85     RIL_E_REQUEST_NOT_SUPPORTED = 6,
86     RIL_E_CANCELLED = 7,
87     RIL_E_OP_NOT_ALLOWED_DURING_VOICE_CALL = 8, /* data ops are not allowed during voice
88                                                    call on a Class C GPRS device */
89     RIL_E_OP_NOT_ALLOWED_BEFORE_REG_TO_NW = 9,  /* data ops are not allowed before device
90                                                    registers in network */
91     RIL_E_SMS_SEND_FAIL_RETRY = 10,             /* fail to send sms and need retry */
92     RIL_E_SIM_ABSENT = 11,                      /* fail to set the location where CDMA subscription
93                                                    shall be retrieved because of SIM or RUIM
94                                                    card absent */
95     RIL_E_SUBSCRIPTION_NOT_AVAILABLE = 12,      /* fail to find CDMA subscription from specified
96                                                    location */
97     RIL_E_MODE_NOT_SUPPORTED = 13,              /* HW does not support preferred network type */
98     RIL_E_FDN_CHECK_FAILURE = 14,               /* command failed because recipient is not on FDN list */
99     RIL_E_ILLEGAL_SIM_OR_ME = 15,               /* network selection failed due to
100                                                    illegal SIM or ME */
101     RIL_E_MISSING_RESOURCE = 16,                /* no logical channel available */
102     RIL_E_NO_SUCH_ELEMENT = 17,                 /* application not found on SIM */
103 } RIL_Errno;
104 
105 typedef enum {
106     RIL_CALL_ACTIVE = 0,
107     RIL_CALL_HOLDING = 1,
108     RIL_CALL_DIALING = 2,    /* MO call only */
109     RIL_CALL_ALERTING = 3,   /* MO call only */
110     RIL_CALL_INCOMING = 4,   /* MT call only */
111     RIL_CALL_WAITING = 5     /* MT call only */
112 } RIL_CallState;
113 
114 typedef enum {
115     RADIO_STATE_OFF = 0,                   /* Radio explictly powered off (eg CFUN=0) */
116     RADIO_STATE_UNAVAILABLE = 1,           /* Radio unavailable (eg, resetting or not booted) */
117     /* States 2-9 below are deprecated. Just leaving them here for backward compatibility. */
118     RADIO_STATE_SIM_NOT_READY = 2,         /* Radio is on, but the SIM interface is not ready */
119     RADIO_STATE_SIM_LOCKED_OR_ABSENT = 3,  /* SIM PIN locked, PUK required, network
120                                               personalization locked, or SIM absent */
121     RADIO_STATE_SIM_READY = 4,             /* Radio is on and SIM interface is available */
122     RADIO_STATE_RUIM_NOT_READY = 5,        /* Radio is on, but the RUIM interface is not ready */
123     RADIO_STATE_RUIM_READY = 6,            /* Radio is on and the RUIM interface is available */
124     RADIO_STATE_RUIM_LOCKED_OR_ABSENT = 7, /* RUIM PIN locked, PUK required, network
125                                               personalization locked, or RUIM absent */
126     RADIO_STATE_NV_NOT_READY = 8,          /* Radio is on, but the NV interface is not available */
127     RADIO_STATE_NV_READY = 9,              /* Radio is on and the NV interface is available */
128     RADIO_STATE_ON = 10                    /* Radio is on */
129 } RIL_RadioState;
130 
131 typedef enum {
132     RADIO_TECH_UNKNOWN = 0,
133     RADIO_TECH_GPRS = 1,
134     RADIO_TECH_EDGE = 2,
135     RADIO_TECH_UMTS = 3,
136     RADIO_TECH_IS95A = 4,
137     RADIO_TECH_IS95B = 5,
138     RADIO_TECH_1xRTT =  6,
139     RADIO_TECH_EVDO_0 = 7,
140     RADIO_TECH_EVDO_A = 8,
141     RADIO_TECH_HSDPA = 9,
142     RADIO_TECH_HSUPA = 10,
143     RADIO_TECH_HSPA = 11,
144     RADIO_TECH_EVDO_B = 12,
145     RADIO_TECH_EHRPD = 13,
146     RADIO_TECH_LTE = 14,
147     RADIO_TECH_HSPAP = 15, // HSPA+
148     RADIO_TECH_GSM = 16, // Only supports voice
149     RADIO_TECH_TD_SCDMA = 17
150 } RIL_RadioTechnology;
151 
152 // Do we want to split Data from Voice and the use
153 // RIL_RadioTechnology for get/setPreferredVoice/Data ?
154 typedef enum {
155     PREF_NET_TYPE_GSM_WCDMA                = 0, /* GSM/WCDMA (WCDMA preferred) */
156     PREF_NET_TYPE_GSM_ONLY                 = 1, /* GSM only */
157     PREF_NET_TYPE_WCDMA                    = 2, /* WCDMA  */
158     PREF_NET_TYPE_GSM_WCDMA_AUTO           = 3, /* GSM/WCDMA (auto mode, according to PRL) */
159     PREF_NET_TYPE_CDMA_EVDO_AUTO           = 4, /* CDMA and EvDo (auto mode, according to PRL) */
160     PREF_NET_TYPE_CDMA_ONLY                = 5, /* CDMA only */
161     PREF_NET_TYPE_EVDO_ONLY                = 6, /* EvDo only */
162     PREF_NET_TYPE_GSM_WCDMA_CDMA_EVDO_AUTO = 7, /* GSM/WCDMA, CDMA, and EvDo (auto mode, according to PRL) */
163     PREF_NET_TYPE_LTE_CDMA_EVDO            = 8, /* LTE, CDMA and EvDo */
164     PREF_NET_TYPE_LTE_GSM_WCDMA            = 9, /* LTE, GSM/WCDMA */
165     PREF_NET_TYPE_LTE_CMDA_EVDO_GSM_WCDMA  = 10, /* LTE, CDMA, EvDo, GSM/WCDMA */
166     PREF_NET_TYPE_LTE_ONLY                 = 11, /* LTE only */
167     PREF_NET_TYPE_LTE_WCDMA                = 12  /* LTE/WCDMA */
168 } RIL_PreferredNetworkType;
169 
170 /* Source for cdma subscription */
171 typedef enum {
172    CDMA_SUBSCRIPTION_SOURCE_RUIM_SIM = 0,
173    CDMA_SUBSCRIPTION_SOURCE_NV = 1
174 } RIL_CdmaSubscriptionSource;
175 
176 /* User-to-User signaling Info activation types derived from 3GPP 23.087 v8.0 */
177 typedef enum {
178     RIL_UUS_TYPE1_IMPLICIT = 0,
179     RIL_UUS_TYPE1_REQUIRED = 1,
180     RIL_UUS_TYPE1_NOT_REQUIRED = 2,
181     RIL_UUS_TYPE2_REQUIRED = 3,
182     RIL_UUS_TYPE2_NOT_REQUIRED = 4,
183     RIL_UUS_TYPE3_REQUIRED = 5,
184     RIL_UUS_TYPE3_NOT_REQUIRED = 6
185 } RIL_UUS_Type;
186 
187 /* User-to-User Signaling Information data coding schemes. Possible values for
188  * Octet 3 (Protocol Discriminator field) in the UUIE. The values have been
189  * specified in section 10.5.4.25 of 3GPP TS 24.008 */
190 typedef enum {
191     RIL_UUS_DCS_USP = 0,          /* User specified protocol */
192     RIL_UUS_DCS_OSIHLP = 1,       /* OSI higher layer protocol */
193     RIL_UUS_DCS_X244 = 2,         /* X.244 */
194     RIL_UUS_DCS_RMCF = 3,         /* Reserved for system mangement
195                                      convergence function */
196     RIL_UUS_DCS_IA5c = 4          /* IA5 characters */
197 } RIL_UUS_DCS;
198 
199 /* User-to-User Signaling Information defined in 3GPP 23.087 v8.0
200  * This data is passed in RIL_ExtensionRecord and rec contains this
201  * structure when type is RIL_UUS_INFO_EXT_REC */
202 typedef struct {
203   RIL_UUS_Type    uusType;    /* UUS Type */
204   RIL_UUS_DCS     uusDcs;     /* UUS Data Coding Scheme */
205   int             uusLength;  /* Length of UUS Data */
206   char *          uusData;    /* UUS Data */
207 } RIL_UUS_Info;
208 
209 /* CDMA Signal Information Record as defined in C.S0005 section 3.7.5.5 */
210 typedef struct {
211   char isPresent;    /* non-zero if signal information record is present */
212   char signalType;   /* as defined 3.7.5.5-1 */
213   char alertPitch;   /* as defined 3.7.5.5-2 */
214   char signal;       /* as defined 3.7.5.5-3, 3.7.5.5-4 or 3.7.5.5-5 */
215 } RIL_CDMA_SignalInfoRecord;
216 
217 typedef struct {
218     RIL_CallState   state;
219     int             index;      /* Connection Index for use with, eg, AT+CHLD */
220     int             toa;        /* type of address, eg 145 = intl */
221     char            isMpty;     /* nonzero if is mpty call */
222     char            isMT;       /* nonzero if call is mobile terminated */
223     char            als;        /* ALS line indicator if available
224                                    (0 = line 1) */
225     char            isVoice;    /* nonzero if this is is a voice call */
226     char            isVoicePrivacy;     /* nonzero if CDMA voice privacy mode is active */
227     char *          number;     /* Remote party number */
228     int             numberPresentation; /* 0=Allowed, 1=Restricted, 2=Not Specified/Unknown 3=Payphone */
229     char *          name;       /* Remote party name */
230     int             namePresentation; /* 0=Allowed, 1=Restricted, 2=Not Specified/Unknown 3=Payphone */
231     RIL_UUS_Info *  uusInfo;    /* NULL or Pointer to User-User Signaling Information */
232 } RIL_Call;
233 
234 /* Deprecated, use RIL_Data_Call_Response_v6 */
235 typedef struct {
236     int             cid;        /* Context ID, uniquely identifies this call */
237     int             active;     /* 0=inactive, 1=active/physical link down, 2=active/physical link up */
238     char *          type;       /* One of the PDP_type values in TS 27.007 section 10.1.1.
239                                    For example, "IP", "IPV6", "IPV4V6", or "PPP". */
240     char *          apn;        /* ignored */
241     char *          address;    /* An address, e.g., "192.0.1.3" or "2001:db8::1". */
242 } RIL_Data_Call_Response_v4;
243 
244 /*
245  * Returned by RIL_REQUEST_SETUP_DATA_CALL, RIL_REQUEST_DATA_CALL_LIST
246  * and RIL_UNSOL_DATA_CALL_LIST_CHANGED, on error status != 0.
247  */
248 typedef struct {
249     int             status;     /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */
250     int             suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry
251                                            back-off timer value RIL wants to override the one
252                                            pre-configured in FW.
253                                            The unit is miliseconds.
254                                            The value < 0 means no value is suggested.
255                                            The value 0 means retry should be done ASAP.
256                                            The value of INT_MAX(0x7fffffff) means no retry. */
257     int             cid;        /* Context ID, uniquely identifies this call */
258     int             active;     /* 0=inactive, 1=active/physical link down, 2=active/physical link up */
259     char *          type;       /* One of the PDP_type values in TS 27.007 section 10.1.1.
260                                    For example, "IP", "IPV6", "IPV4V6", or "PPP". If status is
261                                    PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED this is the type supported
262                                    such as "IP" or "IPV6" */
263     char *          ifname;     /* The network interface name */
264     char *          addresses;  /* A space-delimited list of addresses with optional "/" prefix length,
265                                    e.g., "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64".
266                                    May not be empty, typically 1 IPv4 or 1 IPv6 or
267                                    one of each. If the prefix length is absent the addresses
268                                    are assumed to be point to point with IPv4 having a prefix
269                                    length of 32 and IPv6 128. */
270     char *          dnses;      /* A space-delimited list of DNS server addresses,
271                                    e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
272                                    May be empty. */
273     char *          gateways;   /* A space-delimited list of default gateway addresses,
274                                    e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
275                                    May be empty in which case the addresses represent point
276                                    to point connections. */
277 } RIL_Data_Call_Response_v6;
278 
279 typedef struct {
280     int             status;     /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */
281     int             suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry
282                                            back-off timer value RIL wants to override the one
283                                            pre-configured in FW.
284                                            The unit is miliseconds.
285                                            The value < 0 means no value is suggested.
286                                            The value 0 means retry should be done ASAP.
287                                            The value of INT_MAX(0x7fffffff) means no retry. */
288     int             cid;        /* Context ID, uniquely identifies this call */
289     int             active;     /* 0=inactive, 1=active/physical link down, 2=active/physical link up */
290     char *          type;       /* One of the PDP_type values in TS 27.007 section 10.1.1.
291                                    For example, "IP", "IPV6", "IPV4V6", or "PPP". If status is
292                                    PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED this is the type supported
293                                    such as "IP" or "IPV6" */
294     char *          ifname;     /* The network interface name */
295     char *          addresses;  /* A space-delimited list of addresses with optional "/" prefix length,
296                                    e.g., "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64".
297                                    May not be empty, typically 1 IPv4 or 1 IPv6 or
298                                    one of each. If the prefix length is absent the addresses
299                                    are assumed to be point to point with IPv4 having a prefix
300                                    length of 32 and IPv6 128. */
301     char *          dnses;      /* A space-delimited list of DNS server addresses,
302                                    e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
303                                    May be empty. */
304     char *          gateways;   /* A space-delimited list of default gateway addresses,
305                                    e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
306                                    May be empty in which case the addresses represent point
307                                    to point connections. */
308     char *          pcscf;    /* the Proxy Call State Control Function address
309                                  via PCO(Protocol Configuration Option) for IMS client. */
310 } RIL_Data_Call_Response_v9; // FIXME: Change to v10
311 
312 typedef enum {
313     RADIO_TECH_3GPP = 1, /* 3GPP Technologies - GSM, WCDMA */
314     RADIO_TECH_3GPP2 = 2 /* 3GPP2 Technologies - CDMA */
315 } RIL_RadioTechnologyFamily;
316 
317 typedef struct {
318     RIL_RadioTechnologyFamily tech;
319     unsigned char             retry;       /* 0 == not retry, nonzero == retry */
320     int                       messageRef;  /* Valid field if retry is set to nonzero.
321                                               Contains messageRef from RIL_SMS_Response
322                                               corresponding to failed MO SMS.
323                                             */
324 
325     union {
326         /* Valid field if tech is RADIO_TECH_3GPP2. See RIL_REQUEST_CDMA_SEND_SMS */
327         RIL_CDMA_SMS_Message* cdmaMessage;
328 
329         /* Valid field if tech is RADIO_TECH_3GPP. See RIL_REQUEST_SEND_SMS */
330         char**                gsmMessage;
331     } message;
332 } RIL_IMS_SMS_Message;
333 
334 typedef struct {
335     int messageRef;   /* TP-Message-Reference for GSM,
336                          and BearerData MessageId for CDMA
337                          (See 3GPP2 C.S0015-B, v2.0, table 4.5-1). */
338     char *ackPDU;     /* or NULL if n/a */
339     int errorCode;    /* See 3GPP 27.005, 3.2.5 for GSM/UMTS,
340                          3GPP2 N.S0005 (IS-41C) Table 171 for CDMA,
341                          -1 if unknown or not applicable*/
342 } RIL_SMS_Response;
343 
344 /** Used by RIL_REQUEST_WRITE_SMS_TO_SIM */
345 typedef struct {
346     int status;     /* Status of message.  See TS 27.005 3.1, "<stat>": */
347                     /*      0 = "REC UNREAD"    */
348                     /*      1 = "REC READ"      */
349                     /*      2 = "STO UNSENT"    */
350                     /*      3 = "STO SENT"      */
351     char * pdu;     /* PDU of message to write, as an ASCII hex string less the SMSC address,
352                        the TP-layer length is "strlen(pdu)/2". */
353     char * smsc;    /* SMSC address in GSM BCD format prefixed by a length byte
354                        (as expected by TS 27.005) or NULL for default SMSC */
355 } RIL_SMS_WriteArgs;
356 
357 /** Used by RIL_REQUEST_DIAL */
358 typedef struct {
359     char * address;
360     int clir;
361             /* (same as 'n' paremeter in TS 27.007 7.7 "+CLIR"
362              * clir == 0 on "use subscription default value"
363              * clir == 1 on "CLIR invocation" (restrict CLI presentation)
364              * clir == 2 on "CLIR suppression" (allow CLI presentation)
365              */
366     RIL_UUS_Info *  uusInfo;    /* NULL or Pointer to User-User Signaling Information */
367 } RIL_Dial;
368 
369 typedef struct {
370     int command;    /* one of the commands listed for TS 27.007 +CRSM*/
371     int fileid;     /* EF id */
372     char *path;     /* "pathid" from TS 27.007 +CRSM command.
373                        Path is in hex asciii format eg "7f205f70"
374                        Path must always be provided.
375                      */
376     int p1;
377     int p2;
378     int p3;
379     char *data;     /* May be NULL*/
380     char *pin2;     /* May be NULL*/
381 } RIL_SIM_IO_v5;
382 
383 typedef struct {
384     int command;    /* one of the commands listed for TS 27.007 +CRSM*/
385     int fileid;     /* EF id */
386     char *path;     /* "pathid" from TS 27.007 +CRSM command.
387                        Path is in hex asciii format eg "7f205f70"
388                        Path must always be provided.
389                      */
390     int p1;
391     int p2;
392     int p3;
393     char *data;     /* May be NULL*/
394     char *pin2;     /* May be NULL*/
395     char *aidPtr;   /* AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value. */
396 } RIL_SIM_IO_v6;
397 
398 /* Used by RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL and
399  * RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC. */
400 typedef struct {
401     int sessionid;  /* "sessionid" from TS 27.007 +CGLA command. Should be
402                        ignored for +CSIM command. */
403 
404     /* Following fields are used to derive the APDU ("command" and "length"
405        values in TS 27.007 +CSIM and +CGLA commands). */
406     int cla;
407     int instruction;
408     int p1;
409     int p2;
410     int p3;         /* A negative P3 implies a 4 byte APDU. */
411     char *data;     /* May be NULL. In hex string format. */
412 } RIL_SIM_APDU;
413 
414 typedef struct {
415     int sw1;
416     int sw2;
417     char *simResponse;  /* In hex string format ([a-fA-F0-9]*), except for SIM_AUTHENTICATION
418                            response for which it is in Base64 format, see 3GPP TS 31.102 7.1.2 */
419 } RIL_SIM_IO_Response;
420 
421 /* See also com.android.internal.telephony.gsm.CallForwardInfo */
422 
423 typedef struct {
424     int             status;     /*
425                                  * For RIL_REQUEST_QUERY_CALL_FORWARD_STATUS
426                                  * status 1 = active, 0 = not active
427                                  *
428                                  * For RIL_REQUEST_SET_CALL_FORWARD:
429                                  * status is:
430                                  * 0 = disable
431                                  * 1 = enable
432                                  * 2 = interrogate
433                                  * 3 = registeration
434                                  * 4 = erasure
435                                  */
436 
437     int             reason;      /* from TS 27.007 7.11 "reason" */
438     int             serviceClass;/* From 27.007 +CCFC/+CLCK "class"
439                                     See table for Android mapping from
440                                     MMI service code
441                                     0 means user doesn't input class */
442     int             toa;         /* "type" from TS 27.007 7.11 */
443     char *          number;      /* "number" from TS 27.007 7.11. May be NULL */
444     int             timeSeconds; /* for CF no reply only */
445 }RIL_CallForwardInfo;
446 
447 typedef struct {
448    char * cid;         /* Combination of LAC and Cell Id in 32 bits in GSM.
449                         * Upper 16 bits is LAC and lower 16 bits
450                         * is CID (as described in TS 27.005)
451                         * Primary Scrambling Code (as described in TS 25.331)
452                         *         in 9 bits in UMTS
453                         * Valid values are hexadecimal 0x0000 - 0xffffffff.
454                         */
455    int    rssi;        /* Received RSSI in GSM,
456                         * Level index of CPICH Received Signal Code Power in UMTS
457                         */
458 } RIL_NeighboringCell;
459 
460 /* See RIL_REQUEST_LAST_CALL_FAIL_CAUSE */
461 typedef enum {
462     CALL_FAIL_UNOBTAINABLE_NUMBER = 1,
463     CALL_FAIL_NORMAL = 16,
464     CALL_FAIL_BUSY = 17,
465     CALL_FAIL_CONGESTION = 34,
466     CALL_FAIL_ACM_LIMIT_EXCEEDED = 68,
467     CALL_FAIL_CALL_BARRED = 240,
468     CALL_FAIL_FDN_BLOCKED = 241,
469     CALL_FAIL_IMSI_UNKNOWN_IN_VLR = 242,
470     CALL_FAIL_IMEI_NOT_ACCEPTED = 243,
471     CALL_FAIL_CDMA_LOCKED_UNTIL_POWER_CYCLE = 1000,
472     CALL_FAIL_CDMA_DROP = 1001,
473     CALL_FAIL_CDMA_INTERCEPT = 1002,
474     CALL_FAIL_CDMA_REORDER = 1003,
475     CALL_FAIL_CDMA_SO_REJECT = 1004,
476     CALL_FAIL_CDMA_RETRY_ORDER = 1005,
477     CALL_FAIL_CDMA_ACCESS_FAILURE = 1006,
478     CALL_FAIL_CDMA_PREEMPTED = 1007,
479     CALL_FAIL_CDMA_NOT_EMERGENCY = 1008, /* For non-emergency number dialed
480                                             during emergency callback mode */
481     CALL_FAIL_CDMA_ACCESS_BLOCKED = 1009, /* CDMA network access probes blocked */
482     CALL_FAIL_ERROR_UNSPECIFIED = 0xffff
483 } RIL_LastCallFailCause;
484 
485 /* See RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE */
486 typedef enum {
487     PDP_FAIL_NONE = 0, /* No error, connection ok */
488 
489     /* an integer cause code defined in TS 24.008
490        section 6.1.3.1.3 or TS 24.301 Release 8+ Annex B.
491        If the implementation does not have access to the exact cause codes,
492        then it should return one of the following values,
493        as the UI layer needs to distinguish these
494        cases for error notification and potential retries. */
495     PDP_FAIL_OPERATOR_BARRED = 0x08,               /* no retry */
496     PDP_FAIL_INSUFFICIENT_RESOURCES = 0x1A,
497     PDP_FAIL_MISSING_UKNOWN_APN = 0x1B,            /* no retry */
498     PDP_FAIL_UNKNOWN_PDP_ADDRESS_TYPE = 0x1C,      /* no retry */
499     PDP_FAIL_USER_AUTHENTICATION = 0x1D,           /* no retry */
500     PDP_FAIL_ACTIVATION_REJECT_GGSN = 0x1E,        /* no retry */
501     PDP_FAIL_ACTIVATION_REJECT_UNSPECIFIED = 0x1F,
502     PDP_FAIL_SERVICE_OPTION_NOT_SUPPORTED = 0x20,  /* no retry */
503     PDP_FAIL_SERVICE_OPTION_NOT_SUBSCRIBED = 0x21, /* no retry */
504     PDP_FAIL_SERVICE_OPTION_OUT_OF_ORDER = 0x22,
505     PDP_FAIL_NSAPI_IN_USE = 0x23,                  /* no retry */
506     PDP_FAIL_REGULAR_DEACTIVATION = 0x24,          /* possibly restart radio,
507                                                       based on framework config */
508     PDP_FAIL_ONLY_IPV4_ALLOWED = 0x32,             /* no retry */
509     PDP_FAIL_ONLY_IPV6_ALLOWED = 0x33,             /* no retry */
510     PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED = 0x34,
511     PDP_FAIL_PROTOCOL_ERRORS   = 0x6F,             /* no retry */
512 
513     /* Not mentioned in the specification */
514     PDP_FAIL_VOICE_REGISTRATION_FAIL = -1,
515     PDP_FAIL_DATA_REGISTRATION_FAIL = -2,
516 
517    /* reasons for data call drop - network/modem disconnect */
518     PDP_FAIL_SIGNAL_LOST = -3,
519     PDP_FAIL_PREF_RADIO_TECH_CHANGED = -4,/* preferred technology has changed, should retry
520                                              with parameters appropriate for new technology */
521     PDP_FAIL_RADIO_POWER_OFF = -5,        /* data call was disconnected because radio was resetting,
522                                              powered off - no retry */
523     PDP_FAIL_TETHERED_CALL_ACTIVE = -6,   /* data call was disconnected by modem because tethered
524                                              mode was up on same APN/data profile - no retry until
525                                              tethered call is off */
526 
527     PDP_FAIL_ERROR_UNSPECIFIED = 0xffff,  /* retry silently */
528 } RIL_DataCallFailCause;
529 
530 /* See RIL_REQUEST_SETUP_DATA_CALL */
531 typedef enum {
532     RIL_DATA_PROFILE_DEFAULT    = 0,
533     RIL_DATA_PROFILE_TETHERED   = 1,
534     RIL_DATA_PROFILE_OEM_BASE   = 1000    /* Start of OEM-specific profiles */
535 } RIL_DataProfile;
536 
537 /* Used by RIL_UNSOL_SUPP_SVC_NOTIFICATION */
538 typedef struct {
539     int     notificationType;   /*
540                                  * 0 = MO intermediate result code
541                                  * 1 = MT unsolicited result code
542                                  */
543     int     code;               /* See 27.007 7.17
544                                    "code1" for MO
545                                    "code2" for MT. */
546     int     index;              /* CUG index. See 27.007 7.17. */
547     int     type;               /* "type" from 27.007 7.17 (MT only). */
548     char *  number;             /* "number" from 27.007 7.17
549                                    (MT only, may be NULL). */
550 } RIL_SuppSvcNotification;
551 
552 #define RIL_CARD_MAX_APPS     8
553 
554 typedef enum {
555     RIL_CARDSTATE_ABSENT   = 0,
556     RIL_CARDSTATE_PRESENT  = 1,
557     RIL_CARDSTATE_ERROR    = 2
558 } RIL_CardState;
559 
560 typedef enum {
561     RIL_PERSOSUBSTATE_UNKNOWN                   = 0, /* initial state */
562     RIL_PERSOSUBSTATE_IN_PROGRESS               = 1, /* in between each lock transition */
563     RIL_PERSOSUBSTATE_READY                     = 2, /* when either SIM or RUIM Perso is finished
564                                                         since each app can only have 1 active perso
565                                                         involved */
566     RIL_PERSOSUBSTATE_SIM_NETWORK               = 3,
567     RIL_PERSOSUBSTATE_SIM_NETWORK_SUBSET        = 4,
568     RIL_PERSOSUBSTATE_SIM_CORPORATE             = 5,
569     RIL_PERSOSUBSTATE_SIM_SERVICE_PROVIDER      = 6,
570     RIL_PERSOSUBSTATE_SIM_SIM                   = 7,
571     RIL_PERSOSUBSTATE_SIM_NETWORK_PUK           = 8, /* The corresponding perso lock is blocked */
572     RIL_PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK    = 9,
573     RIL_PERSOSUBSTATE_SIM_CORPORATE_PUK         = 10,
574     RIL_PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK  = 11,
575     RIL_PERSOSUBSTATE_SIM_SIM_PUK               = 12,
576     RIL_PERSOSUBSTATE_RUIM_NETWORK1             = 13,
577     RIL_PERSOSUBSTATE_RUIM_NETWORK2             = 14,
578     RIL_PERSOSUBSTATE_RUIM_HRPD                 = 15,
579     RIL_PERSOSUBSTATE_RUIM_CORPORATE            = 16,
580     RIL_PERSOSUBSTATE_RUIM_SERVICE_PROVIDER     = 17,
581     RIL_PERSOSUBSTATE_RUIM_RUIM                 = 18,
582     RIL_PERSOSUBSTATE_RUIM_NETWORK1_PUK         = 19, /* The corresponding perso lock is blocked */
583     RIL_PERSOSUBSTATE_RUIM_NETWORK2_PUK         = 20,
584     RIL_PERSOSUBSTATE_RUIM_HRPD_PUK             = 21,
585     RIL_PERSOSUBSTATE_RUIM_CORPORATE_PUK        = 22,
586     RIL_PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK = 23,
587     RIL_PERSOSUBSTATE_RUIM_RUIM_PUK             = 24
588 } RIL_PersoSubstate;
589 
590 typedef enum {
591     RIL_APPSTATE_UNKNOWN               = 0,
592     RIL_APPSTATE_DETECTED              = 1,
593     RIL_APPSTATE_PIN                   = 2, /* If PIN1 or UPin is required */
594     RIL_APPSTATE_PUK                   = 3, /* If PUK1 or Puk for UPin is required */
595     RIL_APPSTATE_SUBSCRIPTION_PERSO    = 4, /* perso_substate should be look at
596                                                when app_state is assigned to this value */
597     RIL_APPSTATE_READY                 = 5
598 } RIL_AppState;
599 
600 typedef enum {
601     RIL_PINSTATE_UNKNOWN              = 0,
602     RIL_PINSTATE_ENABLED_NOT_VERIFIED = 1,
603     RIL_PINSTATE_ENABLED_VERIFIED     = 2,
604     RIL_PINSTATE_DISABLED             = 3,
605     RIL_PINSTATE_ENABLED_BLOCKED      = 4,
606     RIL_PINSTATE_ENABLED_PERM_BLOCKED = 5
607 } RIL_PinState;
608 
609 typedef enum {
610   RIL_APPTYPE_UNKNOWN = 0,
611   RIL_APPTYPE_SIM     = 1,
612   RIL_APPTYPE_USIM    = 2,
613   RIL_APPTYPE_RUIM    = 3,
614   RIL_APPTYPE_CSIM    = 4,
615   RIL_APPTYPE_ISIM    = 5
616 } RIL_AppType;
617 
618 typedef struct
619 {
620   RIL_AppType      app_type;
621   RIL_AppState     app_state;
622   RIL_PersoSubstate perso_substate; /* applicable only if app_state ==
623                                        RIL_APPSTATE_SUBSCRIPTION_PERSO */
624   char             *aid_ptr;        /* null terminated string, e.g., from 0xA0, 0x00 -> 0x41,
625                                        0x30, 0x30, 0x30 */
626   char             *app_label_ptr;  /* null terminated string */
627   int              pin1_replaced;   /* applicable to USIM, CSIM & ISIM */
628   RIL_PinState     pin1;
629   RIL_PinState     pin2;
630 } RIL_AppStatus;
631 
632 /* Deprecated, use RIL_CardStatus_v6 */
633 typedef struct
634 {
635   RIL_CardState card_state;
636   RIL_PinState  universal_pin_state;             /* applicable to USIM and CSIM: RIL_PINSTATE_xxx */
637   int           gsm_umts_subscription_app_index; /* value < RIL_CARD_MAX_APPS, -1 if none */
638   int           cdma_subscription_app_index;     /* value < RIL_CARD_MAX_APPS, -1 if none */
639   int           num_applications;                /* value <= RIL_CARD_MAX_APPS */
640   RIL_AppStatus applications[RIL_CARD_MAX_APPS];
641 } RIL_CardStatus_v5;
642 
643 typedef struct
644 {
645   RIL_CardState card_state;
646   RIL_PinState  universal_pin_state;             /* applicable to USIM and CSIM: RIL_PINSTATE_xxx */
647   int           gsm_umts_subscription_app_index; /* value < RIL_CARD_MAX_APPS, -1 if none */
648   int           cdma_subscription_app_index;     /* value < RIL_CARD_MAX_APPS, -1 if none */
649   int           ims_subscription_app_index;      /* value < RIL_CARD_MAX_APPS, -1 if none */
650   int           num_applications;                /* value <= RIL_CARD_MAX_APPS */
651   RIL_AppStatus applications[RIL_CARD_MAX_APPS];
652 } RIL_CardStatus_v6;
653 
654 /** The result of a SIM refresh, returned in data[0] of RIL_UNSOL_SIM_REFRESH
655  *      or as part of RIL_SimRefreshResponse_v7
656  */
657 typedef enum {
658     /* A file on SIM has been updated.  data[1] contains the EFID. */
659     SIM_FILE_UPDATE = 0,
660     /* SIM initialized.  All files should be re-read. */
661     SIM_INIT = 1,
662     /* SIM reset.  SIM power required, SIM may be locked and all files should be re-read. */
663     SIM_RESET = 2
664 } RIL_SimRefreshResult;
665 
666 typedef struct {
667     RIL_SimRefreshResult result;
668     int                  ef_id; /* is the EFID of the updated file if the result is */
669                                 /* SIM_FILE_UPDATE or 0 for any other result. */
670     char *               aid;   /* is AID(application ID) of the card application */
671                                 /* See ETSI 102.221 8.1 and 101.220 4 */
672                                 /*     For SIM_FILE_UPDATE result it can be set to AID of */
673                                 /*         application in which updated EF resides or it can be */
674                                 /*         NULL if EF is outside of an application. */
675                                 /*     For SIM_INIT result this field is set to AID of */
676                                 /*         application that caused REFRESH */
677                                 /*     For SIM_RESET result it is NULL. */
678 } RIL_SimRefreshResponse_v7;
679 
680 /* Deprecated, use RIL_CDMA_CallWaiting_v6 */
681 typedef struct {
682     char *          number;             /* Remote party number */
683     int             numberPresentation; /* 0=Allowed, 1=Restricted, 2=Not Specified/Unknown */
684     char *          name;               /* Remote party name */
685     RIL_CDMA_SignalInfoRecord signalInfoRecord;
686 } RIL_CDMA_CallWaiting_v5;
687 
688 typedef struct {
689     char *          number;             /* Remote party number */
690     int             numberPresentation; /* 0=Allowed, 1=Restricted, 2=Not Specified/Unknown */
691     char *          name;               /* Remote party name */
692     RIL_CDMA_SignalInfoRecord signalInfoRecord;
693     /* Number type/Number plan required to support International Call Waiting */
694     int             number_type;        /* 0=Unknown, 1=International, 2=National,
695                                            3=Network specific, 4=subscriber */
696     int             number_plan;        /* 0=Unknown, 1=ISDN, 3=Data, 4=Telex, 8=Nat'l, 9=Private */
697 } RIL_CDMA_CallWaiting_v6;
698 
699 /**
700  * Which types of Cell Broadcast Message (CBM) are to be received by the ME
701  *
702  * uFromServiceID - uToServiceID defines a range of CBM message identifiers
703  * whose value is 0x0000 - 0xFFFF as defined in TS 23.041 9.4.1.2.2 for GMS
704  * and 9.4.4.2.2 for UMTS. All other values can be treated as empty
705  * CBM message ID.
706  *
707  * uFromCodeScheme - uToCodeScheme defines a range of CBM data coding schemes
708  * whose value is 0x00 - 0xFF as defined in TS 23.041 9.4.1.2.3 for GMS
709  * and 9.4.4.2.3 for UMTS.
710  * All other values can be treated as empty CBM data coding scheme.
711  *
712  * selected 0 means message types specified in <fromServiceId, toServiceId>
713  * and <fromCodeScheme, toCodeScheme>are not accepted, while 1 means accepted.
714  *
715  * Used by RIL_REQUEST_GSM_GET_BROADCAST_CONFIG and
716  * RIL_REQUEST_GSM_SET_BROADCAST_CONFIG.
717  */
718 typedef struct {
719     int fromServiceId;
720     int toServiceId;
721     int fromCodeScheme;
722     int toCodeScheme;
723     unsigned char selected;
724 } RIL_GSM_BroadcastSmsConfigInfo;
725 
726 /* No restriction at all including voice/SMS/USSD/SS/AV64 and packet data. */
727 #define RIL_RESTRICTED_STATE_NONE           0x00
728 /* Block emergency call due to restriction. But allow all normal voice/SMS/USSD/SS/AV64. */
729 #define RIL_RESTRICTED_STATE_CS_EMERGENCY   0x01
730 /* Block all normal voice/SMS/USSD/SS/AV64 due to restriction. Only Emergency call allowed. */
731 #define RIL_RESTRICTED_STATE_CS_NORMAL      0x02
732 /* Block all voice/SMS/USSD/SS/AV64 including emergency call due to restriction.*/
733 #define RIL_RESTRICTED_STATE_CS_ALL         0x04
734 /* Block packet data access due to restriction. */
735 #define RIL_RESTRICTED_STATE_PS_ALL         0x10
736 
737 /* The status for an OTASP/OTAPA session */
738 typedef enum {
739     CDMA_OTA_PROVISION_STATUS_SPL_UNLOCKED,
740     CDMA_OTA_PROVISION_STATUS_SPC_RETRIES_EXCEEDED,
741     CDMA_OTA_PROVISION_STATUS_A_KEY_EXCHANGED,
742     CDMA_OTA_PROVISION_STATUS_SSD_UPDATED,
743     CDMA_OTA_PROVISION_STATUS_NAM_DOWNLOADED,
744     CDMA_OTA_PROVISION_STATUS_MDN_DOWNLOADED,
745     CDMA_OTA_PROVISION_STATUS_IMSI_DOWNLOADED,
746     CDMA_OTA_PROVISION_STATUS_PRL_DOWNLOADED,
747     CDMA_OTA_PROVISION_STATUS_COMMITTED,
748     CDMA_OTA_PROVISION_STATUS_OTAPA_STARTED,
749     CDMA_OTA_PROVISION_STATUS_OTAPA_STOPPED,
750     CDMA_OTA_PROVISION_STATUS_OTAPA_ABORTED
751 } RIL_CDMA_OTA_ProvisionStatus;
752 
753 typedef struct {
754     int signalStrength;  /* Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
755     int bitErrorRate;    /* bit error rate (0-7, 99) as defined in TS 27.007 8.5 */
756 } RIL_GW_SignalStrength;
757 
758 typedef struct {
759     int signalStrength;  /* Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
760     int bitErrorRate;    /* bit error rate (0-7, 99) as defined in TS 27.007 8.5 */
761 } RIL_SignalStrengthWcdma;
762 
763 typedef struct {
764     int dbm;  /* Valid values are positive integers.  This value is the actual RSSI value
765                * multiplied by -1.  Example: If the actual RSSI is -75, then this response
766                * value will be 75.
767                */
768     int ecio; /* Valid values are positive integers.  This value is the actual Ec/Io multiplied
769                * by -10.  Example: If the actual Ec/Io is -12.5 dB, then this response value
770                * will be 125.
771                */
772 } RIL_CDMA_SignalStrength;
773 
774 
775 typedef struct {
776     int dbm;  /* Valid values are positive integers.  This value is the actual RSSI value
777                * multiplied by -1.  Example: If the actual RSSI is -75, then this response
778                * value will be 75.
779                */
780     int ecio; /* Valid values are positive integers.  This value is the actual Ec/Io multiplied
781                * by -10.  Example: If the actual Ec/Io is -12.5 dB, then this response value
782                * will be 125.
783                */
784     int signalNoiseRatio; /* Valid values are 0-8.  8 is the highest signal to noise ratio. */
785 } RIL_EVDO_SignalStrength;
786 
787 typedef struct {
788     int signalStrength;  /* Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
789     int rsrp;            /* The current Reference Signal Receive Power in dBm multipled by -1.
790                           * Range: 44 to 140 dBm
791                           * INT_MAX: 0x7FFFFFFF denotes invalid value.
792                           * Reference: 3GPP TS 36.133 9.1.4 */
793     int rsrq;            /* The current Reference Signal Receive Quality in dB multiplied by -1.
794                           * Range: 20 to 3 dB.
795                           * INT_MAX: 0x7FFFFFFF denotes invalid value.
796                           * Reference: 3GPP TS 36.133 9.1.7 */
797     int rssnr;           /* The current reference signal signal-to-noise ratio in 0.1 dB units.
798                           * Range: -200 to +300 (-200 = -20.0 dB, +300 = 30dB).
799                           * INT_MAX : 0x7FFFFFFF denotes invalid value.
800                           * Reference: 3GPP TS 36.101 8.1.1 */
801     int cqi;             /* The current Channel Quality Indicator.
802                           * Range: 0 to 15.
803                           * INT_MAX : 0x7FFFFFFF denotes invalid value.
804                           * Reference: 3GPP TS 36.101 9.2, 9.3, A.4 */
805 } RIL_LTE_SignalStrength;
806 
807 typedef struct {
808     int signalStrength;  /* Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
809     int rsrp;            /* The current Reference Signal Receive Power in dBm multipled by -1.
810                           * Range: 44 to 140 dBm
811                           * INT_MAX: 0x7FFFFFFF denotes invalid value.
812                           * Reference: 3GPP TS 36.133 9.1.4 */
813     int rsrq;            /* The current Reference Signal Receive Quality in dB multiplied by -1.
814                           * Range: 20 to 3 dB.
815                           * INT_MAX: 0x7FFFFFFF denotes invalid value.
816                           * Reference: 3GPP TS 36.133 9.1.7 */
817     int rssnr;           /* The current reference signal signal-to-noise ratio in 0.1 dB units.
818                           * Range: -200 to +300 (-200 = -20.0 dB, +300 = 30dB).
819                           * INT_MAX : 0x7FFFFFFF denotes invalid value.
820                           * Reference: 3GPP TS 36.101 8.1.1 */
821     int cqi;             /* The current Channel Quality Indicator.
822                           * Range: 0 to 15.
823                           * INT_MAX : 0x7FFFFFFF denotes invalid value.
824                           * Reference: 3GPP TS 36.101 9.2, 9.3, A.4 */
825     int timingAdvance;   /* timing advance in micro seconds for a one way trip from cell to device.
826                           * Approximate distance can be calculated using 300m/us * timingAdvance.
827                           * Range: 0 to 0x7FFFFFFE
828                           * INT_MAX : 0x7FFFFFFF denotes invalid value.
829                           * Reference: 3GPP 36.321 section 6.1.3.5
830                           * also: http://www.cellular-planningoptimization.com/2010/02/timing-advance-with-calculation.html */
831 } RIL_LTE_SignalStrength_v8;
832 
833 typedef struct {
834     int rscp;    /* The Received Signal Code Power in dBm multipled by -1.
835                   * Range : 25 to 120
836                   * INT_MAX: 0x7FFFFFFF denotes invalid value.
837                   * Reference: 3GPP TS 25.123, section 9.1.1.1 */
838 } RIL_TD_SCDMA_SignalStrength;
839 
840 /* Deprecated, use RIL_SignalStrength_v6 */
841 typedef struct {
842     RIL_GW_SignalStrength   GW_SignalStrength;
843     RIL_CDMA_SignalStrength CDMA_SignalStrength;
844     RIL_EVDO_SignalStrength EVDO_SignalStrength;
845 } RIL_SignalStrength_v5;
846 
847 typedef struct {
848     RIL_GW_SignalStrength   GW_SignalStrength;
849     RIL_CDMA_SignalStrength CDMA_SignalStrength;
850     RIL_EVDO_SignalStrength EVDO_SignalStrength;
851     RIL_LTE_SignalStrength  LTE_SignalStrength;
852 } RIL_SignalStrength_v6;
853 
854 typedef struct {
855     RIL_GW_SignalStrength       GW_SignalStrength;
856     RIL_CDMA_SignalStrength     CDMA_SignalStrength;
857     RIL_EVDO_SignalStrength     EVDO_SignalStrength;
858     RIL_LTE_SignalStrength_v8   LTE_SignalStrength;
859 } RIL_SignalStrength_v8;
860 
861 typedef struct {
862     RIL_GW_SignalStrength       GW_SignalStrength;
863     RIL_CDMA_SignalStrength     CDMA_SignalStrength;
864     RIL_EVDO_SignalStrength     EVDO_SignalStrength;
865     RIL_LTE_SignalStrength_v8   LTE_SignalStrength;
866     RIL_TD_SCDMA_SignalStrength TD_SCDMA_SignalStrength;
867 } RIL_SignalStrength_v10;
868 
869 /** RIL_CellIdentityGsm */
870 typedef struct {
871     int mcc;    /* 3-digit Mobile Country Code, 0..999, INT_MAX if unknown */
872     int mnc;    /* 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown */
873     int lac;    /* 16-bit Location Area Code, 0..65535, INT_MAX if unknown  */
874     int cid;    /* 16-bit GSM Cell Identity described in TS 27.007, 0..65535, INT_MAX if unknown  */
875 } RIL_CellIdentityGsm;
876 
877 /** RIL_CellIdentityWcdma */
878 typedef struct {
879     int mcc;    /* 3-digit Mobile Country Code, 0..999, INT_MAX if unknown  */
880     int mnc;    /* 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown  */
881     int lac;    /* 16-bit Location Area Code, 0..65535, INT_MAX if unknown  */
882     int cid;    /* 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown  */
883     int psc;    /* 9-bit UMTS Primary Scrambling Code described in TS 25.331, 0..511, INT_MAX if unknown */
884 } RIL_CellIdentityWcdma;
885 
886 /** RIL_CellIdentityCdma */
887 typedef struct {
888     int networkId;      /* Network Id 0..65535, INT_MAX if unknown */
889     int systemId;       /* CDMA System Id 0..32767, INT_MAX if unknown  */
890     int basestationId;  /* Base Station Id 0..65535, INT_MAX if unknown  */
891     int longitude;      /* Longitude is a decimal number as specified in 3GPP2 C.S0005-A v6.0.
892                          * It is represented in units of 0.25 seconds and ranges from -2592000
893                          * to 2592000, both values inclusive (corresponding to a range of -180
894                          * to +180 degrees). INT_MAX if unknown */
895 
896     int latitude;       /* Latitude is a decimal number as specified in 3GPP2 C.S0005-A v6.0.
897                          * It is represented in units of 0.25 seconds and ranges from -1296000
898                          * to 1296000, both values inclusive (corresponding to a range of -90
899                          * to +90 degrees). INT_MAX if unknown */
900 } RIL_CellIdentityCdma;
901 
902 /** RIL_CellIdentityLte */
903 typedef struct {
904     int mcc;    /* 3-digit Mobile Country Code, 0..999, INT_MAX if unknown  */
905     int mnc;    /* 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown  */
906     int ci;     /* 28-bit Cell Identity described in TS ???, INT_MAX if unknown */
907     int pci;    /* physical cell id 0..503, INT_MAX if unknown  */
908     int tac;    /* 16-bit tracking area code, INT_MAX if unknown  */
909 } RIL_CellIdentityLte;
910 
911 /** RIL_CellIdentityTdscdma */
912 typedef struct {
913     int mcc;    /* 3-digit Mobile Country Code, 0..999, INT_MAX if unknown  */
914     int mnc;    /* 2 or 3-digit Mobile Network Code, 0..999, INT_MAX if unknown  */
915     int lac;    /* 16-bit Location Area Code, 0..65535, INT_MAX if unknown  */
916     int cid;    /* 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, INT_MAX if unknown  */
917     int cpid;    /* 8-bit Cell Parameters ID described in TS 25.331, 0..127, INT_MAX if unknown */
918 } RIL_CellIdentityTdscdma;
919 
920 /** RIL_CellInfoGsm */
921 typedef struct {
922   RIL_CellIdentityGsm   cellIdentityGsm;
923   RIL_GW_SignalStrength signalStrengthGsm;
924 } RIL_CellInfoGsm;
925 
926 /** RIL_CellInfoWcdma */
927 typedef struct {
928   RIL_CellIdentityWcdma cellIdentityWcdma;
929   RIL_SignalStrengthWcdma signalStrengthWcdma;
930 } RIL_CellInfoWcdma;
931 
932 /** RIL_CellInfoCdma */
933 typedef struct {
934   RIL_CellIdentityCdma      cellIdentityCdma;
935   RIL_CDMA_SignalStrength   signalStrengthCdma;
936   RIL_EVDO_SignalStrength   signalStrengthEvdo;
937 } RIL_CellInfoCdma;
938 
939 /** RIL_CellInfoLte */
940 typedef struct {
941   RIL_CellIdentityLte        cellIdentityLte;
942   RIL_LTE_SignalStrength_v8  signalStrengthLte;
943 } RIL_CellInfoLte;
944 
945 /** RIL_CellInfoTdscdma */
946 typedef struct {
947   RIL_CellIdentityTdscdma cellIdentityTdscdma;
948   RIL_TD_SCDMA_SignalStrength signalStrengthTdscdma;
949 } RIL_CellInfoTdscdma;
950 
951 // Must be the same as CellInfo.TYPE_XXX
952 typedef enum {
953   RIL_CELL_INFO_TYPE_GSM    = 1,
954   RIL_CELL_INFO_TYPE_CDMA   = 2,
955   RIL_CELL_INFO_TYPE_LTE    = 3,
956   RIL_CELL_INFO_TYPE_WCDMA  = 4,
957   RIL_CELL_INFO_TYPE_TD_SCDMA  = 5
958 } RIL_CellInfoType;
959 
960 // Must be the same as CellInfo.TIMESTAMP_TYPE_XXX
961 typedef enum {
962     RIL_TIMESTAMP_TYPE_UNKNOWN = 0,
963     RIL_TIMESTAMP_TYPE_ANTENNA = 1,
964     RIL_TIMESTAMP_TYPE_MODEM = 2,
965     RIL_TIMESTAMP_TYPE_OEM_RIL = 3,
966     RIL_TIMESTAMP_TYPE_JAVA_RIL = 4,
967 } RIL_TimeStampType;
968 
969 typedef struct {
970   RIL_CellInfoType  cellInfoType;   /* cell type for selecting from union CellInfo */
971   int               registered;     /* !0 if this cell is registered 0 if not registered */
972   RIL_TimeStampType timeStampType;  /* type of time stamp represented by timeStamp */
973   uint64_t          timeStamp;      /* Time in nanos as returned by ril_nano_time */
974   union {
975     RIL_CellInfoGsm     gsm;
976     RIL_CellInfoCdma    cdma;
977     RIL_CellInfoLte     lte;
978     RIL_CellInfoWcdma   wcdma;
979     RIL_CellInfoTdscdma tdscdma;
980   } CellInfo;
981 } RIL_CellInfo;
982 
983 /* Names of the CDMA info records (C.S0005 section 3.7.5) */
984 typedef enum {
985   RIL_CDMA_DISPLAY_INFO_REC,
986   RIL_CDMA_CALLED_PARTY_NUMBER_INFO_REC,
987   RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC,
988   RIL_CDMA_CONNECTED_NUMBER_INFO_REC,
989   RIL_CDMA_SIGNAL_INFO_REC,
990   RIL_CDMA_REDIRECTING_NUMBER_INFO_REC,
991   RIL_CDMA_LINE_CONTROL_INFO_REC,
992   RIL_CDMA_EXTENDED_DISPLAY_INFO_REC,
993   RIL_CDMA_T53_CLIR_INFO_REC,
994   RIL_CDMA_T53_RELEASE_INFO_REC,
995   RIL_CDMA_T53_AUDIO_CONTROL_INFO_REC
996 } RIL_CDMA_InfoRecName;
997 
998 /* Display Info Rec as defined in C.S0005 section 3.7.5.1
999    Extended Display Info Rec as defined in C.S0005 section 3.7.5.16
1000    Note: the Extended Display info rec contains multiple records of the
1001    form: display_tag, display_len, and display_len occurrences of the
1002    chari field if the display_tag is not 10000000 or 10000001.
1003    To save space, the records are stored consecutively in a byte buffer.
1004    The display_tag, display_len and chari fields are all 1 byte.
1005 */
1006 
1007 typedef struct {
1008   char alpha_len;
1009   char alpha_buf[CDMA_ALPHA_INFO_BUFFER_LENGTH];
1010 } RIL_CDMA_DisplayInfoRecord;
1011 
1012 /* Called Party Number Info Rec as defined in C.S0005 section 3.7.5.2
1013    Calling Party Number Info Rec as defined in C.S0005 section 3.7.5.3
1014    Connected Number Info Rec as defined in C.S0005 section 3.7.5.4
1015 */
1016 
1017 typedef struct {
1018   char len;
1019   char buf[CDMA_NUMBER_INFO_BUFFER_LENGTH];
1020   char number_type;
1021   char number_plan;
1022   char pi;
1023   char si;
1024 } RIL_CDMA_NumberInfoRecord;
1025 
1026 /* Redirecting Number Information Record as defined in C.S0005 section 3.7.5.11 */
1027 typedef enum {
1028   RIL_REDIRECTING_REASON_UNKNOWN = 0,
1029   RIL_REDIRECTING_REASON_CALL_FORWARDING_BUSY = 1,
1030   RIL_REDIRECTING_REASON_CALL_FORWARDING_NO_REPLY = 2,
1031   RIL_REDIRECTING_REASON_CALLED_DTE_OUT_OF_ORDER = 9,
1032   RIL_REDIRECTING_REASON_CALL_FORWARDING_BY_THE_CALLED_DTE = 10,
1033   RIL_REDIRECTING_REASON_CALL_FORWARDING_UNCONDITIONAL = 15,
1034   RIL_REDIRECTING_REASON_RESERVED
1035 } RIL_CDMA_RedirectingReason;
1036 
1037 typedef struct {
1038   RIL_CDMA_NumberInfoRecord redirectingNumber;
1039   /* redirectingReason is set to RIL_REDIRECTING_REASON_UNKNOWN if not included */
1040   RIL_CDMA_RedirectingReason redirectingReason;
1041 } RIL_CDMA_RedirectingNumberInfoRecord;
1042 
1043 /* Line Control Information Record as defined in C.S0005 section 3.7.5.15 */
1044 typedef struct {
1045   char lineCtrlPolarityIncluded;
1046   char lineCtrlToggle;
1047   char lineCtrlReverse;
1048   char lineCtrlPowerDenial;
1049 } RIL_CDMA_LineControlInfoRecord;
1050 
1051 /* T53 CLIR Information Record */
1052 typedef struct {
1053   char cause;
1054 } RIL_CDMA_T53_CLIRInfoRecord;
1055 
1056 /* T53 Audio Control Information Record */
1057 typedef struct {
1058   char upLink;
1059   char downLink;
1060 } RIL_CDMA_T53_AudioControlInfoRecord;
1061 
1062 typedef struct {
1063 
1064   RIL_CDMA_InfoRecName name;
1065 
1066   union {
1067     /* Display and Extended Display Info Rec */
1068     RIL_CDMA_DisplayInfoRecord           display;
1069 
1070     /* Called Party Number, Calling Party Number, Connected Number Info Rec */
1071     RIL_CDMA_NumberInfoRecord            number;
1072 
1073     /* Signal Info Rec */
1074     RIL_CDMA_SignalInfoRecord            signal;
1075 
1076     /* Redirecting Number Info Rec */
1077     RIL_CDMA_RedirectingNumberInfoRecord redir;
1078 
1079     /* Line Control Info Rec */
1080     RIL_CDMA_LineControlInfoRecord       lineCtrl;
1081 
1082     /* T53 CLIR Info Rec */
1083     RIL_CDMA_T53_CLIRInfoRecord          clir;
1084 
1085     /* T53 Audio Control Info Rec */
1086     RIL_CDMA_T53_AudioControlInfoRecord  audioCtrl;
1087   } rec;
1088 } RIL_CDMA_InformationRecord;
1089 
1090 #define RIL_CDMA_MAX_NUMBER_OF_INFO_RECS 10
1091 
1092 #define RIL_HARDWARE_CONFIG_UUID_LENGTH 64
1093 
1094 typedef struct {
1095   char numberOfInfoRecs;
1096   RIL_CDMA_InformationRecord infoRec[RIL_CDMA_MAX_NUMBER_OF_INFO_RECS];
1097 } RIL_CDMA_InformationRecords;
1098 
1099 /* See RIL_REQUEST_NV_READ_ITEM */
1100 typedef struct {
1101   RIL_NV_Item itemID;
1102 } RIL_NV_ReadItem;
1103 
1104 /* See RIL_REQUEST_NV_WRITE_ITEM */
1105 typedef struct {
1106   RIL_NV_Item   itemID;
1107   char *        value;
1108 } RIL_NV_WriteItem;
1109 
1110 typedef enum {
1111     HANDOVER_STARTED = 0,
1112     HANDOVER_COMPLETED = 1,
1113     HANDOVER_FAILED = 2,
1114     HANDOVER_CANCELED = 3
1115 } RIL_SrvccState;
1116 
1117 /* hardware configuration reported to RILJ. */
1118 typedef enum {
1119    RIL_HARDWARE_CONFIG_MODEM = 0,
1120    RIL_HARDWARE_CONFIG_SIM = 1,
1121 } RIL_HardwareConfig_Type;
1122 
1123 typedef enum {
1124    RIL_HARDWARE_CONFIG_STATE_ENABLED = 0,
1125    RIL_HARDWARE_CONFIG_STATE_STANDBY = 1,
1126    RIL_HARDWARE_CONFIG_STATE_DISABLED = 2,
1127 } RIL_HardwareConfig_State;
1128 
1129 typedef struct {
1130    int rilModel;
1131    uint32_t rat; /* bitset - ref. RIL_RadioTechnology. */
1132    int maxVoice;
1133    int maxData;
1134    int maxStandby;
1135 } RIL_HardwareConfig_Modem;
1136 
1137 typedef struct {
1138    char modemUuid[RIL_HARDWARE_CONFIG_UUID_LENGTH];
1139 } RIL_HardwareConfig_Sim;
1140 
1141 typedef struct {
1142   RIL_HardwareConfig_Type type;
1143   char uuid[RIL_HARDWARE_CONFIG_UUID_LENGTH];
1144   RIL_HardwareConfig_State state;
1145   union {
1146      RIL_HardwareConfig_Modem modem;
1147      RIL_HardwareConfig_Sim sim;
1148   } cfg;
1149 } RIL_HardwareConfig;
1150 
1151 /**
1152  * Data connection power state
1153  */
1154 typedef enum {
1155     RIL_DC_POWER_STATE_LOW      = 1,        // Low power state
1156     RIL_DC_POWER_STATE_MEDIUM   = 2,        // Medium power state
1157     RIL_DC_POWER_STATE_HIGH     = 3,        // High power state
1158     RIL_DC_POWER_STATE_UNKNOWN  = INT32_MAX // Unknown state
1159 } RIL_DcPowerStates;
1160 
1161 /**
1162  * Data connection real time info
1163  */
1164 typedef struct {
1165     uint64_t                    time;       // Time in nanos as returned by ril_nano_time
1166     RIL_DcPowerStates           powerState; // Current power state
1167 } RIL_DcRtInfo;
1168 
1169 /**
1170  * Data profile to modem
1171  */
1172 typedef struct {
1173     /* id of the data profile */
1174     int profileId;
1175     /* the APN to connect to */
1176     char* apn;
1177     /** one of the PDP_type values in TS 27.007 section 10.1.1.
1178      * For example, "IP", "IPV6", "IPV4V6", or "PPP".
1179      */
1180     char* protocol;
1181     /** authentication protocol used for this PDP context
1182      * (None: 0, PAP: 1, CHAP: 2, PAP&CHAP: 3)
1183      */
1184     int authType;
1185     /* the username for APN, or NULL */
1186     char* user;
1187     /* the password for APN, or NULL */
1188     char* password;
1189     /* the profile type, TYPE_COMMON-0, TYPE_3GPP-1, TYPE_3GPP2-2 */
1190     int type;
1191     /* the period in seconds to limit the maximum connections */
1192     int maxConnsTime;
1193     /* the maximum connections during maxConnsTime */
1194     int maxConns;
1195     /** the required wait time in seconds after a successful UE initiated
1196      * disconnect of a given PDN connection before the device can send
1197      * a new PDN connection request for that given PDN
1198      */
1199     int waitTime;
1200     /* true to enable the profile, 0 to disable, 1 to enable */
1201     int enabled;
1202 } RIL_DataProfileInfo;
1203 
1204 /**
1205  * RIL_REQUEST_GET_SIM_STATUS
1206  *
1207  * Requests status of the SIM interface and the SIM card
1208  *
1209  * "data" is NULL
1210  *
1211  * "response" is const RIL_CardStatus_v6 *
1212  *
1213  * Valid errors:
1214  *  Must never fail
1215  */
1216 #define RIL_REQUEST_GET_SIM_STATUS 1
1217 
1218 /**
1219  * RIL_REQUEST_ENTER_SIM_PIN
1220  *
1221  * Supplies SIM PIN. Only called if RIL_CardStatus has RIL_APPSTATE_PIN state
1222  *
1223  * "data" is const char **
1224  * ((const char **)data)[0] is PIN value
1225  * ((const char **)data)[1] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
1226  *
1227  * "response" is int *
1228  * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
1229  *
1230  * Valid errors:
1231  *
1232  * SUCCESS
1233  * RADIO_NOT_AVAILABLE (radio resetting)
1234  * GENERIC_FAILURE
1235  * PASSWORD_INCORRECT
1236  */
1237 
1238 #define RIL_REQUEST_ENTER_SIM_PIN 2
1239 
1240 
1241 /**
1242  * RIL_REQUEST_ENTER_SIM_PUK
1243  *
1244  * Supplies SIM PUK and new PIN.
1245  *
1246  * "data" is const char **
1247  * ((const char **)data)[0] is PUK value
1248  * ((const char **)data)[1] is new PIN value
1249  * ((const char **)data)[2] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
1250  *
1251  * "response" is int *
1252  * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
1253  *
1254  * Valid errors:
1255  *
1256  *  SUCCESS
1257  *  RADIO_NOT_AVAILABLE (radio resetting)
1258  *  GENERIC_FAILURE
1259  *  PASSWORD_INCORRECT
1260  *     (PUK is invalid)
1261  */
1262 
1263 #define RIL_REQUEST_ENTER_SIM_PUK 3
1264 
1265 /**
1266  * RIL_REQUEST_ENTER_SIM_PIN2
1267  *
1268  * Supplies SIM PIN2. Only called following operation where SIM_PIN2 was
1269  * returned as a a failure from a previous operation.
1270  *
1271  * "data" is const char **
1272  * ((const char **)data)[0] is PIN2 value
1273  * ((const char **)data)[1] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
1274  *
1275  * "response" is int *
1276  * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
1277  *
1278  * Valid errors:
1279  *
1280  *  SUCCESS
1281  *  RADIO_NOT_AVAILABLE (radio resetting)
1282  *  GENERIC_FAILURE
1283  *  PASSWORD_INCORRECT
1284  */
1285 
1286 #define RIL_REQUEST_ENTER_SIM_PIN2 4
1287 
1288 /**
1289  * RIL_REQUEST_ENTER_SIM_PUK2
1290  *
1291  * Supplies SIM PUK2 and new PIN2.
1292  *
1293  * "data" is const char **
1294  * ((const char **)data)[0] is PUK2 value
1295  * ((const char **)data)[1] is new PIN2 value
1296  * ((const char **)data)[2] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
1297  *
1298  * "response" is int *
1299  * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
1300  *
1301  * Valid errors:
1302  *
1303  *  SUCCESS
1304  *  RADIO_NOT_AVAILABLE (radio resetting)
1305  *  GENERIC_FAILURE
1306  *  PASSWORD_INCORRECT
1307  *     (PUK2 is invalid)
1308  */
1309 
1310 #define RIL_REQUEST_ENTER_SIM_PUK2 5
1311 
1312 /**
1313  * RIL_REQUEST_CHANGE_SIM_PIN
1314  *
1315  * Supplies old SIM PIN and new PIN.
1316  *
1317  * "data" is const char **
1318  * ((const char **)data)[0] is old PIN value
1319  * ((const char **)data)[1] is new PIN value
1320  * ((const char **)data)[2] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
1321  *
1322  * "response" is int *
1323  * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
1324  *
1325  * Valid errors:
1326  *
1327  *  SUCCESS
1328  *  RADIO_NOT_AVAILABLE (radio resetting)
1329  *  GENERIC_FAILURE
1330  *  PASSWORD_INCORRECT
1331  *     (old PIN is invalid)
1332  *
1333  */
1334 
1335 #define RIL_REQUEST_CHANGE_SIM_PIN 6
1336 
1337 
1338 /**
1339  * RIL_REQUEST_CHANGE_SIM_PIN2
1340  *
1341  * Supplies old SIM PIN2 and new PIN2.
1342  *
1343  * "data" is const char **
1344  * ((const char **)data)[0] is old PIN2 value
1345  * ((const char **)data)[1] is new PIN2 value
1346  * ((const char **)data)[2] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
1347  *
1348  * "response" is int *
1349  * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
1350  *
1351  * Valid errors:
1352  *
1353  *  SUCCESS
1354  *  RADIO_NOT_AVAILABLE (radio resetting)
1355  *  GENERIC_FAILURE
1356  *  PASSWORD_INCORRECT
1357  *     (old PIN2 is invalid)
1358  *
1359  */
1360 
1361 #define RIL_REQUEST_CHANGE_SIM_PIN2 7
1362 
1363 /**
1364  * RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION
1365  *
1366  * Requests that network personlization be deactivated
1367  *
1368  * "data" is const char **
1369  * ((const char **)(data))[0]] is network depersonlization code
1370  *
1371  * "response" is int *
1372  * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
1373  *
1374  * Valid errors:
1375  *
1376  *  SUCCESS
1377  *  RADIO_NOT_AVAILABLE (radio resetting)
1378  *  GENERIC_FAILURE
1379  *  PASSWORD_INCORRECT
1380  *     (code is invalid)
1381  */
1382 
1383 #define RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION 8
1384 
1385 /**
1386  * RIL_REQUEST_GET_CURRENT_CALLS
1387  *
1388  * Requests current call list
1389  *
1390  * "data" is NULL
1391  *
1392  * "response" must be a "const RIL_Call **"
1393  *
1394  * Valid errors:
1395  *
1396  *  SUCCESS
1397  *  RADIO_NOT_AVAILABLE (radio resetting)
1398  *  GENERIC_FAILURE
1399  *      (request will be made again in a few hundred msec)
1400  */
1401 
1402 #define RIL_REQUEST_GET_CURRENT_CALLS 9
1403 
1404 
1405 /**
1406  * RIL_REQUEST_DIAL
1407  *
1408  * Initiate voice call
1409  *
1410  * "data" is const RIL_Dial *
1411  * "response" is NULL
1412  *
1413  * This method is never used for supplementary service codes
1414  *
1415  * Valid errors:
1416  *  SUCCESS
1417  *  RADIO_NOT_AVAILABLE (radio resetting)
1418  *  GENERIC_FAILURE
1419  */
1420 #define RIL_REQUEST_DIAL 10
1421 
1422 /**
1423  * RIL_REQUEST_GET_IMSI
1424  *
1425  * Get the SIM IMSI
1426  *
1427  * Only valid when radio state is "RADIO_STATE_ON"
1428  *
1429  * "data" is const char **
1430  * ((const char **)data)[0] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
1431  * "response" is a const char * containing the IMSI
1432  *
1433  * Valid errors:
1434  *  SUCCESS
1435  *  RADIO_NOT_AVAILABLE (radio resetting)
1436  *  GENERIC_FAILURE
1437  */
1438 
1439 #define RIL_REQUEST_GET_IMSI 11
1440 
1441 /**
1442  * RIL_REQUEST_HANGUP
1443  *
1444  * Hang up a specific line (like AT+CHLD=1x)
1445  *
1446  * After this HANGUP request returns, RIL should show the connection is NOT
1447  * active anymore in next RIL_REQUEST_GET_CURRENT_CALLS query.
1448  *
1449  * "data" is an int *
1450  * (int *)data)[0] contains Connection index (value of 'x' in CHLD above)
1451  *
1452  * "response" is NULL
1453  *
1454  * Valid errors:
1455  *  SUCCESS
1456  *  RADIO_NOT_AVAILABLE (radio resetting)
1457  *  GENERIC_FAILURE
1458  */
1459 
1460 #define RIL_REQUEST_HANGUP 12
1461 
1462 /**
1463  * RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND
1464  *
1465  * Hang up waiting or held (like AT+CHLD=0)
1466  *
1467  * After this HANGUP request returns, RIL should show the connection is NOT
1468  * active anymore in next RIL_REQUEST_GET_CURRENT_CALLS query.
1469  *
1470  * "data" is NULL
1471  * "response" is NULL
1472  *
1473  * Valid errors:
1474  *  SUCCESS
1475  *  RADIO_NOT_AVAILABLE (radio resetting)
1476  *  GENERIC_FAILURE
1477  */
1478 
1479 #define RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND 13
1480 
1481 /**
1482  * RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND
1483  *
1484  * Hang up waiting or held (like AT+CHLD=1)
1485  *
1486  * After this HANGUP request returns, RIL should show the connection is NOT
1487  * active anymore in next RIL_REQUEST_GET_CURRENT_CALLS query.
1488  *
1489  * "data" is NULL
1490  * "response" is NULL
1491  *
1492  * Valid errors:
1493  *  SUCCESS
1494  *  RADIO_NOT_AVAILABLE (radio resetting)
1495  *  GENERIC_FAILURE
1496  */
1497 
1498 #define RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND 14
1499 
1500 /**
1501  * RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE
1502  *
1503  * Switch waiting or holding call and active call (like AT+CHLD=2)
1504  *
1505  * State transitions should be is follows:
1506  *
1507  * If call 1 is waiting and call 2 is active, then if this re
1508  *
1509  *   BEFORE                               AFTER
1510  * Call 1   Call 2                 Call 1       Call 2
1511  * ACTIVE   HOLDING                HOLDING     ACTIVE
1512  * ACTIVE   WAITING                HOLDING     ACTIVE
1513  * HOLDING  WAITING                HOLDING     ACTIVE
1514  * ACTIVE   IDLE                   HOLDING     IDLE
1515  * IDLE     IDLE                   IDLE        IDLE
1516  *
1517  * "data" is NULL
1518  * "response" is NULL
1519  *
1520  * Valid errors:
1521  *  SUCCESS
1522  *  RADIO_NOT_AVAILABLE (radio resetting)
1523  *  GENERIC_FAILURE
1524  */
1525 
1526 #define RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE 15
1527 #define RIL_REQUEST_SWITCH_HOLDING_AND_ACTIVE 15
1528 
1529 /**
1530  * RIL_REQUEST_CONFERENCE
1531  *
1532  * Conference holding and active (like AT+CHLD=3)
1533 
1534  * "data" is NULL
1535  * "response" is NULL
1536  *
1537  * Valid errors:
1538  *  SUCCESS
1539  *  RADIO_NOT_AVAILABLE (radio resetting)
1540  *  GENERIC_FAILURE
1541  */
1542 #define RIL_REQUEST_CONFERENCE 16
1543 
1544 /**
1545  * RIL_REQUEST_UDUB
1546  *
1547  * Send UDUB (user determined used busy) to ringing or
1548  * waiting call answer)(RIL_BasicRequest r);
1549  *
1550  * "data" is NULL
1551  * "response" is NULL
1552  *
1553  * Valid errors:
1554  *  SUCCESS
1555  *  RADIO_NOT_AVAILABLE (radio resetting)
1556  *  GENERIC_FAILURE
1557  */
1558 #define RIL_REQUEST_UDUB 17
1559 
1560 /**
1561  * RIL_REQUEST_LAST_CALL_FAIL_CAUSE
1562  *
1563  * Requests the failure cause code for the most recently terminated call
1564  *
1565  * "data" is NULL
1566  * "response" is a "int *"
1567  * ((int *)response)[0] is RIL_LastCallFailCause.  GSM failure reasons are
1568  * mapped to cause codes defined in TS 24.008 Annex H where possible. CDMA
1569  * failure reasons are derived from the possible call failure scenarios
1570  * described in the "CDMA IS-2000 Release A (C.S0005-A v6.0)" standard.
1571  *
1572  * The implementation should return CALL_FAIL_ERROR_UNSPECIFIED for blocked
1573  * MO calls by restricted state (See RIL_UNSOL_RESTRICTED_STATE_CHANGED)
1574  *
1575  * If the implementation does not have access to the exact cause codes,
1576  * then it should return one of the values listed in RIL_LastCallFailCause,
1577  * as the UI layer needs to distinguish these cases for tone generation or
1578  * error notification.
1579  *
1580  * Valid errors:
1581  *  SUCCESS
1582  *  RADIO_NOT_AVAILABLE
1583  *  GENERIC_FAILURE
1584  *
1585  * See also: RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE
1586  */
1587 #define RIL_REQUEST_LAST_CALL_FAIL_CAUSE 18
1588 
1589 /**
1590  * RIL_REQUEST_SIGNAL_STRENGTH
1591  *
1592  * Requests current signal strength and associated information
1593  *
1594  * Must succeed if radio is on.
1595  *
1596  * "data" is NULL
1597  *
1598  * "response" is a const RIL_SignalStrength *
1599  *
1600  * Valid errors:
1601  *  SUCCESS
1602  *  RADIO_NOT_AVAILABLE
1603  */
1604 #define RIL_REQUEST_SIGNAL_STRENGTH 19
1605 
1606 /**
1607  * RIL_REQUEST_VOICE_REGISTRATION_STATE
1608  *
1609  * Request current registration state
1610  *
1611  * "data" is NULL
1612  * "response" is a "char **"
1613  * ((const char **)response)[0] is registration state 0-6,
1614  *              0 - Not registered, MT is not currently searching
1615  *                  a new operator to register
1616  *              1 - Registered, home network
1617  *              2 - Not registered, but MT is currently searching
1618  *                  a new operator to register
1619  *              3 - Registration denied
1620  *              4 - Unknown
1621  *              5 - Registered, roaming
1622  *             10 - Same as 0, but indicates that emergency calls
1623  *                  are enabled.
1624  *             12 - Same as 2, but indicates that emergency calls
1625  *                  are enabled.
1626  *             13 - Same as 3, but indicates that emergency calls
1627  *                  are enabled.
1628  *             14 - Same as 4, but indicates that emergency calls
1629  *                  are enabled.
1630  *
1631  * ((const char **)response)[1] is LAC if registered on a GSM/WCDMA system or
1632  *                              NULL if not.Valid LAC are 0x0000 - 0xffff
1633  * ((const char **)response)[2] is CID if registered on a * GSM/WCDMA or
1634  *                              NULL if not.
1635  *                                 Valid CID are 0x00000000 - 0xffffffff
1636  *                                    In GSM, CID is Cell ID (see TS 27.007)
1637  *                                            in 16 bits
1638  *                                    In UMTS, CID is UMTS Cell Identity
1639  *                                             (see TS 25.331) in 28 bits
1640  * ((const char **)response)[3] indicates the available voice radio technology,
1641  *                              valid values as defined by RIL_RadioTechnology.
1642  * ((const char **)response)[4] is Base Station ID if registered on a CDMA
1643  *                              system or NULL if not.  Base Station ID in
1644  *                              decimal format
1645  * ((const char **)response)[5] is Base Station latitude if registered on a
1646  *                              CDMA system or NULL if not. Base Station
1647  *                              latitude is a decimal number as specified in
1648  *                              3GPP2 C.S0005-A v6.0. It is represented in
1649  *                              units of 0.25 seconds and ranges from -1296000
1650  *                              to 1296000, both values inclusive (corresponding
1651  *                              to a range of -90 to +90 degrees).
1652  * ((const char **)response)[6] is Base Station longitude if registered on a
1653  *                              CDMA system or NULL if not. Base Station
1654  *                              longitude is a decimal number as specified in
1655  *                              3GPP2 C.S0005-A v6.0. It is represented in
1656  *                              units of 0.25 seconds and ranges from -2592000
1657  *                              to 2592000, both values inclusive (corresponding
1658  *                              to a range of -180 to +180 degrees).
1659  * ((const char **)response)[7] is concurrent services support indicator if
1660  *                              registered on a CDMA system 0-1.
1661  *                                   0 - Concurrent services not supported,
1662  *                                   1 - Concurrent services supported
1663  * ((const char **)response)[8] is System ID if registered on a CDMA system or
1664  *                              NULL if not. Valid System ID are 0 - 32767
1665  * ((const char **)response)[9] is Network ID if registered on a CDMA system or
1666  *                              NULL if not. Valid System ID are 0 - 65535
1667  * ((const char **)response)[10] is the TSB-58 Roaming Indicator if registered
1668  *                               on a CDMA or EVDO system or NULL if not. Valid values
1669  *                               are 0-255.
1670  * ((const char **)response)[11] indicates whether the current system is in the
1671  *                               PRL if registered on a CDMA or EVDO system or NULL if
1672  *                               not. 0=not in the PRL, 1=in the PRL
1673  * ((const char **)response)[12] is the default Roaming Indicator from the PRL,
1674  *                               if registered on a CDMA or EVDO system or NULL if not.
1675  *                               Valid values are 0-255.
1676  * ((const char **)response)[13] if registration state is 3 (Registration
1677  *                               denied) this is an enumerated reason why
1678  *                               registration was denied.  See 3GPP TS 24.008,
1679  *                               10.5.3.6 and Annex G.
1680  *                                 0 - General
1681  *                                 1 - Authentication Failure
1682  *                                 2 - IMSI unknown in HLR
1683  *                                 3 - Illegal MS
1684  *                                 4 - Illegal ME
1685  *                                 5 - PLMN not allowed
1686  *                                 6 - Location area not allowed
1687  *                                 7 - Roaming not allowed
1688  *                                 8 - No Suitable Cells in this Location Area
1689  *                                 9 - Network failure
1690  *                                10 - Persistent location update reject
1691  *                                11 - PLMN not allowed
1692  *                                12 - Location area not allowed
1693  *                                13 - Roaming not allowed in this Location Area
1694  *                                15 - No Suitable Cells in this Location Area
1695  *                                17 - Network Failure
1696  *                                20 - MAC Failure
1697  *                                21 - Sync Failure
1698  *                                22 - Congestion
1699  *                                23 - GSM Authentication unacceptable
1700  *                                25 - Not Authorized for this CSG
1701  *                                32 - Service option not supported
1702  *                                33 - Requested service option not subscribed
1703  *                                34 - Service option temporarily out of order
1704  *                                38 - Call cannot be identified
1705  *                                48-63 - Retry upon entry into a new cell
1706  *                                95 - Semantically incorrect message
1707  *                                96 - Invalid mandatory information
1708  *                                97 - Message type non-existent or not implemented
1709  *                                98 - Message not compatible with protocol state
1710  *                                99 - Information element non-existent or not implemented
1711  *                               100 - Conditional IE error
1712  *                               101 - Message not compatible with protocol state
1713  *                               111 - Protocol error, unspecified
1714  * ((const char **)response)[14] is the Primary Scrambling Code of the current
1715  *                               cell as described in TS 25.331, in hexadecimal
1716  *                               format, or NULL if unknown or not registered
1717  *                               to a UMTS network.
1718  *
1719  * Please note that registration state 4 ("unknown") is treated
1720  * as "out of service" in the Android telephony system
1721  *
1722  * Registration state 3 can be returned if Location Update Reject
1723  * (with cause 17 - Network Failure) is received repeatedly from the network,
1724  * to facilitate "managed roaming"
1725  *
1726  * Valid errors:
1727  *  SUCCESS
1728  *  RADIO_NOT_AVAILABLE
1729  *  GENERIC_FAILURE
1730  */
1731 #define RIL_REQUEST_VOICE_REGISTRATION_STATE 20
1732 
1733 /**
1734  * RIL_REQUEST_DATA_REGISTRATION_STATE
1735  *
1736  * Request current DATA registration state
1737  *
1738  * "data" is NULL
1739  * "response" is a "char **"
1740  * ((const char **)response)[0] is registration state 0-5 from TS 27.007 10.1.20 AT+CGREG
1741  * ((const char **)response)[1] is LAC if registered or NULL if not
1742  * ((const char **)response)[2] is CID if registered or NULL if not
1743  * ((const char **)response)[3] indicates the available data radio technology,
1744  *                              valid values as defined by RIL_RadioTechnology.
1745  * ((const char **)response)[4] if registration state is 3 (Registration
1746  *                               denied) this is an enumerated reason why
1747  *                               registration was denied.  See 3GPP TS 24.008,
1748  *                               Annex G.6 "Additonal cause codes for GMM".
1749  *      7 == GPRS services not allowed
1750  *      8 == GPRS services and non-GPRS services not allowed
1751  *      9 == MS identity cannot be derived by the network
1752  *      10 == Implicitly detached
1753  *      14 == GPRS services not allowed in this PLMN
1754  *      16 == MSC temporarily not reachable
1755  *      40 == No PDP context activated
1756  * ((const char **)response)[5] The maximum number of simultaneous Data Calls that can be
1757  *                              established using RIL_REQUEST_SETUP_DATA_CALL.
1758  *
1759  * The values at offsets 6..10 are optional LTE location information in decimal.
1760  * If a value is unknown that value may be NULL. If all values are NULL,
1761  * none need to be present.
1762  *  ((const char **)response)[6] is TAC, a 16-bit Tracking Area Code.
1763  *  ((const char **)response)[7] is CID, a 0-503 Physical Cell Identifier.
1764  *  ((const char **)response)[8] is ECI, a 28-bit E-UTRAN Cell Identifier.
1765  *  ((const char **)response)[9] is CSGID, a 27-bit Closed Subscriber Group Identity.
1766  *  ((const char **)response)[10] is TADV, a 6-bit timing advance value.
1767  *
1768  * LAC and CID are in hexadecimal format.
1769  * valid LAC are 0x0000 - 0xffff
1770  * valid CID are 0x00000000 - 0x0fffffff
1771  *
1772  * Please note that registration state 4 ("unknown") is treated
1773  * as "out of service" in the Android telephony system
1774  *
1775  * Valid errors:
1776  *  SUCCESS
1777  *  RADIO_NOT_AVAILABLE
1778  *  GENERIC_FAILURE
1779  */
1780 #define RIL_REQUEST_DATA_REGISTRATION_STATE 21
1781 
1782 /**
1783  * RIL_REQUEST_OPERATOR
1784  *
1785  * Request current operator ONS or EONS
1786  *
1787  * "data" is NULL
1788  * "response" is a "const char **"
1789  * ((const char **)response)[0] is long alpha ONS or EONS
1790  *                                  or NULL if unregistered
1791  *
1792  * ((const char **)response)[1] is short alpha ONS or EONS
1793  *                                  or NULL if unregistered
1794  * ((const char **)response)[2] is 5 or 6 digit numeric code (MCC + MNC)
1795  *                                  or NULL if unregistered
1796  *
1797  * Valid errors:
1798  *  SUCCESS
1799  *  RADIO_NOT_AVAILABLE
1800  *  GENERIC_FAILURE
1801  */
1802 #define RIL_REQUEST_OPERATOR 22
1803 
1804 /**
1805  * RIL_REQUEST_RADIO_POWER
1806  *
1807  * Toggle radio on and off (for "airplane" mode)
1808  * If the radio is is turned off/on the radio modem subsystem
1809  * is expected return to an initialized state. For instance,
1810  * any voice and data calls will be terminated and all associated
1811  * lists emptied.
1812  *
1813  * "data" is int *
1814  * ((int *)data)[0] is > 0 for "Radio On"
1815  * ((int *)data)[0] is == 0 for "Radio Off"
1816  *
1817  * "response" is NULL
1818  *
1819  * Turn radio on if "on" > 0
1820  * Turn radio off if "on" == 0
1821  *
1822  * Valid errors:
1823  *  SUCCESS
1824  *  RADIO_NOT_AVAILABLE
1825  *  GENERIC_FAILURE
1826  */
1827 #define RIL_REQUEST_RADIO_POWER 23
1828 
1829 /**
1830  * RIL_REQUEST_DTMF
1831  *
1832  * Send a DTMF tone
1833  *
1834  * If the implementation is currently playing a tone requested via
1835  * RIL_REQUEST_DTMF_START, that tone should be cancelled and the new tone
1836  * should be played instead
1837  *
1838  * "data" is a char * containing a single character with one of 12 values: 0-9,*,#
1839  * "response" is NULL
1840  *
1841  * FIXME should this block/mute microphone?
1842  * How does this interact with local DTMF feedback?
1843  *
1844  * Valid errors:
1845  *  SUCCESS
1846  *  RADIO_NOT_AVAILABLE
1847  *  GENERIC_FAILURE
1848  *
1849  * See also: RIL_REQUEST_DTMF_STOP, RIL_REQUEST_DTMF_START
1850  *
1851  */
1852 #define RIL_REQUEST_DTMF 24
1853 
1854 /**
1855  * RIL_REQUEST_SEND_SMS
1856  *
1857  * Send an SMS message
1858  *
1859  * "data" is const char **
1860  * ((const char **)data)[0] is SMSC address in GSM BCD format prefixed
1861  *      by a length byte (as expected by TS 27.005) or NULL for default SMSC
1862  * ((const char **)data)[1] is SMS in PDU format as an ASCII hex string
1863  *      less the SMSC address
1864  *      TP-Layer-Length is be "strlen(((const char **)data)[1])/2"
1865  *
1866  * "response" is a const RIL_SMS_Response *
1867  *
1868  * Based on the return error, caller decides to resend if sending sms
1869  * fails. SMS_SEND_FAIL_RETRY means retry (i.e. error cause is 332)
1870  * and GENERIC_FAILURE means no retry (i.e. error cause is 500)
1871  *
1872  * Valid errors:
1873  *  SUCCESS
1874  *  RADIO_NOT_AVAILABLE
1875  *  SMS_SEND_FAIL_RETRY
1876  *  FDN_CHECK_FAILURE
1877  *  GENERIC_FAILURE
1878  *
1879  * FIXME how do we specify TP-Message-Reference if we need to resend?
1880  */
1881 #define RIL_REQUEST_SEND_SMS 25
1882 
1883 
1884 /**
1885  * RIL_REQUEST_SEND_SMS_EXPECT_MORE
1886  *
1887  * Send an SMS message. Identical to RIL_REQUEST_SEND_SMS,
1888  * except that more messages are expected to be sent soon. If possible,
1889  * keep SMS relay protocol link open (eg TS 27.005 AT+CMMS command)
1890  *
1891  * "data" is const char **
1892  * ((const char **)data)[0] is SMSC address in GSM BCD format prefixed
1893  *      by a length byte (as expected by TS 27.005) or NULL for default SMSC
1894  * ((const char **)data)[1] is SMS in PDU format as an ASCII hex string
1895  *      less the SMSC address
1896  *      TP-Layer-Length is be "strlen(((const char **)data)[1])/2"
1897  *
1898  * "response" is a const RIL_SMS_Response *
1899  *
1900  * Based on the return error, caller decides to resend if sending sms
1901  * fails. SMS_SEND_FAIL_RETRY means retry (i.e. error cause is 332)
1902  * and GENERIC_FAILURE means no retry (i.e. error cause is 500)
1903  *
1904  * Valid errors:
1905  *  SUCCESS
1906  *  RADIO_NOT_AVAILABLE
1907  *  SMS_SEND_FAIL_RETRY
1908  *  GENERIC_FAILURE
1909  *
1910  */
1911 #define RIL_REQUEST_SEND_SMS_EXPECT_MORE 26
1912 
1913 
1914 /**
1915  * RIL_REQUEST_SETUP_DATA_CALL
1916  *
1917  * Setup a packet data connection. If RIL_Data_Call_Response_v6.status
1918  * return success it is added to the list of data calls and a
1919  * RIL_UNSOL_DATA_CALL_LIST_CHANGED is sent. The call remains in the
1920  * list until RIL_REQUEST_DEACTIVATE_DATA_CALL is issued or the
1921  * radio is powered off/on. This list is returned by RIL_REQUEST_DATA_CALL_LIST
1922  * and RIL_UNSOL_DATA_CALL_LIST_CHANGED.
1923  *
1924  * The RIL is expected to:
1925  *  - Create one data call context.
1926  *  - Create and configure a dedicated interface for the context
1927  *  - The interface must be point to point.
1928  *  - The interface is configured with one or more addresses and
1929  *    is capable of sending and receiving packets. The prefix length
1930  *    of the addresses must be /32 for IPv4 and /128 for IPv6.
1931  *  - Must NOT change the linux routing table.
1932  *  - Support up to RIL_REQUEST_DATA_REGISTRATION_STATE response[5]
1933  *    number of simultaneous data call contexts.
1934  *
1935  * "data" is a const char **
1936  * ((const char **)data)[0] Radio technology to use: 0-CDMA, 1-GSM/UMTS, 2...
1937  *                          for values above 2 this is RIL_RadioTechnology + 2.
1938  * ((const char **)data)[1] is a RIL_DataProfile (support is optional)
1939  * ((const char **)data)[2] is the APN to connect to if radio technology is GSM/UMTS. This APN will
1940  *                          override the one in the profile. NULL indicates no APN overrride.
1941  * ((const char **)data)[3] is the username for APN, or NULL
1942  * ((const char **)data)[4] is the password for APN, or NULL
1943  * ((const char **)data)[5] is the PAP / CHAP auth type. Values:
1944  *                          0 => PAP and CHAP is never performed.
1945  *                          1 => PAP may be performed; CHAP is never performed.
1946  *                          2 => CHAP may be performed; PAP is never performed.
1947  *                          3 => PAP / CHAP may be performed - baseband dependent.
1948  * ((const char **)data)[6] is the connection type to request must be one of the
1949  *                          PDP_type values in TS 27.007 section 10.1.1.
1950  *                          For example, "IP", "IPV6", "IPV4V6", or "PPP".
1951  * ((const char **)data)[7] Optional connection property parameters, format to be defined.
1952  *
1953  * "response" is a RIL_Data_Call_Response_v6
1954  *
1955  * FIXME may need way to configure QoS settings
1956  *
1957  * Valid errors:
1958  *  SUCCESS should be returned on both success and failure of setup with
1959  *  the RIL_Data_Call_Response_v6.status containing the actual status.
1960  *  For all other errors the RIL_Data_Call_Resonse_v6 is ignored.
1961  *
1962  *  Other errors could include:
1963  *    RADIO_NOT_AVAILABLE, GENERIC_FAILURE, OP_NOT_ALLOWED_BEFORE_REG_TO_NW,
1964  *    OP_NOT_ALLOWED_DURING_VOICE_CALL and REQUEST_NOT_SUPPORTED.
1965  *
1966  * See also: RIL_REQUEST_DEACTIVATE_DATA_CALL
1967  */
1968 #define RIL_REQUEST_SETUP_DATA_CALL 27
1969 
1970 
1971 /**
1972  * RIL_REQUEST_SIM_IO
1973  *
1974  * Request SIM I/O operation.
1975  * This is similar to the TS 27.007 "restricted SIM" operation
1976  * where it assumes all of the EF selection will be done by the
1977  * callee.
1978  *
1979  * "data" is a const RIL_SIM_IO_v6 *
1980  * Please note that RIL_SIM_IO has a "PIN2" field which may be NULL,
1981  * or may specify a PIN2 for operations that require a PIN2 (eg
1982  * updating FDN records)
1983  *
1984  * "response" is a const RIL_SIM_IO_Response *
1985  *
1986  * Arguments and responses that are unused for certain
1987  * values of "command" should be ignored or set to NULL
1988  *
1989  * Valid errors:
1990  *  SUCCESS
1991  *  RADIO_NOT_AVAILABLE
1992  *  GENERIC_FAILURE
1993  *  SIM_PIN2
1994  *  SIM_PUK2
1995  */
1996 #define RIL_REQUEST_SIM_IO 28
1997 
1998 /**
1999  * RIL_REQUEST_SEND_USSD
2000  *
2001  * Send a USSD message
2002  *
2003  * If a USSD session already exists, the message should be sent in the
2004  * context of that session. Otherwise, a new session should be created.
2005  *
2006  * The network reply should be reported via RIL_UNSOL_ON_USSD
2007  *
2008  * Only one USSD session may exist at a time, and the session is assumed
2009  * to exist until:
2010  *   a) The android system invokes RIL_REQUEST_CANCEL_USSD
2011  *   b) The implementation sends a RIL_UNSOL_ON_USSD with a type code
2012  *      of "0" (USSD-Notify/no further action) or "2" (session terminated)
2013  *
2014  * "data" is a const char * containing the USSD request in UTF-8 format
2015  * "response" is NULL
2016  *
2017  * Valid errors:
2018  *  SUCCESS
2019  *  RADIO_NOT_AVAILABLE
2020  *  FDN_CHECK_FAILURE
2021  *  GENERIC_FAILURE
2022  *
2023  * See also: RIL_REQUEST_CANCEL_USSD, RIL_UNSOL_ON_USSD
2024  */
2025 
2026 #define RIL_REQUEST_SEND_USSD 29
2027 
2028 /**
2029  * RIL_REQUEST_CANCEL_USSD
2030  *
2031  * Cancel the current USSD session if one exists
2032  *
2033  * "data" is null
2034  * "response" is NULL
2035  *
2036  * Valid errors:
2037  *  SUCCESS
2038  *  RADIO_NOT_AVAILABLE
2039  *  GENERIC_FAILURE
2040  */
2041 
2042 #define RIL_REQUEST_CANCEL_USSD 30
2043 
2044 /**
2045  * RIL_REQUEST_GET_CLIR
2046  *
2047  * Gets current CLIR status
2048  * "data" is NULL
2049  * "response" is int *
2050  * ((int *)data)[0] is "n" parameter from TS 27.007 7.7
2051  * ((int *)data)[1] is "m" parameter from TS 27.007 7.7
2052  *
2053  * Valid errors:
2054  *  SUCCESS
2055  *  RADIO_NOT_AVAILABLE
2056  *  GENERIC_FAILURE
2057  */
2058 #define RIL_REQUEST_GET_CLIR 31
2059 
2060 /**
2061  * RIL_REQUEST_SET_CLIR
2062  *
2063  * "data" is int *
2064  * ((int *)data)[0] is "n" parameter from TS 27.007 7.7
2065  *
2066  * "response" is NULL
2067  *
2068  * Valid errors:
2069  *  SUCCESS
2070  *  RADIO_NOT_AVAILABLE
2071  *  GENERIC_FAILURE
2072  */
2073 #define RIL_REQUEST_SET_CLIR 32
2074 
2075 /**
2076  * RIL_REQUEST_QUERY_CALL_FORWARD_STATUS
2077  *
2078  * "data" is const RIL_CallForwardInfo *
2079  *
2080  * "response" is const RIL_CallForwardInfo **
2081  * "response" points to an array of RIL_CallForwardInfo *'s, one for
2082  * each distinct registered phone number.
2083  *
2084  * For example, if data is forwarded to +18005551212 and voice is forwarded
2085  * to +18005559999, then two separate RIL_CallForwardInfo's should be returned
2086  *
2087  * If, however, both data and voice are forwarded to +18005551212, then
2088  * a single RIL_CallForwardInfo can be returned with the service class
2089  * set to "data + voice = 3")
2090  *
2091  * Valid errors:
2092  *  SUCCESS
2093  *  RADIO_NOT_AVAILABLE
2094  *  GENERIC_FAILURE
2095  */
2096 #define RIL_REQUEST_QUERY_CALL_FORWARD_STATUS 33
2097 
2098 
2099 /**
2100  * RIL_REQUEST_SET_CALL_FORWARD
2101  *
2102  * Configure call forward rule
2103  *
2104  * "data" is const RIL_CallForwardInfo *
2105  * "response" is NULL
2106  *
2107  * Valid errors:
2108  *  SUCCESS
2109  *  RADIO_NOT_AVAILABLE
2110  *  GENERIC_FAILURE
2111  */
2112 #define RIL_REQUEST_SET_CALL_FORWARD 34
2113 
2114 
2115 /**
2116  * RIL_REQUEST_QUERY_CALL_WAITING
2117  *
2118  * Query current call waiting state
2119  *
2120  * "data" is const int *
2121  * ((const int *)data)[0] is the TS 27.007 service class to query.
2122  * "response" is a const int *
2123  * ((const int *)response)[0] is 0 for "disabled" and 1 for "enabled"
2124  *
2125  * If ((const int *)response)[0] is = 1, then ((const int *)response)[1]
2126  * must follow, with the TS 27.007 service class bit vector of services
2127  * for which call waiting is enabled.
2128  *
2129  * For example, if ((const int *)response)[0]  is 1 and
2130  * ((const int *)response)[1] is 3, then call waiting is enabled for data
2131  * and voice and disabled for everything else
2132  *
2133  * Valid errors:
2134  *  SUCCESS
2135  *  RADIO_NOT_AVAILABLE
2136  *  GENERIC_FAILURE
2137  */
2138 #define RIL_REQUEST_QUERY_CALL_WAITING 35
2139 
2140 
2141 /**
2142  * RIL_REQUEST_SET_CALL_WAITING
2143  *
2144  * Configure current call waiting state
2145  *
2146  * "data" is const int *
2147  * ((const int *)data)[0] is 0 for "disabled" and 1 for "enabled"
2148  * ((const int *)data)[1] is the TS 27.007 service class bit vector of
2149  *                           services to modify
2150  * "response" is NULL
2151  *
2152  * Valid errors:
2153  *  SUCCESS
2154  *  RADIO_NOT_AVAILABLE
2155  *  GENERIC_FAILURE
2156  */
2157 #define RIL_REQUEST_SET_CALL_WAITING 36
2158 
2159 /**
2160  * RIL_REQUEST_SMS_ACKNOWLEDGE
2161  *
2162  * Acknowledge successful or failed receipt of SMS previously indicated
2163  * via RIL_UNSOL_RESPONSE_NEW_SMS
2164  *
2165  * "data" is int *
2166  * ((int *)data)[0] is 1 on successful receipt
2167  *                  (basically, AT+CNMA=1 from TS 27.005
2168  *                  is 0 on failed receipt
2169  *                  (basically, AT+CNMA=2 from TS 27.005)
2170  * ((int *)data)[1] if data[0] is 0, this contains the failure cause as defined
2171  *                  in TS 23.040, 9.2.3.22. Currently only 0xD3 (memory
2172  *                  capacity exceeded) and 0xFF (unspecified error) are
2173  *                  reported.
2174  *
2175  * "response" is NULL
2176  *
2177  * FIXME would like request that specified RP-ACK/RP-ERROR PDU
2178  *
2179  * Valid errors:
2180  *  SUCCESS
2181  *  RADIO_NOT_AVAILABLE
2182  *  GENERIC_FAILURE
2183  */
2184 #define RIL_REQUEST_SMS_ACKNOWLEDGE  37
2185 
2186 /**
2187  * RIL_REQUEST_GET_IMEI - DEPRECATED
2188  *
2189  * Get the device IMEI, including check digit
2190  *
2191  * The request is DEPRECATED, use RIL_REQUEST_DEVICE_IDENTITY
2192  * Valid when RadioState is not RADIO_STATE_UNAVAILABLE
2193  *
2194  * "data" is NULL
2195  * "response" is a const char * containing the IMEI
2196  *
2197  * Valid errors:
2198  *  SUCCESS
2199  *  RADIO_NOT_AVAILABLE (radio resetting)
2200  *  GENERIC_FAILURE
2201  */
2202 
2203 #define RIL_REQUEST_GET_IMEI 38
2204 
2205 /**
2206  * RIL_REQUEST_GET_IMEISV - DEPRECATED
2207  *
2208  * Get the device IMEISV, which should be two decimal digits
2209  *
2210  * The request is DEPRECATED, use RIL_REQUEST_DEVICE_IDENTITY
2211  * Valid when RadioState is not RADIO_STATE_UNAVAILABLE
2212  *
2213  * "data" is NULL
2214  * "response" is a const char * containing the IMEISV
2215  *
2216  * Valid errors:
2217  *  SUCCESS
2218  *  RADIO_NOT_AVAILABLE (radio resetting)
2219  *  GENERIC_FAILURE
2220  */
2221 
2222 #define RIL_REQUEST_GET_IMEISV 39
2223 
2224 
2225 /**
2226  * RIL_REQUEST_ANSWER
2227  *
2228  * Answer incoming call
2229  *
2230  * Will not be called for WAITING calls.
2231  * RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE will be used in this case
2232  * instead
2233  *
2234  * "data" is NULL
2235  * "response" is NULL
2236  *
2237  * Valid errors:
2238  *  SUCCESS
2239  *  RADIO_NOT_AVAILABLE (radio resetting)
2240  *  GENERIC_FAILURE
2241  */
2242 
2243 #define RIL_REQUEST_ANSWER 40
2244 
2245 /**
2246  * RIL_REQUEST_DEACTIVATE_DATA_CALL
2247  *
2248  * Deactivate packet data connection and remove from the
2249  * data call list if SUCCESS is returned. Any other return
2250  * values should also try to remove the call from the list,
2251  * but that may not be possible. In any event a
2252  * RIL_REQUEST_RADIO_POWER off/on must clear the list. An
2253  * RIL_UNSOL_DATA_CALL_LIST_CHANGED is not expected to be
2254  * issued because of an RIL_REQUEST_DEACTIVATE_DATA_CALL.
2255  *
2256  * "data" is const char **
2257  * ((char**)data)[0] indicating CID
2258  * ((char**)data)[1] indicating Disconnect Reason
2259  *                   0 => No specific reason specified
2260  *                   1 => Radio shutdown requested
2261  *
2262  * "response" is NULL
2263  *
2264  * Valid errors:
2265  *  SUCCESS
2266  *  RADIO_NOT_AVAILABLE
2267  *  GENERIC_FAILURE
2268  *
2269  * See also: RIL_REQUEST_SETUP_DATA_CALL
2270  */
2271 #define RIL_REQUEST_DEACTIVATE_DATA_CALL 41
2272 
2273 /**
2274  * RIL_REQUEST_QUERY_FACILITY_LOCK
2275  *
2276  * Query the status of a facility lock state
2277  *
2278  * "data" is const char **
2279  * ((const char **)data)[0] is the facility string code from TS 27.007 7.4
2280  *                      (eg "AO" for BAOC, "SC" for SIM lock)
2281  * ((const char **)data)[1] is the password, or "" if not required
2282  * ((const char **)data)[2] is the TS 27.007 service class bit vector of
2283  *                           services to query
2284  * ((const char **)data)[3] is AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
2285  *                            This is only applicable in the case of Fixed Dialing Numbers
2286  *                            (FDN) requests.
2287  *
2288  * "response" is an int *
2289  * ((const int *)response) 0 is the TS 27.007 service class bit vector of
2290  *                           services for which the specified barring facility
2291  *                           is active. "0" means "disabled for all"
2292  *
2293  *
2294  * Valid errors:
2295  *  SUCCESS
2296  *  RADIO_NOT_AVAILABLE
2297  *  GENERIC_FAILURE
2298  *
2299  */
2300 #define RIL_REQUEST_QUERY_FACILITY_LOCK 42
2301 
2302 /**
2303  * RIL_REQUEST_SET_FACILITY_LOCK
2304  *
2305  * Enable/disable one facility lock
2306  *
2307  * "data" is const char **
2308  *
2309  * ((const char **)data)[0] = facility string code from TS 27.007 7.4
2310  * (eg "AO" for BAOC)
2311  * ((const char **)data)[1] = "0" for "unlock" and "1" for "lock"
2312  * ((const char **)data)[2] = password
2313  * ((const char **)data)[3] = string representation of decimal TS 27.007
2314  *                            service class bit vector. Eg, the string
2315  *                            "1" means "set this facility for voice services"
2316  * ((const char **)data)[4] = AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
2317  *                            This is only applicable in the case of Fixed Dialing Numbers
2318  *                            (FDN) requests.
2319  *
2320  * "response" is int *
2321  * ((int *)response)[0] is the number of retries remaining, or -1 if unknown
2322  *
2323  * Valid errors:
2324  *  SUCCESS
2325  *  RADIO_NOT_AVAILABLE
2326  *  GENERIC_FAILURE
2327  *
2328  */
2329 #define RIL_REQUEST_SET_FACILITY_LOCK 43
2330 
2331 /**
2332  * RIL_REQUEST_CHANGE_BARRING_PASSWORD
2333  *
2334  * Change call barring facility password
2335  *
2336  * "data" is const char **
2337  *
2338  * ((const char **)data)[0] = facility string code from TS 27.007 7.4
2339  * (eg "AO" for BAOC)
2340  * ((const char **)data)[1] = old password
2341  * ((const char **)data)[2] = new password
2342  *
2343  * "response" is NULL
2344  *
2345  * Valid errors:
2346  *  SUCCESS
2347  *  RADIO_NOT_AVAILABLE
2348  *  GENERIC_FAILURE
2349  *
2350  */
2351 #define RIL_REQUEST_CHANGE_BARRING_PASSWORD 44
2352 
2353 /**
2354  * RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE
2355  *
2356  * Query current network selectin mode
2357  *
2358  * "data" is NULL
2359  *
2360  * "response" is int *
2361  * ((const int *)response)[0] is
2362  *     0 for automatic selection
2363  *     1 for manual selection
2364  *
2365  * Valid errors:
2366  *  SUCCESS
2367  *  RADIO_NOT_AVAILABLE
2368  *  GENERIC_FAILURE
2369  *
2370  */
2371 #define RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE 45
2372 
2373 /**
2374  * RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC
2375  *
2376  * Specify that the network should be selected automatically
2377  *
2378  * "data" is NULL
2379  * "response" is NULL
2380  *
2381  * This request must not respond until the new operator is selected
2382  * and registered
2383  *
2384  * Valid errors:
2385  *  SUCCESS
2386  *  RADIO_NOT_AVAILABLE
2387  *  ILLEGAL_SIM_OR_ME
2388  *  GENERIC_FAILURE
2389  *
2390  * Note: Returns ILLEGAL_SIM_OR_ME when the failure is permanent and
2391  *       no retries needed, such as illegal SIM or ME.
2392  *       Returns GENERIC_FAILURE for all other causes that might be
2393  *       fixed by retries.
2394  *
2395  */
2396 #define RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC 46
2397 
2398 /**
2399  * RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL
2400  *
2401  * Manually select a specified network.
2402  *
2403  * "data" is const char * specifying MCCMNC of network to select (eg "310170")
2404  * "response" is NULL
2405  *
2406  * This request must not respond until the new operator is selected
2407  * and registered
2408  *
2409  * Valid errors:
2410  *  SUCCESS
2411  *  RADIO_NOT_AVAILABLE
2412  *  ILLEGAL_SIM_OR_ME
2413  *  GENERIC_FAILURE
2414  *
2415  * Note: Returns ILLEGAL_SIM_OR_ME when the failure is permanent and
2416  *       no retries needed, such as illegal SIM or ME.
2417  *       Returns GENERIC_FAILURE for all other causes that might be
2418  *       fixed by retries.
2419  *
2420  */
2421 #define RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL 47
2422 
2423 /**
2424  * RIL_REQUEST_QUERY_AVAILABLE_NETWORKS
2425  *
2426  * Scans for available networks
2427  *
2428  * "data" is NULL
2429  * "response" is const char ** that should be an array of n*4 strings, where
2430  *    n is the number of available networks
2431  * For each available network:
2432  *
2433  * ((const char **)response)[n+0] is long alpha ONS or EONS
2434  * ((const char **)response)[n+1] is short alpha ONS or EONS
2435  * ((const char **)response)[n+2] is 5 or 6 digit numeric code (MCC + MNC)
2436  * ((const char **)response)[n+3] is a string value of the status:
2437  *           "unknown"
2438  *           "available"
2439  *           "current"
2440  *           "forbidden"
2441  *
2442  * This request must not respond until the new operator is selected
2443  * and registered
2444  *
2445  * Valid errors:
2446  *  SUCCESS
2447  *  RADIO_NOT_AVAILABLE
2448  *  GENERIC_FAILURE
2449  *
2450  */
2451 #define RIL_REQUEST_QUERY_AVAILABLE_NETWORKS 48
2452 
2453 /**
2454  * RIL_REQUEST_DTMF_START
2455  *
2456  * Start playing a DTMF tone. Continue playing DTMF tone until
2457  * RIL_REQUEST_DTMF_STOP is received
2458  *
2459  * If a RIL_REQUEST_DTMF_START is received while a tone is currently playing,
2460  * it should cancel the previous tone and play the new one.
2461  *
2462  * "data" is a char *
2463  * ((char *)data)[0] is a single character with one of 12 values: 0-9,*,#
2464  * "response" is NULL
2465  *
2466  * Valid errors:
2467  *  SUCCESS
2468  *  RADIO_NOT_AVAILABLE
2469  *  GENERIC_FAILURE
2470  *
2471  * See also: RIL_REQUEST_DTMF, RIL_REQUEST_DTMF_STOP
2472  */
2473 #define RIL_REQUEST_DTMF_START 49
2474 
2475 /**
2476  * RIL_REQUEST_DTMF_STOP
2477  *
2478  * Stop playing a currently playing DTMF tone.
2479  *
2480  * "data" is NULL
2481  * "response" is NULL
2482  *
2483  * Valid errors:
2484  *  SUCCESS
2485  *  RADIO_NOT_AVAILABLE
2486  *  GENERIC_FAILURE
2487  *
2488  * See also: RIL_REQUEST_DTMF, RIL_REQUEST_DTMF_START
2489  */
2490 #define RIL_REQUEST_DTMF_STOP 50
2491 
2492 /**
2493  * RIL_REQUEST_BASEBAND_VERSION
2494  *
2495  * Return string value indicating baseband version, eg
2496  * response from AT+CGMR
2497  *
2498  * "data" is NULL
2499  * "response" is const char * containing version string for log reporting
2500  *
2501  * Valid errors:
2502  *  SUCCESS
2503  *  RADIO_NOT_AVAILABLE
2504  *  GENERIC_FAILURE
2505  *
2506  */
2507 #define RIL_REQUEST_BASEBAND_VERSION 51
2508 
2509 /**
2510  * RIL_REQUEST_SEPARATE_CONNECTION
2511  *
2512  * Separate a party from a multiparty call placing the multiparty call
2513  * (less the specified party) on hold and leaving the specified party
2514  * as the only other member of the current (active) call
2515  *
2516  * Like AT+CHLD=2x
2517  *
2518  * See TS 22.084 1.3.8.2 (iii)
2519  * TS 22.030 6.5.5 "Entering "2X followed by send"
2520  * TS 27.007 "AT+CHLD=2x"
2521  *
2522  * "data" is an int *
2523  * (int *)data)[0] contains Connection index (value of 'x' in CHLD above) "response" is NULL
2524  *
2525  * "response" is NULL
2526  *
2527  * Valid errors:
2528  *  SUCCESS
2529  *  RADIO_NOT_AVAILABLE (radio resetting)
2530  *  GENERIC_FAILURE
2531  */
2532 #define RIL_REQUEST_SEPARATE_CONNECTION 52
2533 
2534 
2535 /**
2536  * RIL_REQUEST_SET_MUTE
2537  *
2538  * Turn on or off uplink (microphone) mute.
2539  *
2540  * Will only be sent while voice call is active.
2541  * Will always be reset to "disable mute" when a new voice call is initiated
2542  *
2543  * "data" is an int *
2544  * (int *)data)[0] is 1 for "enable mute" and 0 for "disable mute"
2545  *
2546  * "response" is NULL
2547  *
2548  * Valid errors:
2549  *  SUCCESS
2550  *  RADIO_NOT_AVAILABLE (radio resetting)
2551  *  GENERIC_FAILURE
2552  */
2553 
2554 #define RIL_REQUEST_SET_MUTE 53
2555 
2556 /**
2557  * RIL_REQUEST_GET_MUTE
2558  *
2559  * Queries the current state of the uplink mute setting
2560  *
2561  * "data" is NULL
2562  * "response" is an int *
2563  * (int *)response)[0] is 1 for "mute enabled" and 0 for "mute disabled"
2564  *
2565  * Valid errors:
2566  *  SUCCESS
2567  *  RADIO_NOT_AVAILABLE (radio resetting)
2568  *  GENERIC_FAILURE
2569  */
2570 
2571 #define RIL_REQUEST_GET_MUTE 54
2572 
2573 /**
2574  * RIL_REQUEST_QUERY_CLIP
2575  *
2576  * Queries the status of the CLIP supplementary service
2577  *
2578  * (for MMI code "*#30#")
2579  *
2580  * "data" is NULL
2581  * "response" is an int *
2582  * (int *)response)[0] is 1 for "CLIP provisioned"
2583  *                           and 0 for "CLIP not provisioned"
2584  *                           and 2 for "unknown, e.g. no network etc"
2585  *
2586  * Valid errors:
2587  *  SUCCESS
2588  *  RADIO_NOT_AVAILABLE (radio resetting)
2589  *  GENERIC_FAILURE
2590  */
2591 
2592 #define RIL_REQUEST_QUERY_CLIP 55
2593 
2594 /**
2595  * RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE - Deprecated use the status
2596  * field in RIL_Data_Call_Response_v6.
2597  *
2598  * Requests the failure cause code for the most recently failed PDP
2599  * context or CDMA data connection active
2600  * replaces RIL_REQUEST_LAST_PDP_FAIL_CAUSE
2601  *
2602  * "data" is NULL
2603  *
2604  * "response" is a "int *"
2605  * ((int *)response)[0] is an integer cause code defined in TS 24.008
2606  *   section 6.1.3.1.3 or close approximation
2607  *
2608  * If the implementation does not have access to the exact cause codes,
2609  * then it should return one of the values listed in
2610  * RIL_DataCallFailCause, as the UI layer needs to distinguish these
2611  * cases for error notification
2612  * and potential retries.
2613  *
2614  * Valid errors:
2615  *  SUCCESS
2616  *  RADIO_NOT_AVAILABLE
2617  *  GENERIC_FAILURE
2618  *
2619  * See also: RIL_REQUEST_LAST_CALL_FAIL_CAUSE
2620  *
2621  * Deprecated use the status field in RIL_Data_Call_Response_v6.
2622  */
2623 
2624 #define RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE 56
2625 
2626 /**
2627  * RIL_REQUEST_DATA_CALL_LIST
2628  *
2629  * Returns the data call list. An entry is added when a
2630  * RIL_REQUEST_SETUP_DATA_CALL is issued and removed on a
2631  * RIL_REQUEST_DEACTIVATE_DATA_CALL. The list is emptied
2632  * when RIL_REQUEST_RADIO_POWER off/on is issued.
2633  *
2634  * "data" is NULL
2635  * "response" is an array of RIL_Data_Call_Response_v6
2636  *
2637  * Valid errors:
2638  *  SUCCESS
2639  *  RADIO_NOT_AVAILABLE (radio resetting)
2640  *  GENERIC_FAILURE
2641  *
2642  * See also: RIL_UNSOL_DATA_CALL_LIST_CHANGED
2643  */
2644 
2645 #define RIL_REQUEST_DATA_CALL_LIST 57
2646 
2647 /**
2648  * RIL_REQUEST_RESET_RADIO - DEPRECATED
2649  *
2650  * Request a radio reset. The RIL implementation may postpone
2651  * the reset until after this request is responded to if the baseband
2652  * is presently busy.
2653  *
2654  * The request is DEPRECATED, use RIL_REQUEST_RADIO_POWER
2655  *
2656  * "data" is NULL
2657  * "response" is NULL
2658  *
2659  * Valid errors:
2660  *  SUCCESS
2661  *  RADIO_NOT_AVAILABLE (radio resetting)
2662  *  GENERIC_FAILURE
2663  *  REQUEST_NOT_SUPPORTED
2664  */
2665 
2666 #define RIL_REQUEST_RESET_RADIO 58
2667 
2668 /**
2669  * RIL_REQUEST_OEM_HOOK_RAW
2670  *
2671  * This request reserved for OEM-specific uses. It passes raw byte arrays
2672  * back and forth.
2673  *
2674  * It can be invoked on the Java side from
2675  * com.android.internal.telephony.Phone.invokeOemRilRequestRaw()
2676  *
2677  * "data" is a char * of bytes copied from the byte[] data argument in java
2678  * "response" is a char * of bytes that will returned via the
2679  * caller's "response" Message here:
2680  * (byte[])(((AsyncResult)response.obj).result)
2681  *
2682  * An error response here will result in
2683  * (((AsyncResult)response.obj).result) == null and
2684  * (((AsyncResult)response.obj).exception) being an instance of
2685  * com.android.internal.telephony.gsm.CommandException
2686  *
2687  * Valid errors:
2688  *  All
2689  */
2690 
2691 #define RIL_REQUEST_OEM_HOOK_RAW 59
2692 
2693 /**
2694  * RIL_REQUEST_OEM_HOOK_STRINGS
2695  *
2696  * This request reserved for OEM-specific uses. It passes strings
2697  * back and forth.
2698  *
2699  * It can be invoked on the Java side from
2700  * com.android.internal.telephony.Phone.invokeOemRilRequestStrings()
2701  *
2702  * "data" is a const char **, representing an array of null-terminated UTF-8
2703  * strings copied from the "String[] strings" argument to
2704  * invokeOemRilRequestStrings()
2705  *
2706  * "response" is a const char **, representing an array of null-terminated UTF-8
2707  * stings that will be returned via the caller's response message here:
2708  *
2709  * (String[])(((AsyncResult)response.obj).result)
2710  *
2711  * An error response here will result in
2712  * (((AsyncResult)response.obj).result) == null and
2713  * (((AsyncResult)response.obj).exception) being an instance of
2714  * com.android.internal.telephony.gsm.CommandException
2715  *
2716  * Valid errors:
2717  *  All
2718  */
2719 
2720 #define RIL_REQUEST_OEM_HOOK_STRINGS 60
2721 
2722 /**
2723  * RIL_REQUEST_SCREEN_STATE
2724  *
2725  * Indicates the current state of the screen.  When the screen is off, the
2726  * RIL should notify the baseband to suppress certain notifications (eg,
2727  * signal strength and changes in LAC/CID or BID/SID/NID/latitude/longitude)
2728  * in an effort to conserve power.  These notifications should resume when the
2729  * screen is on.
2730  *
2731  * "data" is int *
2732  * ((int *)data)[0] is == 1 for "Screen On"
2733  * ((int *)data)[0] is == 0 for "Screen Off"
2734  *
2735  * "response" is NULL
2736  *
2737  * Valid errors:
2738  *  SUCCESS
2739  *  GENERIC_FAILURE
2740  */
2741 #define RIL_REQUEST_SCREEN_STATE 61
2742 
2743 
2744 /**
2745  * RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION
2746  *
2747  * Enables/disables supplementary service related notifications
2748  * from the network.
2749  *
2750  * Notifications are reported via RIL_UNSOL_SUPP_SVC_NOTIFICATION.
2751  *
2752  * "data" is int *
2753  * ((int *)data)[0] is == 1 for notifications enabled
2754  * ((int *)data)[0] is == 0 for notifications disabled
2755  *
2756  * "response" is NULL
2757  *
2758  * Valid errors:
2759  *  SUCCESS
2760  *  RADIO_NOT_AVAILABLE
2761  *  GENERIC_FAILURE
2762  *
2763  * See also: RIL_UNSOL_SUPP_SVC_NOTIFICATION.
2764  */
2765 #define RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION 62
2766 
2767 /**
2768  * RIL_REQUEST_WRITE_SMS_TO_SIM
2769  *
2770  * Stores a SMS message to SIM memory.
2771  *
2772  * "data" is RIL_SMS_WriteArgs *
2773  *
2774  * "response" is int *
2775  * ((const int *)response)[0] is the record index where the message is stored.
2776  *
2777  * Valid errors:
2778  *  SUCCESS
2779  *  GENERIC_FAILURE
2780  *
2781  */
2782 #define RIL_REQUEST_WRITE_SMS_TO_SIM 63
2783 
2784 /**
2785  * RIL_REQUEST_DELETE_SMS_ON_SIM
2786  *
2787  * Deletes a SMS message from SIM memory.
2788  *
2789  * "data" is int  *
2790  * ((int *)data)[0] is the record index of the message to delete.
2791  *
2792  * "response" is NULL
2793  *
2794  * Valid errors:
2795  *  SUCCESS
2796  *  GENERIC_FAILURE
2797  *
2798  */
2799 #define RIL_REQUEST_DELETE_SMS_ON_SIM 64
2800 
2801 /**
2802  * RIL_REQUEST_SET_BAND_MODE
2803  *
2804  * Assign a specified band for RF configuration.
2805  *
2806  * "data" is int *
2807  * ((int *)data)[0] is == 0 for "unspecified" (selected by baseband automatically)
2808  * ((int *)data)[0] is == 1 for "EURO band" (GSM-900 / DCS-1800 / WCDMA-IMT-2000)
2809  * ((int *)data)[0] is == 2 for "US band" (GSM-850 / PCS-1900 / WCDMA-850 / WCDMA-PCS-1900)
2810  * ((int *)data)[0] is == 3 for "JPN band" (WCDMA-800 / WCDMA-IMT-2000)
2811  * ((int *)data)[0] is == 4 for "AUS band" (GSM-900 / DCS-1800 / WCDMA-850 / WCDMA-IMT-2000)
2812  * ((int *)data)[0] is == 5 for "AUS band 2" (GSM-900 / DCS-1800 / WCDMA-850)
2813  * ((int *)data)[0] is == 6 for "Cellular (800-MHz Band)"
2814  * ((int *)data)[0] is == 7 for "PCS (1900-MHz Band)"
2815  * ((int *)data)[0] is == 8 for "Band Class 3 (JTACS Band)"
2816  * ((int *)data)[0] is == 9 for "Band Class 4 (Korean PCS Band)"
2817  * ((int *)data)[0] is == 10 for "Band Class 5 (450-MHz Band)"
2818  * ((int *)data)[0] is == 11 for "Band Class 6 (2-GMHz IMT2000 Band)"
2819  * ((int *)data)[0] is == 12 for "Band Class 7 (Upper 700-MHz Band)"
2820  * ((int *)data)[0] is == 13 for "Band Class 8 (1800-MHz Band)"
2821  * ((int *)data)[0] is == 14 for "Band Class 9 (900-MHz Band)"
2822  * ((int *)data)[0] is == 15 for "Band Class 10 (Secondary 800-MHz Band)"
2823  * ((int *)data)[0] is == 16 for "Band Class 11 (400-MHz European PAMR Band)"
2824  * ((int *)data)[0] is == 17 for "Band Class 15 (AWS Band)"
2825  * ((int *)data)[0] is == 18 for "Band Class 16 (US 2.5-GHz Band)"
2826  *
2827  * "response" is NULL
2828  *
2829  * Valid errors:
2830  *  SUCCESS
2831  *  RADIO_NOT_AVAILABLE
2832  *  GENERIC_FAILURE
2833  */
2834 #define RIL_REQUEST_SET_BAND_MODE 65
2835 
2836 /**
2837  * RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE
2838  *
2839  * Query the list of band mode supported by RF.
2840  *
2841  * "data" is NULL
2842  *
2843  * "response" is int *
2844  * "response" points to an array of int's, the int[0] is the size of array, reset is one for
2845  * each available band mode.
2846  *
2847  *  0 for "unspecified" (selected by baseband automatically)
2848  *  1 for "EURO band" (GSM-900 / DCS-1800 / WCDMA-IMT-2000)
2849  *  2 for "US band" (GSM-850 / PCS-1900 / WCDMA-850 / WCDMA-PCS-1900)
2850  *  3 for "JPN band" (WCDMA-800 / WCDMA-IMT-2000)
2851  *  4 for "AUS band" (GSM-900 / DCS-1800 / WCDMA-850 / WCDMA-IMT-2000)
2852  *  5 for "AUS band 2" (GSM-900 / DCS-1800 / WCDMA-850)
2853  *  6 for "Cellular (800-MHz Band)"
2854  *  7 for "PCS (1900-MHz Band)"
2855  *  8 for "Band Class 3 (JTACS Band)"
2856  *  9 for "Band Class 4 (Korean PCS Band)"
2857  *  10 for "Band Class 5 (450-MHz Band)"
2858  *  11 for "Band Class 6 (2-GMHz IMT2000 Band)"
2859  *  12 for "Band Class 7 (Upper 700-MHz Band)"
2860  *  13 for "Band Class 8 (1800-MHz Band)"
2861  *  14 for "Band Class 9 (900-MHz Band)"
2862  *  15 for "Band Class 10 (Secondary 800-MHz Band)"
2863  *  16 for "Band Class 11 (400-MHz European PAMR Band)"
2864  *  17 for "Band Class 15 (AWS Band)"
2865  *  18 for "Band Class 16 (US 2.5-GHz Band)"
2866  *
2867  * Valid errors:
2868  *  SUCCESS
2869  *  RADIO_NOT_AVAILABLE
2870  *  GENERIC_FAILURE
2871  *
2872  * See also: RIL_REQUEST_SET_BAND_MODE
2873  */
2874 #define RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE 66
2875 
2876 /**
2877  * RIL_REQUEST_STK_GET_PROFILE
2878  *
2879  * Requests the profile of SIM tool kit.
2880  * The profile indicates the SAT/USAT features supported by ME.
2881  * The SAT/USAT features refer to 3GPP TS 11.14 and 3GPP TS 31.111
2882  *
2883  * "data" is NULL
2884  *
2885  * "response" is a const char * containing SAT/USAT profile
2886  * in hexadecimal format string starting with first byte of terminal profile
2887  *
2888  * Valid errors:
2889  *  RIL_E_SUCCESS
2890  *  RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
2891  *  RIL_E_GENERIC_FAILURE
2892  */
2893 #define RIL_REQUEST_STK_GET_PROFILE 67
2894 
2895 /**
2896  * RIL_REQUEST_STK_SET_PROFILE
2897  *
2898  * Download the STK terminal profile as part of SIM initialization
2899  * procedure
2900  *
2901  * "data" is a const char * containing SAT/USAT profile
2902  * in hexadecimal format string starting with first byte of terminal profile
2903  *
2904  * "response" is NULL
2905  *
2906  * Valid errors:
2907  *  RIL_E_SUCCESS
2908  *  RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
2909  *  RIL_E_GENERIC_FAILURE
2910  */
2911 #define RIL_REQUEST_STK_SET_PROFILE 68
2912 
2913 /**
2914  * RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND
2915  *
2916  * Requests to send a SAT/USAT envelope command to SIM.
2917  * The SAT/USAT envelope command refers to 3GPP TS 11.14 and 3GPP TS 31.111
2918  *
2919  * "data" is a const char * containing SAT/USAT command
2920  * in hexadecimal format string starting with command tag
2921  *
2922  * "response" is a const char * containing SAT/USAT response
2923  * in hexadecimal format string starting with first byte of response
2924  * (May be NULL)
2925  *
2926  * Valid errors:
2927  *  RIL_E_SUCCESS
2928  *  RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
2929  *  RIL_E_GENERIC_FAILURE
2930  */
2931 #define RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND 69
2932 
2933 /**
2934  * RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE
2935  *
2936  * Requests to send a terminal response to SIM for a received
2937  * proactive command
2938  *
2939  * "data" is a const char * containing SAT/USAT response
2940  * in hexadecimal format string starting with first byte of response data
2941  *
2942  * "response" is NULL
2943  *
2944  * Valid errors:
2945  *  RIL_E_SUCCESS
2946  *  RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
2947  *  RIL_E_GENERIC_FAILURE
2948  */
2949 #define RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE 70
2950 
2951 /**
2952  * RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM
2953  *
2954  * When STK application gets RIL_UNSOL_STK_CALL_SETUP, the call actually has
2955  * been initialized by ME already. (We could see the call has been in the 'call
2956  * list') So, STK application needs to accept/reject the call according as user
2957  * operations.
2958  *
2959  * "data" is int *
2960  * ((int *)data)[0] is > 0 for "accept" the call setup
2961  * ((int *)data)[0] is == 0 for "reject" the call setup
2962  *
2963  * "response" is NULL
2964  *
2965  * Valid errors:
2966  *  RIL_E_SUCCESS
2967  *  RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
2968  *  RIL_E_GENERIC_FAILURE
2969  */
2970 #define RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM 71
2971 
2972 /**
2973  * RIL_REQUEST_EXPLICIT_CALL_TRANSFER
2974  *
2975  * Connects the two calls and disconnects the subscriber from both calls.
2976  *
2977  * "data" is NULL
2978  * "response" is NULL
2979  *
2980  * Valid errors:
2981  *  SUCCESS
2982  *  RADIO_NOT_AVAILABLE (radio resetting)
2983  *  GENERIC_FAILURE
2984  */
2985 #define RIL_REQUEST_EXPLICIT_CALL_TRANSFER 72
2986 
2987 /**
2988  * RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE
2989  *
2990  * Requests to set the preferred network type for searching and registering
2991  * (CS/PS domain, RAT, and operation mode)
2992  *
2993  * "data" is int * which is RIL_PreferredNetworkType
2994  *
2995  * "response" is NULL
2996  *
2997  * Valid errors:
2998  *  SUCCESS
2999  *  RADIO_NOT_AVAILABLE (radio resetting)
3000  *  GENERIC_FAILURE
3001  *  MODE_NOT_SUPPORTED
3002  */
3003 #define RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE 73
3004 
3005 /**
3006  * RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE
3007  *
3008  * Query the preferred network type (CS/PS domain, RAT, and operation mode)
3009  * for searching and registering
3010  *
3011  * "data" is NULL
3012  *
3013  * "response" is int *
3014  * ((int *)reponse)[0] is == RIL_PreferredNetworkType
3015  *
3016  * Valid errors:
3017  *  SUCCESS
3018  *  RADIO_NOT_AVAILABLE
3019  *  GENERIC_FAILURE
3020  *
3021  * See also: RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE
3022  */
3023 #define RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE 74
3024 
3025 /**
3026  * RIL_REQUEST_NEIGHBORING_CELL_IDS
3027  *
3028  * Request neighboring cell id in GSM network
3029  *
3030  * "data" is NULL
3031  * "response" must be a " const RIL_NeighboringCell** "
3032  *
3033  * Valid errors:
3034  *  SUCCESS
3035  *  RADIO_NOT_AVAILABLE
3036  *  GENERIC_FAILURE
3037  */
3038 #define RIL_REQUEST_GET_NEIGHBORING_CELL_IDS 75
3039 
3040 /**
3041  * RIL_REQUEST_SET_LOCATION_UPDATES
3042  *
3043  * Enables/disables network state change notifications due to changes in
3044  * LAC and/or CID (for GSM) or BID/SID/NID/latitude/longitude (for CDMA).
3045  * Basically +CREG=2 vs. +CREG=1 (TS 27.007).
3046  *
3047  * Note:  The RIL implementation should default to "updates enabled"
3048  * when the screen is on and "updates disabled" when the screen is off.
3049  *
3050  * "data" is int *
3051  * ((int *)data)[0] is == 1 for updates enabled (+CREG=2)
3052  * ((int *)data)[0] is == 0 for updates disabled (+CREG=1)
3053  *
3054  * "response" is NULL
3055  *
3056  * Valid errors:
3057  *  SUCCESS
3058  *  RADIO_NOT_AVAILABLE
3059  *  GENERIC_FAILURE
3060  *
3061  * See also: RIL_REQUEST_SCREEN_STATE, RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED
3062  */
3063 #define RIL_REQUEST_SET_LOCATION_UPDATES 76
3064 
3065 /**
3066  * RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE
3067  *
3068  * Request to set the location where the CDMA subscription shall
3069  * be retrieved
3070  *
3071  * "data" is int *
3072  * ((int *)data)[0] is == RIL_CdmaSubscriptionSource
3073  *
3074  * "response" is NULL
3075  *
3076  * Valid errors:
3077  *  SUCCESS
3078  *  RADIO_NOT_AVAILABLE
3079  *  GENERIC_FAILURE
3080  *  SIM_ABSENT
3081  *  SUBSCRIPTION_NOT_AVAILABLE
3082  *
3083  * See also: RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE
3084  */
3085 #define RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE 77
3086 
3087 /**
3088  * RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE
3089  *
3090  * Request to set the roaming preferences in CDMA
3091  *
3092  * "data" is int *
3093  * ((int *)data)[0] is == 0 for Home Networks only, as defined in PRL
3094  * ((int *)data)[0] is == 1 for Roaming on Affiliated networks, as defined in PRL
3095  * ((int *)data)[0] is == 2 for Roaming on Any Network, as defined in the PRL
3096  *
3097  * "response" is NULL
3098  *
3099  * Valid errors:
3100  *  SUCCESS
3101  *  RADIO_NOT_AVAILABLE
3102  *  GENERIC_FAILURE
3103  */
3104 #define RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE 78
3105 
3106 /**
3107  * RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE
3108  *
3109  * Request the actual setting of the roaming preferences in CDMA in the modem
3110  *
3111  * "data" is NULL
3112  *
3113  * "response" is int *
3114  * ((int *)response)[0] is == 0 for Home Networks only, as defined in PRL
3115  * ((int *)response)[0] is == 1 for Roaming on Affiliated networks, as defined in PRL
3116  * ((int *)response)[0] is == 2 for Roaming on Any Network, as defined in the PRL
3117  *
3118  * "response" is NULL
3119  *
3120  * Valid errors:
3121  *  SUCCESS
3122  *  RADIO_NOT_AVAILABLE
3123  *  GENERIC_FAILURE
3124  */
3125 #define RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE 79
3126 
3127 /**
3128  * RIL_REQUEST_SET_TTY_MODE
3129  *
3130  * Request to set the TTY mode
3131  *
3132  * "data" is int *
3133  * ((int *)data)[0] is == 0 for TTY off
3134  * ((int *)data)[0] is == 1 for TTY Full
3135  * ((int *)data)[0] is == 2 for TTY HCO (hearing carryover)
3136  * ((int *)data)[0] is == 3 for TTY VCO (voice carryover)
3137  *
3138  * "response" is NULL
3139  *
3140  * Valid errors:
3141  *  SUCCESS
3142  *  RADIO_NOT_AVAILABLE
3143  *  GENERIC_FAILURE
3144  */
3145 #define RIL_REQUEST_SET_TTY_MODE 80
3146 
3147 /**
3148  * RIL_REQUEST_QUERY_TTY_MODE
3149  *
3150  * Request the setting of TTY mode
3151  *
3152  * "data" is NULL
3153  *
3154  * "response" is int *
3155  * ((int *)response)[0] is == 0 for TTY off
3156  * ((int *)response)[0] is == 1 for TTY Full
3157  * ((int *)response)[0] is == 2 for TTY HCO (hearing carryover)
3158  * ((int *)response)[0] is == 3 for TTY VCO (voice carryover)
3159  *
3160  * "response" is NULL
3161  *
3162  * Valid errors:
3163  *  SUCCESS
3164  *  RADIO_NOT_AVAILABLE
3165  *  GENERIC_FAILURE
3166  */
3167 #define RIL_REQUEST_QUERY_TTY_MODE 81
3168 
3169 /**
3170  * RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE
3171  *
3172  * Request to set the preferred voice privacy mode used in voice
3173  * scrambling
3174  *
3175  * "data" is int *
3176  * ((int *)data)[0] is == 0 for Standard Privacy Mode (Public Long Code Mask)
3177  * ((int *)data)[0] is == 1 for Enhanced Privacy Mode (Private Long Code Mask)
3178  *
3179  * "response" is NULL
3180  *
3181  * Valid errors:
3182  *  SUCCESS
3183  *  RADIO_NOT_AVAILABLE
3184  *  GENERIC_FAILURE
3185  */
3186 #define RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE 82
3187 
3188 /**
3189  * RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE
3190  *
3191  * Request the setting of preferred voice privacy mode
3192  *
3193  * "data" is NULL
3194  *
3195  * "response" is int *
3196  * ((int *)response)[0] is == 0 for Standard Privacy Mode (Public Long Code Mask)
3197  * ((int *)response)[0] is == 1 for Enhanced Privacy Mode (Private Long Code Mask)
3198  *
3199  * "response" is NULL
3200  *
3201  * Valid errors:
3202  *  SUCCESS
3203  *  RADIO_NOT_AVAILABLE
3204  *  GENERIC_FAILURE
3205  */
3206 #define RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE 83
3207 
3208 /**
3209  * RIL_REQUEST_CDMA_FLASH
3210  *
3211  * Send FLASH
3212  *
3213  * "data" is const char *
3214  * ((const char *)data)[0] is a FLASH string
3215  *
3216  * "response" is NULL
3217  *
3218  * Valid errors:
3219  *  SUCCESS
3220  *  RADIO_NOT_AVAILABLE
3221  *  GENERIC_FAILURE
3222  *
3223  */
3224 #define RIL_REQUEST_CDMA_FLASH 84
3225 
3226 /**
3227  * RIL_REQUEST_CDMA_BURST_DTMF
3228  *
3229  * Send DTMF string
3230  *
3231  * "data" is const char **
3232  * ((const char **)data)[0] is a DTMF string
3233  * ((const char **)data)[1] is the DTMF ON length in milliseconds, or 0 to use
3234  *                          default
3235  * ((const char **)data)[2] is the DTMF OFF length in milliseconds, or 0 to use
3236  *                          default
3237  *
3238  * "response" is NULL
3239  *
3240  * Valid errors:
3241  *  SUCCESS
3242  *  RADIO_NOT_AVAILABLE
3243  *  GENERIC_FAILURE
3244  *
3245  */
3246 #define RIL_REQUEST_CDMA_BURST_DTMF 85
3247 
3248 /**
3249  * RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY
3250  *
3251  * Takes a 26 digit string (20 digit AKEY + 6 digit checksum).
3252  * If the checksum is valid the 20 digit AKEY is written to NV,
3253  * replacing the existing AKEY no matter what it was before.
3254  *
3255  * "data" is const char *
3256  * ((const char *)data)[0] is a 26 digit string (ASCII digits '0'-'9')
3257  *                         where the last 6 digits are a checksum of the
3258  *                         first 20, as specified in TR45.AHAG
3259  *                         "Common Cryptographic Algorithms, Revision D.1
3260  *                         Section 2.2"
3261  *
3262  * "response" is NULL
3263  *
3264  * Valid errors:
3265  *  SUCCESS
3266  *  RADIO_NOT_AVAILABLE
3267  *  GENERIC_FAILURE
3268  *
3269  */
3270 #define RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY 86
3271 
3272 /**
3273  * RIL_REQUEST_CDMA_SEND_SMS
3274  *
3275  * Send a CDMA SMS message
3276  *
3277  * "data" is const RIL_CDMA_SMS_Message *
3278  *
3279  * "response" is a const RIL_SMS_Response *
3280  *
3281  * Based on the return error, caller decides to resend if sending sms
3282  * fails. The CDMA error class is derived as follows,
3283  * SUCCESS is error class 0 (no error)
3284  * SMS_SEND_FAIL_RETRY is error class 2 (temporary failure)
3285  * and GENERIC_FAILURE is error class 3 (permanent and no retry)
3286  *
3287  * Valid errors:
3288  *  SUCCESS
3289  *  RADIO_NOT_AVAILABLE
3290  *  SMS_SEND_FAIL_RETRY
3291  *  GENERIC_FAILURE
3292  *
3293  */
3294 #define RIL_REQUEST_CDMA_SEND_SMS 87
3295 
3296 /**
3297  * RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE
3298  *
3299  * Acknowledge the success or failure in the receipt of SMS
3300  * previously indicated via RIL_UNSOL_RESPONSE_CDMA_NEW_SMS
3301  *
3302  * "data" is const RIL_CDMA_SMS_Ack *
3303  *
3304  * "response" is NULL
3305  *
3306  * Valid errors:
3307  *  SUCCESS
3308  *  RADIO_NOT_AVAILABLE
3309  *  GENERIC_FAILURE
3310  *
3311  */
3312 #define RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE 88
3313 
3314 /**
3315  * RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG
3316  *
3317  * Request the setting of GSM/WCDMA Cell Broadcast SMS config.
3318  *
3319  * "data" is NULL
3320  *
3321  * "response" is a const RIL_GSM_BroadcastSmsConfigInfo **
3322  * "responselen" is count * sizeof (RIL_GSM_BroadcastSmsConfigInfo *)
3323  *
3324  * Valid errors:
3325  *  SUCCESS
3326  *  RADIO_NOT_AVAILABLE
3327  *  GENERIC_FAILURE
3328  *
3329  */
3330 #define RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG 89
3331 
3332 /**
3333  * RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG
3334  *
3335  * Set GSM/WCDMA Cell Broadcast SMS config
3336  *
3337  * "data" is a const RIL_GSM_BroadcastSmsConfigInfo **
3338  * "datalen" is count * sizeof(RIL_GSM_BroadcastSmsConfigInfo *)
3339  *
3340  * "response" is NULL
3341  *
3342  * Valid errors:
3343  *  SUCCESS
3344  *  RADIO_NOT_AVAILABLE
3345  *  GENERIC_FAILURE
3346  *
3347  */
3348 #define RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG 90
3349 
3350 /**
3351  * RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION
3352  *
3353 * Enable or disable the reception of GSM/WCDMA Cell Broadcast SMS
3354  *
3355  * "data" is const int *
3356  * (const int *)data[0] indicates to activate or turn off the
3357  * reception of GSM/WCDMA Cell Broadcast SMS, 0-1,
3358  *                       0 - Activate, 1 - Turn off
3359  *
3360  * "response" is NULL
3361  *
3362  * Valid errors:
3363  *  SUCCESS
3364  *  RADIO_NOT_AVAILABLE
3365  *  GENERIC_FAILURE
3366  *
3367  */
3368 #define RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION 91
3369 
3370 /**
3371  * RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG
3372  *
3373  * Request the setting of CDMA Broadcast SMS config
3374  *
3375  * "data" is NULL
3376  *
3377  * "response" is a const RIL_CDMA_BroadcastSmsConfigInfo **
3378  * "responselen" is count * sizeof (RIL_CDMA_BroadcastSmsConfigInfo *)
3379  *
3380  * Valid errors:
3381  *  SUCCESS
3382  *  RADIO_NOT_AVAILABLE
3383  *  GENERIC_FAILURE
3384  *
3385  */
3386 #define RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG 92
3387 
3388 /**
3389  * RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG
3390  *
3391  * Set CDMA Broadcast SMS config
3392  *
3393  * "data" is an const RIL_CDMA_BroadcastSmsConfigInfo **
3394  * "datalen" is count * sizeof(const RIL_CDMA_BroadcastSmsConfigInfo *)
3395  *
3396  * "response" is NULL
3397  *
3398  * Valid errors:
3399  *  SUCCESS
3400  *  RADIO_NOT_AVAILABLE
3401  *  GENERIC_FAILURE
3402  *
3403  */
3404 #define RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG 93
3405 
3406 /**
3407  * RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION
3408  *
3409  * Enable or disable the reception of CDMA Broadcast SMS
3410  *
3411  * "data" is const int *
3412  * (const int *)data[0] indicates to activate or turn off the
3413  * reception of CDMA Broadcast SMS, 0-1,
3414  *                       0 - Activate, 1 - Turn off
3415  *
3416  * "response" is NULL
3417  *
3418  * Valid errors:
3419  *  SUCCESS
3420  *  RADIO_NOT_AVAILABLE
3421  *  GENERIC_FAILURE
3422  *
3423  */
3424 #define RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION 94
3425 
3426 /**
3427  * RIL_REQUEST_CDMA_SUBSCRIPTION
3428  *
3429  * Request the device MDN / H_SID / H_NID.
3430  *
3431  * The request is only allowed when CDMA subscription is available.  When CDMA
3432  * subscription is changed, application layer should re-issue the request to
3433  * update the subscription information.
3434  *
3435  * If a NULL value is returned for any of the device id, it means that error
3436  * accessing the device.
3437  *
3438  * "response" is const char **
3439  * ((const char **)response)[0] is MDN if CDMA subscription is available
3440  * ((const char **)response)[1] is a comma separated list of H_SID (Home SID) if
3441  *                              CDMA subscription is available, in decimal format
3442  * ((const char **)response)[2] is a comma separated list of H_NID (Home NID) if
3443  *                              CDMA subscription is available, in decimal format
3444  * ((const char **)response)[3] is MIN (10 digits, MIN2+MIN1) if CDMA subscription is available
3445  * ((const char **)response)[4] is PRL version if CDMA subscription is available
3446  *
3447  * Valid errors:
3448  *  SUCCESS
3449  *  RIL_E_SUBSCRIPTION_NOT_AVAILABLE
3450  */
3451 
3452 #define RIL_REQUEST_CDMA_SUBSCRIPTION 95
3453 
3454 /**
3455  * RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM
3456  *
3457  * Stores a CDMA SMS message to RUIM memory.
3458  *
3459  * "data" is RIL_CDMA_SMS_WriteArgs *
3460  *
3461  * "response" is int *
3462  * ((const int *)response)[0] is the record index where the message is stored.
3463  *
3464  * Valid errors:
3465  *  SUCCESS
3466  *  RADIO_NOT_AVAILABLE
3467  *  GENERIC_FAILURE
3468  *
3469  */
3470 #define RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM 96
3471 
3472 /**
3473  * RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM
3474  *
3475  * Deletes a CDMA SMS message from RUIM memory.
3476  *
3477  * "data" is int  *
3478  * ((int *)data)[0] is the record index of the message to delete.
3479  *
3480  * "response" is NULL
3481  *
3482  * Valid errors:
3483  *  SUCCESS
3484  *  RADIO_NOT_AVAILABLE
3485  *  GENERIC_FAILURE
3486  *
3487  */
3488 #define RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM 97
3489 
3490 /**
3491  * RIL_REQUEST_DEVICE_IDENTITY
3492  *
3493  * Request the device ESN / MEID / IMEI / IMEISV.
3494  *
3495  * The request is always allowed and contains GSM and CDMA device identity;
3496  * it substitutes the deprecated requests RIL_REQUEST_GET_IMEI and
3497  * RIL_REQUEST_GET_IMEISV.
3498  *
3499  * If a NULL value is returned for any of the device id, it means that error
3500  * accessing the device.
3501  *
3502  * When CDMA subscription is changed the ESN/MEID may change.  The application
3503  * layer should re-issue the request to update the device identity in this case.
3504  *
3505  * "response" is const char **
3506  * ((const char **)response)[0] is IMEI if GSM subscription is available
3507  * ((const char **)response)[1] is IMEISV if GSM subscription is available
3508  * ((const char **)response)[2] is ESN if CDMA subscription is available
3509  * ((const char **)response)[3] is MEID if CDMA subscription is available
3510  *
3511  * Valid errors:
3512  *  SUCCESS
3513  *  RADIO_NOT_AVAILABLE
3514  *  GENERIC_FAILURE
3515  */
3516 #define RIL_REQUEST_DEVICE_IDENTITY 98
3517 
3518 /**
3519  * RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE
3520  *
3521  * Request the radio's system selection module to exit emergency
3522  * callback mode.  RIL will not respond with SUCCESS until the modem has
3523  * completely exited from Emergency Callback Mode.
3524  *
3525  * "data" is NULL
3526  *
3527  * "response" is NULL
3528  *
3529  * Valid errors:
3530  *  SUCCESS
3531  *  RADIO_NOT_AVAILABLE
3532  *  GENERIC_FAILURE
3533  *
3534  */
3535 #define RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE 99
3536 
3537 /**
3538  * RIL_REQUEST_GET_SMSC_ADDRESS
3539  *
3540  * Queries the default Short Message Service Center address on the device.
3541  *
3542  * "data" is NULL
3543  *
3544  * "response" is const char * containing the SMSC address.
3545  *
3546  * Valid errors:
3547  *  SUCCESS
3548  *  RADIO_NOT_AVAILABLE
3549  *  GENERIC_FAILURE
3550  *
3551  */
3552 #define RIL_REQUEST_GET_SMSC_ADDRESS 100
3553 
3554 /**
3555  * RIL_REQUEST_SET_SMSC_ADDRESS
3556  *
3557  * Sets the default Short Message Service Center address on the device.
3558  *
3559  * "data" is const char * containing the SMSC address.
3560  *
3561  * "response" is NULL
3562  *
3563  * Valid errors:
3564  *  SUCCESS
3565  *  RADIO_NOT_AVAILABLE
3566  *  GENERIC_FAILURE
3567  *
3568  */
3569 #define RIL_REQUEST_SET_SMSC_ADDRESS 101
3570 
3571 /**
3572  * RIL_REQUEST_REPORT_SMS_MEMORY_STATUS
3573  *
3574  * Indicates whether there is storage available for new SMS messages.
3575  *
3576  * "data" is int *
3577  * ((int *)data)[0] is 1 if memory is available for storing new messages
3578  *                  is 0 if memory capacity is exceeded
3579  *
3580  * "response" is NULL
3581  *
3582  * Valid errors:
3583  *  SUCCESS
3584  *  RADIO_NOT_AVAILABLE
3585  *  GENERIC_FAILURE
3586  *
3587  */
3588 #define RIL_REQUEST_REPORT_SMS_MEMORY_STATUS 102
3589 
3590 /**
3591  * RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING
3592  *
3593  * Indicates that the StkSerivce is running and is
3594  * ready to receive RIL_UNSOL_STK_XXXXX commands.
3595  *
3596  * "data" is NULL
3597  * "response" is NULL
3598  *
3599  * Valid errors:
3600  *  SUCCESS
3601  *  RADIO_NOT_AVAILABLE
3602  *  GENERIC_FAILURE
3603  *
3604  */
3605 #define RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING 103
3606 
3607 /**
3608  * RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE
3609  *
3610  * Request to query the location where the CDMA subscription shall
3611  * be retrieved
3612  *
3613  * "data" is NULL
3614  *
3615  * "response" is int *
3616  * ((int *)data)[0] is == RIL_CdmaSubscriptionSource
3617  *
3618  * Valid errors:
3619  *  SUCCESS
3620  *  RADIO_NOT_AVAILABLE
3621  *  GENERIC_FAILURE
3622  *  SUBSCRIPTION_NOT_AVAILABLE
3623  *
3624  * See also: RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE
3625  */
3626 #define RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE 104
3627 
3628 /**
3629  * RIL_REQUEST_ISIM_AUTHENTICATION
3630  *
3631  * Request the ISIM application on the UICC to perform AKA
3632  * challenge/response algorithm for IMS authentication
3633  *
3634  * "data" is a const char * containing the challenge string in Base64 format
3635  * "response" is a const char * containing the response in Base64 format
3636  *
3637  * Valid errors:
3638  *  SUCCESS
3639  *  RADIO_NOT_AVAILABLE
3640  *  GENERIC_FAILURE
3641  */
3642 #define RIL_REQUEST_ISIM_AUTHENTICATION 105
3643 
3644 /**
3645  * RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU
3646  *
3647  * Acknowledge successful or failed receipt of SMS previously indicated
3648  * via RIL_UNSOL_RESPONSE_NEW_SMS, including acknowledgement TPDU to send
3649  * as the RP-User-Data element of the RP-ACK or RP-ERROR PDU.
3650  *
3651  * "data" is const char **
3652  * ((const char **)data)[0] is "1" on successful receipt (send RP-ACK)
3653  *                          is "0" on failed receipt (send RP-ERROR)
3654  * ((const char **)data)[1] is the acknowledgement TPDU in hexadecimal format
3655  *
3656  * "response" is NULL
3657  *
3658  * Valid errors:
3659  *  SUCCESS
3660  *  RADIO_NOT_AVAILABLE
3661  *  GENERIC_FAILURE
3662  */
3663 #define RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU 106
3664 
3665 /**
3666  * RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS
3667  *
3668  * Requests to send a SAT/USAT envelope command to SIM.
3669  * The SAT/USAT envelope command refers to 3GPP TS 11.14 and 3GPP TS 31.111.
3670  *
3671  * This request has one difference from RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND:
3672  * the SW1 and SW2 status bytes from the UICC response are returned along with
3673  * the response data, using the same structure as RIL_REQUEST_SIM_IO.
3674  *
3675  * The RIL implementation shall perform the normal processing of a '91XX'
3676  * response in SW1/SW2 to retrieve the pending proactive command and send it
3677  * as an unsolicited response, as RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND does.
3678  *
3679  * "data" is a const char * containing the SAT/USAT command
3680  * in hexadecimal format starting with command tag
3681  *
3682  * "response" is a const RIL_SIM_IO_Response *
3683  *
3684  * Valid errors:
3685  *  RIL_E_SUCCESS
3686  *  RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
3687  *  RIL_E_GENERIC_FAILURE
3688  */
3689 #define RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS 107
3690 
3691 /**
3692  * RIL_REQUEST_VOICE_RADIO_TECH
3693  *
3694  * Query the radio technology type (3GPP/3GPP2) used for voice. Query is valid only
3695  * when radio state is RADIO_STATE_ON
3696  *
3697  * "data" is NULL
3698  * "response" is int *
3699  * ((int *) response)[0] is of type const RIL_RadioTechnology
3700  *
3701  * Valid errors:
3702  *  SUCCESS
3703  *  RADIO_NOT_AVAILABLE
3704  *  GENERIC_FAILURE
3705  */
3706 #define RIL_REQUEST_VOICE_RADIO_TECH 108
3707 
3708 /**
3709  * RIL_REQUEST_GET_CELL_INFO_LIST
3710  *
3711  * Request all of the current cell information known to the radio. The radio
3712  * must a list of all current cells, including the neighboring cells. If for a particular
3713  * cell information isn't known then the appropriate unknown value will be returned.
3714  * This does not cause or change the rate of RIL_UNSOL_CELL_INFO_LIST.
3715  *
3716  * "data" is NULL
3717  *
3718  * "response" is an array of  RIL_CellInfo.
3719  */
3720 #define RIL_REQUEST_GET_CELL_INFO_LIST 109
3721 
3722 /**
3723  * RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE
3724  *
3725  * Sets the minimum time between when RIL_UNSOL_CELL_INFO_LIST should be invoked.
3726  * A value of 0, means invoke RIL_UNSOL_CELL_INFO_LIST when any of the reported
3727  * information changes. Setting the value to INT_MAX(0x7fffffff) means never issue
3728  * a RIL_UNSOL_CELL_INFO_LIST.
3729  *
3730  * "data" is int *
3731  * ((int *)data)[0] is minimum time in milliseconds
3732  *
3733  * "response" is NULL
3734  *
3735  * Valid errors:
3736  *  SUCCESS
3737  *  RADIO_NOT_AVAILABLE
3738  *  GENERIC_FAILURE
3739  */
3740 #define RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE 110
3741 
3742 /**
3743  * RIL_REQUEST_SET_INITIAL_ATTACH_APN
3744  *
3745  * Set an apn to initial attach network
3746  * "response" is NULL
3747  *
3748  * Valid errors:
3749  *  SUCCESS
3750  *  RADIO_NOT_AVAILABLE (radio resetting)
3751  *  GENERIC_FAILURE
3752  *  SUBSCRIPTION_NOT_AVAILABLE
3753  */
3754 #define RIL_REQUEST_SET_INITIAL_ATTACH_APN 111
3755 
3756 /**
3757  * RIL_REQUEST_IMS_REGISTRATION_STATE
3758  *
3759  * Request current IMS registration state
3760  *
3761  * "data" is NULL
3762  *
3763  * "response" is int *
3764  * ((int *)response)[0] is registration state:
3765  *              0 - Not registered
3766  *              1 - Registered
3767  *
3768  * If ((int*)response)[0] is = 1, then ((int *) response)[1]
3769  * must follow with IMS SMS format:
3770  *
3771  * ((int *) response)[1] is of type RIL_RadioTechnologyFamily
3772  *
3773  * Valid errors:
3774  *  SUCCESS
3775  *  RADIO_NOT_AVAILABLE
3776  *  GENERIC_FAILURE
3777  */
3778 #define RIL_REQUEST_IMS_REGISTRATION_STATE 112
3779 
3780 /**
3781  * RIL_REQUEST_IMS_SEND_SMS
3782  *
3783  * Send a SMS message over IMS
3784  *
3785  * "data" is const RIL_IMS_SMS_Message *
3786  *
3787  * "response" is a const RIL_SMS_Response *
3788  *
3789  * Based on the return error, caller decides to resend if sending sms
3790  * fails. SMS_SEND_FAIL_RETRY means retry, and other errors means no retry.
3791  * In case of retry, data is encoded based on Voice Technology available.
3792  *
3793  * Valid errors:
3794  *  SUCCESS
3795  *  RADIO_NOT_AVAILABLE
3796  *  SMS_SEND_FAIL_RETRY
3797  *  FDN_CHECK_FAILURE
3798  *  GENERIC_FAILURE
3799  *
3800  */
3801 #define RIL_REQUEST_IMS_SEND_SMS 113
3802 
3803 /**
3804  * RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC
3805  *
3806  * Request APDU exchange on the basic channel. This command reflects TS 27.007
3807  * "generic SIM access" operation (+CSIM). The modem must ensure proper function
3808  * of GSM/CDMA, and filter commands appropriately. It should filter
3809  * channel management and SELECT by DF name commands.
3810  *
3811  * "data" is a const RIL_SIM_APDU *
3812  * "sessionid" field should be ignored.
3813  *
3814  * "response" is a const RIL_SIM_IO_Response *
3815  *
3816  * Valid errors:
3817  *  SUCCESS
3818  *  RADIO_NOT_AVAILABLE
3819  *  GENERIC_FAILURE
3820  */
3821 #define RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC 114
3822 
3823 /**
3824  * RIL_REQUEST_SIM_OPEN_CHANNEL
3825  *
3826  * Open a new logical channel and select the given application. This command
3827  * reflects TS 27.007 "open logical channel" operation (+CCHO).
3828  *
3829  * "data" is const char * and set to AID value, See ETSI 102.221 and 101.220.
3830  *
3831  * "response" is int *
3832  * ((int *)data)[0] contains the session id of the logical channel.
3833  * ((int *)data)[1] onwards may optionally contain the select response for the
3834  *     open channel command with one byte per integer.
3835  *
3836  * Valid errors:
3837  *  SUCCESS
3838  *  RADIO_NOT_AVAILABLE
3839  *  GENERIC_FAILURE
3840  *  MISSING_RESOURCE
3841  *  NO_SUCH_ELEMENT
3842  */
3843 #define RIL_REQUEST_SIM_OPEN_CHANNEL 115
3844 
3845 /**
3846  * RIL_REQUEST_SIM_CLOSE_CHANNEL
3847  *
3848  * Close a previously opened logical channel. This command reflects TS 27.007
3849  * "close logical channel" operation (+CCHC).
3850  *
3851  * "data" is int *
3852  * ((int *)data)[0] is the session id of logical the channel to close.
3853  *
3854  * "response" is NULL
3855  *
3856  * Valid errors:
3857  *  SUCCESS
3858  *  RADIO_NOT_AVAILABLE
3859  *  GENERIC_FAILURE
3860  */
3861 #define RIL_REQUEST_SIM_CLOSE_CHANNEL 116
3862 
3863 /**
3864  * RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL
3865  *
3866  * Exchange APDUs with a UICC over a previously opened logical channel. This
3867  * command reflects TS 27.007 "generic logical channel access" operation
3868  * (+CGLA). The modem should filter channel management and SELECT by DF name
3869  * commands.
3870  *
3871  * "data" is a const RIL_SIM_APDU*
3872  *
3873  * "response" is a const RIL_SIM_IO_Response *
3874  *
3875  * Valid errors:
3876  *  SUCCESS
3877  *  RADIO_NOT_AVAILABLE
3878  *  GENERIC_FAILURE
3879  */
3880 #define RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL 117
3881 
3882 /**
3883  * RIL_REQUEST_NV_READ_ITEM
3884  *
3885  * Read one of the radio NV items defined in RadioNVItems.java / ril_nv_items.h.
3886  * This is used for device configuration by some CDMA operators.
3887  *
3888  * "data" is a const RIL_NV_ReadItem *
3889  *
3890  * "response" is const char * containing the contents of the NV item
3891  *
3892  * Valid errors:
3893  *  SUCCESS
3894  *  RADIO_NOT_AVAILABLE
3895  *  GENERIC_FAILURE
3896  */
3897 #define RIL_REQUEST_NV_READ_ITEM 118
3898 
3899 /**
3900  * RIL_REQUEST_NV_WRITE_ITEM
3901  *
3902  * Write one of the radio NV items defined in RadioNVItems.java / ril_nv_items.h.
3903  * This is used for device configuration by some CDMA operators.
3904  *
3905  * "data" is a const RIL_NV_WriteItem *
3906  *
3907  * "response" is NULL
3908  *
3909  * Valid errors:
3910  *  SUCCESS
3911  *  RADIO_NOT_AVAILABLE
3912  *  GENERIC_FAILURE
3913  */
3914 #define RIL_REQUEST_NV_WRITE_ITEM 119
3915 
3916 /**
3917  * RIL_REQUEST_NV_WRITE_CDMA_PRL
3918  *
3919  * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage.
3920  * This is used for device configuration by some CDMA operators.
3921  *
3922  * "data" is a const char * containing the PRL as a byte array
3923  *
3924  * "response" is NULL
3925  *
3926  * Valid errors:
3927  *  SUCCESS
3928  *  RADIO_NOT_AVAILABLE
3929  *  GENERIC_FAILURE
3930  */
3931 #define RIL_REQUEST_NV_WRITE_CDMA_PRL 120
3932 
3933 /**
3934  * RIL_REQUEST_NV_RESET_CONFIG
3935  *
3936  * Reset the radio NV configuration to the factory state.
3937  * This is used for device configuration by some CDMA operators.
3938  *
3939  * "data" is int *
3940  * ((int *)data)[0] is 1 to reload all NV items
3941  * ((int *)data)[0] is 2 for erase NV reset (SCRTN)
3942  * ((int *)data)[0] is 3 for factory reset (RTN)
3943  *
3944  * "response" is NULL
3945  *
3946  * Valid errors:
3947  *  SUCCESS
3948  *  RADIO_NOT_AVAILABLE
3949  *  GENERIC_FAILURE
3950  */
3951 #define RIL_REQUEST_NV_RESET_CONFIG 121
3952 
3953  /** RIL_REQUEST_SET_UICC_SUBSCRIPTION
3954  * FIXME This API needs to have more documentation.
3955  *
3956  * Selection/de-selection of a subscription from a SIM card
3957  * "data" is const  RIL_SelectUiccSub*
3958 
3959  *
3960  * "response" is NULL
3961  *
3962  *  Valid errors:
3963  *  SUCCESS
3964  *  RADIO_NOT_AVAILABLE (radio resetting)
3965  *  GENERIC_FAILURE
3966  *  SUBSCRIPTION_NOT_SUPPORTED
3967  *
3968  */
3969 #define RIL_REQUEST_SET_UICC_SUBSCRIPTION  122
3970 
3971 /**
3972  *  RIL_REQUEST_ALLOW_DATA
3973  *
3974  *  Tells the modem whether data calls are allowed or not
3975  *
3976  * "data" is int *
3977  * FIXME slotId and aid will be added.
3978  * ((int *)data)[0] is == 0 to allow data calls
3979  * ((int *)data)[0] is == 1 to disallow data calls
3980  *
3981  * "response" is NULL
3982  *
3983  *  Valid errors:
3984  *
3985  *  SUCCESS
3986  *  RADIO_NOT_AVAILABLE (radio resetting)
3987  *  GENERIC_FAILURE
3988  *
3989  */
3990 #define RIL_REQUEST_ALLOW_DATA  123
3991 
3992 /**
3993  * RIL_REQUEST_GET_HARDWARE_CONFIG
3994  *
3995  * Request all of the current hardware (modem and sim) associated
3996  * with the RIL.
3997  *
3998  * "data" is NULL
3999  *
4000  * "response" is an array of  RIL_HardwareConfig.
4001  */
4002 #define RIL_REQUEST_GET_HARDWARE_CONFIG 124
4003 
4004 /**
4005  * RIL_REQUEST_SIM_AUTHENTICATION
4006  *
4007  * Returns the response of SIM Authentication through RIL to a
4008  * challenge request.
4009  *
4010  * "data" Base64 encoded string containing challenge:
4011  *      int   authContext;          P2 value of authentication command, see P2 parameter in
4012  *                                  3GPP TS 31.102 7.1.2
4013  *      char *authData;             the challenge string in Base64 format, see 3GPP
4014  *                                  TS 31.102 7.1.2
4015  *      char *aid;                  AID value, See ETSI 102.221 8.1 and 101.220 4,
4016  *                                  NULL if no value
4017  *
4018  * "response" Base64 encoded strings containing response:
4019  *      int   sw1;                  Status bytes per 3GPP TS 31.102 section 7.3
4020  *      int   sw2;
4021  *      char *simResponse;          Response in Base64 format, see 3GPP TS 31.102 7.1.2
4022  */
4023 #define RIL_REQUEST_SIM_AUTHENTICATION 125
4024 
4025 /**
4026  * RIL_REQUEST_GET_DC_RT_INFO
4027  *
4028  * Requests the Data Connection Real Time Info
4029  *
4030  * "data" is NULL
4031  *
4032  * "response" is the most recent RIL_DcRtInfo
4033  *
4034  * Valid errors:
4035  *  SUCCESS
4036  *  RADIO_NOT_AVAILABLE
4037  *  GENERIC_FAILURE
4038  *
4039  * See also: RIL_UNSOL_DC_RT_INFO_CHANGED
4040  */
4041 #define RIL_REQUEST_GET_DC_RT_INFO 126
4042 
4043 /**
4044  * RIL_REQUEST_SET_DC_RT_INFO_RATE
4045  *
4046  * This is the minimum number of milliseconds between successive
4047  * RIL_UNSOL_DC_RT_INFO_CHANGED messages and defines the highest rate
4048  * at which RIL_UNSOL_DC_RT_INFO_CHANGED's will be sent. A value of
4049  * 0 means send as fast as possible.
4050  *
4051  * "data" The number of milliseconds as an int
4052  *
4053  * "response" is null
4054  *
4055  * Valid errors:
4056  *  SUCCESS must not fail
4057  */
4058 #define RIL_REQUEST_SET_DC_RT_INFO_RATE 127
4059 
4060 /**
4061  * RIL_REQUEST_SET_DATA_PROFILE
4062  *
4063  * Set data profile in modem
4064  * "data" is an const RIL_DataProfileInfo **
4065  * "datalen" is count * sizeof(const RIL_DataProfileInfo *)
4066  * "response" is NULL
4067  *
4068  * Valid errors:
4069  *  SUCCESS
4070  *  RADIO_NOT_AVAILABLE (radio resetting)
4071  *  GENERIC_FAILURE
4072  *  SUBSCRIPTION_NOT_AVAILABLE
4073  */
4074 #define RIL_REQUEST_SET_DATA_PROFILE 128
4075 
4076 /**
4077  * RIL_REQUEST_SHUTDOWN
4078  *
4079  * Device is shutting down. All further commands are ignored
4080  * and RADIO_NOT_AVAILABLE must be returned.
4081  *
4082  * "data" is null
4083  * "response" is NULL
4084  *
4085  * Valid errors:
4086  *  SUCCESS
4087  *  RADIO_NOT_AVAILABLE
4088  *  GENERIC_FAILURE
4089  */
4090 #define RIL_REQUEST_SHUTDOWN 129
4091 
4092 
4093 /***********************************************************************/
4094 
4095 
4096 #define RIL_UNSOL_RESPONSE_BASE 1000
4097 
4098 /**
4099  * RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED
4100  *
4101  * Indicate when value of RIL_RadioState has changed.
4102  *
4103  * Callee will invoke RIL_RadioStateRequest method on main thread
4104  *
4105  * "data" is NULL
4106  */
4107 
4108 #define RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED 1000
4109 
4110 
4111 /**
4112  * RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED
4113  *
4114  * Indicate when call state has changed
4115  *
4116  * Callee will invoke RIL_REQUEST_GET_CURRENT_CALLS on main thread
4117  *
4118  * "data" is NULL
4119  *
4120  * Response should be invoked on, for example,
4121  * "RING", "BUSY", "NO CARRIER", and also call state
4122  * transitions (DIALING->ALERTING ALERTING->ACTIVE)
4123  *
4124  * Redundent or extraneous invocations are tolerated
4125  */
4126 #define RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED 1001
4127 
4128 
4129 /**
4130  * RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED
4131  *
4132  * Called when the voice network state changed
4133  *
4134  * Callee will invoke the following requests on main thread:
4135  *
4136  * RIL_REQUEST_VOICE_REGISTRATION_STATE
4137  * RIL_REQUEST_OPERATOR
4138  *
4139  * "data" is NULL
4140  *
4141  * FIXME should this happen when SIM records are loaded? (eg, for
4142  * EONS)
4143  */
4144 #define RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED 1002
4145 
4146 /**
4147  * RIL_UNSOL_RESPONSE_NEW_SMS
4148  *
4149  * Called when new SMS is received.
4150  *
4151  * "data" is const char *
4152  * This is a pointer to a string containing the PDU of an SMS-DELIVER
4153  * as an ascii string of hex digits. The PDU starts with the SMSC address
4154  * per TS 27.005 (+CMT:)
4155  *
4156  * Callee will subsequently confirm the receipt of thei SMS with a
4157  * RIL_REQUEST_SMS_ACKNOWLEDGE
4158  *
4159  * No new RIL_UNSOL_RESPONSE_NEW_SMS
4160  * or RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT messages should be sent until a
4161  * RIL_REQUEST_SMS_ACKNOWLEDGE has been received
4162  */
4163 
4164 #define RIL_UNSOL_RESPONSE_NEW_SMS 1003
4165 
4166 /**
4167  * RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT
4168  *
4169  * Called when new SMS Status Report is received.
4170  *
4171  * "data" is const char *
4172  * This is a pointer to a string containing the PDU of an SMS-STATUS-REPORT
4173  * as an ascii string of hex digits. The PDU starts with the SMSC address
4174  * per TS 27.005 (+CDS:).
4175  *
4176  * Callee will subsequently confirm the receipt of the SMS with a
4177  * RIL_REQUEST_SMS_ACKNOWLEDGE
4178  *
4179  * No new RIL_UNSOL_RESPONSE_NEW_SMS
4180  * or RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT messages should be sent until a
4181  * RIL_REQUEST_SMS_ACKNOWLEDGE has been received
4182  */
4183 
4184 #define RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT 1004
4185 
4186 /**
4187  * RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM
4188  *
4189  * Called when new SMS has been stored on SIM card
4190  *
4191  * "data" is const int *
4192  * ((const int *)data)[0] contains the slot index on the SIM that contains
4193  * the new message
4194  */
4195 
4196 #define RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM 1005
4197 
4198 /**
4199  * RIL_UNSOL_ON_USSD
4200  *
4201  * Called when a new USSD message is received.
4202  *
4203  * "data" is const char **
4204  * ((const char **)data)[0] points to a type code, which is
4205  *  one of these string values:
4206  *      "0"   USSD-Notify -- text in ((const char **)data)[1]
4207  *      "1"   USSD-Request -- text in ((const char **)data)[1]
4208  *      "2"   Session terminated by network
4209  *      "3"   other local client (eg, SIM Toolkit) has responded
4210  *      "4"   Operation not supported
4211  *      "5"   Network timeout
4212  *
4213  * The USSD session is assumed to persist if the type code is "1", otherwise
4214  * the current session (if any) is assumed to have terminated.
4215  *
4216  * ((const char **)data)[1] points to a message string if applicable, which
4217  * should always be in UTF-8.
4218  */
4219 #define RIL_UNSOL_ON_USSD 1006
4220 /* Previously #define RIL_UNSOL_ON_USSD_NOTIFY 1006   */
4221 
4222 /**
4223  * RIL_UNSOL_ON_USSD_REQUEST
4224  *
4225  * Obsolete. Send via RIL_UNSOL_ON_USSD
4226  */
4227 #define RIL_UNSOL_ON_USSD_REQUEST 1007
4228 
4229 
4230 /**
4231  * RIL_UNSOL_NITZ_TIME_RECEIVED
4232  *
4233  * Called when radio has received a NITZ time message
4234  *
4235  * "data" is const char * pointing to NITZ time string
4236  * in the form "yy/mm/dd,hh:mm:ss(+/-)tz,dt"
4237  */
4238 #define RIL_UNSOL_NITZ_TIME_RECEIVED  1008
4239 
4240 /**
4241  * RIL_UNSOL_SIGNAL_STRENGTH
4242  *
4243  * Radio may report signal strength rather han have it polled.
4244  *
4245  * "data" is a const RIL_SignalStrength *
4246  */
4247 #define RIL_UNSOL_SIGNAL_STRENGTH  1009
4248 
4249 
4250 /**
4251  * RIL_UNSOL_DATA_CALL_LIST_CHANGED
4252  *
4253  * "data" is an array of RIL_Data_Call_Response_v6 identical to that
4254  * returned by RIL_REQUEST_DATA_CALL_LIST. It is the complete list
4255  * of current data contexts including new contexts that have been
4256  * activated. A data call is only removed from this list when the
4257  * framework sends a RIL_REQUEST_DEACTIVATE_DATA_CALL or the radio
4258  * is powered off/on.
4259  *
4260  * See also: RIL_REQUEST_DATA_CALL_LIST
4261  */
4262 
4263 #define RIL_UNSOL_DATA_CALL_LIST_CHANGED 1010
4264 
4265 /**
4266  * RIL_UNSOL_SUPP_SVC_NOTIFICATION
4267  *
4268  * Reports supplementary service related notification from the network.
4269  *
4270  * "data" is a const RIL_SuppSvcNotification *
4271  *
4272  */
4273 
4274 #define RIL_UNSOL_SUPP_SVC_NOTIFICATION 1011
4275 
4276 /**
4277  * RIL_UNSOL_STK_SESSION_END
4278  *
4279  * Indicate when STK session is terminated by SIM.
4280  *
4281  * "data" is NULL
4282  */
4283 #define RIL_UNSOL_STK_SESSION_END 1012
4284 
4285 /**
4286  * RIL_UNSOL_STK_PROACTIVE_COMMAND
4287  *
4288  * Indicate when SIM issue a STK proactive command to applications
4289  *
4290  * "data" is a const char * containing SAT/USAT proactive command
4291  * in hexadecimal format string starting with command tag
4292  *
4293  */
4294 #define RIL_UNSOL_STK_PROACTIVE_COMMAND 1013
4295 
4296 /**
4297  * RIL_UNSOL_STK_EVENT_NOTIFY
4298  *
4299  * Indicate when SIM notifies applcations some event happens.
4300  * Generally, application does not need to have any feedback to
4301  * SIM but shall be able to indicate appropriate messages to users.
4302  *
4303  * "data" is a const char * containing SAT/USAT commands or responses
4304  * sent by ME to SIM or commands handled by ME, in hexadecimal format string
4305  * starting with first byte of response data or command tag
4306  *
4307  */
4308 #define RIL_UNSOL_STK_EVENT_NOTIFY 1014
4309 
4310 /**
4311  * RIL_UNSOL_STK_CALL_SETUP
4312  *
4313  * Indicate when SIM wants application to setup a voice call.
4314  *
4315  * "data" is const int *
4316  * ((const int *)data)[0] contains timeout value (in milliseconds)
4317  */
4318 #define RIL_UNSOL_STK_CALL_SETUP 1015
4319 
4320 /**
4321  * RIL_UNSOL_SIM_SMS_STORAGE_FULL
4322  *
4323  * Indicates that SMS storage on the SIM is full.  Sent when the network
4324  * attempts to deliver a new SMS message.  Messages cannot be saved on the
4325  * SIM until space is freed.  In particular, incoming Class 2 messages
4326  * cannot be stored.
4327  *
4328  * "data" is null
4329  *
4330  */
4331 #define RIL_UNSOL_SIM_SMS_STORAGE_FULL 1016
4332 
4333 /**
4334  * RIL_UNSOL_SIM_REFRESH
4335  *
4336  * Indicates that file(s) on the SIM have been updated, or the SIM
4337  * has been reinitialized.
4338  *
4339  * In the case where RIL is version 6 or older:
4340  * "data" is an int *
4341  * ((int *)data)[0] is a RIL_SimRefreshResult.
4342  * ((int *)data)[1] is the EFID of the updated file if the result is
4343  * SIM_FILE_UPDATE or NULL for any other result.
4344  *
4345  * In the case where RIL is version 7:
4346  * "data" is a RIL_SimRefreshResponse_v7 *
4347  *
4348  * Note: If the SIM state changes as a result of the SIM refresh (eg,
4349  * SIM_READY -> SIM_LOCKED_OR_ABSENT), RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED
4350  * should be sent.
4351  */
4352 #define RIL_UNSOL_SIM_REFRESH 1017
4353 
4354 /**
4355  * RIL_UNSOL_CALL_RING
4356  *
4357  * Ring indication for an incoming call (eg, RING or CRING event).
4358  * There must be at least one RIL_UNSOL_CALL_RING at the beginning
4359  * of a call and sending multiple is optional. If the system property
4360  * ro.telephony.call_ring.multiple is false then the upper layers
4361  * will generate the multiple events internally. Otherwise the vendor
4362  * ril must generate multiple RIL_UNSOL_CALL_RING if
4363  * ro.telephony.call_ring.multiple is true or if it is absent.
4364  *
4365  * The rate of these events is controlled by ro.telephony.call_ring.delay
4366  * and has a default value of 3000 (3 seconds) if absent.
4367  *
4368  * "data" is null for GSM
4369  * "data" is const RIL_CDMA_SignalInfoRecord * if CDMA
4370  */
4371 #define RIL_UNSOL_CALL_RING 1018
4372 
4373 /**
4374  * RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED
4375  *
4376  * Indicates that SIM state changes.
4377  *
4378  * Callee will invoke RIL_REQUEST_GET_SIM_STATUS on main thread
4379 
4380  * "data" is null
4381  */
4382 #define RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED 1019
4383 
4384 /**
4385  * RIL_UNSOL_RESPONSE_CDMA_NEW_SMS
4386  *
4387  * Called when new CDMA SMS is received
4388  *
4389  * "data" is const RIL_CDMA_SMS_Message *
4390  *
4391  * Callee will subsequently confirm the receipt of the SMS with
4392  * a RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE
4393  *
4394  * No new RIL_UNSOL_RESPONSE_CDMA_NEW_SMS should be sent until
4395  * RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE has been received
4396  *
4397  */
4398 #define RIL_UNSOL_RESPONSE_CDMA_NEW_SMS 1020
4399 
4400 /**
4401  * RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS
4402  *
4403  * Called when new Broadcast SMS is received
4404  *
4405  * "data" can be one of the following:
4406  * If received from GSM network, "data" is const char of 88 bytes
4407  * which indicates each page of a CBS Message sent to the MS by the
4408  * BTS as coded in 3GPP 23.041 Section 9.4.1.2.
4409  * If received from UMTS network, "data" is const char of 90 up to 1252
4410  * bytes which contain between 1 and 15 CBS Message pages sent as one
4411  * packet to the MS by the BTS as coded in 3GPP 23.041 Section 9.4.2.2.
4412  *
4413  */
4414 #define RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS 1021
4415 
4416 /**
4417  * RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL
4418  *
4419  * Indicates that SMS storage on the RUIM is full.  Messages
4420  * cannot be saved on the RUIM until space is freed.
4421  *
4422  * "data" is null
4423  *
4424  */
4425 #define RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL 1022
4426 
4427 /**
4428  * RIL_UNSOL_RESTRICTED_STATE_CHANGED
4429  *
4430  * Indicates a restricted state change (eg, for Domain Specific Access Control).
4431  *
4432  * Radio need send this msg after radio off/on cycle no matter it is changed or not.
4433  *
4434  * "data" is an int *
4435  * ((int *)data)[0] contains a bitmask of RIL_RESTRICTED_STATE_* values.
4436  */
4437 #define RIL_UNSOL_RESTRICTED_STATE_CHANGED 1023
4438 
4439 /**
4440  * RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE
4441  *
4442  * Indicates that the radio system selection module has
4443  * autonomously entered emergency callback mode.
4444  *
4445  * "data" is null
4446  *
4447  */
4448 #define RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE 1024
4449 
4450 /**
4451  * RIL_UNSOL_CDMA_CALL_WAITING
4452  *
4453  * Called when CDMA radio receives a call waiting indication.
4454  *
4455  * "data" is const RIL_CDMA_CallWaiting *
4456  *
4457  */
4458 #define RIL_UNSOL_CDMA_CALL_WAITING 1025
4459 
4460 /**
4461  * RIL_UNSOL_CDMA_OTA_PROVISION_STATUS
4462  *
4463  * Called when CDMA radio receives an update of the progress of an
4464  * OTASP/OTAPA call.
4465  *
4466  * "data" is const int *
4467  *  For CDMA this is an integer OTASP/OTAPA status listed in
4468  *  RIL_CDMA_OTA_ProvisionStatus.
4469  *
4470  */
4471 #define RIL_UNSOL_CDMA_OTA_PROVISION_STATUS 1026
4472 
4473 /**
4474  * RIL_UNSOL_CDMA_INFO_REC
4475  *
4476  * Called when CDMA radio receives one or more info recs.
4477  *
4478  * "data" is const RIL_CDMA_InformationRecords *
4479  *
4480  */
4481 #define RIL_UNSOL_CDMA_INFO_REC 1027
4482 
4483 /**
4484  * RIL_UNSOL_OEM_HOOK_RAW
4485  *
4486  * This is for OEM specific use.
4487  *
4488  * "data" is a byte[]
4489  */
4490 #define RIL_UNSOL_OEM_HOOK_RAW 1028
4491 
4492 /**
4493  * RIL_UNSOL_RINGBACK_TONE
4494  *
4495  * Indicates that nework doesn't have in-band information,  need to
4496  * play out-band tone.
4497  *
4498  * "data" is an int *
4499  * ((int *)data)[0] == 0 for stop play ringback tone.
4500  * ((int *)data)[0] == 1 for start play ringback tone.
4501  */
4502 #define RIL_UNSOL_RINGBACK_TONE 1029
4503 
4504 /**
4505  * RIL_UNSOL_RESEND_INCALL_MUTE
4506  *
4507  * Indicates that framework/application need reset the uplink mute state.
4508  *
4509  * There may be situations where the mute state becomes out of sync
4510  * between the application and device in some GSM infrastructures.
4511  *
4512  * "data" is null
4513  */
4514 #define RIL_UNSOL_RESEND_INCALL_MUTE 1030
4515 
4516 /**
4517  * RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED
4518  *
4519  * Called when CDMA subscription source changed.
4520  *
4521  * "data" is int *
4522  * ((int *)data)[0] is == RIL_CdmaSubscriptionSource
4523  */
4524 #define RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED 1031
4525 
4526 /**
4527  * RIL_UNSOL_CDMA_PRL_CHANGED
4528  *
4529  * Called when PRL (preferred roaming list) changes.
4530  *
4531  * "data" is int *
4532  * ((int *)data)[0] is PRL_VERSION as would be returned by RIL_REQUEST_CDMA_SUBSCRIPTION
4533  */
4534 #define RIL_UNSOL_CDMA_PRL_CHANGED 1032
4535 
4536 /**
4537  * RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE
4538  *
4539  * Called when Emergency Callback Mode Ends
4540  *
4541  * Indicates that the radio system selection module has
4542  * proactively exited emergency callback mode.
4543  *
4544  * "data" is NULL
4545  *
4546  */
4547 #define RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE 1033
4548 
4549 /**
4550  * RIL_UNSOL_RIL_CONNECTED
4551  *
4552  * Called the ril connects and returns the version
4553  *
4554  * "data" is int *
4555  * ((int *)data)[0] is RIL_VERSION
4556  */
4557 #define RIL_UNSOL_RIL_CONNECTED 1034
4558 
4559 /**
4560  * RIL_UNSOL_VOICE_RADIO_TECH_CHANGED
4561  *
4562  * Indicates that voice technology has changed. Contains new radio technology
4563  * as a data in the message.
4564  *
4565  * "data" is int *
4566  * ((int *)data)[0] is of type const RIL_RadioTechnology
4567  *
4568  */
4569 #define RIL_UNSOL_VOICE_RADIO_TECH_CHANGED 1035
4570 
4571 /**
4572  * RIL_UNSOL_CELL_INFO_LIST
4573  *
4574  * Same information as returned by RIL_REQUEST_GET_CELL_INFO_LIST, but returned
4575  * at the rate no greater than specified by RIL_REQUEST_SET_UNSOL_CELL_INFO_RATE.
4576  *
4577  * "data" is NULL
4578  *
4579  * "response" is an array of RIL_CellInfo.
4580  */
4581 #define RIL_UNSOL_CELL_INFO_LIST 1036
4582 
4583 /**
4584  * RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED
4585  *
4586  * Called when IMS registration state has changed
4587  *
4588  * To get IMS registration state and IMS SMS format, callee needs to invoke the
4589  * following request on main thread:
4590  *
4591  * RIL_REQUEST_IMS_REGISTRATION_STATE
4592  *
4593  * "data" is NULL
4594  *
4595  */
4596 #define RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED 1037
4597 
4598 /**
4599  * RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED
4600  *
4601  * Indicated when there is a change in subscription status.
4602  * This event will be sent in the following scenarios
4603  *  - subscription readiness at modem, which was selected by telephony layer
4604  *  - when subscription is deactivated by modem due to UICC card removal
4605  *  - When network invalidates the subscription i.e. attach reject due to authentication reject
4606  *
4607  * "data" is const int *
4608  * ((const int *)data)[0] == 0 for Subscription Deactivated
4609  * ((const int *)data)[0] == 1 for Subscription Activated
4610  *
4611  */
4612 #define RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED 1038
4613 
4614 /**
4615  * RIL_UNSOL_SRVCC_STATE_NOTIFY
4616  *
4617  * Called when Single Radio Voice Call Continuity(SRVCC)
4618  * progress state has changed
4619  *
4620  * "data" is int *
4621  * ((int *)data)[0] is of type const RIL_SrvccState
4622  *
4623  */
4624 
4625 #define RIL_UNSOL_SRVCC_STATE_NOTIFY 1039
4626 
4627 /**
4628  * RIL_UNSOL_HARDWARE_CONFIG_CHANGED
4629  *
4630  * Called when the hardware configuration associated with the RILd changes
4631  *
4632  * "data" is an array of RIL_HardwareConfig
4633  *
4634  */
4635 #define RIL_UNSOL_HARDWARE_CONFIG_CHANGED 1040
4636 
4637 /**
4638  * RIL_UNSOL_DC_RT_INFO_CHANGED
4639  *
4640  * Sent when the DC_RT_STATE changes but the time
4641  * between these messages must not be less than the
4642  * value set by RIL_REQUEST_SET_DC_RT_RATE.
4643  *
4644  * "data" is the most recent RIL_DcRtInfo
4645  *
4646  */
4647 #define RIL_UNSOL_DC_RT_INFO_CHANGED 1041
4648 
4649 /***********************************************************************/
4650 
4651 #if defined(ANDROID_MULTI_SIM)
4652 /**
4653  * RIL_Request Function pointer
4654  *
4655  * @param request is one of RIL_REQUEST_*
4656  * @param data is pointer to data defined for that RIL_REQUEST_*
4657  *        data is owned by caller, and should not be modified or freed by callee
4658  * @param t should be used in subsequent call to RIL_onResponse
4659  * @param datalen the length of data
4660  *
4661  */
4662 typedef void (*RIL_RequestFunc) (int request, void *data,
4663                                     size_t datalen, RIL_Token t, RIL_SOCKET_ID socket_id);
4664 
4665 /**
4666  * This function should return the current radio state synchronously
4667  */
4668 typedef RIL_RadioState (*RIL_RadioStateRequest)(RIL_SOCKET_ID socket_id);
4669 
4670 #else
4671 /* Backward compatible */
4672 
4673 /**
4674  * RIL_Request Function pointer
4675  *
4676  * @param request is one of RIL_REQUEST_*
4677  * @param data is pointer to data defined for that RIL_REQUEST_*
4678  *        data is owned by caller, and should not be modified or freed by callee
4679  * @param t should be used in subsequent call to RIL_onResponse
4680  * @param datalen the length of data
4681  *
4682  */
4683 typedef void (*RIL_RequestFunc) (int request, void *data,
4684                                     size_t datalen, RIL_Token t);
4685 
4686 /**
4687  * This function should return the current radio state synchronously
4688  */
4689 typedef RIL_RadioState (*RIL_RadioStateRequest)();
4690 
4691 #endif
4692 
4693 
4694 /**
4695  * This function returns "1" if the specified RIL_REQUEST code is
4696  * supported and 0 if it is not
4697  *
4698  * @param requestCode is one of RIL_REQUEST codes
4699  */
4700 
4701 typedef int (*RIL_Supports)(int requestCode);
4702 
4703 /**
4704  * This function is called from a separate thread--not the
4705  * thread that calls RIL_RequestFunc--and indicates that a pending
4706  * request should be cancelled.
4707  *
4708  * On cancel, the callee should do its best to abandon the request and
4709  * call RIL_onRequestComplete with RIL_Errno CANCELLED at some later point.
4710  *
4711  * Subsequent calls to  RIL_onRequestComplete for this request with
4712  * other results will be tolerated but ignored. (That is, it is valid
4713  * to ignore the cancellation request)
4714  *
4715  * RIL_Cancel calls should return immediately, and not wait for cancellation
4716  *
4717  * Please see ITU v.250 5.6.1 for how one might implement this on a TS 27.007
4718  * interface
4719  *
4720  * @param t token wants to be canceled
4721  */
4722 
4723 typedef void (*RIL_Cancel)(RIL_Token t);
4724 
4725 typedef void (*RIL_TimedCallback) (void *param);
4726 
4727 /**
4728  * Return a version string for your RIL implementation
4729  */
4730 typedef const char * (*RIL_GetVersion) (void);
4731 
4732 typedef struct {
4733     int version;        /* set to RIL_VERSION */
4734     RIL_RequestFunc onRequest;
4735     RIL_RadioStateRequest onStateRequest;
4736     RIL_Supports supports;
4737     RIL_Cancel onCancel;
4738     RIL_GetVersion getVersion;
4739 } RIL_RadioFunctions;
4740 
4741 typedef struct {
4742     char *apn;
4743     char *protocol;
4744     int authtype;
4745     char *username;
4746     char *password;
4747 } RIL_InitialAttachApn;
4748 
4749 typedef struct {
4750     int authContext;            /* P2 value of authentication command, see P2 parameter in
4751                                    3GPP TS 31.102 7.1.2 */
4752     char *authData;             /* the challenge string in Base64 format, see 3GPP
4753                                    TS 31.102 7.1.2 */
4754     char *aid;                  /* AID value, See ETSI 102.221 8.1 and 101.220 4,
4755                                    NULL if no value. */
4756 } RIL_SimAuthentication;
4757 
4758 #ifdef RIL_SHLIB
4759 struct RIL_Env {
4760     /**
4761      * "t" is parameter passed in on previous call to RIL_Notification
4762      * routine.
4763      *
4764      * If "e" != SUCCESS, then response can be null/is ignored
4765      *
4766      * "response" is owned by caller, and should not be modified or
4767      * freed by callee
4768      *
4769      * RIL_onRequestComplete will return as soon as possible
4770      */
4771     void (*OnRequestComplete)(RIL_Token t, RIL_Errno e,
4772                            void *response, size_t responselen);
4773 
4774 #if defined(ANDROID_MULTI_SIM)
4775     /**
4776      * "unsolResponse" is one of RIL_UNSOL_RESPONSE_*
4777      * "data" is pointer to data defined for that RIL_UNSOL_RESPONSE_*
4778      *
4779      * "data" is owned by caller, and should not be modified or freed by callee
4780      */
4781     void (*OnUnsolicitedResponse)(int unsolResponse, const void *data, size_t datalen, RIL_SOCKET_ID socket_id);
4782 #else
4783     /**
4784      * "unsolResponse" is one of RIL_UNSOL_RESPONSE_*
4785      * "data" is pointer to data defined for that RIL_UNSOL_RESPONSE_*
4786      *
4787      * "data" is owned by caller, and should not be modified or freed by callee
4788      */
4789     void (*OnUnsolicitedResponse)(int unsolResponse, const void *data, size_t datalen);
4790 #endif
4791     /**
4792      * Call user-specifed "callback" function on on the same thread that
4793      * RIL_RequestFunc is called. If "relativeTime" is specified, then it specifies
4794      * a relative time value at which the callback is invoked. If relativeTime is
4795      * NULL or points to a 0-filled structure, the callback will be invoked as
4796      * soon as possible
4797      */
4798 
4799     void (*RequestTimedCallback) (RIL_TimedCallback callback,
4800                                    void *param, const struct timeval *relativeTime);
4801 };
4802 
4803 
4804 /**
4805  *  RIL implementations must defined RIL_Init
4806  *  argc and argv will be command line arguments intended for the RIL implementation
4807  *  Return NULL on error
4808  *
4809  * @param env is environment point defined as RIL_Env
4810  * @param argc number of arguments
4811  * @param argv list fo arguments
4812  *
4813  */
4814 const RIL_RadioFunctions *RIL_Init(const struct RIL_Env *env, int argc, char **argv);
4815 
4816 #else /* RIL_SHLIB */
4817 
4818 /**
4819  * Call this once at startup to register notification routine
4820  *
4821  * @param callbacks user-specifed callback function
4822  */
4823 void RIL_register (const RIL_RadioFunctions *callbacks);
4824 
4825 
4826 /**
4827  *
4828  * RIL_onRequestComplete will return as soon as possible
4829  *
4830  * @param t is parameter passed in on previous call to RIL_Notification
4831  *          routine.
4832  * @param e error code
4833  *          if "e" != SUCCESS, then response can be null/is ignored
4834  * @param response is owned by caller, and should not be modified or
4835  *                 freed by callee
4836  * @param responselen the length of response in byte
4837  */
4838 void RIL_onRequestComplete(RIL_Token t, RIL_Errno e,
4839                            void *response, size_t responselen);
4840 
4841 #if defined(ANDROID_MULTI_SIM)
4842 /**
4843  * @param unsolResponse is one of RIL_UNSOL_RESPONSE_*
4844  * @param data is pointer to data defined for that RIL_UNSOL_RESPONSE_*
4845  *     "data" is owned by caller, and should not be modified or freed by callee
4846  * @param datalen the length of data in byte
4847  */
4848 
4849 void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
4850                                 size_t datalen, RIL_SOCKET_ID socket_id);
4851 #else
4852 /**
4853  * @param unsolResponse is one of RIL_UNSOL_RESPONSE_*
4854  * @param data is pointer to data defined for that RIL_UNSOL_RESPONSE_*
4855  *     "data" is owned by caller, and should not be modified or freed by callee
4856  * @param datalen the length of data in byte
4857  */
4858 
4859 void RIL_onUnsolicitedResponse(int unsolResponse, const void *data,
4860                                 size_t datalen);
4861 #endif
4862 
4863 /**
4864  * Call user-specifed "callback" function on on the same thread that
4865  * RIL_RequestFunc is called. If "relativeTime" is specified, then it specifies
4866  * a relative time value at which the callback is invoked. If relativeTime is
4867  * NULL or points to a 0-filled structure, the callback will be invoked as
4868  * soon as possible
4869  *
4870  * @param callback user-specifed callback function
4871  * @param param parameter list
4872  * @param relativeTime a relative time value at which the callback is invoked
4873  */
4874 
4875 void RIL_requestTimedCallback (RIL_TimedCallback callback,
4876                                void *param, const struct timeval *relativeTime);
4877 
4878 
4879 #endif /* RIL_SHLIB */
4880 
4881 #ifdef __cplusplus
4882 }
4883 #endif
4884 
4885 #endif /*ANDROID_RIL_H*/
4886