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