CommandsInterface.java revision 767a662ecde33c3979bf02b793d392aca0403162
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
17package com.android.internal.telephony;
18
19import android.os.Message;
20import android.os.Handler;
21
22
23/**
24 * {@hide}
25 */
26public interface CommandsInterface {
27    enum RadioState {
28        RADIO_OFF,         /* Radio explictly powered off (eg CFUN=0) */
29        RADIO_UNAVAILABLE, /* Radio unavailable (eg, resetting or not booted) */
30        SIM_NOT_READY,     /* Radio is on, but the SIM interface is not ready */
31        SIM_LOCKED_OR_ABSENT,  /* SIM PIN locked, PUK required, network
32                               personalization, or SIM absent */
33        SIM_READY,         /* Radio is on and SIM interface is available */
34        RUIM_NOT_READY,    /* Radio is on, but the RUIM interface is not ready */
35        RUIM_READY,        /* Radio is on and the RUIM interface is available */
36        RUIM_LOCKED_OR_ABSENT, /* RUIM PIN locked, PUK required, network
37                                  personalization locked, or RUIM absent */
38        NV_NOT_READY,      /* Radio is on, but the NV interface is not available */
39        NV_READY;          /* Radio is on and the NV interface is available */
40
41        public boolean isOn() /* and available...*/ {
42            return this == SIM_NOT_READY
43                    || this == SIM_LOCKED_OR_ABSENT
44                    || this == SIM_READY
45                    || this == RUIM_NOT_READY
46                    || this == RUIM_READY
47                    || this == RUIM_LOCKED_OR_ABSENT
48                    || this == NV_NOT_READY
49                    || this == NV_READY;
50        }
51
52        public boolean isAvailable() {
53            return this != RADIO_UNAVAILABLE;
54        }
55
56        public boolean isSIMReady() {
57            return this == SIM_READY;
58        }
59
60        public boolean isRUIMReady() {
61            return this == RUIM_READY;
62        }
63
64        public boolean isNVReady() {
65            return this == NV_READY;
66        }
67
68        public boolean isGsm() {
69            return this == SIM_NOT_READY
70                    || this == SIM_LOCKED_OR_ABSENT
71                    || this == SIM_READY;
72        }
73
74        public boolean isCdma() {
75            return this ==  RUIM_NOT_READY
76                    || this == RUIM_READY
77                    || this == RUIM_LOCKED_OR_ABSENT
78                    || this == NV_NOT_READY
79                    || this == NV_READY;
80        }
81    }
82
83    enum IccStatus {
84        ICC_ABSENT,
85        ICC_NOT_READY,
86        ICC_READY,
87        ICC_PIN,
88        ICC_PUK,
89        ICC_NETWORK_PERSONALIZATION
90    }
91
92    //***** Constants
93
94    // Used as parameter to dial() and setCLIR() below
95    static final int CLIR_DEFAULT = 0;      // "use subscription default value"
96    static final int CLIR_INVOCATION = 1;   // (restrict CLI presentation)
97    static final int CLIR_SUPPRESSION = 2;  // (allow CLI presentation)
98
99
100    // Used as parameters for call forward methods below
101    static final int CF_ACTION_DISABLE          = 0;
102    static final int CF_ACTION_ENABLE           = 1;
103//  static final int CF_ACTION_UNUSED           = 2;
104    static final int CF_ACTION_REGISTRATION     = 3;
105    static final int CF_ACTION_ERASURE          = 4;
106
107    static final int CF_REASON_UNCONDITIONAL    = 0;
108    static final int CF_REASON_BUSY             = 1;
109    static final int CF_REASON_NO_REPLY         = 2;
110    static final int CF_REASON_NOT_REACHABLE    = 3;
111    static final int CF_REASON_ALL              = 4;
112    static final int CF_REASON_ALL_CONDITIONAL  = 5;
113
114    // Used for call barring methods below
115    static final String CB_FACILITY_BAOC         = "AO";
116    static final String CB_FACILITY_BAOIC        = "OI";
117    static final String CB_FACILITY_BAOICxH      = "OX";
118    static final String CB_FACILITY_BAIC         = "AI";
119    static final String CB_FACILITY_BAICr        = "IR";
120    static final String CB_FACILITY_BA_ALL       = "AB";
121    static final String CB_FACILITY_BA_MO        = "AG";
122    static final String CB_FACILITY_BA_MT        = "AC";
123    static final String CB_FACILITY_BA_SIM       = "SC";
124    static final String CB_FACILITY_BA_FD        = "FD";
125
126
127    // Used for various supp services apis
128    // See 27.007 +CCFC or +CLCK
129    static final int SERVICE_CLASS_NONE     = 0; // no user input
130    static final int SERVICE_CLASS_VOICE    = (1 << 0);
131    static final int SERVICE_CLASS_DATA     = (1 << 1); //synoym for 16+32+64+128
132    static final int SERVICE_CLASS_FAX      = (1 << 2);
133    static final int SERVICE_CLASS_SMS      = (1 << 3);
134    static final int SERVICE_CLASS_DATA_SYNC = (1 << 4);
135    static final int SERVICE_CLASS_DATA_ASYNC = (1 << 5);
136    static final int SERVICE_CLASS_PACKET   = (1 << 6);
137    static final int SERVICE_CLASS_PAD      = (1 << 7);
138    static final int SERVICE_CLASS_MAX      = (1 << 7); // Max SERVICE_CLASS value
139
140    // Numeric representation of string values returned
141    // by messages sent to setOnUSSD handler
142    static final int USSD_MODE_NOTIFY       = 0;
143    static final int USSD_MODE_REQUEST      = 1;
144
145    // SIM Refresh results, passed up from RIL.
146    static final int SIM_REFRESH_FILE_UPDATED   = 0;  // Single file updated
147    static final int SIM_REFRESH_INIT           = 1;  // SIM initialized; reload all
148    static final int SIM_REFRESH_RESET          = 2;  // SIM reset; may be locked
149
150    //***** Methods
151
152    RadioState getRadioState();
153
154    /**
155     * Fires on any RadioState transition
156     * Always fires immediately as well
157     *
158     * do not attempt to calculate transitions by storing getRadioState() values
159     * on previous invocations of this notification. Instead, use the other
160     * registration methods
161     */
162    void registerForRadioStateChanged(Handler h, int what, Object obj);
163    void unregisterForRadioStateChanged(Handler h);
164
165    /**
166     * Fires on any transition into RadioState.isOn()
167     * Fires immediately if currently in that state
168     * In general, actions should be idempotent. State may change
169     * before event is received.
170     */
171    void registerForOn(Handler h, int what, Object obj);
172    void unregisterForOn(Handler h);
173
174    /**
175     * Fires on any transition out of RadioState.isAvailable()
176     * Fires immediately if currently in that state
177     * In general, actions should be idempotent. State may change
178     * before event is received.
179     */
180    void registerForAvailable(Handler h, int what, Object obj);
181    void unregisterForAvailable(Handler h);
182
183    /**
184     * Fires on any transition into !RadioState.isAvailable()
185     * Fires immediately if currently in that state
186     * In general, actions should be idempotent. State may change
187     * before event is received.
188     */
189    void registerForNotAvailable(Handler h, int what, Object obj);
190    void unregisterForNotAvailable(Handler h);
191
192    /**
193     * Fires on any transition into RADIO_OFF or !RadioState.isAvailable()
194     * Fires immediately if currently in that state
195     * In general, actions should be idempotent. State may change
196     * before event is received.
197     */
198    void registerForOffOrNotAvailable(Handler h, int what, Object obj);
199    void unregisterForOffOrNotAvailable(Handler h);
200
201    /**
202     * Fires on any transition into SIM_READY
203     * Fires immediately if if currently in that state
204     * In general, actions should be idempotent. State may change
205     * before event is received.
206     */
207    void registerForSIMReady(Handler h, int what, Object obj);
208    void unregisterForSIMReady(Handler h);
209
210    /** Any transition into SIM_LOCKED_OR_ABSENT */
211    void registerForSIMLockedOrAbsent(Handler h, int what, Object obj);
212    void unregisterForSIMLockedOrAbsent(Handler h);
213
214    void registerForCallStateChanged(Handler h, int what, Object obj);
215    void unregisterForCallStateChanged(Handler h);
216    void registerForNetworkStateChanged(Handler h, int what, Object obj);
217    void unregisterForNetworkStateChanged(Handler h);
218    void registerForDataStateChanged(Handler h, int what, Object obj);
219    void unregisterForDataStateChanged(Handler h);
220
221    void registerForRadioTechnologyChanged(Handler h, int what, Object obj);
222    void unregisterForRadioTechnologyChanged(Handler h);
223    void registerForNVReady(Handler h, int what, Object obj);
224    void unregisterForNVReady(Handler h);
225    void registerForRUIMLockedOrAbsent(Handler h, int what, Object obj);
226    void unregisterForRUIMLockedOrAbsent(Handler h);
227
228    /** InCall voice privacy notifications */
229    void registerForInCallVoicePrivacyOn(Handler h, int what, Object obj);
230    void unregisterForInCallVoicePrivacyOn(Handler h);
231    void registerForInCallVoicePrivacyOff(Handler h, int what, Object obj);
232    void unregisterForInCallVoicePrivacyOff(Handler h);
233
234    /**
235     * Fires on any transition into RUIM_READY
236     * Fires immediately if if currently in that state
237     * In general, actions should be idempotent. State may change
238     * before event is received.
239     */
240    void registerForRUIMReady(Handler h, int what, Object obj);
241    void unregisterForRUIMReady(Handler h);
242
243    /**
244     * unlike the register* methods, there's only one new SMS handler
245     * if you need to unregister, you should also tell the radio to stop
246     * sending SMS's to you (via AT+CNMI)
247     *
248     * AsyncResult.result is a String containing the SMS PDU
249     */
250    void setOnNewSMS(Handler h, int what, Object obj);
251    void unSetOnNewSMS(Handler h);
252
253   /**
254     * Register for NEW_SMS_ON_SIM unsolicited message
255     *
256     * AsyncResult.result is an int array containing the index of new SMS
257     */
258    void setOnSmsOnSim(Handler h, int what, Object obj);
259    void unSetOnSmsOnSim(Handler h);
260
261    /**
262     * Register for NEW_SMS_STATUS_REPORT unsolicited message
263     *
264     * AsyncResult.result is a String containing the status report PDU
265     */
266    void setOnSmsStatus(Handler h, int what, Object obj);
267    void unSetOnSmsStatus(Handler h);
268
269    /**
270     * unlike the register* methods, there's only one NITZ time handler
271     *
272     * AsyncResult.result is an Object[]
273     * ((Object[])AsyncResult.result)[0] is a String containing the NITZ time string
274     * ((Object[])AsyncResult.result)[1] is a Long containing the milliseconds since boot as
275     *                                   returned by elapsedRealtime() when this NITZ time
276     *                                   was posted.
277     *
278     * Please note that the delivery of this message may be delayed several
279     * seconds on system startup
280     */
281    void setOnNITZTime(Handler h, int what, Object obj);
282    void unSetOnNITZTime(Handler h);
283
284    /**
285     * unlike the register* methods, there's only one USSD notify handler
286     *
287     * Represents the arrival of a USSD "notify" message, which may
288     * or may not have been triggered by a previous USSD send
289     *
290     * AsyncResult.result is a String[]
291     * ((String[])(AsyncResult.result))[0] contains status code
292     *      "0"   USSD-Notify -- text in ((const char **)data)[1]
293     *      "1"   USSD-Request -- text in ((const char **)data)[1]
294     *      "2"   Session terminated by network
295     *      "3"   other local client (eg, SIM Toolkit) has responded
296     *      "4"   Operation not supported
297     *      "5"   Network timeout
298     *
299     * ((String[])(AsyncResult.result))[1] contains the USSD message
300     * The numeric representations of these are in USSD_MODE_*
301     */
302
303    void setOnUSSD(Handler h, int what, Object obj);
304    void unSetOnUSSD(Handler h);
305
306    /**
307     * unlike the register* methods, there's only one signal strength handler
308     * AsyncResult.result is an int[2]
309     * response.obj.result[0] is received signal strength (0-31, 99)
310     * response.obj.result[1] is  bit error rate (0-7, 99)
311     * as defined in TS 27.007 8.5
312     */
313
314    void setOnSignalStrengthUpdate(Handler h, int what, Object obj);
315    void unSetOnSignalStrengthUpdate(Handler h);
316
317    /**
318     * Sets the handler for SIM/RUIM SMS storage full unsolicited message.
319     * Unlike the register* methods, there's only one notification handler
320     *
321     * @param h Handler for notification message.
322     * @param what User-defined message code.
323     * @param obj User object.
324     */
325    void setOnIccSmsFull(Handler h, int what, Object obj);
326    void unSetOnIccSmsFull(Handler h);
327
328    /**
329     * Sets the handler for SIM Refresh notifications.
330     * Unlike the register* methods, there's only one notification handler
331     *
332     * @param h Handler for notification message.
333     * @param what User-defined message code.
334     * @param obj User object.
335     */
336    void setOnIccRefresh(Handler h, int what, Object obj);
337    void unSetOnIccRefresh(Handler h);
338
339    /**
340     * Sets the handler for RING notifications.
341     * Unlike the register* methods, there's only one notification handler
342     *
343     * @param h Handler for notification message.
344     * @param what User-defined message code.
345     * @param obj User object.
346     */
347    void setOnCallRing(Handler h, int what, Object obj);
348    void unSetOnCallRing(Handler h);
349
350    /**
351     * Sets the handler for RESTRICTED_STATE changed notification,
352     * eg, for Domain Specific Access Control
353     * unlike the register* methods, there's only one signal strength handler
354     *
355     * AsyncResult.result is an int[1]
356     * response.obj.result[0] is a bitmask of RIL_RESTRICTED_STATE_* values
357     */
358
359    void setOnRestrictedStateChanged(Handler h, int what, Object obj);
360    void unSetOnRestrictedStateChanged(Handler h);
361
362    /**
363     * Sets the handler for Supplementary Service Notifications.
364     * Unlike the register* methods, there's only one notification handler
365     *
366     * @param h Handler for notification message.
367     * @param what User-defined message code.
368     * @param obj User object.
369     */
370    void setOnSuppServiceNotification(Handler h, int what, Object obj);
371    void unSetOnSuppServiceNotification(Handler h);
372
373    /**
374     * Sets the handler for Session End Notifications for STK.
375     * Unlike the register* methods, there's only one notification handler
376     *
377     * @param h Handler for notification message.
378     * @param what User-defined message code.
379     * @param obj User object.
380     */
381    void setOnStkSessionEnd(Handler h, int what, Object obj);
382    void unSetOnStkSessionEnd(Handler h);
383
384    /**
385     * Sets the handler for Proactive Commands for STK.
386     * Unlike the register* methods, there's only one notification handler
387     *
388     * @param h Handler for notification message.
389     * @param what User-defined message code.
390     * @param obj User object.
391     */
392    void setOnStkProactiveCmd(Handler h, int what, Object obj);
393    void unSetOnStkProactiveCmd(Handler h);
394
395    /**
396     * Sets the handler for Event Notifications for STK.
397     * Unlike the register* methods, there's only one notification handler
398     *
399     * @param h Handler for notification message.
400     * @param what User-defined message code.
401     * @param obj User object.
402     */
403    void setOnStkEvent(Handler h, int what, Object obj);
404    void unSetOnStkEvent(Handler h);
405
406    /**
407     * Sets the handler for Call Set Up Notifications for STK.
408     * Unlike the register* methods, there's only one notification handler
409     *
410     * @param h Handler for notification message.
411     * @param what User-defined message code.
412     * @param obj User object.
413     */
414    void setOnStkCallSetUp(Handler h, int what, Object obj);
415    void unSetOnStkCallSetUp(Handler h);
416
417    /**
418     * Enables/disbables supplementary service related notifications from
419     * the network.
420     *
421     * @param enable true to enable notifications, false to disable.
422     * @param result Message to be posted when command completes.
423     */
424    void setSuppServiceNotifications(boolean enable, Message result);
425    //void unSetSuppServiceNotifications(Handler h);
426
427
428    /**
429     * Returns current ICC status.
430     *
431     * AsyncResult.result is IccStatus
432     *
433     */
434
435    void getIccStatus(Message result);
436
437    /**
438     * Supply the ICC PIN to the ICC card
439     *
440     *  returned message
441     *  retMsg.obj = AsyncResult ar
442     *  ar.exception carries exception on failure
443     *  This exception is CommandException with an error of PASSWORD_INCORRECT
444     *  if the password is incorrect
445     *
446     * ar.exception and ar.result are null on success
447     */
448
449    void supplyIccPin(String pin, Message result);
450
451    /**
452     * Supply the ICC PUK to the ICC card
453     *
454     *  returned message
455     *  retMsg.obj = AsyncResult ar
456     *  ar.exception carries exception on failure
457     *  This exception is CommandException with an error of PASSWORD_INCORRECT
458     *  if the password is incorrect
459     *
460     * ar.exception and ar.result are null on success
461     */
462
463    void supplyIccPuk(String puk, String newPin, Message result);
464
465    /**
466     * Supply the ICC PIN2 to the ICC card
467     * Only called following operation where ICC_PIN2 was
468     * returned as a a failure from a previous operation
469     *
470     *  returned message
471     *  retMsg.obj = AsyncResult ar
472     *  ar.exception carries exception on failure
473     *  This exception is CommandException with an error of PASSWORD_INCORRECT
474     *  if the password is incorrect
475     *
476     * ar.exception and ar.result are null on success
477     */
478
479    void supplyIccPin2(String pin2, Message result);
480
481    /**
482     * Supply the SIM PUK2 to the SIM card
483     * Only called following operation where SIM_PUK2 was
484     * returned as a a failure from a previous operation
485     *
486     *  returned message
487     *  retMsg.obj = AsyncResult ar
488     *  ar.exception carries exception on failure
489     *  This exception is CommandException with an error of PASSWORD_INCORRECT
490     *  if the password is incorrect
491     *
492     * ar.exception and ar.result are null on success
493     */
494
495    void supplyIccPuk2(String puk2, String newPin2, Message result);
496
497    void changeIccPin(String oldPin, String newPin, Message result);
498    void changeIccPin2(String oldPin2, String newPin2, Message result);
499
500    void changeBarringPassword(String facility, String oldPwd, String newPwd, Message result);
501
502    void supplyNetworkDepersonalization(String netpin, Message result);
503
504    /**
505     *  returned message
506     *  retMsg.obj = AsyncResult ar
507     *  ar.exception carries exception on failure
508     *  ar.userObject contains the orignal value of result.obj
509     *  ar.result contains a List of DriverCall
510     *      The ar.result List is sorted by DriverCall.index
511     */
512    void getCurrentCalls (Message result);
513
514    /**
515     *  returned message
516     *  retMsg.obj = AsyncResult ar
517     *  ar.exception carries exception on failure
518     *  ar.userObject contains the orignal value of result.obj
519     *  ar.result contains a List of PDPContextState
520     *  @deprecated
521     */
522    void getPDPContextList(Message result);
523
524    /**
525     *  returned message
526     *  retMsg.obj = AsyncResult ar
527     *  ar.exception carries exception on failure
528     *  ar.userObject contains the orignal value of result.obj
529     *  ar.result contains a List of PDPContextState
530     */
531    void getDataCallList(Message result);
532
533    /**
534     *  returned message
535     *  retMsg.obj = AsyncResult ar
536     *  ar.exception carries exception on failure
537     *  ar.userObject contains the orignal value of result.obj
538     *  ar.result is null on success and failure
539     *
540     * CLIR_DEFAULT     == on "use subscription default value"
541     * CLIR_SUPPRESSION == on "CLIR suppression" (allow CLI presentation)
542     * CLIR_INVOCATION  == on "CLIR invocation" (restrict CLI presentation)
543     */
544    void dial (String address, int clirMode, Message result);
545
546    /**
547     *  returned message
548     *  retMsg.obj = AsyncResult ar
549     *  ar.exception carries exception on failure
550     *  ar.userObject contains the orignal value of result.obj
551     *  ar.result is String containing IMSI on success
552     */
553    void getIMSI(Message result);
554
555    /**
556     *  returned message
557     *  retMsg.obj = AsyncResult ar
558     *  ar.exception carries exception on failure
559     *  ar.userObject contains the orignal value of result.obj
560     *  ar.result is String containing IMEI on success
561     */
562    void getIMEI(Message result);
563
564    /**
565     *  returned message
566     *  retMsg.obj = AsyncResult ar
567     *  ar.exception carries exception on failure
568     *  ar.userObject contains the orignal value of result.obj
569     *  ar.result is String containing IMEISV on success
570     */
571    void getIMEISV(Message result);
572
573    /**
574     * Hang up one individual connection.
575     *  returned message
576     *  retMsg.obj = AsyncResult ar
577     *  ar.exception carries exception on failure
578     *  ar.userObject contains the orignal value of result.obj
579     *  ar.result is null on success and failure
580     *
581     *  3GPP 22.030 6.5.5
582     *  "Releases a specific active call X"
583     */
584    void hangupConnection (int gsmIndex, Message result);
585
586    /**
587     * 3GPP 22.030 6.5.5
588     *  "Releases all held calls or sets User Determined User Busy (UDUB)
589     *   for a waiting call."
590     *  ar.exception carries exception on failure
591     *  ar.userObject contains the orignal value of result.obj
592     *  ar.result is null on success and failure
593     */
594    void hangupWaitingOrBackground (Message result);
595
596    /**
597     * 3GPP 22.030 6.5.5
598     * "Releases all active calls (if any exist) and accepts
599     *  the other (held or waiting) call."
600     *
601     *  ar.exception carries exception on failure
602     *  ar.userObject contains the orignal value of result.obj
603     *  ar.result is null on success and failure
604     */
605    void hangupForegroundResumeBackground (Message result);
606
607    /**
608     * 3GPP 22.030 6.5.5
609     * "Places all active calls (if any exist) on hold and accepts
610     *  the other (held or waiting) call."
611     *
612     *  ar.exception carries exception on failure
613     *  ar.userObject contains the orignal value of result.obj
614     *  ar.result is null on success and failure
615     */
616    void switchWaitingOrHoldingAndActive (Message result);
617
618    /**
619     * 3GPP 22.030 6.5.5
620     * "Adds a held call to the conversation"
621     *
622     *  ar.exception carries exception on failure
623     *  ar.userObject contains the orignal value of result.obj
624     *  ar.result is null on success and failure
625     */
626    void conference (Message result);
627
628    /**
629     * Set preferred Voice Privacy (VP).
630     *
631     * @param enable true is enhanced and false is normal VP
632     * @param result is a callback message
633     */
634    void setPreferredVoicePrivacy(boolean enable, Message result);
635
636    /**
637     * Get currently set preferred Voice Privacy (VP) mode.
638     *
639     * @param result is a callback message
640     */
641    void getPreferredVoicePrivacy(Message result);
642
643    /**
644     * 3GPP 22.030 6.5.5
645     * "Places all active calls on hold except call X with which
646     *  communication shall be supported."
647     */
648    void separateConnection (int gsmIndex, Message result);
649
650    /**
651     *
652     *  ar.exception carries exception on failure
653     *  ar.userObject contains the orignal value of result.obj
654     *  ar.result is null on success and failure
655     */
656    void acceptCall (Message result);
657
658    /**
659     *  also known as UDUB
660     *  ar.exception carries exception on failure
661     *  ar.userObject contains the orignal value of result.obj
662     *  ar.result is null on success and failure
663     */
664    void rejectCall (Message result);
665
666    /**
667     * 3GPP 22.030 6.5.5
668     * "Connects the two calls and disconnects the subscriber from both calls"
669     *
670     *  ar.exception carries exception on failure
671     *  ar.userObject contains the orignal value of result.obj
672     *  ar.result is null on success and failure
673     */
674    void explicitCallTransfer (Message result);
675
676    /**
677     * cause code returned as int[0] in Message.obj.response
678     * Returns integer cause code defined in TS 24.008
679     * Annex H or closest approximation.
680     * Most significant codes:
681     * - Any defined in 22.001 F.4 (for generating busy/congestion)
682     * - Cause 68: ACM >= ACMMax
683     */
684    void getLastCallFailCause (Message result);
685
686
687    /**
688     * Reason for last PDP context deactivate or failure to activate
689     * cause code returned as int[0] in Message.obj.response
690     * returns an integer cause code defined in TS 24.008
691     * section 6.1.3.1.3 or close approximation
692     * @deprecated
693     */
694    void getLastPdpFailCause (Message result);
695
696    /**
697     * The preferred new alternative to getLastPdpFailCause
698     * that is also CDMA-compatible.
699     */
700    void getLastDataCallFailCause (Message result);
701
702    void setMute (boolean enableMute, Message response);
703
704    void getMute (Message response);
705
706    /**
707     * response.obj is an AsyncResult
708     * response.obj.result is an int[2]
709     * response.obj.result[0] is received signal strength (0-31, 99)
710     * response.obj.result[1] is  bit error rate (0-7, 99)
711     * as defined in TS 27.007 8.5
712     */
713    void getSignalStrength (Message response);
714
715
716    /**
717     * response.obj.result is an int[3]
718     * response.obj.result[0] is registration state 0-5 from TS 27.007 7.2
719     * response.obj.result[1] is LAC if registered or -1 if not
720     * response.obj.result[2] is CID if registered or -1 if not
721     * valid LAC and CIDs are 0x0000 - 0xffff
722     *
723     * Please note that registration state 4 ("unknown") is treated
724     * as "out of service" above
725     */
726    void getRegistrationState (Message response);
727
728    /**
729     * response.obj.result is an int[3]
730     * response.obj.result[0] is registration state 0-5 from TS 27.007 7.2
731     * response.obj.result[1] is LAC if registered or -1 if not
732     * response.obj.result[2] is CID if registered or -1 if not
733     * valid LAC and CIDs are 0x0000 - 0xffff
734     *
735     * Please note that registration state 4 ("unknown") is treated
736     * as "out of service" above
737     */
738    void getGPRSRegistrationState (Message response);
739
740    /**
741     * response.obj.result is a String[3]
742     * response.obj.result[0] is long alpha or null if unregistered
743     * response.obj.result[1] is short alpha or null if unregistered
744     * response.obj.result[2] is numeric or null if unregistered
745     */
746    void getOperator(Message response);
747
748    /**
749     *  ar.exception carries exception on failure
750     *  ar.userObject contains the orignal value of result.obj
751     *  ar.result is null on success and failure
752     */
753    void sendDtmf(char c, Message result);
754
755
756    /**
757     *  ar.exception carries exception on failure
758     *  ar.userObject contains the orignal value of result.obj
759     *  ar.result is null on success and failure
760     */
761    void startDtmf(char c, Message result);
762
763    /**
764     *  ar.exception carries exception on failure
765     *  ar.userObject contains the orignal value of result.obj
766     *  ar.result is null on success and failure
767     */
768    void stopDtmf(Message result);
769
770
771    /**
772     * smscPDU is smsc address in PDU form GSM BCD format prefixed
773     *      by a length byte (as expected by TS 27.005) or NULL for default SMSC
774     * pdu is SMS in PDU format as an ASCII hex string
775     *      less the SMSC address
776     */
777    void sendSMS (String smscPDU, String pdu, Message response);
778
779    /**
780     * @param pdu is CDMA-SMS in internal pseudo-PDU format
781     * @param response sent when operation completes
782     */
783    void sendCdmaSms(byte[] pdu, Message response);
784
785    /**
786     * Deletes the specified SMS record from SIM memory (EF_SMS).
787     *
788     * @param index index of the SMS record to delete
789     * @param response sent when operation completes
790     */
791    void deleteSmsOnSim(int index, Message response);
792
793    /**
794     * Deletes the specified SMS record from RUIM memory (EF_SMS in DF_CDMA).
795     *
796     * @param index index of the SMS record to delete
797     * @param response sent when operation completes
798     */
799    void deleteSmsOnRuim(int index, Message response);
800
801    /**
802     * Writes an SMS message to SIM memory (EF_SMS).
803     *
804     * @param status status of message on SIM.  One of:
805     *                  SmsManger.STATUS_ON_ICC_READ
806     *                  SmsManger.STATUS_ON_ICC_UNREAD
807     *                  SmsManger.STATUS_ON_ICC_SENT
808     *                  SmsManger.STATUS_ON_ICC_UNSENT
809     * @param pdu message PDU, as hex string
810     * @param response sent when operation completes.
811     *                  response.obj will be an AsyncResult, and will indicate
812     *                  any error that may have occurred (eg, out of memory).
813     */
814    void writeSmsToSim(int status, String smsc, String pdu, Message response);
815
816    void writeSmsToRuim(int status, String pdu, Message response);
817
818    /**
819     * @deprecated
820     * @param apn
821     * @param user
822     * @param password
823     * @param response
824     */
825    void setupDefaultPDP(String apn, String user, String password, Message response);
826
827    /**
828     * @deprecated
829     * @param cid
830     * @param response
831     */
832    void deactivateDefaultPDP(int cid, Message response);
833
834    void setRadioPower(boolean on, Message response);
835
836    void acknowledgeLastIncomingSMS(boolean success, Message response);
837
838    void acknowledgeLastIncomingCdmaSms(boolean success, Message response);
839
840    /**
841     * parameters equivilient to 27.007 AT+CRSM command
842     * response.obj will be an AsyncResult
843     * response.obj.userObj will be a IccIoResult on success
844     */
845    void iccIO (int command, int fileid, String path, int p1, int p2, int p3,
846            String data, String pin2, Message response);
847
848    /**
849     * (AsyncResult)response.obj).result is an int[] with element [0] set to
850     * 1 for "CLIP is provisioned", and 0 for "CLIP is not provisioned".
851     *
852     * @param response is callback message
853     */
854
855    void queryCLIP(Message response);
856
857    /**
858     * response.obj will be a an int[2]
859     *
860     * response.obj[0] will be TS 27.007 +CLIR parameter 'n'
861     *  0 presentation indicator is used according to the subscription of the CLIR service
862     *  1 CLIR invocation
863     *  2 CLIR suppression
864     *
865     * response.obj[1] will be TS 27.007 +CLIR parameter 'm'
866     *  0 CLIR not provisioned
867     *  1 CLIR provisioned in permanent mode
868     *  2 unknown (e.g. no network, etc.)
869     *  3 CLIR temporary mode presentation restricted
870     *  4 CLIR temporary mode presentation allowed
871     */
872
873    void getCLIR(Message response);
874
875    /**
876     * clirMode is one of the CLIR_* constants above
877     *
878     * response.obj is null
879     */
880
881    void setCLIR(int clirMode, Message response);
882
883    /**
884     * (AsyncResult)response.obj).result is an int[] with element [0] set to
885     * 0 for disabled, 1 for enabled.
886     *
887     * @param serviceClass is a sum of SERVICE_CLASS_*
888     * @param response is callback message
889     */
890
891    void queryCallWaiting(int serviceClass, Message response);
892
893    /**
894     * @param enable is true to enable, false to disable
895     * @param serviceClass is a sum of SERVICE_CLASS_*
896     * @param response is callback message
897     */
898
899    void setCallWaiting(boolean enable, int serviceClass, Message response);
900
901    /**
902     * @param action is one of CF_ACTION_*
903     * @param cfReason is one of CF_REASON_*
904     * @param serviceClass is a sum of SERVICE_CLASSS_*
905     */
906    void setCallForward(int action, int cfReason, int serviceClass,
907                String number, int timeSeconds, Message response);
908
909    /**
910     * cfReason is one of CF_REASON_*
911     *
912     * ((AsyncResult)response.obj).result will be an array of
913     * CallForwardInfo's
914     *
915     * An array of length 0 means "disabled for all codes"
916     */
917    void queryCallForwardStatus(int cfReason, int serviceClass,
918            String number, Message response);
919
920    void setNetworkSelectionModeAutomatic(Message response);
921
922    void setNetworkSelectionModeManual(String operatorNumeric, Message response);
923
924    /**
925     * Queries whether the current network selection mode is automatic
926     * or manual
927     *
928     * ((AsyncResult)response.obj).result  is an int[] with element [0] being
929     * a 0 for automatic selection and a 1 for manual selection
930     */
931
932    void getNetworkSelectionMode(Message response);
933
934    /**
935     * Queries the currently available networks
936     *
937     * ((AsyncResult)response.obj).result  is a List of NetworkInfo objects
938     */
939    void getAvailableNetworks(Message response);
940
941    void getBasebandVersion (Message response);
942
943
944    /**
945     * (AsyncResult)response.obj).result will be an Integer representing
946     * the sum of enabled serivice classes (sum of SERVICE_CLASS_*)
947     *
948     * @param facility one of CB_FACILTY_*
949     * @param password password or "" if not required
950     * @param serviceClass is a sum of SERVICE_CLASS_*
951     * @param response is callback message
952     */
953
954    void queryFacilityLock (String facility, String password, int serviceClass,
955        Message response);
956
957    /**
958     * @param facility one of CB_FACILTY_*
959     * @param lockState true means lock, false means unlock
960     * @param password password or "" if not required
961     * @param serviceClass is a sum of SERVICE_CLASS_*
962     * @param response is callback message
963     */
964    void setFacilityLock (String facility, boolean lockState, String password,
965        int serviceClass, Message response);
966
967
968    void sendUSSD (String ussdString, Message response);
969
970    /**
971     * Cancels a pending USSD session if one exists.
972     * @param response callback message
973     */
974    void cancelPendingUssd (Message response);
975
976    void resetRadio(Message result);
977
978    /**
979     * Assign a specified band for RF configuration.
980     *
981     * @param bandMode one of BM_*_BAND
982     * @param response is callback message
983     */
984    void setBandMode (int bandMode, Message response);
985
986    /**
987     * Query the list of band mode supported by RF.
988     *
989     * @param response is callback message
990     *        ((AsyncResult)response.obj).result  is an int[] with every
991     *        element representing one avialable BM_*_BAND
992     */
993    void queryAvailableBandMode (Message response);
994
995    /**
996     *  Requests to set the preferred network type for searching and registering
997     * (CS/PS domain, RAT, and operation mode)
998     * @param networkType one of  NT_*_TYPE
999     * @param response is callback message
1000     */
1001    void setPreferredNetworkType(int networkType , Message response);
1002
1003     /**
1004     *  Query the preferred network type setting
1005     *
1006     * @param response is callback message to report one of  NT_*_TYPE
1007     */
1008    void getPreferredNetworkType(Message response);
1009
1010    /**
1011     * Query neighboring cell ids
1012     *
1013     * @param response s callback message to cell ids
1014     */
1015    void getNeighboringCids(Message response);
1016
1017    /**
1018     * Request to enable/disable network state change notifications when
1019     * location informateion (lac and/or cid) has changed.
1020     *
1021     * @param enable true to enable, false to disable
1022     * @param response callback message
1023     */
1024    void setLocationUpdates(boolean enable, Message response);
1025
1026
1027    void invokeOemRilRequestRaw(byte[] data, Message response);
1028
1029    void invokeOemRilRequestStrings(String[] strings, Message response);
1030
1031
1032    /**
1033     * Send TERMINAL RESPONSE to the SIM, after processing a proactive command
1034     * sent by the SIM.
1035     *
1036     * @param contents  String containing SAT/USAT response in hexadecimal
1037     *                  format starting with first byte of response data. See
1038     *                  TS 102 223 for details.
1039     * @param response  Callback message
1040     */
1041    public void sendTerminalResponse(String contents, Message response);
1042
1043    /**
1044     * Send ENVELOPE to the SIM, after processing a proactive command sent by
1045     * the SIM.
1046     *
1047     * @param contents  String containing SAT/USAT response in hexadecimal
1048     *                  format starting with command tag. See TS 102 223 for
1049     *                  details.
1050     * @param response  Callback message
1051     */
1052    public void sendEnvelope(String contents, Message response);
1053
1054    /**
1055     * Accept or reject the call setup request from SIM.
1056     *
1057     * @param accept   true if the call is to be accepted, false otherwise.
1058     * @param response Callback message
1059     */
1060    public void handleCallSetupRequestFromSim(boolean accept, Message response);
1061
1062    //***** new Methods for CDMA support
1063
1064    /**
1065     * Request the device ESN / MEID / IMEI / IMEISV.
1066     * "response" is const char **
1067     *   [0] is IMEI if GSM subscription is available
1068     *   [1] is IMEISV if GSM subscription is available
1069     *   [2] is ESN if CDMA subscription is available
1070     *   [3] is MEID if CDMA subscription is available
1071     */
1072    public void getDeviceIdentity(Message response);
1073
1074    /**
1075     * Request the device IMSI_M / MDN / AH_SID / H_SID / H_NID.
1076     * "response" is const char **
1077     *   [0] is IMSI_M if CDMA subscription is available
1078     *   [1] is MDN if CDMA subscription is available
1079     *   [2] is AH_SID (Analog Home SID) if CDMA subscription
1080     *   [3] is H_SID (Home SID) if CDMA subscription is available
1081     *   [4] is H_NID (Home SID) if CDMA subscription is available
1082     */
1083    public void getCDMASubscription(Message response);
1084
1085    /**
1086     * Send Flash Code.
1087     * "response" is is NULL
1088     *   [0] is a FLASH string
1089     */
1090    public void sendCDMAFeatureCode(String FeatureCode, Message response);
1091
1092    /** Set the Phone type created */
1093    void setPhoneType(int phoneType);
1094    /**
1095     *  Query the CDMA roaming preference setting
1096     *
1097     * @param response is callback message to report one of  CDMA_RM_*
1098     */
1099    void queryCdmaRoamingPreference(Message response);
1100
1101    /**
1102     *  Requests to set the CDMA roaming preference
1103     * @param cdmaRoamingType one of  CDMA_RM_*
1104     * @param response is callback message
1105     */
1106    void setCdmaRoamingPreference(int cdmaRoamingType, Message response);
1107
1108    /**
1109     *  Requests to set the CDMA subscription mode
1110     * @param cdmaSubscriptionType one of  CDMA_SUBSCRIPTION_*
1111     * @param response is callback message
1112     */
1113    void setCdmaSubscription(int cdmaSubscriptionType, Message response);
1114
1115    /**
1116     *  Set the TTY mode for the CDMA phone
1117     *
1118     * @param enable is true to enable, false to disable
1119     * @param response is callback message
1120     */
1121    void setTTYModeEnabled(boolean enable, Message response);
1122
1123    /**
1124     *  Query the TTY mode for the CDMA phone
1125     * (AsyncResult)response.obj).result is an int[] with element [0] set to
1126     * 0 for disabled, 1 for enabled.
1127     *
1128     * @param response is callback message
1129     */
1130    void queryTTYModeEnabled(Message response);
1131
1132    /**
1133     * Setup a packet data connection On successful completion, the result
1134     * message will return the following: [0] indicating PDP CID, which is
1135     * generated by RIL. This Connection ID is used in both GSM/UMTS and CDMA
1136     * modes [1] indicating the network interface name for GSM/UMTS or CDMA [2]
1137     * indicating the IP address for this interface for GSM/UMTS and NULL in the
1138     * case of CDMA
1139     *
1140     * @param radioTechnology
1141     *            indicates whether to setup connection on radio technology CDMA
1142     *            (0) or GSM/UMTS (1)
1143     * @param profile
1144     *            Profile Number or NULL to indicate default profile
1145     * @param apn
1146     *            the APN to connect to if radio technology is GSM/UMTS.
1147     *            Otherwise null for CDMA.
1148     * @param user
1149     *            the username for APN, or NULL
1150     * @param password
1151     *            the password for APN, or NULL
1152     * @param result
1153     *            Callback message
1154     */
1155    public void setupDataCall(String radioTechnology, String profile, String apn,
1156            String user, String password, Message result);
1157
1158    /**
1159     * Deactivate packet data connection
1160     *
1161     * @param cid
1162     *            The connection ID
1163     * @param result
1164     *            Callback message is empty on completion
1165     */
1166    public void deactivateDataCall(int cid, Message result);
1167
1168    /**
1169     * Activate or deactivate cell broadcast SMS.
1170     *
1171     * @param activate
1172     *            0 = activate, 1 = deactivate
1173     * @param result
1174     *            Callback message is empty on completion
1175     */
1176    public void activateCdmaBroadcastSms(int activate, Message result);
1177
1178    /**
1179     * Configure cdma cell broadcast SMS.
1180     *
1181     * @param result
1182     *            Callback message is empty on completion
1183     */
1184    public void setCdmaBroadcastConfig(int[] configValuesArray, Message result);
1185
1186    /**
1187     * Query the current configuration of cdma cell broadcast SMS.
1188     *
1189     * @param result
1190     *            Callback message contains the configuration from the modem on completion
1191     */
1192    public void getCdmaBroadcastConfig(Message result);
1193}
1194