本文整理匯總了Java中android.telephony.SignalStrength.getCdmaDbm方法的典型用法代碼示例。如果您正苦於以下問題:Java SignalStrength.getCdmaDbm方法的具體用法?Java SignalStrength.getCdmaDbm怎麽用?Java SignalStrength.getCdmaDbm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.telephony.SignalStrength
的用法示例。
在下文中一共展示了SignalStrength.getCdmaDbm方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
/**
* Description: TODO: add more info
*
* Issues:
*
* [ ] Getting and comparing signal strengths between different RATs can be very
* tricky, since they all return different ranges of values. AOS doesn't
* specify very clearly what exactly is returned, even though people have
* a good idea, by trial and error.
*
* See note in : SignalStrengthTracker.java
*
* Notes:
*
*
*
*/
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
// Update Signal Strength
if (signalStrength.isGsm()) {
int dbm;
if (signalStrength.getGsmSignalStrength() <= 2 ||
signalStrength.getGsmSignalStrength() == NeighboringCellInfo.UNKNOWN_RSSI) {
// Unknown signal strength, get it another way
String[] bits = signalStrength.toString().split(" ");
dbm = Integer.parseInt(bits[9]);
} else {
dbm = signalStrength.getGsmSignalStrength();
}
mDevice.setSignalDbm(dbm);
} else {
int evdoDbm = signalStrength.getEvdoDbm();
int cdmaDbm = signalStrength.getCdmaDbm();
// Use lowest signal to be conservative
mDevice.setSignalDbm((cdmaDbm < evdoDbm) ? cdmaDbm : evdoDbm);
}
// Send it to signal tracker
signalStrengthTracker.registerSignalStrength(mDevice.mCell.getCID(), mDevice.getSignalDBm());
//signalStrengthTracker.isMysterious(mDevice.mCell.getCID(), mDevice.getSignalDBm());
}
示例2: getCdmaLevel
import android.telephony.SignalStrength; //導入方法依賴的package包/類
private int getCdmaLevel(SignalStrength signalStrength) {
final int cdmaDbm = signalStrength.getCdmaDbm();
final int cdmaEcio = signalStrength.getCdmaEcio();
final int levelDbm;
if(cdmaDbm >= -75) levelDbm = 4;
else if(cdmaDbm >= -85) levelDbm = 3;
else if(cdmaDbm >= -95) levelDbm = 2;
else if(cdmaDbm >= -100) levelDbm = 1;
else levelDbm = 0;
final int levelEcio;
// Ec/Io are in dB*10
if(cdmaEcio >= -90) levelEcio = 4;
else if(cdmaEcio >= -110) levelEcio = 3;
else if(cdmaEcio >= -130) levelEcio = 2;
else if(cdmaEcio >= -150) levelEcio = 1;
else levelEcio = 0;
return (levelDbm < levelEcio) ? levelDbm : levelEcio;
}
示例3: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
/**
* Description: TODO: add more info
*
* Issues:
*
* [ ] Getting and comparing signal strengths between different RATs can be very
* tricky, since they all return different ranges of values. AOS doesn't
* specify very clearly what exactly is returned, even though people have
* a good idea, by trial and error.
*
* See note in : SignalStrengthTracker.java
*/
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
// Update Signal Strength
if (signalStrength.isGsm()) {
int dbm;
if (signalStrength.getGsmSignalStrength() <= 2 ||
signalStrength.getGsmSignalStrength() == NeighboringCellInfo.UNKNOWN_RSSI) {
// Unknown signal strength, get it another way
String[] bits = signalStrength.toString().split(" ");
dbm = Integer.parseInt(bits[9]);
} else {
dbm = signalStrength.getGsmSignalStrength();
}
device.setSignalDbm(dbm);
} else {
int evdoDbm = signalStrength.getEvdoDbm();
int cdmaDbm = signalStrength.getCdmaDbm();
// Use lowest signal to be conservative
device.setSignalDbm((cdmaDbm < evdoDbm) ? cdmaDbm : evdoDbm);
}
// Send it to signal tracker
signalStrengthTracker.registerSignalStrength(device.cell.getCellId(), device.getSignalDBm());
//signalStrengthTracker.isMysterious(device.cell.getCid(), device.getSignalDBm());
}
示例4: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
Log.i(TAG, "onSignalStrengthsChanged" + signalStrength);
// if(Build.VERSION.SDK_INT>=18){
// if(signalStrength instanceof SignalStrength){
// Log.i("LOG_TAG", "onSignalStrengthsChanged: getcdaRscp" + signalStrength.getDbm());
// int ttt = signalStrength.getDbm();
// text1.setText(String.valueOf(ttt));
// }
// else{
Log.i(TAG, "onSignalStrengthsChanged: getcda dbm: " + signalStrength.getCdmaDbm());
int ttt = signalStrength.getCdmaDbm();
text1.setText(String.valueOf(ttt));
// }
// }
}
示例5: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
String sim = UEDevice.getSimType(activity);
mNavigationView.setSingalText(sim);
if (sim.equals("無服務")) {
mNavigationView.setSingalStatus(UISingalView.STATUS_NONE);
return;
}
mNavigationView.setSingalStatus(UISingalView.STATUS_NORMAL);
int level = 0;
if (signalStrength.isGsm()) {
level = signalStrength.getGsmSignalStrength();
}else {
if (sim.equals("中國電信")) {
level = signalStrength.getCdmaDbm();
}else {
level = signalStrength.getEvdoDbm();
}
}
if (level == 0) {
mNavigationView.setSignal(5);
return;
}
if (level < -112) {
mNavigationView.setSignal(0);
}else if (level >= -111 && level < -104) {
mNavigationView.setSignal(1);
}else if (level >= -104 && level < -97) {
mNavigationView.setSignal(2);
}else if (level >= -97 && level < -90) {
mNavigationView.setSignal(3);
}else if (level >= -90 && level < -83) {
mNavigationView.setSignal(4);
}else {
mNavigationView.setSignal(5);
}
}
示例6: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
if (isRegistered) {
int level = signalStrength.getGsmSignalStrength();
if (level > 4) level /= 7.75;
else if (level < 1) {
int strength = signalStrength.getCdmaDbm();
if (strength < -100) level = 0;
else if (strength < -95) level = 1;
else if (strength < -85) level = 2;
else if (strength < -75) level = 3;
else if (strength != 0) level = 4;
else {
strength = signalStrength.getEvdoDbm();
if (strength == 0 || strength < -100) level = 0;
else if (strength < -95) level = 1;
else if (strength < -85) level = 2;
else if (strength < -75) level = 3;
else level = 4;
}
}
onDrawableUpdate(level);
}
}
示例7: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
//Log.e(Tag, signalStrength.toString());
get_Reflection_Method(signalStrength);
try {
Method getLteRsrp = signalStrength.getClass().getDeclaredMethod("getLteRsrp");
getLteRsrp.setAccessible(true);
lte_RSRP = (int) getLteRsrp.invoke(signalStrength);
Method getLteRsrq = signalStrength.getClass().getDeclaredMethod("getLteRsrq");
getLteRsrq.setAccessible(true);
lte_RSRQ = (int) getLteRsrq.invoke(signalStrength);
Method getLteRssnr = signalStrength.getClass().getDeclaredMethod("getLteRssnr");
getLteRssnr.setAccessible(true);
lte_SINR = (int) getLteRssnr.invoke(signalStrength);
cdma_RxPwr = signalStrength.getCdmaDbm();
cdma_EcIo = signalStrength.getCdmaEcio();
gsm_RSSI = signalStrength.getGsmSignalStrength();
getWcdmaSignalStrength();
((MainActivity)mcontext).mSectionsPagerAdapter.notifyDataSetChanged();
} catch (Exception e) {
e.printStackTrace();
}
getCellIdentity();
}
示例8: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
// TODO Auto-generated method stub
super.onSignalStrengthsChanged(signalStrength);
gsmSignal = signalStrength.getGsmSignalStrength();
cdmaDbm = signalStrength.getCdmaDbm();
evdoDbm = signalStrength.getEvdoDbm();
}
示例9: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
int strength = -1;
dbm = -1024;
if (signalStrength.isGsm()) {
if (signalStrength.getGsmSignalStrength() != 99) {
dbm = signalStrength.getGsmSignalStrength() * 2 - 113;
} else {
dbm = signalStrength.getGsmSignalStrength();
}
} else {
dbm = signalStrength.getCdmaDbm();
}
oldTime = System.currentTimeMillis();
if (dbm <= -111) {
strength = 0;
} else if (dbm <= -99 && dbm >= -110) {
strength = 1;
} else if (dbm <= -86 && dbm >= -98) {
strength = 2;
} else if (dbm <= -74 && dbm >= -85) {
strength = 3;
} else if ((dbm <= -61 && dbm >= -73) || (dbm >= 60 && dbm < 99)) {
strength = 4;
} else {
viewBeforeSignal.setVisibility(View.GONE);
txtStatusSignal.setVisibility(View.GONE);
}
if (strength != -1) {
viewBeforeSignal.setVisibility(View.VISIBLE);
txtStatusSignal.setVisibility(View.VISIBLE);
txtStatusSignal.setText(getString(R.string.txtStatusSignal)
+ " " + strength + " bars");
txtStatusSignal
.setContentDescription(getString(R.string.txtStatusSignal)
+ " " + strength + " bars");
attachListener(txtStatusSignal);
}
}
示例10: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
super.onSignalStrengthsChanged(signalStrength);
if (signalStrength.isGsm()) {
int asu = signalStrength.getGsmSignalStrength();
if (asu == 0 || asu == 99) {
PhoneStateUtils.signalStrength = 0;
} else if (asu < 5) {
PhoneStateUtils.signalStrength = 2;
} else if (asu >= 5 && asu < 8) {
PhoneStateUtils.signalStrength = 3;
} else if (asu >= 8 && asu < 12) {
PhoneStateUtils.signalStrength = 4;
} else if (asu >= 12 && asu < 14) {
PhoneStateUtils.signalStrength = 5;
} else if (asu >= 14) {
PhoneStateUtils.signalStrength = 6;
}
} else {
int cdmaDbm = signalStrength.getCdmaDbm();
if (cdmaDbm >= -89) {
PhoneStateUtils.signalStrength = 6;
} else if (cdmaDbm >= -97) {
PhoneStateUtils.signalStrength = 5;
} else if (cdmaDbm >= -103) {
PhoneStateUtils.signalStrength = 4;
} else if (cdmaDbm >= -107) {
PhoneStateUtils.signalStrength = 3;
} else if (cdmaDbm >= -109) {
PhoneStateUtils.signalStrength = 2;
} else {
PhoneStateUtils.signalStrength = 0;
}
}
}
示例11: onSignalStrengthsChanged
import android.telephony.SignalStrength; //導入方法依賴的package包/類
@Override
public void onSignalStrengthsChanged (SignalStrength signalStrength) {
logger.debug("::onSignalStrengthsChanged()");
int dBmRSSI = signalStrength.getCdmaDbm();
this.updateCellularRowInTable("up", "byte", dBmRSSI, dBmRSSI);
}