FileDocCategorySizeDatePackage
CellSignalStrengthLte.javaAPI DocAndroid 5.1 API8387Thu Mar 12 22:22:42 GMT 2015android.telephony

CellSignalStrengthLte

public final class CellSignalStrengthLte extends CellSignalStrength implements android.os.Parcelable
LTE signal strength related information.

Fields Summary
private static final String
LOG_TAG
private static final boolean
DBG
private int
mSignalStrength
private int
mRsrp
private int
mRsrq
private int
mRssnr
private int
mCqi
private int
mTimingAdvance
public static final Parcelable.Creator
CREATOR
Implement the Parcelable interface
Constructors Summary
public CellSignalStrengthLte()
Empty constructor

hide


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

        mSignalStrength = in.readInt();
        // rsrp and rsrq are written into the parcel as positive values.
        // Need to convert into negative values
        mRsrp = in.readInt() * -1;
        mRsrq = in.readInt() * -1;
        mRssnr = in.readInt();
        mCqi = in.readInt();
        mTimingAdvance = in.readInt();
        if (DBG) log("CellSignalStrengthLte(Parcel): " + toString());
    
public CellSignalStrengthLte(int signalStrength, int rsrp, int rsrq, int rssnr, int cqi, int timingAdvance)
Constructor

hide

        initialize(signalStrength, rsrp, rsrq, rssnr, cqi, timingAdvance);
    
public CellSignalStrengthLte(CellSignalStrengthLte s)
Copy constructors

param
s Source SignalStrength
hide

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

hide

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

hide

        mSignalStrength = s.mSignalStrength;
        mRsrp = s.mRsrp;
        mRsrq = s.mRsrq;
        mRssnr = s.mRssnr;
        mCqi = s.mCqi;
        mTimingAdvance = s.mTimingAdvance;
    
public intdescribeContents()
Implement the Parcelable interface

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

        CellSignalStrengthLte s;

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

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

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

        int lteAsuLevel = 99;
        int lteDbm = getDbm();
        if (lteDbm <= -140) lteAsuLevel = 0;
        else if (lteDbm >= -43) lteAsuLevel = 97;
        else lteAsuLevel = lteDbm + 140;
        if (DBG) log("Lte Asu level: "+lteAsuLevel);
        return lteAsuLevel;
    
public intgetDbm()
Get signal strength as dBm

        return mRsrp;
    
public intgetLevel()
Get signal level as an int from 0..4

        int levelRsrp = 0;
        int levelRssnr = 0;

        if (mRsrp == Integer.MAX_VALUE) levelRsrp = 0;
        else if (mRsrp >= -95) levelRsrp = SIGNAL_STRENGTH_GREAT;
        else if (mRsrp >= -105) levelRsrp = SIGNAL_STRENGTH_GOOD;
        else if (mRsrp >= -115) levelRsrp = SIGNAL_STRENGTH_MODERATE;
        else levelRsrp = SIGNAL_STRENGTH_POOR;

        // See RIL_LTE_SignalStrength in ril.h
        if (mRssnr == Integer.MAX_VALUE) levelRssnr = 0;
        else if (mRssnr >= 45) levelRssnr = SIGNAL_STRENGTH_GREAT;
        else if (mRssnr >= 10) levelRssnr = SIGNAL_STRENGTH_GOOD;
        else if (mRssnr >= -30) levelRssnr = SIGNAL_STRENGTH_MODERATE;
        else levelRssnr = SIGNAL_STRENGTH_POOR;

        int level;
        if (mRsrp == Integer.MAX_VALUE)
            level = levelRssnr;
        else if (mRssnr == Integer.MAX_VALUE)
            level = levelRsrp;
        else
            level = (levelRssnr < levelRsrp) ? levelRssnr : levelRsrp;

        if (DBG) log("Lte rsrp level: " + levelRsrp
                + " snr level: " + levelRssnr + " level: " + level);
        return level;
    
public intgetTimingAdvance()
Get the timing advance value for LTE. See 3GPP xxxx

        return mTimingAdvance;
    
public inthashCode()

        int primeNum = 31;
        return (mSignalStrength * primeNum) + (mRsrp * primeNum)
                + (mRsrq * primeNum) + (mRssnr * primeNum) + (mCqi * primeNum)
                + (mTimingAdvance * primeNum);
    
public voidinitialize(int lteSignalStrength, int rsrp, int rsrq, int rssnr, int cqi, int timingAdvance)
Initialize all the values

param
lteSignalStrength
param
rsrp
param
rsrq
param
rssnr
param
cqi
hide

        mSignalStrength = lteSignalStrength;
        mRsrp = rsrp;
        mRsrq = rsrq;
        mRssnr = rssnr;
        mCqi = cqi;
        mTimingAdvance = timingAdvance;
    
public voidinitialize(SignalStrength ss, int timingAdvance)
Initialize from the SignalStrength structure.

param
ss
hide

        mSignalStrength = ss.getLteSignalStrength();
        mRsrp = ss.getLteRsrp();
        mRsrq = ss.getLteRsrq();
        mRssnr = ss.getLteRssnr();
        mCqi = ss.getLteCqi();
        mTimingAdvance = timingAdvance;
    
private static voidlog(java.lang.String s)
log


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

hide

        mSignalStrength = Integer.MAX_VALUE;
        mRsrp = Integer.MAX_VALUE;
        mRsrq = Integer.MAX_VALUE;
        mRssnr = Integer.MAX_VALUE;
        mCqi = Integer.MAX_VALUE;
        mTimingAdvance = Integer.MAX_VALUE;
    
public java.lang.StringtoString()

return
string representation.

        return "CellSignalStrengthLte:"
                + " ss=" + mSignalStrength
                + " rsrp=" + mRsrp
                + " rsrq=" + mRsrq
                + " rssnr=" + mRssnr
                + " cqi=" + mCqi
                + " ta=" + mTimingAdvance;
    
public voidwriteToParcel(android.os.Parcel dest, int flags)
Implement the Parcelable interface

        if (DBG) log("writeToParcel(Parcel, int): " + toString());
        dest.writeInt(mSignalStrength);
        // Need to multiply rsrp and rsrq by -1
        // to ensure consistency when reading values written here
        dest.writeInt(mRsrp * -1);
        dest.writeInt(mRsrq * -1);
        dest.writeInt(mRssnr);
        dest.writeInt(mCqi);
        dest.writeInt(mTimingAdvance);