FileDocCategorySizeDatePackage
DriverCall.javaAPI DocAndroid 1.5 API4655Wed May 06 22:42:02 BST 2009com.android.internal.telephony.gsm

DriverCall

public class DriverCall extends Object implements Comparable
{@hide}

Fields Summary
static final String
LOG_TAG
public int
index
public boolean
isMT
public State
state
public boolean
isMpty
public String
number
public int
TOA
public boolean
isVoice
public int
als
public int
numberPresentation
Constructors Summary
public DriverCall()

    
Methods Summary
public intcompareTo(java.lang.Object o)
For sorting by index

        DriverCall dc;

        dc = (DriverCall)o;

        if (index < dc.index) {
            return -1;
        } else if (index == dc.index) {
            return 0;
        } else { /*index > dc.index*/
            return 1;
        }
    
static com.android.internal.telephony.gsm.DriverCallfromCLCCLine(java.lang.String line)
returns null on error

  
         
     
     
    
        DriverCall ret = new DriverCall();

        //+CLCC: 1,0,2,0,0,\"+18005551212\",145
        //     index,isMT,state,mode,isMpty(,number,TOA)?
        ATResponseParser p = new ATResponseParser(line);

        try {
            ret.index = p.nextInt();
            ret.isMT = p.nextBoolean();
            ret.state = stateFromCLCC(p.nextInt());

            ret.isVoice = (0 == p.nextInt());
            ret.isMpty = p.nextBoolean();
            
            // use ALLOWED as default presentation while parsing CLCC
            ret.numberPresentation = Connection.PRESENTATION_ALLOWED;
            
            if (p.hasMore()) {
                // Some lame implementations return strings
                // like "NOT AVAILABLE" in the CLCC line
                ret.number = PhoneNumberUtils.extractNetworkPortion(
                                    p.nextString());

                if (ret.number.length() == 0) {
                    ret.number = null;
                }

                ret.TOA = p.nextInt();

                // Make sure there's a leading + on addresses with a TOA
                // of 145

                ret.number = PhoneNumberUtils.stringFromStringAndTOA(
                                ret.number, ret.TOA);

            }
        } catch (ATParseEx ex) {
            Log.e(LOG_TAG,"Invalid CLCC line: '" + line + "'");
            return null;
        }

        return ret;
    
public static intpresentationFromCLIP(int cli)

        switch(cli) {
            case 0: return Connection.PRESENTATION_ALLOWED;
            case 1: return Connection.PRESENTATION_RESTRICTED;
            case 2: return Connection.PRESENTATION_UNKNOWN;
            case 3: return Connection.PRESENTATION_PAYPHONE;
            default:
                throw new ATParseEx("illegal presentation " + cli);
        }
    
public static com.android.internal.telephony.gsm.DriverCall$StatestateFromCLCC(int state)

        switch(state) {
            case 0: return State.ACTIVE;
            case 1: return State.HOLDING;
            case 2: return State.DIALING;
            case 3: return State.ALERTING;
            case 4: return State.INCOMING;
            case 5: return State.WAITING;
            default:
                throw new ATParseEx("illegal call state " + state);
        }
    
public java.lang.StringtoString()

        return "id=" + index + ","
                + (isMT ? "mt" : "mo") + ","
                + state + ","
                + (isVoice ? "voice" : "no_voc") + ","
                + (isMpty ? "conf" : "norm") + ","
                + TOA + "," + als + ",cli " + numberPresentation;