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