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