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