OSDN Git Service

auto import from //branches/cupcake_rel/...@141571
[android-x86/hardware-ril.git] / include / telephony / ril.h
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 /*
18  * ISSUES:
19  * - SMS retransmit (specifying TP-Message-ID)
20  *
21  */
22
23 /**
24  * TODO
25  *
26  * Supp Service Notification (+CSSN)
27  * GPRS PDP context deactivate notification
28  *  
29  */
30
31
32 #ifndef ANDROID_RIL_H 
33 #define ANDROID_RIL_H 1
34
35 #include <stdlib.h>
36 #include <sys/time.h>
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 #define RIL_VERSION 2
43
44 typedef void * RIL_Token;
45
46 typedef enum {
47     RIL_E_SUCCESS = 0,
48     RIL_E_RADIO_NOT_AVAILABLE = 1,     /* If radio did not start or is resetting */
49     RIL_E_GENERIC_FAILURE = 2,
50     RIL_E_PASSWORD_INCORRECT = 3,      /* for PIN/PIN2 methods only! */
51     RIL_E_SIM_PIN2 = 4,                /* Operation requires SIM PIN2 to be entered */
52     RIL_E_SIM_PUK2 = 5,                /* Operation requires SIM PIN2 to be entered */
53     RIL_E_REQUEST_NOT_SUPPORTED = 6,
54     RIL_E_CANCELLED = 7,
55     RIL_E_OP_NOT_ALLOWED_DURING_VOICE_CALL = 8, /* data ops are not allowed during voice
56                                                    call on a Class C GPRS device */
57     RIL_E_OP_NOT_ALLOWED_BEFORE_REG_TO_NW = 9,  /* data ops are not allowed before device
58                                                    registers in network */
59     RIL_E_SMS_SEND_FAIL_RETRY = 10              /* fail to send sms and need retry */   
60 } RIL_Errno;
61
62 typedef enum {
63     RIL_CALL_ACTIVE = 0,
64     RIL_CALL_HOLDING = 1,
65     RIL_CALL_DIALING = 2,    /* MO call only */
66     RIL_CALL_ALERTING = 3,   /* MO call only */
67     RIL_CALL_INCOMING = 4,   /* MT call only */
68     RIL_CALL_WAITING = 5     /* MT call only */
69 } RIL_CallState;
70
71 typedef enum {
72     RADIO_STATE_OFF = 0,          /* Radio explictly powered off (eg CFUN=0) */
73     RADIO_STATE_UNAVAILABLE = 1,  /* Radio unavailable (eg, resetting or not booted) */
74     RADIO_STATE_SIM_NOT_READY = 2,      /* Radio is on, but the SIM interface is not ready */
75     RADIO_STATE_SIM_LOCKED_OR_ABSENT = 3, /* SIM PIN locked, PUK required, network 
76                                personalization locked, or SIM absent */
77     RADIO_STATE_SIM_READY = 4           /* Radio is on and SIM interface is available */
78 } RIL_RadioState;
79
80 typedef struct {
81     RIL_CallState   state;
82     int             index;      /* GSM Index for use with, eg, AT+CHLD */
83     int             toa;        /* type of address, eg 145 = intl */
84     char            isMpty;     /* nonzero if is mpty call */
85     char            isMT;       /* nonzero if call is mobile terminated */
86     char            als;        /* ALS line indicator if available 
87                                    (0 = line 1) */
88     char            isVoice;    /* nonzero if this is is a voice call */
89
90     char *          number;     /* phone number */
91     char            numberPresentation; /* 0 = Allowed, 
92                                            1 = Restricted,
93                                            2 = Not Specified/Unknown, 
94                                            3 = Payphone */
95 } RIL_Call;
96
97 typedef struct {
98     int             cid;        /* Context ID */
99     int             active;     /* nonzero if context is active */
100     char *          type;       /* X.25, IP, IPV6, etc. */
101     char *          apn;
102     char *          address;
103 } RIL_PDP_Context_Response;
104
105 typedef struct {
106     int messageRef;   /*TP-Message-Reference*/
107     char *ackPDU;     /* or NULL if n/a */
108 } RIL_SMS_Response;
109
110 /** Used by RIL_REQUEST_WRITE_SMS_TO_SIM */
111 typedef struct {
112     int status;     /* Status of message.  See TS 27.005 3.1, "<stat>": */
113                     /*      0 = "REC UNREAD"    */
114                     /*      1 = "REC READ"      */
115                     /*      2 = "STO UNSENT"    */
116                     /*      3 = "STO SENT"      */
117     char * pdu;     /* PDU of message to write, as a hex string. */
118     char * smsc;    /* SMSC address in GSM BCD format prefixed by a length byte
119                        (as expected by TS 27.005) or NULL for default SMSC */
120 } RIL_SMS_WriteArgs;
121
122 /** Used by RIL_REQUEST_DIAL */
123 typedef struct {
124     char * address;
125     int clir;
126             /* (same as 'n' paremeter in TS 27.007 7.7 "+CLIR"
127              * clir == 0 on "use subscription default value"
128              * clir == 1 on "CLIR invocation" (restrict CLI presentation)
129              * clir == 2 on "CLIR suppression" (allow CLI presentation)
130              */
131
132 } RIL_Dial;
133
134 typedef struct {
135     int command;    /* one of the commands listed for TS 27.007 +CRSM*/
136     int fileid;     /* EF id */
137     char *path;     /* "pathid" from TS 27.007 +CRSM command.
138                        Path is in hex asciii format eg "7f205f70"
139                      */
140     int p1;
141     int p2;
142     int p3;
143     char *data;     /* May be NULL*/
144     char *pin2;     /* May be NULL*/
145 } RIL_SIM_IO;
146
147 typedef struct {
148     int sw1;
149     int sw2;
150     char *simResponse;  /* In hex string format ([a-fA-F0-9]*). */
151 } RIL_SIM_IO_Response;
152
153 /* See also com.android.internal.telephony.gsm.CallForwardInfo */
154
155 typedef struct {
156     int             status;     /*
157                                  * For RIL_REQUEST_QUERY_CALL_FORWARD_STATUS
158                                  * status 1 = active, 0 = not active
159                                  *
160                                  * For RIL_REQUEST_SET_CALL_FORWARD:
161                                  * status is:
162                                  * 0 = disable
163                                  * 1 = enable
164                                  * 2 = interrogate
165                                  * 3 = registeration
166                                  * 4 = erasure
167                                  */
168
169     int             reason;     /* from TS 27.007 7.11 "reason" */
170     int             serviceClass;/* From 27.007 +CCFC/+CLCK "class"
171                                     See table for Android mapping from
172                                     MMI service code 
173                                     0 means user doesn't input class */
174     int             toa;        /* "type" from TS 27.007 7.11 */
175     char *          number;     /* "number" from TS 27.007 7.11. May be NULL */
176     int             timeSeconds; /* for CF no reply only */
177 }RIL_CallForwardInfo;
178
179 typedef struct {
180    char * cid;         /* Cell Id (as described in TS 27.005) in 16 bits in GSM
181                         * Primary Scrambling Code (as described in TS 25.331)
182                         *         in 9 bits in UMTS 
183                         * Valid values are hexadecimal 0x0000 - 0xffff.
184                         */
185    int    rssi;        /* Received RSSI in 2G,
186                         * Level index of CPICH Received Signal Code Power in 3G
187                         */
188 } RIL_NeighboringCell;
189
190 /* See RIL_REQUEST_LAST_CALL_FAIL_CAUSE */
191 typedef enum {
192     CALL_FAIL_NORMAL = 16,
193     CALL_FAIL_BUSY = 17,
194     CALL_FAIL_CONGESTION = 34,
195     CALL_FAIL_ACM_LIMIT_EXCEEDED = 68,
196     CALL_FAIL_CALL_BARRED = 240,
197     CALL_FAIL_FDN_BLOCKED = 241,
198     CALL_FAIL_ERROR_UNSPECIFIED = 0xffff
199 } RIL_LastCallFailCause;
200
201 /* See RIL_REQUEST_LAST_PDP_FAIL_CAUSE */
202 typedef enum {
203     PDP_FAIL_BARRED = 8,         /* no retry; prompt user */
204     PDP_FAIL_BAD_APN = 27,       /* no retry; prompt user */
205     PDP_FAIL_USER_AUTHENTICATION = 29, /* no retry; prompt user */
206     PDP_FAIL_SERVICE_OPTION_NOT_SUPPORTED = 32,  /*no retry; prompt user */
207     PDP_FAIL_SERVICE_OPTION_NOT_SUBSCRIBED = 33, /*no retry; prompt user */
208     PDP_FAIL_ERROR_UNSPECIFIED = 0xffff  /* This and all other cases: retry silently */
209 } RIL_LastPDPActivateFailCause;
210
211 /* Used by RIL_UNSOL_SUPP_SVC_NOTIFICATION */
212 typedef struct {
213     int     notificationType;   /*
214                                  * 0 = MO intermediate result code
215                                  * 1 = MT unsolicited result code
216                                  */
217     int     code;               /* See 27.007 7.17
218                                    "code1" for MO
219                                    "code2" for MT. */
220     int     index;              /* CUG index. See 27.007 7.17. */
221     int     type;               /* "type" from 27.007 7.17 (MT only). */
222     char *  number;             /* "number" from 27.007 7.17
223                                    (MT only, may be NULL). */
224 } RIL_SuppSvcNotification;
225
226 /* see RIL_REQUEST_GET_SIM_STATUS */
227 #define RIL_SIM_ABSENT                  0
228 #define RIL_SIM_NOT_READY               1
229 /* RIL_SIM_READY means that the radio state is RADIO_STATE_SIM_READY. 
230  * This is more
231  * than "+CPIN: READY". It also means the radio is ready for SIM I/O
232  */
233 #define RIL_SIM_READY                   2
234 #define RIL_SIM_PIN                     3
235 #define RIL_SIM_PUK                     4
236 #define RIL_SIM_NETWORK_PERSONALIZATION 5
237
238 /* The result of a SIM refresh, returned in data[0] of RIL_UNSOL_SIM_REFRESH */
239 typedef enum {
240     /* A file on SIM has been updated.  data[1] contains the EFID. */
241     SIM_FILE_UPDATE = 0,
242     /* SIM initialized.  All files should be re-read. */
243     SIM_INIT = 1,
244     /* SIM reset.  SIM power required, SIM may be locked and all files should be re-read. */
245     SIM_RESET = 2
246 } RIL_SimRefreshResult;
247
248 /* No restriction at all including voice/SMS/USSD/SS/AV64 and packet data. */
249 #define RIL_RESTRICTED_STATE_NONE           0x00
250 /* Block emergency call due to restriction. But allow all normal voice/SMS/USSD/SS/AV64. */
251 #define RIL_RESTRICTED_STATE_CS_EMERGENCY   0x01
252 /* Block all normal voice/SMS/USSD/SS/AV64 due to restriction. Only Emergency call allowed. */
253 #define RIL_RESTRICTED_STATE_CS_NORMAL      0x02
254 /* Block all voice/SMS/USSD/SS/AV64     including emergency call due to restriction.*/
255 #define RIL_RESTRICTED_STATE_CS_ALL         0x04
256 /* Block packet data access due to restriction. */
257 #define RIL_RESTRICTED_STATE_PS_ALL         0x10
258
259 /** 
260  * RIL_REQUEST_GET_SIM_STATUS
261  *
262  * Requests status of the SIM interface and the SIM card
263  * 
264  * "data" is NULL
265  *
266  * "response" must be an int * pointing to RIL_SIM_* constant 
267  * This should always succeed (RIL_SUCCESS)
268  *
269  * If the radio is off or unavailable, return RIL_SIM_NOT_READY 
270  *
271  * Please note: RIL_SIM_READY means that the radio state 
272  * is RADIO_STATE_SIM_READY.   This is more than "+CPIN: READY". 
273  * It also means the radio is ready for SIM I/O
274  *
275  * Valid errors:
276  *  Must never fail
277  */
278 #define RIL_REQUEST_GET_SIM_STATUS 1
279
280 /**
281  * RIL_REQUEST_ENTER_SIM_PIN
282  *
283  * Supplies SIM PIN. Only called if SIM status is RIL_SIM_PIN
284  *
285  * "data" is const char **
286  * ((const char **)data)[0] is PIN value
287  *
288  * "response" must be NULL
289  *
290  * Valid errors:
291  *  
292  * SUCCESS 
293  * RADIO_NOT_AVAILABLE (radio resetting)
294  * GENERIC_FAILURE
295  * PASSWORD_INCORRECT
296  */
297
298 #define RIL_REQUEST_ENTER_SIM_PIN 2
299
300
301 /**
302  * RIL_REQUEST_ENTER_SIM_PUK
303  *
304  * Supplies SIM PUK and new PIN. 
305  *
306  * "data" is const char **
307  * ((const char **)data)[0] is PUK value
308  * ((const char **)data)[1] is new PIN value
309  *
310  * "response" must be NULL
311  *
312  * Valid errors:
313  *  
314  *  SUCCESS 
315  *  RADIO_NOT_AVAILABLE (radio resetting)
316  *  GENERIC_FAILURE
317  *  PASSWORD_INCORRECT
318  *     (PUK is invalid)
319  */
320
321 #define RIL_REQUEST_ENTER_SIM_PUK 3
322
323 /**
324  * RIL_REQUEST_ENTER_SIM_PIN2
325  *
326  * Supplies SIM PIN2. Only called following operation where SIM_PIN2 was
327  * returned as a a failure from a previous operation.
328  *
329  * "data" is const char **
330  * ((const char **)data)[0] is PIN2 value
331  *
332  * "response" must be NULL
333  *
334  * Valid errors:
335  *  
336  *  SUCCESS 
337  *  RADIO_NOT_AVAILABLE (radio resetting)
338  *  GENERIC_FAILURE
339  *  PASSWORD_INCORRECT
340  */
341
342 #define RIL_REQUEST_ENTER_SIM_PIN2 4
343
344 /**
345  * RIL_REQUEST_ENTER_SIM_PUK2
346  *
347  * Supplies SIM PUK2 and new PIN2. 
348  *
349  * "data" is const char **
350  * ((const char **)data)[0] is PUK2 value
351  * ((const char **)data)[1] is new PIN2 value
352  *
353  * "response" must be NULL
354  *
355  * Valid errors:
356  *  
357  *  SUCCESS 
358  *  RADIO_NOT_AVAILABLE (radio resetting)
359  *  GENERIC_FAILURE
360  *  PASSWORD_INCORRECT
361  *     (PUK2 is invalid)
362  */
363
364 #define RIL_REQUEST_ENTER_SIM_PUK2 5
365
366 /**
367  * RIL_REQUEST_CHANGE_SIM_PIN
368  *
369  * Supplies old SIM PIN and new PIN. 
370  *
371  * "data" is const char **
372  * ((const char **)data)[0] is old PIN value
373  * ((const char **)data)[1] is new PIN value
374  *
375  * "response" must be NULL
376  *
377  * Valid errors:
378  *  
379  *  SUCCESS 
380  *  RADIO_NOT_AVAILABLE (radio resetting)
381  *  GENERIC_FAILURE
382  *  PASSWORD_INCORRECT
383  *     (old PIN is invalid)
384  *      
385  */
386
387 #define RIL_REQUEST_CHANGE_SIM_PIN 6
388
389
390 /**
391  * RIL_REQUEST_CHANGE_SIM_PIN2
392  *
393  * Supplies old SIM PIN2 and new PIN2. 
394  *
395  * "data" is const char **
396  * ((const char **)data)[0] is old PIN2 value
397  * ((const char **)data)[1] is new PIN2 value
398  *
399  * "response" must be NULL
400  *
401  * Valid errors:
402  *  
403  *  SUCCESS 
404  *  RADIO_NOT_AVAILABLE (radio resetting)
405  *  GENERIC_FAILURE
406  *  PASSWORD_INCORRECT
407  *     (old PIN2 is invalid)
408  *      
409  */
410
411 #define RIL_REQUEST_CHANGE_SIM_PIN2 7
412
413 /**
414  * RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION
415  *
416  * Requests that network personlization be deactivated
417  *
418  * "data" is const char **
419  * ((const char **)(data))[0]] is network depersonlization code
420  *
421  * "response" must be NULL
422  *
423  * Valid errors:
424  *  
425  *  SUCCESS 
426  *  RADIO_NOT_AVAILABLE (radio resetting)
427  *  GENERIC_FAILURE
428  *  PASSWORD_INCORRECT
429  *     (code is invalid)
430  */
431
432 #define RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION 8
433
434 /**
435  * RIL_REQUEST_GET_CURRENT_CALLS 
436  *
437  * Requests current call list
438  *
439  * "data" is NULL
440  *
441  * "response" must be a "const RIL_Call **"
442  * 
443  * Valid errors:
444  *  
445  *  SUCCESS 
446  *  RADIO_NOT_AVAILABLE (radio resetting)
447  *  GENERIC_FAILURE
448  *      (request will be made again in a few hundred msec)
449  */
450
451 #define RIL_REQUEST_GET_CURRENT_CALLS 9
452
453
454 /** 
455  * RIL_REQUEST_DIAL
456  *
457  * Initiate voice call
458  *
459  * "data" is const RIL_Dial *
460  * "response" is NULL
461  *  
462  * This method is never used for supplementary service codes
463  *
464  * Valid errors:
465  *  SUCCESS 
466  *  RADIO_NOT_AVAILABLE (radio resetting)
467  *  GENERIC_FAILURE
468  */
469 #define RIL_REQUEST_DIAL 10
470
471 /**
472  * RIL_REQUEST_GET_IMSI
473  *
474  * Get the SIM IMSI
475  *
476  * Only valid when radio state is "RADIO_STATE_SIM_READY"
477  *
478  * "data" is NULL
479  * "response" is a const char * containing the IMSI
480  *
481  * Valid errors:
482  *  SUCCESS 
483  *  RADIO_NOT_AVAILABLE (radio resetting)
484  *  GENERIC_FAILURE
485  */
486
487 #define RIL_REQUEST_GET_IMSI 11
488
489 /**
490  * RIL_REQUEST_HANGUP
491  *
492  * Hang up a specific line (like AT+CHLD=1x)
493  *
494  * "data" is an int * 
495  * (int *)data)[0] contains GSM call index (value of 'x' in CHLD above)
496  *
497  * "response" is NULL
498  *
499  * Valid errors:
500  *  SUCCESS 
501  *  RADIO_NOT_AVAILABLE (radio resetting)
502  *  GENERIC_FAILURE
503  */
504
505 #define RIL_REQUEST_HANGUP 12
506
507 /**
508  * RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND
509  *
510  * Hang up waiting or held (like AT+CHLD=0)
511  *
512  * "data" is NULL
513  * "response" is NULL
514  *
515  * Valid errors:
516  *  SUCCESS 
517  *  RADIO_NOT_AVAILABLE (radio resetting)
518  *  GENERIC_FAILURE
519  */
520
521 #define RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND 13
522
523 /**
524  * RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND
525  *
526  * Hang up waiting or held (like AT+CHLD=1)
527  *
528  * "data" is NULL
529  * "response" is NULL
530  *
531  * Valid errors:
532  *  SUCCESS 
533  *  RADIO_NOT_AVAILABLE (radio resetting)
534  *  GENERIC_FAILURE
535  */
536
537 #define RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND 14
538
539 /**
540  * RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE
541  *
542  * Switch waiting or holding call and active call (like AT+CHLD=2)
543  *
544  * State transitions should be is follows:
545  *
546  * If call 1 is waiting and call 2 is active, then if this re
547  *
548  *   BEFORE                               AFTER
549  * Call 1   Call 2                 Call 1       Call 2
550  * ACTIVE   HOLDING                HOLDING     ACTIVE
551  * ACTIVE   WAITING                HOLDING     ACTIVE
552  * HOLDING  WAITING                HOLDING     ACTIVE
553  * ACTIVE   IDLE                   HOLDING     IDLE
554  * IDLE     IDLE                   IDLE        IDLE
555  *
556  * "data" is NULL
557  * "response" is NULL
558  *
559  * Valid errors:
560  *  SUCCESS 
561  *  RADIO_NOT_AVAILABLE (radio resetting)
562  *  GENERIC_FAILURE
563  */
564
565 #define RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE 15
566 #define RIL_REQUEST_SWITCH_HOLDING_AND_ACTIVE 15
567
568 /**
569  * RIL_REQUEST_CONFERENCE
570  *
571  * Conference holding and active (like AT+CHLD=3)
572
573  * "data" is NULL
574  * "response" is NULL
575  *
576  * Valid errors:
577  *  SUCCESS 
578  *  RADIO_NOT_AVAILABLE (radio resetting)
579  *  GENERIC_FAILURE
580  */
581 #define RIL_REQUEST_CONFERENCE 16
582
583 /**
584  * RIL_REQUEST_UDUB
585  *
586  * Send UDUB (user determined used busy) to ringing or 
587  * waiting call answer)(RIL_BasicRequest r);
588  *
589  * "data" is NULL
590  * "response" is NULL
591  *
592  * Valid errors:
593  *  SUCCESS 
594  *  RADIO_NOT_AVAILABLE (radio resetting)
595  *  GENERIC_FAILURE
596  */
597 #define RIL_REQUEST_UDUB 17
598
599 /**
600  * RIL_REQUEST_LAST_CALL_FAIL_CAUSE
601  *
602  * Requests the failure cause code for the most recently terminated call
603  *
604  * "data" is NULL
605  * "response" is a "int *"
606  * ((int *)response)[0] is an integer cause code defined in TS 24.008
607  *   Annex H or close approximation
608  *
609  * The implementation should return CALL_FAIL_ERROR_UNSPECIFIED for blocked
610  * MO calls by restricted state (See RIL_UNSOL_RESTRICTED_STATE_CHANGED)
611  *
612  * If the implementation does not have access to the exact cause codes,
613  * then it should return one of the values listed in RIL_LastCallFailCause,
614  * as the UI layer needs to distinguish these cases for tone generation or
615  * error notification.
616  *
617  * Valid errors:
618  *  SUCCESS
619  *  RADIO_NOT_AVAILABLE
620  *  GENERIC_FAILURE
621  *
622  * See also: RIL_REQUEST_LAST_PDP_FAIL_CAUSE
623  */
624 #define RIL_REQUEST_LAST_CALL_FAIL_CAUSE 18
625
626 /**
627  * RIL_REQUEST_SIGNAL_STRENGTH
628  *
629  * Requests current signal strength and bit error rate
630  *
631  * Must succeed if radio is on.
632  *
633  * "data" is NULL
634  * "response" is an "int *"
635  * ((int *)response)[0] is received signal strength (0-31, 99)
636  * ((int *)response)[1] is bit error rate (0-7, 99)
637  *  as defined in TS 27.007 8.5
638  *  Other values (eg -1) are not legal
639  *
640  * Valid errors:
641  *  SUCCESS
642  *  RADIO_NOT_AVAILABLE
643  */
644
645 #define RIL_REQUEST_SIGNAL_STRENGTH 19
646 /**
647  * RIL_REQUEST_REGISTRATION_STATE
648  *
649  * Request current registration state
650  *
651  * "data" is NULL
652  * "response" is a "char **"
653  * ((const char **)response)[0] is registration state 0-5 from TS 27.007 7.2
654  * ((const char **)response)[1] is LAC if registered or NULL if not
655  * ((const char **)response)[2] is CID if registered or NULL if not
656  *
657  * LAC and CID are in hexadecimal format.
658  * valid LAC are 0x0000 - 0xffff
659  * valid CID are 0x00000000 - 0x0fffffff
660  *     In GSM, CID is Cell ID (as described in TS 27.007) in 16 bits
661  *     In UMTS, CID is UMTS Cell Identity (as described in TS 25.331) in 28 bits
662  * 
663  * Please note that registration state 4 ("unknown") is treated 
664  * as "out of service" in the Android telephony system
665  *
666  * Valid errors:
667  *  SUCCESS
668  *  RADIO_NOT_AVAILABLE
669  *  GENERIC_FAILURE
670  */
671 #define RIL_REQUEST_REGISTRATION_STATE 20
672
673 /**
674  * RIL_REQUEST_GPRS_REGISTRATION_STATE
675  *
676  * Request current GPRS registration state
677  *
678  * "data" is NULL
679  * "response" is a "char **"
680  * ((const char **)response)[0] is registration state 0-5 from TS 27.007 7.2
681  * ((const char **)response)[1] is LAC if registered or NULL if not
682  * ((const char **)response)[2] is CID if registered or NULL if not
683  * ((const char **)response)[3] indicates the available radio technology, where:
684  *      0 == unknown
685  *      1 == GPRS only
686  *      2 == EDGE
687  *      3 == UMTS
688  *
689  * LAC and CID are in hexadecimal format.
690  * valid LAC are 0x0000 - 0xffff
691  * valid CID are 0x00000000 - 0x0fffffff
692  * 
693  * Please note that registration state 4 ("unknown") is treated 
694  * as "out of service" in the Android telephony system
695  *
696  * Valid errors:
697  *  SUCCESS
698  *  RADIO_NOT_AVAILABLE
699  *  GENERIC_FAILURE
700  */
701 #define RIL_REQUEST_GPRS_REGISTRATION_STATE 21
702
703 /**
704  * RIL_REQUEST_OPERATOR
705  *
706  * Request current operator ONS or EONS
707  *
708  * "data" is NULL
709  * "response" is a "const char **"
710  * ((const char **)response)[0] is long alpha ONS or EONS 
711  *                                  or NULL if unregistered
712  *
713  * ((const char **)response)[1] is short alpha ONS or EONS 
714  *                                  or NULL if unregistered
715  * ((const char **)response)[2] is 5 or 6 digit numeric code (MCC + MNC)
716  *                                  or NULL if unregistered
717  *                                  
718  * Valid errors:
719  *  SUCCESS
720  *  RADIO_NOT_AVAILABLE
721  *  GENERIC_FAILURE
722  */
723 #define RIL_REQUEST_OPERATOR 22
724
725 /**
726  * RIL_REQUEST_RADIO_POWER
727  *
728  * Toggle radio on and off (for "airplane" mode)
729  * "data" is int *
730  * ((int *)data)[0] is > 0 for "Radio On"
731  * ((int *)data)[0] is == 0 for "Radio Off"
732  *
733  * "response" is NULL
734  *
735  * Turn radio on if "on" > 0
736  * Turn radio off if "on" == 0
737  *
738  * Valid errors:
739  *  SUCCESS
740  *  RADIO_NOT_AVAILABLE
741  *  GENERIC_FAILURE
742  */
743 #define RIL_REQUEST_RADIO_POWER 23
744
745 /**
746  * RIL_REQUEST_DTMF
747  *
748  * Send a DTMF tone
749  *
750  * If the implementation is currently playing a tone requested via
751  * RIL_REQUEST_DTMF_START, that tone should be cancelled and the new tone
752  * should be played instead
753  *
754  * "data" is a char *
755  * ((char *)data)[0] is a single character with one of 12 values: 0-9,*,#
756  * ((char *)data)[1] is a single character with one of 3 values:
757  *    'S' -- tone should be played for a short time
758  *    'L' -- tone should be played for a long time
759  * "response" is NULL
760  * 
761  * FIXME should this block/mute microphone?
762  * How does this interact with local DTMF feedback?
763  *
764  * Valid errors:
765  *  SUCCESS
766  *  RADIO_NOT_AVAILABLE
767  *  GENERIC_FAILURE
768  *
769  * See also: RIL_REQUEST_DTMF_STOP, RIL_REQUEST_DTMF_START
770  *
771  */
772 #define RIL_REQUEST_DTMF 24
773
774 /**
775  * RIL_REQUEST_SEND_SMS
776  * 
777  * Send an SMS message
778  *
779  * "data" is const char **
780  * ((const char **)data)[0] is SMSC address in GSM BCD format prefixed
781  *      by a length byte (as expected by TS 27.005) or NULL for default SMSC
782  * ((const char **)data)[1] is SMS in PDU format as an ASCII hex string
783  *      less the SMSC address
784  *      TP-Layer-Length is be "strlen(((const char **)data)[1])/2"
785  *
786  * "response" is a const RIL_SMS_Response *
787  *
788  * Based on the return error, caller decides to resend if sending sms
789  * fails. SMS_SEND_FAIL_RETRY means retry (i.e. error cause is 332) 
790  * and GENERIC_FAILURE means no retry (i.e. error cause is 500)
791  *
792  * Valid errors:
793  *  SUCCESS
794  *  RADIO_NOT_AVAILABLE
795  *  SMS_SEND_FAIL_RETRY
796  *  GENERIC_FAILURE
797  *
798  * FIXME how do we specify TP-Message-Reference if we need to resend?
799  */
800 #define RIL_REQUEST_SEND_SMS 25
801
802
803 /**
804  * RIL_REQUEST_SEND_SMS_EXPECT_MORE
805  * 
806  * Send an SMS message. Identical to RIL_REQUEST_SEND_SMS,
807  * except that more messages are expected to be sent soon. If possible,
808  * keep SMS relay protocol link open (eg TS 27.005 AT+CMMS command)
809  *
810  * "data" is const char **
811  * ((const char **)data)[0] is SMSC address in GSM BCD format prefixed
812  *      by a length byte (as expected by TS 27.005) or NULL for default SMSC
813  * ((const char **)data)[1] is SMS in PDU format as an ASCII hex string
814  *      less the SMSC address
815  *      TP-Layer-Length is be "strlen(((const char **)data)[1])/2"
816  *
817  * "response" is a const RIL_SMS_Response *
818  *
819  * Based on the return error, caller decides to resend if sending sms
820  * fails. SMS_SEND_FAIL_RETRY means retry (i.e. error cause is 332) 
821  * and GENERIC_FAILURE means no retry (i.e. error cause is 500)
822  *
823  * Valid errors:
824  *  SUCCESS
825  *  RADIO_NOT_AVAILABLE
826  *  SMS_SEND_FAIL_RETRY
827  *  GENERIC_FAILURE
828  *
829  */
830 #define RIL_REQUEST_SEND_SMS_EXPECT_MORE 26
831
832
833 /**
834  * RIL_REQUEST_SETUP_DEFAULT_PDP
835  *
836  * Configure and activate PDP context (CID 1) for default IP connection 
837  *
838  * Android Telephony layer will start up pppd process on specified
839  * tty when this request responded to.
840  *
841  * "data" is a const char **
842  * ((const char **)data)[0] is the APN to connect to
843  * ((const char **)data)[1] is the username, or NULL
844  * ((const char **)data)[2] is the password, or NULL
845  *
846  * "response" is a char **
847  * ((char **)response)[0] indicating PDP CID, which is generated by RIL
848  * ((char **)response)[1] indicating the network interface name
849  * ((char **)response)[2] indicating the IP address for this interface
850  *
851  * FIXME may need way to configure QoS settings
852  *
853  * Valid errors:
854  *  SUCCESS
855  *  RADIO_NOT_AVAILABLE
856  *  GENERIC_FAILURE
857  *
858  * See also: RIL_REQUEST_DEACTIVATE_DEFAULT_PDP
859  */
860
861 #define RIL_REQUEST_SETUP_DEFAULT_PDP 27
862
863
864
865 /**
866  * RIL_REQUEST_SIM_IO
867  *
868  * Request SIM I/O operation.
869  * This is similar to the TS 27.007 "restricted SIM" operation
870  * where it assumes all of the EF selection will be done by the
871  * callee.
872  *
873  * "data" is a const RIL_SIM_IO *
874  * Please note that RIL_SIM_IO has a "PIN2" field which may be NULL,
875  * or may specify a PIN2 for operations that require a PIN2 (eg
876  * updating FDN records)
877  *
878  * "response" is a const RIL_SIM_IO_Response *
879  *
880  * Arguments and responses that are unused for certain
881  * values of "command" should be ignored or set to NULL
882  *
883  * Valid errors:
884  *  SUCCESS
885  *  RADIO_NOT_AVAILABLE
886  *  GENERIC_FAILURE
887  *  SIM_PIN2
888  *  SIM_PUK2
889  */
890 #define RIL_REQUEST_SIM_IO 28
891
892 /**
893  * RIL_REQUEST_SEND_USSD
894  *
895  * Send a USSD message
896  *
897  * If a USSD session already exists, the message should be sent in the
898  * context of that session. Otherwise, a new session should be created.
899  *
900  * The network reply should be reported via RIL_UNSOL_ON_USSD
901  *
902  * Only one USSD session may exist at a time, and the session is assumed
903  * to exist until:
904  *   a) The android system invokes RIL_REQUEST_CANCEL_USSD
905  *   b) The implementation sends a RIL_UNSOL_ON_USSD with a type code
906  *      of "0" (USSD-Notify/no further action) or "2" (session terminated)
907  *
908  * "data" is a const char * containing the USSD request in UTF-8 format
909  * "response" is NULL
910  *
911  * Valid errors:
912  *  SUCCESS
913  *  RADIO_NOT_AVAILABLE
914  *  GENERIC_FAILURE
915  *
916  * See also: RIL_REQUEST_CANCEL_USSD, RIL_UNSOL_ON_USSD
917  */
918
919 #define RIL_REQUEST_SEND_USSD 29
920
921 /**
922  * RIL_REQUEST_CANCEL_USSD
923  * 
924  * Cancel the current USSD session if one exists
925  *
926  * "data" is null
927  * "response" is NULL
928  *
929  * Valid errors:
930  *  SUCCESS
931  *  RADIO_NOT_AVAILABLE
932  *  GENERIC_FAILURE 
933  */
934
935 #define RIL_REQUEST_CANCEL_USSD 30
936
937 /**  
938  * RIL_REQUEST_GET_CLIR
939  *
940  * Gets current CLIR status
941  * "data" is NULL
942  * "response" is int *
943  * ((int *)data)[0] is "n" parameter from TS 27.007 7.7
944  * ((int *)data)[1] is "m" parameter from TS 27.007 7.7
945  *
946  * Valid errors:
947  *  SUCCESS
948  *  RADIO_NOT_AVAILABLE
949  *  GENERIC_FAILURE
950  */
951 #define RIL_REQUEST_GET_CLIR 31
952
953 /**
954  * RIL_REQUEST_SET_CLIR
955  *
956  * "data" is int *
957  * ((int *)data)[0] is "n" parameter from TS 27.007 7.7
958  *
959  * "response" is NULL
960  *
961  * Valid errors:
962  *  SUCCESS
963  *  RADIO_NOT_AVAILABLE
964  *  GENERIC_FAILURE
965  */
966 #define RIL_REQUEST_SET_CLIR 32
967
968 /**
969  * RIL_REQUEST_QUERY_CALL_FORWARD_STATUS
970  *
971  * "data" is const RIL_CallForwardInfo *
972  *
973  * "response" is const RIL_CallForwardInfo **
974  * "response" points to an array of RIL_CallForwardInfo *'s, one for
975  * each distinct registered phone number.
976  *
977  * For example, if data is forwarded to +18005551212 and voice is forwarded
978  * to +18005559999, then two separate RIL_CallForwardInfo's should be returned
979  * 
980  * If, however, both data and voice are forwarded to +18005551212, then
981  * a single RIL_CallForwardInfo can be returned with the service class
982  * set to "data + voice = 3")
983  *
984  * Valid errors:
985  *  SUCCESS
986  *  RADIO_NOT_AVAILABLE
987  *  GENERIC_FAILURE
988  */
989 #define RIL_REQUEST_QUERY_CALL_FORWARD_STATUS 33
990
991
992 /**
993  * RIL_REQUEST_SET_CALL_FORWARD
994  *
995  * Configure call forward rule
996  *
997  * "data" is const RIL_CallForwardInfo *
998  * "response" is NULL
999  *  
1000  * Valid errors:
1001  *  SUCCESS
1002  *  RADIO_NOT_AVAILABLE
1003  *  GENERIC_FAILURE
1004  */
1005 #define RIL_REQUEST_SET_CALL_FORWARD 34
1006
1007
1008 /**
1009  * RIL_REQUEST_QUERY_CALL_WAITING
1010  *
1011  * Query current call waiting state
1012  *
1013  * "data" is const int *
1014  * ((const int *)data)[0] is the TS 27.007 service class to query.
1015  * "response" is a const int *
1016  * ((const int *)response)[0] is 0 for "disabled" and 1 for "enabled"
1017  *
1018  * If ((const int *)response)[0] is = 1, then ((const int *)response)[1]
1019  * must follow, with the TS 27.007 service class bit vector of services
1020  * for which call waiting is enabled.
1021  *
1022  * For example, if ((const int *)response)[0]  is 1 and 
1023  * ((const int *)response)[1] is 3, then call waiting is enabled for data
1024  * and voice and disabled for everything else
1025  *
1026  * Valid errors:
1027  *  SUCCESS
1028  *  RADIO_NOT_AVAILABLE
1029  *  GENERIC_FAILURE
1030  */
1031 #define RIL_REQUEST_QUERY_CALL_WAITING 35
1032
1033
1034 /**
1035  * RIL_REQUEST_SET_CALL_WAITING
1036  *
1037  * Configure current call waiting state
1038  *
1039  * "data" is const int *
1040  * ((const int *)data)[0] is 0 for "disabled" and 1 for "enabled"
1041  * ((const int *)data)[1] is the TS 27.007 service class bit vector of
1042  *                           services to modify
1043  * "response" is NULL
1044  *
1045  * Valid errors:
1046  *  SUCCESS
1047  *  RADIO_NOT_AVAILABLE
1048  *  GENERIC_FAILURE
1049  */
1050 #define RIL_REQUEST_SET_CALL_WAITING 36
1051
1052 /**
1053  * RIL_REQUEST_SMS_ACKNOWLEDGE
1054  *
1055  * Acknowledge successful or failed receipt of SMS previously indicated
1056  * via RIL_UNSOL_RESPONSE_NEW_SMS 
1057  *
1058  * "data" is int *
1059  * ((int *)data)[0] is "1" on successful receipt 
1060  *                  (basically, AT+CNMA=1 from TS 27.005
1061  * ((int *)data)[0] is "0" on failed receipt 
1062  *                  (basically, AT+CNMA=2 from TS 27.005)
1063  *
1064  * "response" is NULL
1065  *
1066  * FIXME would like request that specified RP-ACK/RP-ERROR PDU
1067  *
1068  * Valid errors:
1069  *  SUCCESS
1070  *  RADIO_NOT_AVAILABLE
1071  *  GENERIC_FAILURE
1072  */
1073 #define RIL_REQUEST_SMS_ACKNOWLEDGE  37
1074
1075 /**
1076  * RIL_REQUEST_GET_IMEI
1077  *
1078  * Get the device IMEI, including check digit
1079  *
1080  * Valid when RadioState is not RADIO_STATE_UNAVAILABLE
1081  *
1082  * "data" is NULL
1083  * "response" is a const char * containing the IMEI
1084  *
1085  * Valid errors:
1086  *  SUCCESS 
1087  *  RADIO_NOT_AVAILABLE (radio resetting)
1088  *  GENERIC_FAILURE
1089  */
1090
1091 #define RIL_REQUEST_GET_IMEI 38
1092
1093 /**
1094  * RIL_REQUEST_GET_IMEISV
1095  *
1096  * Get the device IMEISV, which should be two decimal digits
1097  *
1098  * Valid when RadioState is not RADIO_STATE_UNAVAILABLE
1099  *
1100  * "data" is NULL
1101  * "response" is a const char * containing the IMEISV
1102  *
1103  * Valid errors:
1104  *  SUCCESS 
1105  *  RADIO_NOT_AVAILABLE (radio resetting)
1106  *  GENERIC_FAILURE
1107  */
1108
1109 #define RIL_REQUEST_GET_IMEISV 39
1110
1111
1112 /**
1113  * RIL_REQUEST_ANSWER
1114  *
1115  * Answer incoming call
1116  *
1117  * Will not be called for WAITING calls.
1118  * RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE will be used in this case
1119  * instead
1120  *
1121  * "data" is NULL
1122  * "response" is NULL
1123  *
1124  * Valid errors:
1125  *  SUCCESS 
1126  *  RADIO_NOT_AVAILABLE (radio resetting)
1127  *  GENERIC_FAILURE
1128  */
1129
1130 #define RIL_REQUEST_ANSWER 40
1131
1132 /**
1133  * RIL_REQUEST_DEACTIVATE_DEFAULT_PDP
1134  *
1135  * Deactivate PDP context created by RIL_REQUEST_SETUP_DEFAULT_PDP
1136  *
1137  * "data" is const char **
1138  * ((char**)data)[0] indicating PDP CID
1139  * "response" is NULL
1140  *
1141  * Valid errors:
1142  *  SUCCESS
1143  *  RADIO_NOT_AVAILABLE
1144  *  GENERIC_FAILURE
1145  *
1146  * See also: RIL_REQUEST_SETUP_DEFAULT_PDP
1147  */
1148
1149 #define RIL_REQUEST_DEACTIVATE_DEFAULT_PDP 41
1150
1151 /**
1152  * RIL_REQUEST_QUERY_FACILITY_LOCK
1153  *
1154  * Query the status of a facility lock state
1155  *
1156  * "data" is const char **
1157  * ((const char **)data)[0] is the facility string code from TS 27.007 7.4  
1158  *                      (eg "AO" for BAOC, "SC" for SIM lock)
1159  * ((const char **)data)[1] is the password, or "" if not required
1160  * ((const char **)data)[2] is the TS 27.007 service class bit vector of
1161  *                           services to query
1162  *
1163  * "response" is an int *
1164  * ((const int *)response) 0 is the TS 27.007 service class bit vector of
1165  *                           services for which the specified barring facility 
1166  *                           is active. "0" means "disabled for all"
1167  * 
1168  *
1169  * Valid errors:
1170  *  SUCCESS
1171  *  RADIO_NOT_AVAILABLE
1172  *  GENERIC_FAILURE
1173  *
1174  */
1175 #define RIL_REQUEST_QUERY_FACILITY_LOCK 42
1176
1177 /**
1178  * RIL_REQUEST_SET_FACILITY_LOCK
1179  *
1180  * Enable/disable one facility lock
1181  *
1182  * "data" is const char **
1183  *
1184  * ((const char **)data)[0] = facility string code from TS 27.007 7.4
1185  * (eg "AO" for BAOC)
1186  * ((const char **)data)[1] = "0" for "unlock" and "1" for "lock"
1187  * ((const char **)data)[2] = password
1188  * ((const char **)data)[3] = string representation of decimal TS 27.007
1189  *                            service class bit vector. Eg, the string
1190  *                            "1" means "set this facility for voice services"
1191  *
1192  * "response" is NULL 
1193  *
1194  * Valid errors:
1195  *  SUCCESS
1196  *  RADIO_NOT_AVAILABLE
1197  *  GENERIC_FAILURE
1198  *
1199  */
1200 #define RIL_REQUEST_SET_FACILITY_LOCK 43
1201
1202 /**
1203  * RIL_REQUEST_CHANGE_BARRING_PASSWORD
1204  *
1205  * Change call barring facility password
1206  *
1207  * "data" is const char **
1208  *
1209  * ((const char **)data)[0] = facility string code from TS 27.007 7.4
1210  * (eg "AO" for BAOC)
1211  * ((const char **)data)[1] = old password
1212  * ((const char **)data)[2] = new password
1213  *
1214  * "response" is NULL 
1215  *
1216  * Valid errors:
1217  *  SUCCESS
1218  *  RADIO_NOT_AVAILABLE
1219  *  GENERIC_FAILURE
1220  *
1221  */
1222 #define RIL_REQUEST_CHANGE_BARRING_PASSWORD 44
1223
1224 /**
1225  * RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE
1226  *
1227  * Query current network selectin mode
1228  *
1229  * "data" is NULL
1230  *
1231  * "response" is int *
1232  * ((const int *)response)[0] is
1233  *     0 for automatic selection
1234  *     1 for manual selection
1235  *
1236  * Valid errors:
1237  *  SUCCESS
1238  *  RADIO_NOT_AVAILABLE
1239  *  GENERIC_FAILURE
1240  *
1241  */
1242 #define RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE 45
1243
1244 /**
1245  * RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC
1246  *
1247  * Specify that the network should be selected automatically
1248  *
1249  * "data" is NULL
1250  * "response" is NULL
1251  *
1252  * This request must not respond until the new operator is selected 
1253  * and registered
1254  *
1255  * Valid errors:
1256  *  SUCCESS
1257  *  RADIO_NOT_AVAILABLE
1258  *  GENERIC_FAILURE
1259  *
1260  */
1261 #define RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC 46
1262
1263 /**
1264  * RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL
1265  *
1266  * Manually select a specified network.
1267  *
1268  * The radio baseband/RIL implementation is expected to fall back to 
1269  * automatic selection mode if the manually selected network should go
1270  * out of range in the future.
1271  *
1272  * "data" is const char * specifying MCCMNC of network to select (eg "310170")
1273  * "response" is NULL
1274  *
1275  * This request must not respond until the new operator is selected 
1276  * and registered
1277  *
1278  * Valid errors:
1279  *  SUCCESS
1280  *  RADIO_NOT_AVAILABLE
1281  *  GENERIC_FAILURE
1282  *
1283  */
1284 #define RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL 47
1285
1286 /**
1287  * RIL_REQUEST_QUERY_AVAILABLE_NETWORKS
1288  *
1289  * Scans for available networks
1290  *
1291  * "data" is NULL
1292  * "response" is const char ** that should be an array of n*4 strings, where
1293  *    n is the number of available networks
1294  * For each available network:
1295  *
1296  * ((const char **)response)[n+0] is long alpha ONS or EONS 
1297  * ((const char **)response)[n+1] is short alpha ONS or EONS 
1298  * ((const char **)response)[n+2] is 5 or 6 digit numeric code (MCC + MNC)
1299  * ((const char **)response)[n+3] is a string value of the status:
1300  *           "unknown"
1301  *           "available"
1302  *           "current"
1303  *           "forbidden"
1304  *
1305  * This request must not respond until the new operator is selected 
1306  * and registered
1307  *
1308  * Valid errors:
1309  *  SUCCESS
1310  *  RADIO_NOT_AVAILABLE
1311  *  GENERIC_FAILURE
1312  *
1313  */
1314 #define RIL_REQUEST_QUERY_AVAILABLE_NETWORKS 48
1315
1316 /**
1317  * RIL_REQUEST_DTMF_START
1318  *
1319  * Start playing a DTMF tone. Continue playing DTMF tone until 
1320  * RIL_REQUEST_DTMF_STOP is received 
1321  *
1322  * If a RIL_REQUEST_DTMF_START is received while a tone is currently playing,
1323  * it should cancel the previous tone and play the new one.
1324  * 
1325  * "data" is a char *
1326  * ((char *)data)[0] is a single character with one of 12 values: 0-9,*,#
1327  * "response" is NULL
1328  * 
1329  * Valid errors:
1330  *  SUCCESS
1331  *  RADIO_NOT_AVAILABLE
1332  *  GENERIC_FAILURE
1333  *
1334  * See also: RIL_REQUEST_DTMF, RIL_REQUEST_DTMF_STOP
1335  */
1336 #define RIL_REQUEST_DTMF_START 49
1337
1338 /**
1339  * RIL_REQUEST_DTMF_STOP
1340  *
1341  * Stop playing a currently playing DTMF tone.
1342  * 
1343  * "data" is NULL
1344  * "response" is NULL
1345  * 
1346  * Valid errors:
1347  *  SUCCESS
1348  *  RADIO_NOT_AVAILABLE
1349  *  GENERIC_FAILURE
1350  *
1351  * See also: RIL_REQUEST_DTMF, RIL_REQUEST_DTMF_START
1352  */
1353 #define RIL_REQUEST_DTMF_STOP 50
1354
1355 /**
1356  * RIL_REQUEST_BASEBAND_VERSION
1357  *
1358  * Return string value indicating baseband version, eg
1359  * response from AT+CGMR
1360  * 
1361  * "data" is NULL
1362  * "response" is const char * containing version string for log reporting
1363  * 
1364  * Valid errors:
1365  *  SUCCESS
1366  *  RADIO_NOT_AVAILABLE
1367  *  GENERIC_FAILURE
1368  *
1369  */
1370 #define RIL_REQUEST_BASEBAND_VERSION 51
1371
1372 /**
1373  * RIL_REQUEST_SEPARATE_CONNECTION
1374  *
1375  * Separate a party from a multiparty call placing the multiparty call
1376  * (less the specified party) on hold and leaving the specified party 
1377  * as the only other member of the current (active) call
1378  *
1379  * Like AT+CHLD=2x
1380  *
1381  * See TS 22.084 1.3.8.2 (iii)
1382  * TS 22.030 6.5.5 "Entering "2X followed by send"
1383  * TS 27.007 "AT+CHLD=2x"
1384  * 
1385  * "data" is an int * 
1386  * (int *)data)[0] contains GSM call index (value of 'x' in CHLD above)
1387  * "response" is NULL
1388  *
1389  * Valid errors:
1390  *  SUCCESS 
1391  *  RADIO_NOT_AVAILABLE (radio resetting)
1392  *  GENERIC_FAILURE
1393  */
1394 #define RIL_REQUEST_SEPARATE_CONNECTION 52
1395
1396
1397 /**
1398  * RIL_REQUEST_SET_MUTE
1399  *
1400  * Turn on or off uplink (microphone) mute.
1401  *
1402  * Will only be sent while voice call is active.
1403  * Will always be reset to "disable mute" when a new voice call is initiated
1404  *
1405  * "data" is an int *
1406  * (int *)data)[0] is 1 for "enable mute" and 0 for "disable mute"
1407  *
1408  * "response" is NULL
1409  *
1410  * Valid errors:
1411  *  SUCCESS 
1412  *  RADIO_NOT_AVAILABLE (radio resetting)
1413  *  GENERIC_FAILURE
1414  */
1415
1416 #define RIL_REQUEST_SET_MUTE 53
1417
1418 /**
1419  * RIL_REQUEST_GET_MUTE
1420  *
1421  * Queries the current state of the uplink mute setting
1422  *
1423  * "data" is NULL
1424  * "response" is an int *
1425  * (int *)response)[0] is 1 for "mute enabled" and 0 for "mute disabled"
1426  *
1427  * Valid errors:
1428  *  SUCCESS 
1429  *  RADIO_NOT_AVAILABLE (radio resetting)
1430  *  GENERIC_FAILURE
1431  */
1432
1433 #define RIL_REQUEST_GET_MUTE 54
1434
1435 /**
1436  * RIL_REQUEST_QUERY_CLIP
1437  *
1438  * Queries the status of the CLIP supplementary service
1439  *
1440  * (for MMI code "*#30#")
1441  *
1442  * "data" is NULL
1443  * "response" is an int *
1444  * (int *)response)[0] is 1 for "CLIP provisioned" 
1445  *                           and 0 for "CLIP not provisioned"
1446  *                           and 2 for "unknown, e.g. no network etc" 
1447  *
1448  * Valid errors:
1449  *  SUCCESS 
1450  *  RADIO_NOT_AVAILABLE (radio resetting)
1451  *  GENERIC_FAILURE
1452  */
1453
1454 #define RIL_REQUEST_QUERY_CLIP 55
1455
1456 /**
1457  * RIL_REQUEST_LAST_PDP_FAIL_CAUSE
1458  * 
1459  * Requests the failure cause code for the most recently failed PDP 
1460  * context activate
1461  *
1462  * "data" is NULL
1463  *
1464  * "response" is a "int *"
1465  * ((int *)response)[0] is an integer cause code defined in TS 24.008
1466  *   section 6.1.3.1.3 or close approximation
1467  *
1468  * If the implementation does not have access to the exact cause codes,
1469  * then it should return one of the values listed in 
1470  * RIL_LastPDPActivateFailCause, as the UI layer needs to distinguish these 
1471  * cases for error notification
1472  * and potential retries.
1473  *
1474  * Valid errors:
1475  *  SUCCESS
1476  *  RADIO_NOT_AVAILABLE
1477  *  GENERIC_FAILURE
1478  *
1479  * See also: RIL_REQUEST_LAST_CALL_FAIL_CAUSE
1480  *  
1481  */ 
1482
1483 #define RIL_REQUEST_LAST_PDP_FAIL_CAUSE 56
1484
1485 /**
1486  * RIL_REQUEST_PDP_CONTEXT_LIST
1487  *
1488  * Queries the status of PDP contexts, returning for each
1489  * its CID, whether or not it is active, and its PDP type,
1490  * APN, and PDP adddress.
1491  *
1492  * "data" is NULL
1493  * "response" is an array of RIL_PDP_Context_Response
1494  *
1495  * Valid errors:
1496  *  SUCCESS 
1497  *  RADIO_NOT_AVAILABLE (radio resetting)
1498  *  GENERIC_FAILURE
1499  */
1500
1501 #define RIL_REQUEST_PDP_CONTEXT_LIST 57
1502
1503 /**
1504  * RIL_REQUEST_RESET_RADIO
1505  *
1506  * Request a radio reset. The RIL implementation may postpone
1507  * the reset until after this request is responded to if the baseband
1508  * is presently busy.
1509  *
1510  * "data" is NULL
1511  * "response" is NULL
1512  *
1513  * The reset action could be delayed for a while
1514  * in case baseband modem is just busy.
1515  *
1516  * Valid errors:
1517  *  SUCCESS 
1518  *  RADIO_NOT_AVAILABLE (radio resetting)
1519  *  GENERIC_FAILURE
1520  */
1521
1522 #define RIL_REQUEST_RESET_RADIO 58
1523
1524 /**
1525  * RIL_REQUEST_OEM_HOOK_RAW
1526  *
1527  * This request reserved for OEM-specific uses. It passes raw byte arrays
1528  * back and forth.
1529  *
1530  * It can be invoked on the Java side from 
1531  * com.android.internal.telephony.Phone.invokeOemRilRequestRaw()
1532  *
1533  * "data" is a char * of bytes copied from the byte[] data argument in java
1534  * "response" is a char * of bytes that will returned via the
1535  * caller's "response" Message here: 
1536  * (byte[])(((AsyncResult)response.obj).result)
1537  *
1538  * An error response here will result in 
1539  * (((AsyncResult)response.obj).result) == null and 
1540  * (((AsyncResult)response.obj).exception) being an instance of
1541  * com.android.internal.telephony.gsm.CommandException
1542  *
1543  * Valid errors:
1544  *  All
1545  */
1546
1547 #define RIL_REQUEST_OEM_HOOK_RAW 59
1548
1549 /**
1550  * RIL_REQUEST_OEM_HOOK_STRINGS
1551  *
1552  * This request reserved for OEM-specific uses. It passes strings
1553  * back and forth.
1554  *
1555  * It can be invoked on the Java side from 
1556  * com.android.internal.telephony.Phone.invokeOemRilRequestStrings()
1557  *
1558  * "data" is a const char **, representing an array of null-terminated UTF-8
1559  * strings copied from the "String[] strings" argument to
1560  * invokeOemRilRequestStrings()
1561  *
1562  * "response" is a const char **, representing an array of null-terminated UTF-8
1563  * stings that will be returned via the caller's response message here:
1564  *
1565  * (String[])(((AsyncResult)response.obj).result)
1566  *
1567  * An error response here will result in 
1568  * (((AsyncResult)response.obj).result) == null and 
1569  * (((AsyncResult)response.obj).exception) being an instance of
1570  * com.android.internal.telephony.gsm.CommandException
1571  *
1572  * Valid errors:
1573  *  All
1574  */
1575
1576 #define RIL_REQUEST_OEM_HOOK_STRINGS 60
1577
1578 /**
1579  * RIL_REQUEST_SCREEN_STATE
1580  *
1581  * Indicates the current state of the screen.  When the screen is off, the
1582  * RIL should notify the baseband to suppress certain notifications (eg,
1583  * signal strength and changes in LAC or CID) in an effort to conserve power.
1584  * These notifications should resume when the screen is on.
1585  *
1586  * "data" is int *
1587  * ((int *)data)[0] is == 1 for "Screen On"
1588  * ((int *)data)[0] is == 0 for "Screen Off"
1589  *
1590  * "response" is NULL
1591  *
1592  * Valid errors:
1593  *  SUCCESS
1594  *  GENERIC_FAILURE
1595  */
1596 #define RIL_REQUEST_SCREEN_STATE 61
1597
1598
1599 /**
1600  * RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION
1601  *
1602  * Enables/disables supplementary service related notifications
1603  * from the network.
1604  *
1605  * Notifications are reported via RIL_UNSOL_SUPP_SVC_NOTIFICATION.
1606  *
1607  * "data" is int *
1608  * ((int *)data)[0] is == 1 for notifications enabled
1609  * ((int *)data)[0] is == 0 for notifications disabled
1610  *
1611  * "response" is NULL
1612  *
1613  * Valid errors:
1614  *  SUCCESS
1615  *  RADIO_NOT_AVAILABLE
1616  *  GENERIC_FAILURE
1617  *
1618  * See also: RIL_UNSOL_SUPP_SVC_NOTIFICATION.
1619  */
1620 #define RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION 62
1621
1622 /**
1623  * RIL_REQUEST_WRITE_SMS_TO_SIM
1624  *
1625  * Stores a SMS message to SIM memory.
1626  *
1627  * "data" is RIL_SMS_WriteArgs *
1628  *
1629  * "response" is int *
1630  * ((const int *)response)[0] is the record index where the message is stored.
1631  *
1632  * Valid errors:
1633  *  SUCCESS
1634  *  GENERIC_FAILURE
1635  *
1636  */
1637 #define RIL_REQUEST_WRITE_SMS_TO_SIM 63
1638
1639 /**
1640  * RIL_REQUEST_DELETE_SMS_ON_SIM
1641  *
1642  * Deletes a SMS message from SIM memory.
1643  *
1644  * "data" is int  *
1645  * ((int *)data)[0] is the record index of the message to delete.
1646  *
1647  * "response" is NULL
1648  *
1649  * Valid errors:
1650  *  SUCCESS
1651  *  GENERIC_FAILURE
1652  *
1653  */
1654 #define RIL_REQUEST_DELETE_SMS_ON_SIM 64
1655
1656 /**
1657  * RIL_REQUEST_SET_BAND_MODE
1658  *
1659  * Assign a specified band for RF configuration.
1660  *
1661  * "data" is int *
1662  * ((int *)data)[0] is == 0 for "unspecified" (selected by baseband automatically)
1663  * ((int *)data)[0] is == 1 for "EURO band" (GSM-900 / DCS-1800 / WCDMA-IMT-2000)
1664  * ((int *)data)[0] is == 2 for "US band" (GSM-850 / PCS-1900 / WCDMA-850 / WCDMA-PCS-1900)
1665  * ((int *)data)[0] is == 3 for "JPN band" (WCDMA-800 / WCDMA-IMT-2000)
1666  * ((int *)data)[0] is == 4 for "AUS band" (GSM-900 / DCS-1800 / WCDMA-850 / WCDMA-IMT-2000)
1667  * ((int *)data)[0] is == 5 for "AUS band 2" (GSM-900 / DCS-1800 / WCDMA-850)
1668  *
1669  * "response" is NULL
1670  *
1671  * Valid errors:
1672  *  SUCCESS
1673  *  RADIO_NOT_AVAILABLE
1674  *  GENERIC_FAILURE
1675  */
1676 #define RIL_REQUEST_SET_BAND_MODE 65
1677
1678 /**
1679  * RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE
1680  *
1681  * Query the list of band mode supported by RF.
1682  *
1683  * "data" is NULL
1684  *
1685  * "response" is int *
1686  * "response" points to an array of int's, the int[0] is the size of array, reset is one for
1687  * each available band mode.
1688  *
1689  *  0 for "unspecified" (selected by baseband automatically)
1690  *  1 for "EURO band" (GSM-900 / DCS-1800 / WCDMA-IMT-2000)
1691  *  2 for "US band" (GSM-850 / PCS-1900 / WCDMA-850 / WCDMA-PCS-1900)
1692  *  3 for "JPN band" (WCDMA-800 / WCDMA-IMT-2000)
1693  *  4 for "AUS band" (GSM-900 / DCS-1800 / WCDMA-850 / WCDMA-IMT-2000)
1694  *  5 for "AUS band 2" (GSM-900 / DCS-1800 / WCDMA-850)
1695  *
1696  * Valid errors:
1697  *  SUCCESS
1698  *  RADIO_NOT_AVAILABLE
1699  *  GENERIC_FAILURE
1700  *
1701  * See also: RIL_REQUEST_SET_BAND_MODE
1702  */
1703 #define RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE 66
1704
1705 /**
1706  * RIL_REQUEST_STK_GET_PROFILE
1707  *
1708  * Requests the profile of SIM tool kit.
1709  * The profile indicates the SAT/USAT features supported by ME.
1710  * The SAT/USAT features refer to 3GPP TS 11.14 and 3GPP TS 31.111
1711  *
1712  * "data" is NULL
1713  *
1714  * "response" is a const char * containing SAT/USAT profile
1715  * in hexadecimal format string starting with first byte of terminal profile
1716  *
1717  * Valid errors:
1718  *  RIL_E_SUCCESS
1719  *  RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
1720  *  RIL_E_GENERIC_FAILURE
1721  */
1722 #define RIL_REQUEST_STK_GET_PROFILE 67
1723
1724 /**
1725  * RIL_REQUEST_STK_SET_PROFILE
1726  *
1727  * Download the STK terminal profile as part of SIM initialization
1728  * procedure
1729  *
1730  * "data" is a const char * containing SAT/USAT profile
1731  * in hexadecimal format string starting with first byte of terminal profile
1732  *
1733  * "response" is NULL
1734  *
1735  * Valid errors:
1736  *  RIL_E_SUCCESS
1737  *  RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
1738  *  RIL_E_GENERIC_FAILURE
1739  */
1740 #define RIL_REQUEST_STK_SET_PROFILE 68
1741
1742 /**
1743  * RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND
1744  *
1745  * Requests to send a SAT/USAT envelope command to SIM.
1746  * The SAT/USAT envelope command refers to 3GPP TS 11.14 and 3GPP TS 31.111
1747  *
1748  * "data" is a const char * containing SAT/USAT command
1749  * in hexadecimal format string starting with command tag
1750  *
1751  * "response" is a const char * containing SAT/USAT response
1752  * in hexadecimal format string starting with first byte of response
1753  * (May be NULL)
1754  *
1755  * Valid errors:
1756  *  RIL_E_SUCCESS
1757  *  RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
1758  *  RIL_E_GENERIC_FAILURE
1759  */
1760 #define RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND 69
1761
1762 /**
1763  * RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE
1764  *
1765  * Requests to send a terminal response to SIM for a received
1766  * proactive command
1767  *
1768  * "data" is a const char * containing SAT/USAT response
1769  * in hexadecimal format string starting with first byte of response data
1770  *
1771  * "response" is NULL
1772  *
1773  * Valid errors:
1774  *  RIL_E_SUCCESS
1775  *  RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
1776  *  RIL_E_GENERIC_FAILURE
1777  */
1778 #define RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE 70
1779
1780 /**
1781  * RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM
1782  *
1783  * When STK application gets RIL_UNSOL_STK_CALL_SETUP, the call actually has
1784  * been initialized by ME already. (We could see the call has been in the 'call
1785  * list') So, STK application needs to accept/reject the call according as user
1786  * operations.
1787  *
1788  * "data" is int *
1789  * ((int *)data)[0] is > 0 for "accept" the call setup
1790  * ((int *)data)[0] is == 0 for "reject" the call setup
1791  *
1792  * "response" is NULL
1793  *
1794  * Valid errors:
1795  *  RIL_E_SUCCESS
1796  *  RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
1797  *  RIL_E_GENERIC_FAILURE
1798  */
1799 #define RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM 71
1800
1801 /**
1802  * RIL_REQUEST_EXPLICIT_CALL_TRANSFER
1803  *
1804  * Connects the two calls and disconnects the subscriber from both calls.
1805  * 
1806  * "data" is NULL
1807  * "response" is NULL
1808  *
1809  * Valid errors:
1810  *  SUCCESS 
1811  *  RADIO_NOT_AVAILABLE (radio resetting)
1812  *  GENERIC_FAILURE
1813  */
1814 #define RIL_REQUEST_EXPLICIT_CALL_TRANSFER 72
1815
1816 /**
1817  * RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE
1818  *
1819  * Requests to set the preferred network type for searching and registering
1820  * (CS/PS domain, RAT, and operation mode)
1821  *
1822  * "data" is int *
1823  * ((int *)data)[0] is == 0 for WCDMA preferred (auto mode)
1824  * ((int *)data)[0] is == 1 for GSM only
1825  * ((int *)data)[0] is == 2 for WCDMA only
1826  *
1827  * "response" is NULL
1828  *
1829  * Valid errors:
1830  *  RIL_E_SUCCESS
1831  *  RIL_E_RADIO_NOT_AVAILABLE (radio resetting)
1832  *  RIL_E_GENERIC_FAILURE
1833  */
1834 #define RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE 73
1835
1836 /**
1837  * RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE
1838  *
1839  * Query the preferred network type (CS/PS domain, RAT, and operation mode)
1840  * for searching and registering
1841  *
1842  * "data" is NULL
1843  *
1844  * "response" is int *
1845  * ((int *)response)[0] is == 0 for WCDMA preferred (auto mode)
1846  * ((int *)response)[0] is == 1 for GSM only
1847  * ((int *)response)[0] is == 2 for WCDMA only
1848  *
1849  * Valid errors:
1850  *  SUCCESS
1851  *  RADIO_NOT_AVAILABLE
1852  *  GENERIC_FAILURE
1853  *
1854  * See also: RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE
1855  */
1856 #define RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE 74
1857
1858 /**
1859  * RIL_REQUEST_NEIGHBORING_CELL_IDS
1860  *
1861  * Request neighboring cell id in GSM network
1862  *
1863  * "data" is NULL
1864  * "response" must be a " const RIL_NeighboringCell** "
1865  *
1866  * Valid errors:
1867  *  SUCCESS
1868  *  RADIO_NOT_AVAILABLE
1869  *  GENERIC_FAILURE
1870  */
1871 #define RIL_REQUEST_GET_NEIGHBORING_CELL_IDS 75
1872
1873 /**
1874  * RIL_REQUEST_SET_LOCATION_UPDATES
1875  *
1876  * Enables/disables network state change notifications due to changes in
1877  * LAC and/or CID (basically, +CREG=2 vs. +CREG=1).  
1878  *
1879  * Note:  The RIL implementation should default to "updates enabled"
1880  * when the screen is on and "updates disabled" when the screen is off.
1881  *
1882  * "data" is int *
1883  * ((int *)data)[0] is == 1 for updates enabled (+CREG=2)
1884  * ((int *)data)[0] is == 0 for updates disabled (+CREG=1)
1885  *
1886  * "response" is NULL
1887  *
1888  * Valid errors:
1889  *  SUCCESS
1890  *  RADIO_NOT_AVAILABLE
1891  *  GENERIC_FAILURE
1892  *
1893  * See also: RIL_REQUEST_SCREEN_STATE, RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED
1894  */
1895 #define RIL_REQUEST_SET_LOCATION_UPDATES 76
1896
1897 /***********************************************************************/
1898
1899 #define RIL_UNSOL_RESPONSE_BASE 1000
1900
1901 /**
1902  * RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED
1903  *
1904  * Indicate when value of RIL_RadioState has changed.
1905  *
1906  * Callee will invoke RIL_RadioStateRequest method on main thread
1907  *
1908  * "data" is NULL
1909  */
1910
1911 #define RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED 1000
1912
1913
1914 /**
1915  * RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED
1916  *
1917  * Indicate when call state has changed
1918  *
1919  * Callee will invoke RIL_REQUEST_GET_CURRENT_CALLS on main thread
1920  *
1921  * "data" is NULL
1922  *
1923  * Response should be invoked on, for example, 
1924  * "RING", "BUSY", "NO CARRIER", and also call state
1925  * transitions (DIALING->ALERTING ALERTING->ACTIVE)
1926  *
1927  * Redundent or extraneous invocations are tolerated
1928  */
1929 #define RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED 1001
1930
1931
1932 /**
1933  * RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED 
1934  *
1935  * Called when network state, operator name, or GPRS state has changed
1936  * Basically on, +CREG and +CGREG
1937  *
1938  * Callee will invoke the following requests on main thread:
1939  *
1940  * RIL_REQUEST_REGISTRATION_STATE
1941  * RIL_REQUEST_GPRS_REGISTRATION_STATE
1942  * RIL_REQUEST_OPERATOR
1943  *
1944  * "data" is NULL
1945  *
1946  * FIXME should this happen when SIM records are loaded? (eg, for
1947  * EONS)
1948  */
1949 #define RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED 1002
1950
1951 /**
1952  * RIL_UNSOL_RESPONSE_NEW_SMS
1953  *
1954  * Called when new SMS is received.
1955  * 
1956  * "data" is const char *
1957  * This is a pointer to a string containing the PDU of an SMS-DELIVER
1958  * as an ascii string of hex digits. The PDU starts with the SMSC address
1959  * per TS 27.005 (+CMT:)
1960  *
1961  * Callee will subsequently confirm the receipt of thei SMS with a
1962  * RIL_REQUEST_SMS_ACKNOWLEDGE
1963  *
1964  * No new RIL_UNSOL_RESPONSE_NEW_SMS 
1965  * or RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT messages should be sent until a
1966  * RIL_REQUEST_SMS_ACKNOWLEDGE has been received
1967  */
1968
1969 #define RIL_UNSOL_RESPONSE_NEW_SMS 1003
1970
1971 /**
1972  * RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT
1973  *
1974  * Called when new SMS Status Report is received.
1975  * 
1976  * "data" is const char *
1977  * This is a pointer to a string containing the PDU of an SMS-STATUS-REPORT
1978  * as an ascii string of hex digits. The PDU starts with the SMSC address
1979  * per TS 27.005 (+CDS:).
1980  *
1981  * Callee will subsequently confirm the receipt of the SMS with a
1982  * RIL_REQUEST_SMS_ACKNOWLEDGE
1983  *
1984  * No new RIL_UNSOL_RESPONSE_NEW_SMS 
1985  * or RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT messages should be sent until a
1986  * RIL_REQUEST_SMS_ACKNOWLEDGE has been received
1987  */
1988
1989 #define RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT 1004
1990
1991 /**
1992  * RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM
1993  *
1994  * Called when new SMS has been stored on SIM card
1995  * 
1996  * "data" is const int *
1997  * ((const int *)data)[0] contains the slot index on the SIM that contains
1998  * the new message
1999  */
2000
2001 #define RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM 1005
2002
2003 /**
2004  * RIL_UNSOL_ON_USSD
2005  *
2006  * Called when a new USSD message is received.
2007  *
2008  * "data" is const char **
2009  * ((const char **)data)[0] points to a type code, which is 
2010  *  one of these string values:
2011  *      "0"   USSD-Notify -- text in ((const char **)data)[1]
2012  *      "1"   USSD-Request -- text in ((const char **)data)[1]
2013  *      "2"   Session terminated by network
2014  *      "3"   other local client (eg, SIM Toolkit) has responded
2015  *      "4"   Operation not supported
2016  *      "5"   Network timeout
2017  *
2018  * The USSD session is assumed to persist if the type code is "1", otherwise
2019  * the current session (if any) is assumed to have terminated.
2020  *
2021  * ((const char **)data)[1] points to a message string if applicable, which
2022  * should always be in UTF-8.
2023  */
2024 #define RIL_UNSOL_ON_USSD 1006
2025 /* Previously #define RIL_UNSOL_ON_USSD_NOTIFY 1006   */
2026
2027 /**
2028  * RIL_UNSOL_ON_USSD_REQUEST
2029  *
2030  * Obsolete. Send via RIL_UNSOL_ON_USSD
2031  */
2032 #define RIL_UNSOL_ON_USSD_REQUEST 1007 
2033
2034
2035 /**
2036  * RIL_UNSOL_NITZ_TIME_RECEIVED
2037  *
2038  * Called when radio has received a NITZ time message
2039  *
2040  * "data" is const char * pointing to NITZ time string
2041  * in the form "yy/mm/dd,hh:mm:ss(+/-)tz,dt"
2042  */
2043 #define RIL_UNSOL_NITZ_TIME_RECEIVED  1008
2044
2045 /**
2046  * RIL_UNSOL_SIGNAL_STRENGTH
2047  *
2048  * Radio may report signal strength rather han have it polled.
2049  *
2050  * "data" is an "int *"
2051  * ((int *)response)[0] is received signal strength (0-31, 99)
2052  * ((int *)response)[1] is bit error rate (0-7, 99)
2053  *  as defined in TS 27.007 8.5
2054  *  Other values (eg -1) are not legal
2055  */
2056 #define RIL_UNSOL_SIGNAL_STRENGTH  1009
2057
2058
2059 /**
2060  * RIL_UNSOL_PDP_CONTEXT_LIST_CHANGED
2061  *
2062  * Indicate a PDP context state has changed, or a new context
2063  * has been activated or deactivated
2064  *
2065  * "data" is an array of RIL_PDP_Context_Response identical to that
2066  * returned by RIL_REQUEST_PDP_CONTEXT_LIST
2067  *
2068  * See also: RIL_REQUEST_PDP_CONTEXT_LIST
2069  */
2070
2071 #define RIL_UNSOL_PDP_CONTEXT_LIST_CHANGED 1010
2072
2073 /**
2074  * RIL_UNSOL_SUPP_SVC_NOTIFICATION
2075  *
2076  * Reports supplementary service related notification from the network.
2077  *
2078  * "data" is a const RIL_SuppSvcNotification *
2079  *
2080  */
2081
2082 #define RIL_UNSOL_SUPP_SVC_NOTIFICATION 1011
2083
2084 /**
2085  * RIL_UNSOL_STK_SESSION_END
2086  *
2087  * Indicate when STK session is terminated by SIM.
2088  *
2089  * "data" is NULL
2090  */
2091 #define RIL_UNSOL_STK_SESSION_END 1012
2092
2093 /**
2094  * RIL_UNSOL_STK_PROACTIVE_COMMAND
2095  *
2096  * Indicate when SIM issue a STK proactive command to applications
2097  *
2098  * "data" is a const char * containing SAT/USAT proactive command
2099  * in hexadecimal format string starting with command tag
2100  *
2101  */
2102 #define RIL_UNSOL_STK_PROACTIVE_COMMAND 1013
2103
2104 /**
2105  * RIL_UNSOL_STK_EVENT_NOTIFY
2106  *
2107  * Indicate when SIM notifies applcations some event happens.
2108  * Generally, application does not need to have any feedback to
2109  * SIM but shall be able to indicate appropriate messages to users.
2110  *
2111  * "data" is a const char * containing SAT/USAT commands or responses
2112  * sent by ME to SIM or commands handled by ME, in hexadecimal format string
2113  * starting with first byte of response data or command tag
2114  *
2115  */
2116 #define RIL_UNSOL_STK_EVENT_NOTIFY 1014
2117
2118 /**
2119  * RIL_UNSOL_STK_CALL_SETUP
2120  *
2121  * Indicate when SIM wants application to setup a voice call.
2122  *
2123  * "data" is const int *
2124  * ((const int *)data)[0] contains timeout value (in milliseconds)
2125  */
2126 #define RIL_UNSOL_STK_CALL_SETUP 1015
2127
2128 /**
2129  * RIL_UNSOL_SIM_SMS_STORAGE_FULL
2130  *
2131  * Indicates that SMS storage on the SIM is full.  Sent when the network
2132  * attempts to deliver a new SMS message.  Messages cannot be saved on the
2133  * SIM until space is freed.  In particular, incoming Class 2 messages
2134  * cannot be stored.
2135  *
2136  * "data" is null
2137  *
2138  */
2139 #define RIL_UNSOL_SIM_SMS_STORAGE_FULL 1016
2140
2141 /**
2142  * RIL_UNSOL_SIM_REFRESH
2143  *
2144  * Indicates that file(s) on the SIM have been updated, or the SIM
2145  * has been reinitialized.
2146  *
2147  * "data" is an int *
2148  * ((int *)data)[0] is a RIL_SimRefreshResult.
2149  * ((int *)data)[1] is the EFID of the updated file if the result is
2150  * SIM_FILE_UPDATE or NULL for any other result.
2151  *
2152  * Note: If the radio state changes as a result of the SIM refresh (eg,
2153  * SIM_READY -> SIM_LOCKED_OR_ABSENT), RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED
2154  * should be sent.
2155  */
2156 #define RIL_UNSOL_SIM_REFRESH 1017
2157
2158 /**
2159  * RIL_UNSOL_CALL_RING
2160  *
2161  * Ring indication for an incoming call (eg, RING or CRING event).
2162  *
2163  * "data" is null
2164  */
2165 #define RIL_UNSOL_CALL_RING 1018
2166
2167
2168 /*
2169  * Import four CDMA notifications 1019 - 1022. Need fix when do real CDMA merge.
2170  */
2171
2172 /**
2173  * RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED
2174  *
2175  * Indicates that SIM state changes.
2176  *
2177  * Callee will invoke RIL_REQUEST_GET_SIM_STATUS on main thread
2178  * "data" is null
2179  */
2180 #define RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED 1019
2181
2182 /**
2183  * RIL_UNSOL_RESPONSE_CDMA_NEW_SMS
2184  *
2185  * Called when new CDMA SMS is received
2186  *
2187  * "data" is const RIL_CDMA_SMS_Message *
2188  *
2189  * Callee will subsequently confirm the receipt of the SMS with
2190  * a RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE
2191  *
2192  * No new RIL_UNSOL_RESPONSE_CDMA_NEW_SMS should be sent until
2193  * RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE has been received
2194  */
2195 #define RIL_UNSOL_RESPONSE_CDMA_NEW_SMS 1020
2196
2197 /**
2198  * RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS
2199  *
2200  * Called when new Broadcast SMS is received
2201  *
2202  * "data" is const char * of 88 bytes which indicates each page
2203  * of a CBS Message sent to the MS by the BTS as coded in 3GPP
2204  * 23.041 Section 9.4.1.1
2205  */
2206 #define RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS 1021
2207         
2208 /**
2209  * RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL
2210  *
2211  * Indicates that SMS storage on the RUIM is full.  Messages
2212  * cannot be saved on the RUIM until space is freed.
2213  *
2214  * "data" is null
2215  */
2216 #define RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL 1022       
2217         
2218 /**
2219  * RIL_UNSOL_RESTRICTED_STATE_CHANGED
2220  *
2221  * Indicates a restricted state change (eg, for Domain Specific Access Control).
2222  *
2223  * Radio need send this msg after radio off/on cycle no matter it is changed or not.
2224  *
2225  * "data" is an int *
2226  * ((int *)data)[0] contains a bitmask of RIL_RESTRICTED_STATE_* values.
2227  */
2228 #define RIL_UNSOL_RESTRICTED_STATE_CHANGED 1023
2229
2230
2231
2232 /***********************************************************************/
2233
2234
2235 /**
2236  * RIL_Request Function pointer
2237  *
2238  * @param request is one of RIL_REQUEST_*
2239  * @param data is pointer to data defined for that RIL_REQUEST_*
2240  *        data is owned by caller, and should not be modified or freed by callee
2241  * @param t should be used in subsequent call to RIL_onResponse
2242  * @param datalen the length of data
2243  *
2244  */
2245 typedef void (*RIL_RequestFunc) (int request, void *data, 
2246                                     size_t datalen, RIL_Token t);
2247
2248 /**
2249  * This function should return the current radio state synchronously
2250  */
2251 typedef RIL_RadioState (*RIL_RadioStateRequest)();
2252
2253 /**
2254  * This function returns "1" if the specified RIL_REQUEST code is
2255  * supported and 0 if it is not
2256  *
2257  * @param requestCode is one of RIL_REQUEST codes
2258  */
2259
2260 typedef int (*RIL_Supports)(int requestCode);
2261
2262 /**
2263  * This function is called from a separate thread--not the 
2264  * thread that calls RIL_RequestFunc--and indicates that a pending
2265  * request should be cancelled.
2266  * 
2267  * On cancel, the callee should do its best to abandon the request and
2268  * call RIL_onRequestComplete with RIL_Errno CANCELLED at some later point.
2269  *
2270  * Subsequent calls to  RIL_onRequestComplete for this request with
2271  * other results will be tolerated but ignored. (That is, it is valid
2272  * to ignore the cancellation request)
2273  *
2274  * RIL_Cancel calls should return immediately, and not wait for cancellation
2275  *
2276  * Please see ITU v.250 5.6.1 for how one might implement this on a TS 27.007 
2277  * interface
2278  *
2279  * @param t token wants to be canceled
2280  */
2281
2282 typedef void (*RIL_Cancel)(RIL_Token t);
2283
2284 typedef void (*RIL_TimedCallback) (void *param);
2285
2286 /**
2287  * Return a version string for your RIL implementation
2288  */
2289 typedef const char * (*RIL_GetVersion) (void);
2290
2291 typedef struct {
2292     int version;        /* set to RIL_VERSION */
2293     RIL_RequestFunc onRequest;
2294     RIL_RadioStateRequest onStateRequest;
2295     RIL_Supports supports;
2296     RIL_Cancel onCancel;
2297     RIL_GetVersion getVersion;
2298 } RIL_RadioFunctions;
2299
2300 #ifdef RIL_SHLIB
2301 struct RIL_Env {
2302     /**
2303      * "t" is parameter passed in on previous call to RIL_Notification
2304      * routine.
2305      *
2306      * If "e" != SUCCESS, then response can be null/is ignored
2307      *
2308      * "response" is owned by caller, and should not be modified or 
2309      * freed by callee
2310      *
2311      * RIL_onRequestComplete will return as soon as possible
2312      */
2313     void (*OnRequestComplete)(RIL_Token t, RIL_Errno e, 
2314                            void *response, size_t responselen);
2315
2316     /**
2317      * "unsolResponse" is one of RIL_UNSOL_RESPONSE_*
2318      * "data" is pointer to data defined for that RIL_UNSOL_RESPONSE_*
2319      *
2320      * "data" is owned by caller, and should not be modified or freed by callee
2321      */
2322
2323     void (*OnUnsolicitedResponse)(int unsolResponse, const void *data, 
2324                                     size_t datalen);
2325
2326     /**
2327      * Call user-specifed "callback" function on on the same thread that 
2328      * RIL_RequestFunc is called. If "relativeTime" is specified, then it specifies
2329      * a relative time value at which the callback is invoked. If relativeTime is
2330      * NULL or points to a 0-filled structure, the callback will be invoked as
2331      * soon as possible
2332      */
2333
2334     void (*RequestTimedCallback) (RIL_TimedCallback callback, 
2335                                    void *param, const struct timeval *relativeTime);   
2336 };
2337
2338
2339 /** 
2340  *  RIL implementations must defined RIL_Init 
2341  *  argc and argv will be command line arguments intended for the RIL implementation
2342  *  Return NULL on error
2343  *
2344  * @param env is environment point defined as RIL_Env
2345  * @param argc number of arguments
2346  * @param argv list fo arguments
2347  *
2348  */
2349 const RIL_RadioFunctions *RIL_Init(const struct RIL_Env *env, int argc, char **argv);
2350
2351 #else /* RIL_SHLIB */
2352
2353 /**
2354  * Call this once at startup to register notification routine
2355  *
2356  * @param callbacks user-specifed callback function
2357  */
2358 void RIL_register (const RIL_RadioFunctions *callbacks);
2359
2360
2361 /**
2362  *
2363  * RIL_onRequestComplete will return as soon as possible
2364  *
2365  * @param t is parameter passed in on previous call to RIL_Notification
2366  *          routine.
2367  * @param e error code
2368  *          if "e" != SUCCESS, then response can be null/is ignored
2369  * @param response is owned by caller, and should not be modified or
2370  *                 freed by callee
2371  * @param responselen the length of response in byte
2372  */
2373 void RIL_onRequestComplete(RIL_Token t, RIL_Errno e, 
2374                            void *response, size_t responselen);
2375
2376 /**
2377  * @param unsolResponse is one of RIL_UNSOL_RESPONSE_*
2378  * @param data is pointer to data defined for that RIL_UNSOL_RESPONSE_*
2379  *     "data" is owned by caller, and should not be modified or freed by callee
2380  * @param datalen the length of data in byte
2381  */
2382
2383 void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, 
2384                                 size_t datalen);
2385
2386
2387 /**
2388  * Call user-specifed "callback" function on on the same thread that 
2389  * RIL_RequestFunc is called. If "relativeTime" is specified, then it specifies
2390  * a relative time value at which the callback is invoked. If relativeTime is
2391  * NULL or points to a 0-filled structure, the callback will be invoked as
2392  * soon as possible
2393  *
2394  * @param callback user-specifed callback function
2395  * @param param parameter list
2396  * @param relativeTime a relative time value at which the callback is invoked
2397  */
2398
2399 void RIL_requestTimedCallback (RIL_TimedCallback callback, 
2400                                void *param, const struct timeval *relativeTime);
2401
2402
2403 #endif /* RIL_SHLIB */
2404
2405 #ifdef __cplusplus
2406 }
2407 #endif
2408
2409 #endif /*ANDROID_RIL_H*/
2410