Constructors Summary |
---|
public CellSignalStrengthCdma()Empty constructor // Valid values are 0-8. 8 is the highest signal to noise ratio
setDefaultValues();
|
public CellSignalStrengthCdma(int cdmaDbm, int cdmaEcio, int evdoDbm, int evdoEcio, int evdoSnr)Constructor
initialize(cdmaDbm, cdmaEcio, evdoDbm, evdoEcio, evdoSnr);
|
private CellSignalStrengthCdma(android.os.Parcel in)Construct a SignalStrength object from the given parcel
where the TYPE_CDMA token is already been processed.
// CdmaDbm, CdmaEcio, EvdoDbm and EvdoEcio are written into
// the parcel as positive values.
// Need to convert into negative values
mCdmaDbm = in.readInt() * -1;
mCdmaEcio = in.readInt() * -1;
mEvdoDbm = in.readInt() * -1;
mEvdoEcio = in.readInt() * -1;
mEvdoSnr = in.readInt();
if (DBG) log("CellSignalStrengthCdma(Parcel): " + toString());
|
public CellSignalStrengthCdma(CellSignalStrengthCdma s)Copy constructors
copyFrom(s);
|
Methods Summary |
---|
public android.telephony.CellSignalStrengthCdma | copy()
return new CellSignalStrengthCdma(this);
|
protected void | copyFrom(android.telephony.CellSignalStrengthCdma s)
mCdmaDbm = s.mCdmaDbm;
mCdmaEcio = s.mCdmaEcio;
mEvdoDbm = s.mEvdoDbm;
mEvdoEcio = s.mEvdoEcio;
mEvdoSnr = s.mEvdoSnr;
|
public int | describeContents()Implement the Parcelable interface
return 0;
|
public boolean | equals(java.lang.Object o)
CellSignalStrengthCdma s;
try {
s = (CellSignalStrengthCdma) o;
} catch (ClassCastException ex) {
return false;
}
if (o == null) {
return false;
}
return mCdmaDbm == s.mCdmaDbm
&& mCdmaEcio == s.mCdmaEcio
&& mEvdoDbm == s.mEvdoDbm
&& mEvdoEcio == s.mEvdoEcio
&& mEvdoSnr == s.mEvdoSnr;
|
public int | getAsuLevel()Get the signal level as an asu value between 0..97, 99 is unknown
final int cdmaDbm = getCdmaDbm();
final int cdmaEcio = getCdmaEcio();
int cdmaAsuLevel;
int ecioAsuLevel;
if (cdmaDbm >= -75) cdmaAsuLevel = 16;
else if (cdmaDbm >= -82) cdmaAsuLevel = 8;
else if (cdmaDbm >= -90) cdmaAsuLevel = 4;
else if (cdmaDbm >= -95) cdmaAsuLevel = 2;
else if (cdmaDbm >= -100) cdmaAsuLevel = 1;
else cdmaAsuLevel = 99;
// Ec/Io are in dB*10
if (cdmaEcio >= -90) ecioAsuLevel = 16;
else if (cdmaEcio >= -100) ecioAsuLevel = 8;
else if (cdmaEcio >= -115) ecioAsuLevel = 4;
else if (cdmaEcio >= -130) ecioAsuLevel = 2;
else if (cdmaEcio >= -150) ecioAsuLevel = 1;
else ecioAsuLevel = 99;
int level = (cdmaAsuLevel < ecioAsuLevel) ? cdmaAsuLevel : ecioAsuLevel;
if (DBG) log("getAsuLevel=" + level);
return level;
|
public int | getCdmaDbm()Get the CDMA RSSI value in dBm
return mCdmaDbm;
|
public int | getCdmaEcio()Get the CDMA Ec/Io value in dB*10
return mCdmaEcio;
|
public int | getCdmaLevel()Get cdma as level 0..4
final int cdmaDbm = getCdmaDbm();
final int cdmaEcio = getCdmaEcio();
int levelDbm;
int levelEcio;
if (cdmaDbm >= -75) levelDbm = SIGNAL_STRENGTH_GREAT;
else if (cdmaDbm >= -85) levelDbm = SIGNAL_STRENGTH_GOOD;
else if (cdmaDbm >= -95) levelDbm = SIGNAL_STRENGTH_MODERATE;
else if (cdmaDbm >= -100) levelDbm = SIGNAL_STRENGTH_POOR;
else levelDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
// Ec/Io are in dB*10
if (cdmaEcio >= -90) levelEcio = SIGNAL_STRENGTH_GREAT;
else if (cdmaEcio >= -110) levelEcio = SIGNAL_STRENGTH_GOOD;
else if (cdmaEcio >= -130) levelEcio = SIGNAL_STRENGTH_MODERATE;
else if (cdmaEcio >= -150) levelEcio = SIGNAL_STRENGTH_POOR;
else levelEcio = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
int level = (levelDbm < levelEcio) ? levelDbm : levelEcio;
if (DBG) log("getCdmaLevel=" + level);
return level;
|
public int | getDbm()Get the signal strength as dBm
int cdmaDbm = getCdmaDbm();
int evdoDbm = getEvdoDbm();
// Use the lower value to be conservative
return (cdmaDbm < evdoDbm) ? cdmaDbm : evdoDbm;
|
public int | getEvdoDbm()Get the EVDO RSSI value in dBm
return mEvdoDbm;
|
public int | getEvdoEcio()Get the EVDO Ec/Io value in dB*10
return mEvdoEcio;
|
public int | getEvdoLevel()Get Evdo as level 0..4
int evdoDbm = getEvdoDbm();
int evdoSnr = getEvdoSnr();
int levelEvdoDbm;
int levelEvdoSnr;
if (evdoDbm >= -65) levelEvdoDbm = SIGNAL_STRENGTH_GREAT;
else if (evdoDbm >= -75) levelEvdoDbm = SIGNAL_STRENGTH_GOOD;
else if (evdoDbm >= -90) levelEvdoDbm = SIGNAL_STRENGTH_MODERATE;
else if (evdoDbm >= -105) levelEvdoDbm = SIGNAL_STRENGTH_POOR;
else levelEvdoDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
if (evdoSnr >= 7) levelEvdoSnr = SIGNAL_STRENGTH_GREAT;
else if (evdoSnr >= 5) levelEvdoSnr = SIGNAL_STRENGTH_GOOD;
else if (evdoSnr >= 3) levelEvdoSnr = SIGNAL_STRENGTH_MODERATE;
else if (evdoSnr >= 1) levelEvdoSnr = SIGNAL_STRENGTH_POOR;
else levelEvdoSnr = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
int level = (levelEvdoDbm < levelEvdoSnr) ? levelEvdoDbm : levelEvdoSnr;
if (DBG) log("getEvdoLevel=" + level);
return level;
|
public int | getEvdoSnr()Get the signal to noise ratio. Valid values are 0-8. 8 is the highest.
return mEvdoSnr;
|
public int | getLevel()Get signal level as an int from 0..4
int level;
int cdmaLevel = getCdmaLevel();
int evdoLevel = getEvdoLevel();
if (evdoLevel == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
/* We don't know evdo, use cdma */
level = getCdmaLevel();
} else if (cdmaLevel == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
/* We don't know cdma, use evdo */
level = getEvdoLevel();
} else {
/* We know both, use the lowest level */
level = cdmaLevel < evdoLevel ? cdmaLevel : evdoLevel;
}
if (DBG) log("getLevel=" + level);
return level;
|
public int | hashCode()
int primeNum = 31;
return ((mCdmaDbm * primeNum) + (mCdmaEcio * primeNum)
+ (mEvdoDbm * primeNum) + (mEvdoEcio * primeNum) + (mEvdoSnr * primeNum));
|
public void | initialize(int cdmaDbm, int cdmaEcio, int evdoDbm, int evdoEcio, int evdoSnr)Initialize all the values
mCdmaDbm = cdmaDbm;
mCdmaEcio = cdmaEcio;
mEvdoDbm = evdoDbm;
mEvdoEcio = evdoEcio;
mEvdoSnr = evdoSnr;
|
private static void | log(java.lang.String s)log
Rlog.w(LOG_TAG, s);
|
public void | setCdmaDbm(int cdmaDbm)
mCdmaDbm = cdmaDbm;
|
public void | setCdmaEcio(int cdmaEcio)
mCdmaEcio = cdmaEcio;
|
public void | setDefaultValues()
mCdmaDbm = Integer.MAX_VALUE;
mCdmaEcio = Integer.MAX_VALUE;
mEvdoDbm = Integer.MAX_VALUE;
mEvdoEcio = Integer.MAX_VALUE;
mEvdoSnr = Integer.MAX_VALUE;
|
public void | setEvdoDbm(int evdoDbm)
mEvdoDbm = evdoDbm;
|
public void | setEvdoEcio(int evdoEcio)
mEvdoEcio = evdoEcio;
|
public void | setEvdoSnr(int evdoSnr)
mEvdoSnr = evdoSnr;
|
public java.lang.String | toString()
return "CellSignalStrengthCdma:"
+ " cdmaDbm=" + mCdmaDbm
+ " cdmaEcio=" + mCdmaEcio
+ " evdoDbm=" + mEvdoDbm
+ " evdoEcio=" + mEvdoEcio
+ " evdoSnr=" + mEvdoSnr;
|
public void | writeToParcel(android.os.Parcel dest, int flags)Implement the Parcelable interface
if (DBG) log("writeToParcel(Parcel, int): " + toString());
// Need to multiply CdmaDbm, CdmaEcio, EvdoDbm and EvdoEcio by -1
// to ensure consistency when reading values written here
dest.writeInt(mCdmaDbm * -1);
dest.writeInt(mCdmaEcio * -1);
dest.writeInt(mEvdoDbm * -1);
dest.writeInt(mEvdoEcio * -1);
dest.writeInt(mEvdoSnr);
|