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