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.cdma.CdmaSmsBroadcastConfigInfo;
20import com.android.internal.telephony.dataconnection.DataProfile;
21import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;
22import com.android.internal.telephony.uicc.IccCardStatus;
23
24import android.os.Message;
25import android.os.Handler;
26
27/**
28 * {@hide}
29 */
30public interface CommandsInterface {
31    enum RadioState {
32        RADIO_OFF,         /* Radio explicitly powered off (eg CFUN=0) */
33        RADIO_UNAVAILABLE, /* Radio unavailable (eg, resetting or not booted) */
34        RADIO_ON;          /* Radio is on */
35
36        public boolean isOn() /* and available...*/ {
37            return this == RADIO_ON;
38        }
39
40        public boolean isAvailable() {
41            return this != RADIO_UNAVAILABLE;
42        }
43    }
44
45    //***** Constants
46
47    // Used as parameter to dial() and setCLIR() below
48    static final int CLIR_DEFAULT = 0;      // "use subscription default value"
49    static final int CLIR_INVOCATION = 1;   // (restrict CLI presentation)
50    static final int CLIR_SUPPRESSION = 2;  // (allow CLI presentation)
51
52
53    // Used as parameters for call forward methods below
54    static final int CF_ACTION_DISABLE          = 0;
55    static final int CF_ACTION_ENABLE           = 1;
56//  static final int CF_ACTION_UNUSED           = 2;
57    static final int CF_ACTION_REGISTRATION     = 3;
58    static final int CF_ACTION_ERASURE          = 4;
59
60    static final int CF_REASON_UNCONDITIONAL    = 0;
61    static final int CF_REASON_BUSY             = 1;
62    static final int CF_REASON_NO_REPLY         = 2;
63    static final int CF_REASON_NOT_REACHABLE    = 3;
64    static final int CF_REASON_ALL              = 4;
65    static final int CF_REASON_ALL_CONDITIONAL  = 5;
66
67    // Used for call barring methods below
68    static final String CB_FACILITY_BAOC         = "AO";
69    static final String CB_FACILITY_BAOIC        = "OI";
70    static final String CB_FACILITY_BAOICxH      = "OX";
71    static final String CB_FACILITY_BAIC         = "AI";
72    static final String CB_FACILITY_BAICr        = "IR";
73    static final String CB_FACILITY_BA_ALL       = "AB";
74    static final String CB_FACILITY_BA_MO        = "AG";
75    static final String CB_FACILITY_BA_MT        = "AC";
76    static final String CB_FACILITY_BA_SIM       = "SC";
77    static final String CB_FACILITY_BA_FD        = "FD";
78
79
80    // Used for various supp services apis
81    // See 27.007 +CCFC or +CLCK
82    static final int SERVICE_CLASS_NONE     = 0; // no user input
83    static final int SERVICE_CLASS_VOICE    = (1 << 0);
84    static final int SERVICE_CLASS_DATA     = (1 << 1); //synonym for 16+32+64+128
85    static final int SERVICE_CLASS_FAX      = (1 << 2);
86    static final int SERVICE_CLASS_SMS      = (1 << 3);
87    static final int SERVICE_CLASS_DATA_SYNC = (1 << 4);
88    static final int SERVICE_CLASS_DATA_ASYNC = (1 << 5);
89    static final int SERVICE_CLASS_PACKET   = (1 << 6);
90    static final int SERVICE_CLASS_PAD      = (1 << 7);
91    static final int SERVICE_CLASS_MAX      = (1 << 7); // Max SERVICE_CLASS value
92
93    // Numeric representation of string values returned
94    // by messages sent to setOnUSSD handler
95    static final int USSD_MODE_NOTIFY       = 0;
96    static final int USSD_MODE_REQUEST      = 1;
97
98    // GSM SMS fail cause for acknowledgeLastIncomingSMS. From TS 23.040, 9.2.3.22.
99    static final int GSM_SMS_FAIL_CAUSE_MEMORY_CAPACITY_EXCEEDED    = 0xD3;
100    static final int GSM_SMS_FAIL_CAUSE_USIM_APP_TOOLKIT_BUSY       = 0xD4;
101    static final int GSM_SMS_FAIL_CAUSE_USIM_DATA_DOWNLOAD_ERROR    = 0xD5;
102    static final int GSM_SMS_FAIL_CAUSE_UNSPECIFIED_ERROR           = 0xFF;
103
104    // CDMA SMS fail cause for acknowledgeLastIncomingCdmaSms.  From TS N.S0005, 6.5.2.125.
105    static final int CDMA_SMS_FAIL_CAUSE_INVALID_TELESERVICE_ID     = 4;
106    static final int CDMA_SMS_FAIL_CAUSE_RESOURCE_SHORTAGE          = 35;
107    static final int CDMA_SMS_FAIL_CAUSE_OTHER_TERMINAL_PROBLEM     = 39;
108    static final int CDMA_SMS_FAIL_CAUSE_ENCODING_PROBLEM           = 96;
109
110    //***** Methods
111    RadioState getRadioState();
112
113    /**
114     * response.obj.result is an int[2]
115     *
116     * response.obj.result[0] is IMS registration state
117     *                        0 - Not registered
118     *                        1 - Registered
119     * response.obj.result[1] is of type RILConstants.GSM_PHONE or
120     *                                    RILConstants.CDMA_PHONE
121     */
122    void getImsRegistrationState(Message result);
123
124    /**
125     * Fires on any RadioState transition
126     * Always fires immediately as well
127     *
128     * do not attempt to calculate transitions by storing getRadioState() values
129     * on previous invocations of this notification. Instead, use the other
130     * registration methods
131     */
132    void registerForRadioStateChanged(Handler h, int what, Object obj);
133    void unregisterForRadioStateChanged(Handler h);
134
135    void registerForVoiceRadioTechChanged(Handler h, int what, Object obj);
136    void unregisterForVoiceRadioTechChanged(Handler h);
137    void registerForImsNetworkStateChanged(Handler h, int what, Object obj);
138    void unregisterForImsNetworkStateChanged(Handler h);
139
140    /**
141     * Fires on any transition into RadioState.isOn()
142     * Fires immediately if currently in that state
143     * In general, actions should be idempotent. State may change
144     * before event is received.
145     */
146    void registerForOn(Handler h, int what, Object obj);
147    void unregisterForOn(Handler h);
148
149    /**
150     * Fires on any transition out of RadioState.isAvailable()
151     * Fires immediately if currently in that state
152     * In general, actions should be idempotent. State may change
153     * before event is received.
154     */
155    void registerForAvailable(Handler h, int what, Object obj);
156    void unregisterForAvailable(Handler h);
157
158    /**
159     * Fires on any transition into !RadioState.isAvailable()
160     * Fires immediately if currently in that state
161     * In general, actions should be idempotent. State may change
162     * before event is received.
163     */
164    void registerForNotAvailable(Handler h, int what, Object obj);
165    void unregisterForNotAvailable(Handler h);
166
167    /**
168     * Fires on any transition into RADIO_OFF or !RadioState.isAvailable()
169     * Fires immediately if currently in that state
170     * In general, actions should be idempotent. State may change
171     * before event is received.
172     */
173    void registerForOffOrNotAvailable(Handler h, int what, Object obj);
174    void unregisterForOffOrNotAvailable(Handler h);
175
176    /**
177     * Fires on any change in ICC status
178     */
179    void registerForIccStatusChanged(Handler h, int what, Object obj);
180    void unregisterForIccStatusChanged(Handler h);
181
182    void registerForCallStateChanged(Handler h, int what, Object obj);
183    void unregisterForCallStateChanged(Handler h);
184    void registerForVoiceNetworkStateChanged(Handler h, int what, Object obj);
185    void unregisterForVoiceNetworkStateChanged(Handler h);
186    void registerForDataNetworkStateChanged(Handler h, int what, Object obj);
187    void unregisterForDataNetworkStateChanged(Handler h);
188
189    /** InCall voice privacy notifications */
190    void registerForInCallVoicePrivacyOn(Handler h, int what, Object obj);
191    void unregisterForInCallVoicePrivacyOn(Handler h);
192    void registerForInCallVoicePrivacyOff(Handler h, int what, Object obj);
193    void unregisterForInCallVoicePrivacyOff(Handler h);
194
195    /** Single Radio Voice Call State progress notifications */
196    void registerForSrvccStateChanged(Handler h, int what, Object obj);
197    void unregisterForSrvccStateChanged(Handler h);
198
199    /**
200     * Handlers for subscription status change indications.
201     *
202     * @param h Handler for subscription status change messages.
203     * @param what User-defined message code.
204     * @param obj User object.
205     */
206    void registerForSubscriptionStatusChanged(Handler h, int what, Object obj);
207    void unregisterForSubscriptionStatusChanged(Handler h);
208
209    /**
210     * fires on any change in hardware configuration.
211     */
212    void registerForHardwareConfigChanged(Handler h, int what, Object obj);
213    void unregisterForHardwareConfigChanged(Handler h);
214
215    /**
216     * unlike the register* methods, there's only one new 3GPP format SMS handler.
217     * if you need to unregister, you should also tell the radio to stop
218     * sending SMS's to you (via AT+CNMI)
219     *
220     * AsyncResult.result is a String containing the SMS PDU
221     */
222    void setOnNewGsmSms(Handler h, int what, Object obj);
223    void unSetOnNewGsmSms(Handler h);
224
225    /**
226     * unlike the register* methods, there's only one new 3GPP2 format SMS handler.
227     * if you need to unregister, you should also tell the radio to stop
228     * sending SMS's to you (via AT+CNMI)
229     *
230     * AsyncResult.result is a String containing the SMS PDU
231     */
232    void setOnNewCdmaSms(Handler h, int what, Object obj);
233    void unSetOnNewCdmaSms(Handler h);
234
235    /**
236     * Set the handler for SMS Cell Broadcast messages.
237     *
238     * AsyncResult.result is a byte array containing the SMS-CB PDU
239     */
240    void setOnNewGsmBroadcastSms(Handler h, int what, Object obj);
241    void unSetOnNewGsmBroadcastSms(Handler h);
242
243    /**
244     * Register for NEW_SMS_ON_SIM unsolicited message
245     *
246     * AsyncResult.result is an int array containing the index of new SMS
247     */
248    void setOnSmsOnSim(Handler h, int what, Object obj);
249    void unSetOnSmsOnSim(Handler h);
250
251    /**
252     * Register for NEW_SMS_STATUS_REPORT unsolicited message
253     *
254     * AsyncResult.result is a String containing the status report PDU
255     */
256    void setOnSmsStatus(Handler h, int what, Object obj);
257    void unSetOnSmsStatus(Handler h);
258
259    /**
260     * unlike the register* methods, there's only one NITZ time handler
261     *
262     * AsyncResult.result is an Object[]
263     * ((Object[])AsyncResult.result)[0] is a String containing the NITZ time string
264     * ((Object[])AsyncResult.result)[1] is a Long containing the milliseconds since boot as
265     *                                   returned by elapsedRealtime() when this NITZ time
266     *                                   was posted.
267     *
268     * Please note that the delivery of this message may be delayed several
269     * seconds on system startup
270     */
271    void setOnNITZTime(Handler h, int what, Object obj);
272    void unSetOnNITZTime(Handler h);
273
274    /**
275     * unlike the register* methods, there's only one USSD notify handler
276     *
277     * Represents the arrival of a USSD "notify" message, which may
278     * or may not have been triggered by a previous USSD send
279     *
280     * AsyncResult.result is a String[]
281     * ((String[])(AsyncResult.result))[0] contains status code
282     *      "0"   USSD-Notify -- text in ((const char **)data)[1]
283     *      "1"   USSD-Request -- text in ((const char **)data)[1]
284     *      "2"   Session terminated by network
285     *      "3"   other local client (eg, SIM Toolkit) has responded
286     *      "4"   Operation not supported
287     *      "5"   Network timeout
288     *
289     * ((String[])(AsyncResult.result))[1] contains the USSD message
290     * The numeric representations of these are in USSD_MODE_*
291     */
292
293    void setOnUSSD(Handler h, int what, Object obj);
294    void unSetOnUSSD(Handler h);
295
296    /**
297     * unlike the register* methods, there's only one signal strength handler
298     * AsyncResult.result is an int[2]
299     * response.obj.result[0] is received signal strength (0-31, 99)
300     * response.obj.result[1] is  bit error rate (0-7, 99)
301     * as defined in TS 27.007 8.5
302     */
303
304    void setOnSignalStrengthUpdate(Handler h, int what, Object obj);
305    void unSetOnSignalStrengthUpdate(Handler h);
306
307    /**
308     * Sets the handler for SIM/RUIM SMS storage full unsolicited message.
309     * Unlike the register* methods, there's only one notification handler
310     *
311     * @param h Handler for notification message.
312     * @param what User-defined message code.
313     * @param obj User object.
314     */
315    void setOnIccSmsFull(Handler h, int what, Object obj);
316    void unSetOnIccSmsFull(Handler h);
317
318    /**
319     * Sets the handler for SIM Refresh notifications.
320     *
321     * @param h Handler for notification message.
322     * @param what User-defined message code.
323     * @param obj User object.
324     */
325    void registerForIccRefresh(Handler h, int what, Object obj);
326    void unregisterForIccRefresh(Handler h);
327
328    void setOnIccRefresh(Handler h, int what, Object obj);
329    void unsetOnIccRefresh(Handler h);
330
331    /**
332     * Sets the handler for RING 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 setOnCallRing(Handler h, int what, Object obj);
340    void unSetOnCallRing(Handler h);
341
342    /**
343     * Sets the handler for RESTRICTED_STATE changed notification,
344     * eg, for Domain Specific Access Control
345     * unlike the register* methods, there's only one signal strength handler
346     *
347     * AsyncResult.result is an int[1]
348     * response.obj.result[0] is a bitmask of RIL_RESTRICTED_STATE_* values
349     */
350
351    void setOnRestrictedStateChanged(Handler h, int what, Object obj);
352    void unSetOnRestrictedStateChanged(Handler h);
353
354    /**
355     * Sets the handler for Supplementary Service Notifications.
356     * Unlike the register* methods, there's only one notification handler
357     *
358     * @param h Handler for notification message.
359     * @param what User-defined message code.
360     * @param obj User object.
361     */
362    void setOnSuppServiceNotification(Handler h, int what, Object obj);
363    void unSetOnSuppServiceNotification(Handler h);
364
365    /**
366     * Sets the handler for Session End Notifications for CAT.
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 setOnCatSessionEnd(Handler h, int what, Object obj);
374    void unSetOnCatSessionEnd(Handler h);
375
376    /**
377     * Sets the handler for Proactive Commands 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 setOnCatProactiveCmd(Handler h, int what, Object obj);
385    void unSetOnCatProactiveCmd(Handler h);
386
387    /**
388     * Sets the handler for Event Notifications 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 setOnCatEvent(Handler h, int what, Object obj);
396    void unSetOnCatEvent(Handler h);
397
398    /**
399     * Sets the handler for Call Set Up 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 setOnCatCallSetUp(Handler h, int what, Object obj);
407    void unSetOnCatCallSetUp(Handler h);
408
409    /**
410     * Enables/disbables supplementary service related notifications from
411     * the network.
412     *
413     * @param enable true to enable notifications, false to disable.
414     * @param result Message to be posted when command completes.
415     */
416    void setSuppServiceNotifications(boolean enable, Message result);
417    //void unSetSuppServiceNotifications(Handler h);
418
419    /**
420     * Sets the handler for Event Notifications for CDMA Display Info.
421     * Unlike the register* methods, there's only one notification handler
422     *
423     * @param h Handler for notification message.
424     * @param what User-defined message code.
425     * @param obj User object.
426     */
427    void registerForDisplayInfo(Handler h, int what, Object obj);
428    void unregisterForDisplayInfo(Handler h);
429
430    /**
431     * Sets the handler for Event Notifications for CallWaiting 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 registerForCallWaitingInfo(Handler h, int what, Object obj);
439    void unregisterForCallWaitingInfo(Handler h);
440
441    /**
442     * Sets the handler for Event Notifications for Signal 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 registerForSignalInfo(Handler h, int what, Object obj);
450    void unregisterForSignalInfo(Handler h);
451
452    /**
453     * Registers the handler for CDMA number information record
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 registerForNumberInfo(Handler h, int what, Object obj);
461    void unregisterForNumberInfo(Handler h);
462
463    /**
464     * Registers the handler for CDMA redirected 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 registerForRedirectedNumberInfo(Handler h, int what, Object obj);
472    void unregisterForRedirectedNumberInfo(Handler h);
473
474    /**
475     * Registers the handler for CDMA line control 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 registerForLineControlInfo(Handler h, int what, Object obj);
483    void unregisterForLineControlInfo(Handler h);
484
485    /**
486     * Registers the handler for CDMA T53 CLIR 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 registerFoT53ClirlInfo(Handler h, int what, Object obj);
494    void unregisterForT53ClirInfo(Handler h);
495
496    /**
497     * Registers the handler for CDMA T53 audio control 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 registerForT53AudioControlInfo(Handler h, int what, Object obj);
505    void unregisterForT53AudioControlInfo(Handler h);
506
507    /**
508     * Fires on if Modem enters Emergency Callback mode
509     */
510    void setEmergencyCallbackMode(Handler h, int what, Object obj);
511
512     /**
513      * Fires on any CDMA OTA provision status change
514      */
515     void registerForCdmaOtaProvision(Handler h,int what, Object obj);
516     void unregisterForCdmaOtaProvision(Handler h);
517
518     /**
519      * Registers the handler when out-band ringback tone is needed.<p>
520      *
521      *  Messages received from this:
522      *  Message.obj will be an AsyncResult
523      *  AsyncResult.userObj = obj
524      *  AsyncResult.result = boolean. <p>
525      */
526     void registerForRingbackTone(Handler h, int what, Object obj);
527     void unregisterForRingbackTone(Handler h);
528
529     /**
530      * Registers the handler when mute/unmute need to be resent to get
531      * uplink audio during a call.<p>
532      *
533      * @param h Handler for notification message.
534      * @param what User-defined message code.
535      * @param obj User object.
536      *
537      */
538     void registerForResendIncallMute(Handler h, int what, Object obj);
539     void unregisterForResendIncallMute(Handler h);
540
541     /**
542      * Registers the handler for when Cdma subscription changed events
543      *
544      * @param h Handler for notification message.
545      * @param what User-defined message code.
546      * @param obj User object.
547      *
548      */
549     void registerForCdmaSubscriptionChanged(Handler h, int what, Object obj);
550     void unregisterForCdmaSubscriptionChanged(Handler h);
551
552     /**
553      * Registers the handler for when Cdma prl changed events
554      *
555      * @param h Handler for notification message.
556      * @param what User-defined message code.
557      * @param obj User object.
558      *
559      */
560     void registerForCdmaPrlChanged(Handler h, int what, Object obj);
561     void unregisterForCdmaPrlChanged(Handler h);
562
563     /**
564      * Registers the handler for when Cdma prl changed events
565      *
566      * @param h Handler for notification message.
567      * @param what User-defined message code.
568      * @param obj User object.
569      *
570      */
571     void registerForExitEmergencyCallbackMode(Handler h, int what, Object obj);
572     void unregisterForExitEmergencyCallbackMode(Handler h);
573
574     /**
575      * Registers the handler for RIL_UNSOL_RIL_CONNECT events.
576      *
577      * When ril connects or disconnects a message is sent to the registrant
578      * which contains an AsyncResult, ar, in msg.obj. The ar.result is an
579      * Integer which is the version of the ril or -1 if the ril disconnected.
580      *
581      * @param h Handler for notification message.
582      * @param what User-defined message code.
583      * @param obj User object.
584      */
585     void registerForRilConnected(Handler h, int what, Object obj);
586     void unregisterForRilConnected(Handler h);
587
588    /**
589     * Supply the ICC PIN to the ICC card
590     *
591     *  returned message
592     *  retMsg.obj = AsyncResult ar
593     *  ar.exception carries exception on failure
594     *  This exception is CommandException with an error of PASSWORD_INCORRECT
595     *  if the password is incorrect
596     *
597     *  ar.result is an optional array of integers where the first entry
598     *  is the number of attempts remaining before the ICC will be PUK locked.
599     *
600     * ar.exception and ar.result are null on success
601     */
602
603    void supplyIccPin(String pin, Message result);
604
605    /**
606     * Supply the PIN for the app with this AID on the ICC card
607     *
608     *  AID (Application ID), See ETSI 102.221 8.1 and 101.220 4
609     *
610     *  returned message
611     *  retMsg.obj = AsyncResult ar
612     *  ar.exception carries exception on failure
613     *  This exception is CommandException with an error of PASSWORD_INCORRECT
614     *  if the password is incorrect
615     *
616     *  ar.result is an optional array of integers where the first entry
617     *  is the number of attempts remaining before the ICC will be PUK locked.
618     *
619     * ar.exception and ar.result are null on success
620     */
621
622    void supplyIccPinForApp(String pin, String aid, Message result);
623
624    /**
625     * Supply the ICC PUK and newPin to the ICC card
626     *
627     *  returned message
628     *  retMsg.obj = AsyncResult ar
629     *  ar.exception carries exception on failure
630     *  This exception is CommandException with an error of PASSWORD_INCORRECT
631     *  if the password is incorrect
632     *
633     *  ar.result is an optional array of integers where the first entry
634     *  is the number of attempts remaining before the ICC is permanently disabled.
635     *
636     * ar.exception and ar.result are null on success
637     */
638
639    void supplyIccPuk(String puk, String newPin, Message result);
640
641    /**
642     * Supply the PUK, new pin for the app with this AID on the ICC card
643     *
644     *  AID (Application ID), See ETSI 102.221 8.1 and 101.220 4
645     *
646     *  retMsg.obj = AsyncResult ar
647     *  ar.exception carries exception on failure
648     *  This exception is CommandException with an error of PASSWORD_INCORRECT
649     *  if the password is incorrect
650     *
651     *  ar.result is an optional array of integers where the first entry
652     *  is the number of attempts remaining before the ICC is permanently disabled.
653     *
654     * ar.exception and ar.result are null on success
655     */
656
657    void supplyIccPukForApp(String puk, String newPin, String aid, Message result);
658
659    /**
660     * Supply the ICC PIN2 to the ICC card
661     * Only called following operation where ICC_PIN2 was
662     * returned as a a failure from a previous operation
663     *
664     *  returned message
665     *  retMsg.obj = AsyncResult ar
666     *  ar.exception carries exception on failure
667     *  This exception is CommandException with an error of PASSWORD_INCORRECT
668     *  if the password is incorrect
669     *
670     *  ar.result is an optional array of integers where the first entry
671     *  is the number of attempts remaining before the ICC will be PUK locked.
672     *
673     * ar.exception and ar.result are null on success
674     */
675
676    void supplyIccPin2(String pin2, Message result);
677
678    /**
679     * Supply the PIN2 for the app with this AID on the ICC card
680     * Only called following operation where ICC_PIN2 was
681     * returned as a a failure from a previous operation
682     *
683     *  AID (Application ID), See ETSI 102.221 8.1 and 101.220 4
684     *
685     *  returned message
686     *  retMsg.obj = AsyncResult ar
687     *  ar.exception carries exception on failure
688     *  This exception is CommandException with an error of PASSWORD_INCORRECT
689     *  if the password is incorrect
690     *
691     *  ar.result is an optional array of integers where the first entry
692     *  is the number of attempts remaining before the ICC will be PUK locked.
693     *
694     * ar.exception and ar.result are null on success
695     */
696
697    void supplyIccPin2ForApp(String pin2, String aid, Message result);
698
699    /**
700     * Supply the SIM PUK2 to the SIM card
701     * Only called following operation where SIM_PUK2 was
702     * returned as a a failure from a previous operation
703     *
704     *  returned message
705     *  retMsg.obj = AsyncResult ar
706     *  ar.exception carries exception on failure
707     *  This exception is CommandException with an error of PASSWORD_INCORRECT
708     *  if the password is incorrect
709     *
710     *  ar.result is an optional array of integers where the first entry
711     *  is the number of attempts remaining before the ICC is permanently disabled.
712     *
713     * ar.exception and ar.result are null on success
714     */
715
716    void supplyIccPuk2(String puk2, String newPin2, Message result);
717
718    /**
719     * Supply the PUK2, newPin2 for the app with this AID on the ICC card
720     * Only called following operation where SIM_PUK2 was
721     * returned as a a failure from a previous operation
722     *
723     *  AID (Application ID), See ETSI 102.221 8.1 and 101.220 4
724     *
725     *  returned message
726     *  retMsg.obj = AsyncResult ar
727     *  ar.exception carries exception on failure
728     *  This exception is CommandException with an error of PASSWORD_INCORRECT
729     *  if the password is incorrect
730     *
731     *  ar.result is an optional array of integers where the first entry
732     *  is the number of attempts remaining before the ICC is permanently disabled.
733     *
734     * ar.exception and ar.result are null on success
735     */
736
737    void supplyIccPuk2ForApp(String puk2, String newPin2, String aid, Message result);
738
739    // TODO: Add java doc and indicate that msg.arg1 contains the number of attempts remaining.
740    void changeIccPin(String oldPin, String newPin, Message result);
741    void changeIccPinForApp(String oldPin, String newPin, String aidPtr, Message result);
742    void changeIccPin2(String oldPin2, String newPin2, Message result);
743    void changeIccPin2ForApp(String oldPin2, String newPin2, String aidPtr, Message result);
744
745    void changeBarringPassword(String facility, String oldPwd, String newPwd, Message result);
746
747    void supplyNetworkDepersonalization(String netpin, Message result);
748
749    /**
750     *  returned message
751     *  retMsg.obj = AsyncResult ar
752     *  ar.exception carries exception on failure
753     *  ar.userObject contains the orignal value of result.obj
754     *  ar.result contains a List of DriverCall
755     *      The ar.result List is sorted by DriverCall.index
756     */
757    void getCurrentCalls (Message result);
758
759    /**
760     *  returned message
761     *  retMsg.obj = AsyncResult ar
762     *  ar.exception carries exception on failure
763     *  ar.userObject contains the orignal value of result.obj
764     *  ar.result contains a List of DataCallResponse
765     *  @deprecated Do not use.
766     */
767    @Deprecated
768    void getPDPContextList(Message result);
769
770    /**
771     *  returned message
772     *  retMsg.obj = AsyncResult ar
773     *  ar.exception carries exception on failure
774     *  ar.userObject contains the orignal value of result.obj
775     *  ar.result contains a List of DataCallResponse
776     */
777    void getDataCallList(Message result);
778
779    /**
780     *  returned message
781     *  retMsg.obj = AsyncResult ar
782     *  ar.exception carries exception on failure
783     *  ar.userObject contains the orignal value of result.obj
784     *  ar.result is null on success and failure
785     *
786     * CLIR_DEFAULT     == on "use subscription default value"
787     * CLIR_SUPPRESSION == on "CLIR suppression" (allow CLI presentation)
788     * CLIR_INVOCATION  == on "CLIR invocation" (restrict CLI presentation)
789     */
790    void dial (String address, int clirMode, Message result);
791
792    /**
793     *  returned message
794     *  retMsg.obj = AsyncResult ar
795     *  ar.exception carries exception on failure
796     *  ar.userObject contains the orignal value of result.obj
797     *  ar.result is null on success and failure
798     *
799     * CLIR_DEFAULT     == on "use subscription default value"
800     * CLIR_SUPPRESSION == on "CLIR suppression" (allow CLI presentation)
801     * CLIR_INVOCATION  == on "CLIR invocation" (restrict CLI presentation)
802     */
803    void dial(String address, int clirMode, UUSInfo uusInfo, Message result);
804
805    /**
806     *  returned message
807     *  retMsg.obj = AsyncResult ar
808     *  ar.exception carries exception on failure
809     *  ar.userObject contains the orignal value of result.obj
810     *  ar.result is String containing IMSI on success
811     */
812    void getIMSI(Message result);
813
814    /**
815     *  returned message
816     *  retMsg.obj = AsyncResult ar
817     *  ar.exception carries exception on failure
818     *  ar.userObject contains the orignal value of result.obj
819     *  ar.result is String containing IMSI on success
820     */
821    void getIMSIForApp(String aid, Message result);
822
823    /**
824     *  returned message
825     *  retMsg.obj = AsyncResult ar
826     *  ar.exception carries exception on failure
827     *  ar.userObject contains the orignal value of result.obj
828     *  ar.result is String containing IMEI on success
829     */
830    void getIMEI(Message result);
831
832    /**
833     *  returned message
834     *  retMsg.obj = AsyncResult ar
835     *  ar.exception carries exception on failure
836     *  ar.userObject contains the orignal value of result.obj
837     *  ar.result is String containing IMEISV on success
838     */
839    void getIMEISV(Message result);
840
841    /**
842     * Hang up one individual connection.
843     *  returned message
844     *  retMsg.obj = AsyncResult ar
845     *  ar.exception carries exception on failure
846     *  ar.userObject contains the orignal value of result.obj
847     *  ar.result is null on success and failure
848     *
849     *  3GPP 22.030 6.5.5
850     *  "Releases a specific active call X"
851     */
852    void hangupConnection (int gsmIndex, Message result);
853
854    /**
855     * 3GPP 22.030 6.5.5
856     *  "Releases all held calls or sets User Determined User Busy (UDUB)
857     *   for a waiting call."
858     *  ar.exception carries exception on failure
859     *  ar.userObject contains the orignal value of result.obj
860     *  ar.result is null on success and failure
861     */
862    void hangupWaitingOrBackground (Message result);
863
864    /**
865     * 3GPP 22.030 6.5.5
866     * "Releases all active calls (if any exist) and accepts
867     *  the other (held or waiting) call."
868     *
869     *  ar.exception carries exception on failure
870     *  ar.userObject contains the orignal value of result.obj
871     *  ar.result is null on success and failure
872     */
873    void hangupForegroundResumeBackground (Message result);
874
875    /**
876     * 3GPP 22.030 6.5.5
877     * "Places all active calls (if any exist) on hold and accepts
878     *  the other (held or waiting) call."
879     *
880     *  ar.exception carries exception on failure
881     *  ar.userObject contains the orignal value of result.obj
882     *  ar.result is null on success and failure
883     */
884    void switchWaitingOrHoldingAndActive (Message result);
885
886    /**
887     * 3GPP 22.030 6.5.5
888     * "Adds a held call to the conversation"
889     *
890     *  ar.exception carries exception on failure
891     *  ar.userObject contains the orignal value of result.obj
892     *  ar.result is null on success and failure
893     */
894    void conference (Message result);
895
896    /**
897     * Set preferred Voice Privacy (VP).
898     *
899     * @param enable true is enhanced and false is normal VP
900     * @param result is a callback message
901     */
902    void setPreferredVoicePrivacy(boolean enable, Message result);
903
904    /**
905     * Get currently set preferred Voice Privacy (VP) mode.
906     *
907     * @param result is a callback message
908     */
909    void getPreferredVoicePrivacy(Message result);
910
911    /**
912     * 3GPP 22.030 6.5.5
913     * "Places all active calls on hold except call X with which
914     *  communication shall be supported."
915     */
916    void separateConnection (int gsmIndex, Message result);
917
918    /**
919     *
920     *  ar.exception carries exception on failure
921     *  ar.userObject contains the orignal value of result.obj
922     *  ar.result is null on success and failure
923     */
924    void acceptCall (Message result);
925
926    /**
927     *  also known as UDUB
928     *  ar.exception carries exception on failure
929     *  ar.userObject contains the orignal value of result.obj
930     *  ar.result is null on success and failure
931     */
932    void rejectCall (Message result);
933
934    /**
935     * 3GPP 22.030 6.5.5
936     * "Connects the two calls and disconnects the subscriber from both calls"
937     *
938     *  ar.exception carries exception on failure
939     *  ar.userObject contains the orignal value of result.obj
940     *  ar.result is null on success and failure
941     */
942    void explicitCallTransfer (Message result);
943
944    /**
945     * cause code returned as int[0] in Message.obj.response
946     * Returns integer cause code defined in TS 24.008
947     * Annex H or closest approximation.
948     * Most significant codes:
949     * - Any defined in 22.001 F.4 (for generating busy/congestion)
950     * - Cause 68: ACM >= ACMMax
951     */
952    void getLastCallFailCause (Message result);
953
954
955    /**
956     * Reason for last PDP context deactivate or failure to activate
957     * cause code returned as int[0] in Message.obj.response
958     * returns an integer cause code defined in TS 24.008
959     * section 6.1.3.1.3 or close approximation
960     * @deprecated Do not use.
961     */
962    @Deprecated
963    void getLastPdpFailCause (Message result);
964
965    /**
966     * The preferred new alternative to getLastPdpFailCause
967     * that is also CDMA-compatible.
968     */
969    void getLastDataCallFailCause (Message result);
970
971    void setMute (boolean enableMute, Message response);
972
973    void getMute (Message response);
974
975    /**
976     * response.obj is an AsyncResult
977     * response.obj.result is an int[2]
978     * response.obj.result[0] is received signal strength (0-31, 99)
979     * response.obj.result[1] is  bit error rate (0-7, 99)
980     * as defined in TS 27.007 8.5
981     */
982    void getSignalStrength (Message response);
983
984
985    /**
986     * response.obj.result is an int[3]
987     * response.obj.result[0] is registration state 0-5 from TS 27.007 7.2
988     * response.obj.result[1] is LAC if registered or -1 if not
989     * response.obj.result[2] is CID if registered or -1 if not
990     * valid LAC and CIDs are 0x0000 - 0xffff
991     *
992     * Please note that registration state 4 ("unknown") is treated
993     * as "out of service" above
994     */
995    void getVoiceRegistrationState (Message response);
996
997    /**
998     * response.obj.result is an int[3]
999     * response.obj.result[0] is registration state 0-5 from TS 27.007 7.2
1000     * response.obj.result[1] is LAC if registered or -1 if not
1001     * response.obj.result[2] is CID if registered or -1 if not
1002     * valid LAC and CIDs are 0x0000 - 0xffff
1003     *
1004     * Please note that registration state 4 ("unknown") is treated
1005     * as "out of service" above
1006     */
1007    void getDataRegistrationState (Message response);
1008
1009    /**
1010     * response.obj.result is a String[3]
1011     * response.obj.result[0] is long alpha or null if unregistered
1012     * response.obj.result[1] is short alpha or null if unregistered
1013     * response.obj.result[2] is numeric or null if unregistered
1014     */
1015    void getOperator(Message response);
1016
1017    /**
1018     *  ar.exception carries exception on failure
1019     *  ar.userObject contains the orignal value of result.obj
1020     *  ar.result is null on success and failure
1021     */
1022    void sendDtmf(char c, Message result);
1023
1024
1025    /**
1026     *  ar.exception carries exception on failure
1027     *  ar.userObject contains the orignal value of result.obj
1028     *  ar.result is null on success and failure
1029     */
1030    void startDtmf(char c, Message result);
1031
1032    /**
1033     *  ar.exception carries exception on failure
1034     *  ar.userObject contains the orignal value of result.obj
1035     *  ar.result is null on success and failure
1036     */
1037    void stopDtmf(Message result);
1038
1039    /**
1040     *  ar.exception carries exception on failure
1041     *  ar.userObject contains the orignal value of result.obj
1042     *  ar.result is null on success and failure
1043     */
1044    void sendBurstDtmf(String dtmfString, int on, int off, Message result);
1045
1046    /**
1047     * smscPDU is smsc address in PDU form GSM BCD format prefixed
1048     *      by a length byte (as expected by TS 27.005) or NULL for default SMSC
1049     * pdu is SMS in PDU format as an ASCII hex string
1050     *      less the SMSC address
1051     */
1052    void sendSMS (String smscPDU, String pdu, Message response);
1053
1054    /**
1055     * Send an SMS message, Identical to sendSMS,
1056     * except that more messages are expected to be sent soon
1057     * smscPDU is smsc address in PDU form GSM BCD format prefixed
1058     *      by a length byte (as expected by TS 27.005) or NULL for default SMSC
1059     * pdu is SMS in PDU format as an ASCII hex string
1060     *      less the SMSC address
1061     */
1062    void sendSMSExpectMore (String smscPDU, String pdu, Message response);
1063
1064    /**
1065     * @param pdu is CDMA-SMS in internal pseudo-PDU format
1066     * @param response sent when operation completes
1067     */
1068    void sendCdmaSms(byte[] pdu, Message response);
1069
1070    /**
1071     * send SMS over IMS with 3GPP/GSM SMS format
1072     * @param smscPDU is smsc address in PDU form GSM BCD format prefixed
1073     *      by a length byte (as expected by TS 27.005) or NULL for default SMSC
1074     * @param pdu is SMS in PDU format as an ASCII hex string
1075     *      less the SMSC address
1076     * @param retry indicates if this is a retry; 0 == not retry, nonzero = retry
1077     * @param messageRef valid field if retry is set to nonzero.
1078     *        Contains messageRef from RIL_SMS_Response corresponding to failed MO SMS
1079     * @param response sent when operation completes
1080     */
1081    void sendImsGsmSms (String smscPDU, String pdu, int retry, int messageRef,
1082            Message response);
1083
1084    /**
1085     * send SMS over IMS with 3GPP2/CDMA SMS format
1086     * @param pdu is CDMA-SMS in internal pseudo-PDU format
1087     * @param response sent when operation completes
1088     * @param retry indicates if this is a retry; 0 == not retry, nonzero = retry
1089     * @param messageRef valid field if retry is set to nonzero.
1090     *        Contains messageRef from RIL_SMS_Response corresponding to failed MO SMS
1091     * @param response sent when operation completes
1092     */
1093    void sendImsCdmaSms(byte[] pdu, int retry, int messageRef, Message response);
1094
1095    /**
1096     * Deletes the specified SMS record from SIM memory (EF_SMS).
1097     *
1098     * @param index index of the SMS record to delete
1099     * @param response sent when operation completes
1100     */
1101    void deleteSmsOnSim(int index, Message response);
1102
1103    /**
1104     * Deletes the specified SMS record from RUIM memory (EF_SMS in DF_CDMA).
1105     *
1106     * @param index index of the SMS record to delete
1107     * @param response sent when operation completes
1108     */
1109    void deleteSmsOnRuim(int index, Message response);
1110
1111    /**
1112     * Writes an SMS message to SIM memory (EF_SMS).
1113     *
1114     * @param status status of message on SIM.  One of:
1115     *                  SmsManger.STATUS_ON_ICC_READ
1116     *                  SmsManger.STATUS_ON_ICC_UNREAD
1117     *                  SmsManger.STATUS_ON_ICC_SENT
1118     *                  SmsManger.STATUS_ON_ICC_UNSENT
1119     * @param pdu message PDU, as hex string
1120     * @param response sent when operation completes.
1121     *                  response.obj will be an AsyncResult, and will indicate
1122     *                  any error that may have occurred (eg, out of memory).
1123     */
1124    void writeSmsToSim(int status, String smsc, String pdu, Message response);
1125
1126    void writeSmsToRuim(int status, String pdu, Message response);
1127
1128    void setRadioPower(boolean on, Message response);
1129
1130    void acknowledgeLastIncomingGsmSms(boolean success, int cause, Message response);
1131
1132    void acknowledgeLastIncomingCdmaSms(boolean success, int cause, Message response);
1133
1134    /**
1135     * Acknowledge successful or failed receipt of last incoming SMS,
1136     * including acknowledgement TPDU to send as the RP-User-Data element
1137     * of the RP-ACK or RP-ERROR PDU.
1138     *
1139     * @param success true to send RP-ACK, false to send RP-ERROR
1140     * @param ackPdu the acknowledgement TPDU in hexadecimal format
1141     * @param response sent when operation completes.
1142     */
1143    void acknowledgeIncomingGsmSmsWithPdu(boolean success, String ackPdu, Message response);
1144
1145    /**
1146     * parameters equivalent to 27.007 AT+CRSM command
1147     * response.obj will be an AsyncResult
1148     * response.obj.result will be an IccIoResult on success
1149     */
1150    void iccIO (int command, int fileid, String path, int p1, int p2, int p3,
1151            String data, String pin2, Message response);
1152
1153    /**
1154     * parameters equivalent to 27.007 AT+CRSM command
1155     * response.obj will be an AsyncResult
1156     * response.obj.userObj will be a IccIoResult on success
1157     */
1158    void iccIOForApp (int command, int fileid, String path, int p1, int p2, int p3,
1159            String data, String pin2, String aid, Message response);
1160
1161    /**
1162     * (AsyncResult)response.obj).result is an int[] with element [0] set to
1163     * 1 for "CLIP is provisioned", and 0 for "CLIP is not provisioned".
1164     *
1165     * @param response is callback message
1166     */
1167
1168    void queryCLIP(Message response);
1169
1170    /**
1171     * response.obj will be a an int[2]
1172     *
1173     * response.obj[0] will be TS 27.007 +CLIR parameter 'n'
1174     *  0 presentation indicator is used according to the subscription of the CLIR service
1175     *  1 CLIR invocation
1176     *  2 CLIR suppression
1177     *
1178     * response.obj[1] will be TS 27.007 +CLIR parameter 'm'
1179     *  0 CLIR not provisioned
1180     *  1 CLIR provisioned in permanent mode
1181     *  2 unknown (e.g. no network, etc.)
1182     *  3 CLIR temporary mode presentation restricted
1183     *  4 CLIR temporary mode presentation allowed
1184     */
1185
1186    void getCLIR(Message response);
1187
1188    /**
1189     * clirMode is one of the CLIR_* constants above
1190     *
1191     * response.obj is null
1192     */
1193
1194    void setCLIR(int clirMode, Message response);
1195
1196    /**
1197     * (AsyncResult)response.obj).result is an int[] with element [0] set to
1198     * 0 for disabled, 1 for enabled.
1199     *
1200     * @param serviceClass is a sum of SERVICE_CLASS_*
1201     * @param response is callback message
1202     */
1203
1204    void queryCallWaiting(int serviceClass, Message response);
1205
1206    /**
1207     * @param enable is true to enable, false to disable
1208     * @param serviceClass is a sum of SERVICE_CLASS_*
1209     * @param response is callback message
1210     */
1211
1212    void setCallWaiting(boolean enable, int serviceClass, Message response);
1213
1214    /**
1215     * @param action is one of CF_ACTION_*
1216     * @param cfReason is one of CF_REASON_*
1217     * @param serviceClass is a sum of SERVICE_CLASSS_*
1218     */
1219    void setCallForward(int action, int cfReason, int serviceClass,
1220                String number, int timeSeconds, Message response);
1221
1222    /**
1223     * cfReason is one of CF_REASON_*
1224     *
1225     * ((AsyncResult)response.obj).result will be an array of
1226     * CallForwardInfo's
1227     *
1228     * An array of length 0 means "disabled for all codes"
1229     */
1230    void queryCallForwardStatus(int cfReason, int serviceClass,
1231            String number, Message response);
1232
1233    void setNetworkSelectionModeAutomatic(Message response);
1234
1235    void setNetworkSelectionModeManual(String operatorNumeric, Message response);
1236
1237    /**
1238     * Queries whether the current network selection mode is automatic
1239     * or manual
1240     *
1241     * ((AsyncResult)response.obj).result  is an int[] with element [0] being
1242     * a 0 for automatic selection and a 1 for manual selection
1243     */
1244
1245    void getNetworkSelectionMode(Message response);
1246
1247    /**
1248     * Queries the currently available networks
1249     *
1250     * ((AsyncResult)response.obj).result  is a List of NetworkInfo objects
1251     */
1252    void getAvailableNetworks(Message response);
1253
1254    void getBasebandVersion (Message response);
1255
1256
1257    /**
1258     * (AsyncResult)response.obj).result will be an Integer representing
1259     * the sum of enabled service classes (sum of SERVICE_CLASS_*)
1260     *
1261     * @param facility one of CB_FACILTY_*
1262     * @param password password or "" if not required
1263     * @param serviceClass is a sum of SERVICE_CLASS_*
1264     * @param response is callback message
1265     */
1266
1267    void queryFacilityLock (String facility, String password, int serviceClass,
1268        Message response);
1269
1270    /**
1271     * (AsyncResult)response.obj).result will be an Integer representing
1272     * the sum of enabled service classes (sum of SERVICE_CLASS_*) for the
1273     * application with appId.
1274     *
1275     * @param facility one of CB_FACILTY_*
1276     * @param password password or "" if not required
1277     * @param serviceClass is a sum of SERVICE_CLASS_*
1278     * @param appId is application Id or null if none
1279     * @param response is callback message
1280     */
1281
1282    void queryFacilityLockForApp(String facility, String password, int serviceClass, String appId,
1283        Message response);
1284
1285    /**
1286     * @param facility one of CB_FACILTY_*
1287     * @param lockState true means lock, false means unlock
1288     * @param password password or "" if not required
1289     * @param serviceClass is a sum of SERVICE_CLASS_*
1290     * @param response is callback message
1291     */
1292    void setFacilityLock (String facility, boolean lockState, String password,
1293        int serviceClass, Message response);
1294
1295    /**
1296     * Set the facility lock for the app with this AID on the ICC card.
1297     *
1298     * @param facility one of CB_FACILTY_*
1299     * @param lockState true means lock, false means unlock
1300     * @param password password or "" if not required
1301     * @param serviceClass is a sum of SERVICE_CLASS_*
1302     * @param appId is application Id or null if none
1303     * @param response is callback message
1304     */
1305    void setFacilityLockForApp(String facility, boolean lockState, String password,
1306        int serviceClass, String appId, Message response);
1307
1308    void sendUSSD (String ussdString, Message response);
1309
1310    /**
1311     * Cancels a pending USSD session if one exists.
1312     * @param response callback message
1313     */
1314    void cancelPendingUssd (Message response);
1315
1316    void resetRadio(Message result);
1317
1318    /**
1319     * Assign a specified band for RF configuration.
1320     *
1321     * @param bandMode one of BM_*_BAND
1322     * @param response is callback message
1323     */
1324    void setBandMode (int bandMode, Message response);
1325
1326    /**
1327     * Query the list of band mode supported by RF.
1328     *
1329     * @param response is callback message
1330     *        ((AsyncResult)response.obj).result  is an int[] where int[0] is
1331     *        the size of the array and the rest of each element representing
1332     *        one available BM_*_BAND
1333     */
1334    void queryAvailableBandMode (Message response);
1335
1336    /**
1337     *  Requests to set the preferred network type for searching and registering
1338     * (CS/PS domain, RAT, and operation mode)
1339     * @param networkType one of  NT_*_TYPE
1340     * @param response is callback message
1341     */
1342    void setPreferredNetworkType(int networkType , Message response);
1343
1344     /**
1345     *  Query the preferred network type setting
1346     *
1347     * @param response is callback message to report one of  NT_*_TYPE
1348     */
1349    void getPreferredNetworkType(Message response);
1350
1351    /**
1352     * Query neighboring cell ids
1353     *
1354     * @param response s callback message to cell ids
1355     */
1356    void getNeighboringCids(Message response);
1357
1358    /**
1359     * Request to enable/disable network state change notifications when
1360     * location information (lac and/or cid) has changed.
1361     *
1362     * @param enable true to enable, false to disable
1363     * @param response callback message
1364     */
1365    void setLocationUpdates(boolean enable, Message response);
1366
1367    /**
1368     * Gets the default SMSC address.
1369     *
1370     * @param result Callback message contains the SMSC address.
1371     */
1372    void getSmscAddress(Message result);
1373
1374    /**
1375     * Sets the default SMSC address.
1376     *
1377     * @param address new SMSC address
1378     * @param result Callback message is empty on completion
1379     */
1380    void setSmscAddress(String address, Message result);
1381
1382    /**
1383     * Indicates whether there is storage available for new SMS messages.
1384     * @param available true if storage is available
1385     * @param result callback message
1386     */
1387    void reportSmsMemoryStatus(boolean available, Message result);
1388
1389    /**
1390     * Indicates to the vendor ril that StkService is running
1391     * and is ready to receive RIL_UNSOL_STK_XXXX commands.
1392     *
1393     * @param result callback message
1394     */
1395    void reportStkServiceIsRunning(Message result);
1396
1397    void invokeOemRilRequestRaw(byte[] data, Message response);
1398
1399    void invokeOemRilRequestStrings(String[] strings, Message response);
1400
1401    /**
1402     * Fires when RIL_UNSOL_OEM_HOOK_RAW is received from the RIL.
1403     */
1404    void setOnUnsolOemHookRaw(Handler h, int what, Object obj);
1405    void unSetOnUnsolOemHookRaw(Handler h);
1406
1407    /**
1408     * Send TERMINAL RESPONSE to the SIM, after processing a proactive command
1409     * sent by the SIM.
1410     *
1411     * @param contents  String containing SAT/USAT response in hexadecimal
1412     *                  format starting with first byte of response data. See
1413     *                  TS 102 223 for details.
1414     * @param response  Callback message
1415     */
1416    public void sendTerminalResponse(String contents, Message response);
1417
1418    /**
1419     * Send ENVELOPE to the SIM, after processing a proactive command sent by
1420     * the SIM.
1421     *
1422     * @param contents  String containing SAT/USAT response in hexadecimal
1423     *                  format starting with command tag. See TS 102 223 for
1424     *                  details.
1425     * @param response  Callback message
1426     */
1427    public void sendEnvelope(String contents, Message response);
1428
1429    /**
1430     * Send ENVELOPE to the SIM, such as an SMS-PP data download envelope
1431     * for a SIM data download message. This method has one difference
1432     * from {@link #sendEnvelope}: The SW1 and SW2 status bytes from the UICC response
1433     * are returned along with the response data.
1434     *
1435     * response.obj will be an AsyncResult
1436     * response.obj.result will be an IccIoResult on success
1437     *
1438     * @param contents  String containing SAT/USAT response in hexadecimal
1439     *                  format starting with command tag. See TS 102 223 for
1440     *                  details.
1441     * @param response  Callback message
1442     */
1443    public void sendEnvelopeWithStatus(String contents, Message response);
1444
1445    /**
1446     * Accept or reject the call setup request from SIM.
1447     *
1448     * @param accept   true if the call is to be accepted, false otherwise.
1449     * @param response Callback message
1450     */
1451    public void handleCallSetupRequestFromSim(boolean accept, Message response);
1452
1453    /**
1454     * Activate or deactivate cell broadcast SMS for GSM.
1455     *
1456     * @param activate
1457     *            true = activate, false = deactivate
1458     * @param result Callback message is empty on completion
1459     */
1460    public void setGsmBroadcastActivation(boolean activate, Message result);
1461
1462    /**
1463     * Configure cell broadcast SMS for GSM.
1464     *
1465     * @param response Callback message is empty on completion
1466     */
1467    public void setGsmBroadcastConfig(SmsBroadcastConfigInfo[] config, Message response);
1468
1469    /**
1470     * Query the current configuration of cell broadcast SMS of GSM.
1471     *
1472     * @param response
1473     *        Callback message contains the configuration from the modem
1474     *        on completion
1475     */
1476    public void getGsmBroadcastConfig(Message response);
1477
1478    //***** new Methods for CDMA support
1479
1480    /**
1481     * Request the device ESN / MEID / IMEI / IMEISV.
1482     * "response" is const char **
1483     *   [0] is IMEI if GSM subscription is available
1484     *   [1] is IMEISV if GSM subscription is available
1485     *   [2] is ESN if CDMA subscription is available
1486     *   [3] is MEID if CDMA subscription is available
1487     */
1488    public void getDeviceIdentity(Message response);
1489
1490    /**
1491     * Request the device MDN / H_SID / H_NID / MIN.
1492     * "response" is const char **
1493     *   [0] is MDN if CDMA subscription is available
1494     *   [1] is a comma separated list of H_SID (Home SID) in decimal format
1495     *       if CDMA subscription is available
1496     *   [2] is a comma separated list of H_NID (Home NID) in decimal format
1497     *       if CDMA subscription is available
1498     *   [3] is MIN (10 digits, MIN2+MIN1) if CDMA subscription is available
1499     */
1500    public void getCDMASubscription(Message response);
1501
1502    /**
1503     * Send Flash Code.
1504     * "response" is is NULL
1505     *   [0] is a FLASH string
1506     */
1507    public void sendCDMAFeatureCode(String FeatureCode, Message response);
1508
1509    /** Set the Phone type created */
1510    void setPhoneType(int phoneType);
1511
1512    /**
1513     *  Query the CDMA roaming preference setting
1514     *
1515     * @param response is callback message to report one of  CDMA_RM_*
1516     */
1517    void queryCdmaRoamingPreference(Message response);
1518
1519    /**
1520     *  Requests to set the CDMA roaming preference
1521     * @param cdmaRoamingType one of  CDMA_RM_*
1522     * @param response is callback message
1523     */
1524    void setCdmaRoamingPreference(int cdmaRoamingType, Message response);
1525
1526    /**
1527     *  Requests to set the CDMA subscription mode
1528     * @param cdmaSubscriptionType one of  CDMA_SUBSCRIPTION_*
1529     * @param response is callback message
1530     */
1531    void setCdmaSubscriptionSource(int cdmaSubscriptionType, Message response);
1532
1533    /**
1534     *  Requests to get the CDMA subscription srouce
1535     * @param response is callback message
1536     */
1537    void getCdmaSubscriptionSource(Message response);
1538
1539    /**
1540     *  Set the TTY mode
1541     *
1542     * @param ttyMode one of the following:
1543     * - {@link com.android.internal.telephony.Phone#TTY_MODE_OFF}
1544     * - {@link com.android.internal.telephony.Phone#TTY_MODE_FULL}
1545     * - {@link com.android.internal.telephony.Phone#TTY_MODE_HCO}
1546     * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO}
1547     * @param response is callback message
1548     */
1549    void setTTYMode(int ttyMode, Message response);
1550
1551    /**
1552     *  Query the TTY mode
1553     * (AsyncResult)response.obj).result is an int[] with element [0] set to
1554     * tty mode:
1555     * - {@link com.android.internal.telephony.Phone#TTY_MODE_OFF}
1556     * - {@link com.android.internal.telephony.Phone#TTY_MODE_FULL}
1557     * - {@link com.android.internal.telephony.Phone#TTY_MODE_HCO}
1558     * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO}
1559     * @param response is callback message
1560     */
1561    void queryTTYMode(Message response);
1562
1563    /**
1564     * Setup a packet data connection On successful completion, the result
1565     * message will return a {@link com.android.internal.telephony.dataconnection.DataCallResponse}
1566     * object containing the connection information.
1567     *
1568     * @param radioTechnology
1569     *            indicates whether to setup connection on radio technology CDMA
1570     *            (0) or GSM/UMTS (1)
1571     * @param profile
1572     *            Profile Number or NULL to indicate default profile
1573     * @param apn
1574     *            the APN to connect to if radio technology is GSM/UMTS.
1575     *            Otherwise null for CDMA.
1576     * @param user
1577     *            the username for APN, or NULL
1578     * @param password
1579     *            the password for APN, or NULL
1580     * @param authType
1581     *            the PAP / CHAP auth type. Values is one of SETUP_DATA_AUTH_*
1582     * @param protocol
1583     *            one of the PDP_type values in TS 27.007 section 10.1.1.
1584     *            For example, "IP", "IPV6", "IPV4V6", or "PPP".
1585     * @param result
1586     *            Callback message
1587     */
1588    public void setupDataCall(String radioTechnology, String profile,
1589            String apn, String user, String password, String authType,
1590            String protocol, Message result);
1591
1592    /**
1593     * Deactivate packet data connection
1594     *
1595     * @param cid
1596     *            The connection ID
1597     * @param reason
1598     *            Data disconnect reason.
1599     * @param result
1600     *            Callback message is empty on completion
1601     */
1602    public void deactivateDataCall(int cid, int reason, Message result);
1603
1604    /**
1605     * Activate or deactivate cell broadcast SMS for CDMA.
1606     *
1607     * @param activate
1608     *            true = activate, false = deactivate
1609     * @param result
1610     *            Callback message is empty on completion
1611     */
1612    public void setCdmaBroadcastActivation(boolean activate, Message result);
1613
1614    /**
1615     * Configure cdma cell broadcast SMS.
1616     *
1617     * @param response
1618     *            Callback message is empty on completion
1619     */
1620    public void setCdmaBroadcastConfig(CdmaSmsBroadcastConfigInfo[] configs, Message response);
1621
1622    /**
1623     * Query the current configuration of cdma cell broadcast SMS.
1624     *
1625     * @param result
1626     *            Callback message contains the configuration from the modem on completion
1627     */
1628    public void getCdmaBroadcastConfig(Message result);
1629
1630    /**
1631     *  Requests the radio's system selection module to exit emergency callback mode.
1632     *  This function should only be called from CDMAPHone.java.
1633     *
1634     * @param response callback message
1635     */
1636    public void exitEmergencyCallbackMode(Message response);
1637
1638    /**
1639     * Request the status of the ICC and UICC cards.
1640     *
1641     * @param result
1642     *          Callback message containing {@link IccCardStatus} structure for the card.
1643     */
1644    public void getIccCardStatus(Message result);
1645
1646    /**
1647     * Return if the current radio is LTE on CDMA. This
1648     * is a tri-state return value as for a period of time
1649     * the mode may be unknown.
1650     *
1651     * @return {@link PhoneConstants#LTE_ON_CDMA_UNKNOWN}, {@link PhoneConstants#LTE_ON_CDMA_FALSE}
1652     * or {@link PhoneConstants#LTE_ON_CDMA_TRUE}
1653     */
1654    public int getLteOnCdmaMode();
1655
1656    /**
1657     * Request the ISIM application on the UICC to perform the AKA
1658     * challenge/response algorithm for IMS authentication. The nonce string
1659     * and challenge response are Base64 encoded Strings.
1660     *
1661     * @param nonce the nonce string to pass with the ISIM authentication request
1662     * @param response a callback message with the String response in the obj field
1663     * @deprecated
1664     * @see requestIccSimAuthentication
1665     */
1666    public void requestIsimAuthentication(String nonce, Message response);
1667
1668    /**
1669     * Request the SIM application on the UICC to perform authentication
1670     * challenge/response algorithm. The data string and challenge response are
1671     * Base64 encoded Strings.
1672     * Can support EAP-SIM, EAP-AKA with results encoded per 3GPP TS 31.102.
1673     *
1674     * @param authContext is the P2 parameter that specifies the authentication context per 3GPP TS
1675     *                    31.102 (Section 7.1.2)
1676     * @param data authentication challenge data
1677     * @param aid used to determine which application/slot to send the auth command to. See ETSI
1678     *            102.221 8.1 and 101.220 4
1679     * @param response a callback message with the String response in the obj field
1680     */
1681    public void requestIccSimAuthentication(int authContext, String data, String aid, Message response);
1682
1683    /**
1684     * Get the current Voice Radio Technology.
1685     *
1686     * AsyncResult.result is an int array with the first value
1687     * being one of the ServiceState.RIL_RADIO_TECHNOLOGY_xxx values.
1688     *
1689     * @param result is sent back to handler and result.obj is a AsyncResult
1690     */
1691    void getVoiceRadioTechnology(Message result);
1692
1693    /**
1694     * Return the current set of CellInfo records
1695     *
1696     * AsyncResult.result is a of Collection<CellInfo>
1697     *
1698     * @param result is sent back to handler and result.obj is a AsyncResult
1699     */
1700    void getCellInfoList(Message result);
1701
1702    /**
1703     * Sets the minimum time in milli-seconds between when RIL_UNSOL_CELL_INFO_LIST
1704     * should be invoked.
1705     *
1706     * The default, 0, means invoke RIL_UNSOL_CELL_INFO_LIST when any of the reported
1707     * information changes. Setting the value to INT_MAX(0x7fffffff) means never issue
1708     * A RIL_UNSOL_CELL_INFO_LIST.
1709     *
1710     *
1711
1712     * @param rateInMillis is sent back to handler and result.obj is a AsyncResult
1713     * @param response.obj is AsyncResult ar when sent to associated handler
1714     *                        ar.exception carries exception on failure or null on success
1715     *                        otherwise the error.
1716     */
1717    void setCellInfoListRate(int rateInMillis, Message response);
1718
1719    /**
1720     * Fires when RIL_UNSOL_CELL_INFO_LIST is received from the RIL.
1721     */
1722    void registerForCellInfoList(Handler h, int what, Object obj);
1723    void unregisterForCellInfoList(Handler h);
1724
1725    /**
1726     * Set Initial Attach Apn
1727     *
1728     * @param apn
1729     *            the APN to connect to if radio technology is GSM/UMTS.
1730     * @param protocol
1731     *            one of the PDP_type values in TS 27.007 section 10.1.1.
1732     *            For example, "IP", "IPV6", "IPV4V6", or "PPP".
1733     * @param authType
1734     *            authentication protocol used for this PDP context
1735     *            (None: 0, PAP: 1, CHAP: 2, PAP&CHAP: 3)
1736     * @param username
1737     *            the username for APN, or NULL
1738     * @param password
1739     *            the password for APN, or NULL
1740     * @param result
1741     *            callback message contains the information of SUCCESS/FAILURE
1742     */
1743    public void setInitialAttachApn(String apn, String protocol, int authType, String username,
1744            String password, Message result);
1745
1746    /**
1747     * Set data profiles in modem
1748     *
1749     * @param dps
1750     *            Array of the data profiles set to modem
1751     * @param result
1752     *            callback message contains the information of SUCCESS/FAILURE
1753     */
1754    public void setDataProfile(DataProfile[] dps, Message result);
1755
1756    /**
1757     * Notifiy that we are testing an emergency call
1758     */
1759    public void testingEmergencyCall();
1760
1761    /**
1762     * Open a logical channel to the SIM.
1763     *
1764     * Input parameters equivalent to TS 27.007 AT+CCHO command.
1765     *
1766     * @param AID Application id. See ETSI 102.221 and 101.220.
1767     * @param response Callback message. response.obj will be an int [1] with
1768     *            element [0] set to the id of the logical channel.
1769     */
1770    public void iccOpenLogicalChannel(String AID, Message response);
1771
1772    /**
1773     * Close a previously opened logical channel to the SIM.
1774     *
1775     * Input parameters equivalent to TS 27.007 AT+CCHC command.
1776     *
1777     * @param channel Channel id. Id of the channel to be closed.
1778     * @param response Callback message.
1779     */
1780    public void iccCloseLogicalChannel(int channel, Message response);
1781
1782    /**
1783     * Exchange APDUs with the SIM on a logical channel.
1784     *
1785     * Input parameters equivalent to TS 27.007 AT+CGLA command.
1786     *
1787     * @param channel Channel id of the channel to use for communication. Has to
1788     *            be greater than zero.
1789     * @param cla Class of the APDU command.
1790     * @param instruction Instruction of the APDU command.
1791     * @param p1 P1 value of the APDU command.
1792     * @param p2 P2 value of the APDU command.
1793     * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
1794     *            is sent to the SIM.
1795     * @param data Data to be sent with the APDU.
1796     * @param response Callback message. response.obj.userObj will be
1797     *            an IccIoResult on success.
1798     */
1799    public void iccTransmitApduLogicalChannel(int channel, int cla, int instruction,
1800            int p1, int p2, int p3, String data, Message response);
1801
1802    /**
1803     * Exchange APDUs with the SIM on a basic channel.
1804     *
1805     * Input parameters equivalent to TS 27.007 AT+CSIM command.
1806     *
1807     * @param cla Class of the APDU command.
1808     * @param instruction Instruction of the APDU command.
1809     * @param p1 P1 value of the APDU command.
1810     * @param p2 P2 value of the APDU command.
1811     * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU
1812     *            is sent to the SIM.
1813     * @param data Data to be sent with the APDU.
1814     * @param response Callback message. response.obj.userObj will be
1815     *            an IccIoResult on success.
1816     */
1817    public void iccTransmitApduBasicChannel(int cla, int instruction, int p1, int p2,
1818            int p3, String data, Message response);
1819
1820    /**
1821     * Read one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
1822     * Used for device configuration by some CDMA operators.
1823     *
1824     * @param itemID the ID of the item to read
1825     * @param response callback message with the String response in the obj field
1826     */
1827    void nvReadItem(int itemID, Message response);
1828
1829    /**
1830     * Write one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
1831     * Used for device configuration by some CDMA operators.
1832     *
1833     * @param itemID the ID of the item to read
1834     * @param itemValue the value to write, as a String
1835     * @param response Callback message.
1836     */
1837    void nvWriteItem(int itemID, String itemValue, Message response);
1838
1839    /**
1840     * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage.
1841     * Used for device configuration by some CDMA operators.
1842     *
1843     * @param preferredRoamingList byte array containing the new PRL
1844     * @param response Callback message.
1845     */
1846    void nvWriteCdmaPrl(byte[] preferredRoamingList, Message response);
1847
1848    /**
1849     * Perform the specified type of NV config reset. The radio will be taken offline
1850     * and the device must be rebooted after erasing the NV. Used for device
1851     * configuration by some CDMA operators.
1852     *
1853     * @param resetType reset type: 1: reload NV reset, 2: erase NV reset, 3: factory NV reset
1854     * @param response Callback message.
1855     */
1856    void nvResetConfig(int resetType, Message response);
1857
1858    /**
1859     *  returned message
1860     *  retMsg.obj = AsyncResult ar
1861     *  ar.exception carries exception on failure
1862     *  ar.userObject contains the orignal value of result.obj
1863     *  ar.result contains a List of HardwareConfig
1864     */
1865    void getHardwareConfig (Message result);
1866
1867    /**
1868     * @return version of the ril.
1869     */
1870    int getRilVersion();
1871
1872   /**
1873     * Sets user selected subscription at Modem.
1874     *
1875     * @param slotId
1876     *          Slot.
1877     * @param appIndex
1878     *          Application index in the card.
1879     * @param subId
1880     *          Indicates subscription 0 or subscription 1.
1881     * @param subStatus
1882     *          Activation status, 1 = activate and 0 = deactivate.
1883     * @param result
1884     *          Callback message contains the information of SUCCESS/FAILURE.
1885     */
1886    // FIXME Update the doc and consider modifying the request to make more generic.
1887    public void setUiccSubscription(int slotId, int appIndex, int subId, int subStatus,
1888            Message result);
1889
1890    /**
1891     * Tells the modem if data is allowed or not.
1892     *
1893     * @param allowed
1894     *          true = allowed, false = not alowed
1895     * @param result
1896     *          Callback message contains the information of SUCCESS/FAILURE.
1897     */
1898    // FIXME We may need to pass AID and slotid also
1899    public void setDataAllowed(boolean allowed, Message result);
1900
1901    /**
1902     * Inform RIL that the device is shutting down
1903     *
1904     * @param result Callback message contains the information of SUCCESS/FAILURE
1905     */
1906    public void requestShutdown(Message result);
1907}
1908