Java Code Examples for android.telephony.SignalStrength#getCdmaDbm()

The following examples show how to use android.telephony.SignalStrength#getCdmaDbm() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CellTracker.java    From AIMSICDL with GNU General Public License v3.0 6 votes vote down vote up
/**
 *  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());
}
 
Example 2
Source File: SignalStrengthPresenter.java    From microbit with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: DualNetworkIconData.java    From Status with Apache License 2.0 5 votes vote down vote up
@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;
            }
        }

        onIconUpdate(level);
    }
}
 
Example 4
Source File: RadioInfo.java    From CellularSignal with GNU General Public License v3.0 5 votes vote down vote up
@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();
}
 
Example 5
Source File: SignalListener.java    From batteryhub with Apache License 2.0 5 votes vote down vote up
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
    // TODO Auto-generated method stub
    super.onSignalStrengthsChanged(signalStrength);
    mGsmSignal = signalStrength.getGsmSignalStrength();
    mCdmaDbm = signalStrength.getCdmaDbm();
    mEvdoDbm = signalStrength.getEvdoDbm();
}
 
Example 6
Source File: UENavigationActivity.java    From Auie with GNU General Public License v2.0 5 votes vote down vote up
@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);
	}
}
 
Example 7
Source File: UENavigationFragmentActivity.java    From Auie with GNU General Public License v2.0 5 votes vote down vote up
@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);
	}
}