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