FileDocCategorySizeDatePackage
CellSignalStrengthWcdma.javaAPI DocAndroid 5.1 API6587Thu Mar 12 22:22:42 GMT 2015android.telephony

CellSignalStrengthWcdma

public final class CellSignalStrengthWcdma extends CellSignalStrength implements android.os.Parcelable
Wcdma signal strength related information.

Fields Summary
private static final String
LOG_TAG
private static final boolean
DBG
private static final int
WCDMA_SIGNAL_STRENGTH_GREAT
private static final int
WCDMA_SIGNAL_STRENGTH_GOOD
private static final int
WCDMA_SIGNAL_STRENGTH_MODERATE
private int
mSignalStrength
private int
mBitErrorRate
public static final Parcelable.Creator
CREATOR
Implement the Parcelable interface
Constructors Summary
public CellSignalStrengthWcdma()
Empty constructor

hide

   // bit error rate (0-7, 99) as defined in TS 27.007 8.5

            
      
        setDefaultValues();
    
private CellSignalStrengthWcdma(android.os.Parcel in)
Construct a SignalStrength object from the given parcel where the token is already been processed.

        mSignalStrength = in.readInt();
        mBitErrorRate = in.readInt();
        if (DBG) log("CellSignalStrengthWcdma(Parcel): " + toString());
    
public CellSignalStrengthWcdma(int ss, int ber)
Constructor

hide

        initialize(ss, ber);
    
public CellSignalStrengthWcdma(CellSignalStrengthWcdma s)
Copy constructors

param
s Source SignalStrength
hide

        copyFrom(s);
    
Methods Summary
public android.telephony.CellSignalStrengthWcdmacopy()

hide

        return new CellSignalStrengthWcdma(this);
    
protected voidcopyFrom(android.telephony.CellSignalStrengthWcdma s)

hide

        mSignalStrength = s.mSignalStrength;
        mBitErrorRate = s.mBitErrorRate;
    
public intdescribeContents()
Implement the Parcelable interface

        return 0;
    
public booleanequals(java.lang.Object o)

        CellSignalStrengthWcdma s;

        try {
            s = (CellSignalStrengthWcdma) o;
        } catch (ClassCastException ex) {
            return false;
        }

        if (o == null) {
            return false;
        }

        return mSignalStrength == s.mSignalStrength && mBitErrorRate == s.mBitErrorRate;
    
public intgetAsuLevel()
Get the signal level as an asu value between 0..31, 99 is unknown Asu is calculated based on 3GPP RSRP. Refer to 3GPP 27.007 (Ver 10.3.0) Sec 8.69

        // ASU ranges from 0 to 31 - TS 27.007 Sec 8.5
        // asu = 0 (-113dB or less) is very weak
        // signal, its better to show 0 bars to the user in such cases.
        // asu = 99 is a special case, where the signal strength is unknown.
        int level = mSignalStrength;
        if (DBG) log("getAsuLevel=" + level);
        return level;
    
public intgetDbm()
Get the signal strength as dBm

        int dBm;

        int level = mSignalStrength;
        int asu = (level == 99 ? Integer.MAX_VALUE : level);
        if (asu != Integer.MAX_VALUE) {
            dBm = -113 + (2 * asu);
        } else {
            dBm = Integer.MAX_VALUE;
        }
        if (DBG) log("getDbm=" + dBm);
        return dBm;
    
public intgetLevel()
Get signal level as an int from 0..4

        int level;

        // ASU ranges from 0 to 31 - TS 27.007 Sec 8.5
        // asu = 0 (-113dB or less) is very weak
        // signal, its better to show 0 bars to the user in such cases.
        // asu = 99 is a special case, where the signal strength is unknown.
        int asu = mSignalStrength;
        if (asu <= 2 || asu == 99) level = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
        else if (asu >= WCDMA_SIGNAL_STRENGTH_GREAT) level = SIGNAL_STRENGTH_GREAT;
        else if (asu >= WCDMA_SIGNAL_STRENGTH_GOOD)  level = SIGNAL_STRENGTH_GOOD;
        else if (asu >= WCDMA_SIGNAL_STRENGTH_MODERATE)  level = SIGNAL_STRENGTH_MODERATE;
        else level = SIGNAL_STRENGTH_POOR;
        if (DBG) log("getLevel=" + level);
        return level;
    
public inthashCode()

        int primeNum = 31;
        return (mSignalStrength * primeNum) + (mBitErrorRate * primeNum);
    
public voidinitialize(int ss, int ber)
Initialize all the values

param
ss SignalStrength as ASU value
param
ber is Bit Error Rate
hide

        mSignalStrength = ss;
        mBitErrorRate = ber;
    
private static voidlog(java.lang.String s)
log


          
         
        Rlog.w(LOG_TAG, s);
    
public voidsetDefaultValues()

hide

        mSignalStrength = Integer.MAX_VALUE;
        mBitErrorRate = Integer.MAX_VALUE;
    
public java.lang.StringtoString()

return
string representation.

        return "CellSignalStrengthWcdma:"
                + " ss=" + mSignalStrength
                + " ber=" + mBitErrorRate;
    
public voidwriteToParcel(android.os.Parcel dest, int flags)
Implement the Parcelable interface

        if (DBG) log("writeToParcel(Parcel, int): " + toString());
        dest.writeInt(mSignalStrength);
        dest.writeInt(mBitErrorRate);