Java Code Examples for android.telephony.NeighboringCellInfo#UNKNOWN_RSSI

The following examples show how to use android.telephony.NeighboringCellInfo#UNKNOWN_RSSI . 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: CellLocationSignalConverter.java    From TowerCollector with Mozilla Public License 2.0 5 votes vote down vote up
private void updateGsm(Cell cell, int asu) {
    Timber.d("update(): Updating GSM signal strength = %s", asu);
    if (asu == NeighboringCellInfo.UNKNOWN_RSSI)
        asu = Cell.UNKNOWN_SIGNAL;
    // NOTE: for GSM asu is always positive but RSSI negative
    if (asu >= 0)
        cell.setGsmLocationSignal(asu, UnitConverter.convertGsmAsuToDbm(asu));
    else
        cell.setGsmLocationSignal(UnitConverter.convertGsmDbmToAsu(asu), asu);
}
 
Example 3
Source File: CellLocationSignalConverter.java    From TowerCollector with Mozilla Public License 2.0 5 votes vote down vote up
private void updateLte(Cell cell, int dbm) {
    Timber.d("update(): Updating LTE signal strength = %s", dbm);
    if (dbm == NeighboringCellInfo.UNKNOWN_RSSI)
        dbm = Cell.UNKNOWN_SIGNAL;
    // NOTE: for LTE asu is always positive but RSRP negative
    if (dbm >= 0)
        cell.setGsmLocationSignal(dbm, UnitConverter.convertLteAsuToDbm(dbm));
    else
        cell.setGsmLocationSignal(UnitConverter.convertLteDbmToAsu(dbm), dbm);
}
 
Example 4
Source File: UnitConverter.java    From TowerCollector with Mozilla Public License 2.0 5 votes vote down vote up
public static int convertGsmDbmToAsu(int dbm) {
    if (dbm == Cell.UNKNOWN_SIGNAL || dbm == NeighboringCellInfo.UNKNOWN_RSSI)
        return Cell.UNKNOWN_SIGNAL;
    if (dbm <= -113)
        return 0;
    int asu = (dbm + 113) / 2;
    if (asu > 31)
        return 31;
    return asu;
}
 
Example 5
Source File: UnitConverter.java    From TowerCollector with Mozilla Public License 2.0 5 votes vote down vote up
public static int convertLteAsuToDbm(int asu) {
    if (asu == Cell.UNKNOWN_SIGNAL || asu == NeighboringCellInfo.UNKNOWN_RSSI)
        return Cell.UNKNOWN_SIGNAL;
    if (asu <= 0)
        return -140;
    if (asu >= 97)
        return -43;
    return asu - 140;
}
 
Example 6
Source File: UnitConverter.java    From TowerCollector with Mozilla Public License 2.0 5 votes vote down vote up
public static int convertLteDbmToAsu(int dbm) {
    if (dbm == Cell.UNKNOWN_SIGNAL || dbm == NeighboringCellInfo.UNKNOWN_RSSI)
        return Cell.UNKNOWN_SIGNAL;
    if (dbm <= -140)
        return 0;
    if (dbm >= -43)
        return 97;
    return dbm + 140;
}
 
Example 7
Source File: UnitConverter.java    From TowerCollector with Mozilla Public License 2.0 4 votes vote down vote up
public static int convertGsmAsuToDbm(int asu) {
    if (asu == Cell.UNKNOWN_SIGNAL || asu == NeighboringCellInfo.UNKNOWN_RSSI)
        return Cell.UNKNOWN_SIGNAL;
    return 2 * asu - 113;
}