Search in sources :

Example 6 with CellSignalStrengthCdma

use of android.telephony.CellSignalStrengthCdma in project platform_packages_apps_Settings by BlissRoms.

the class RadioInfo method buildCdmaInfoString.

private final String buildCdmaInfoString(CellInfoCdma ci) {
    CellIdentityCdma cidCdma = ci.getCellIdentity();
    CellSignalStrengthCdma ssCdma = ci.getCellSignalStrength();
    return String.format("%-3.3s %-5.5s %-5.5s %-5.5s %-6.6s %-6.6s %-6.6s %-6.6s %-5.5s", ci.isRegistered() ? "S  " : "   ", getCellInfoDisplayString(cidCdma.getSystemId()), getCellInfoDisplayString(cidCdma.getNetworkId()), getCellInfoDisplayString(cidCdma.getBasestationId()), getCellInfoDisplayString(ssCdma.getCdmaDbm()), getCellInfoDisplayString(ssCdma.getCdmaEcio()), getCellInfoDisplayString(ssCdma.getEvdoDbm()), getCellInfoDisplayString(ssCdma.getEvdoEcio()), getCellInfoDisplayString(ssCdma.getEvdoSnr()));
}
Also used : CellIdentityCdma(android.telephony.CellIdentityCdma) CellSignalStrengthCdma(android.telephony.CellSignalStrengthCdma)

Example 7 with CellSignalStrengthCdma

use of android.telephony.CellSignalStrengthCdma in project DataLogger by sussexwearlab.

the class CellsInfoDataCollector method getCellInfoString.

private String getCellInfoString(List<CellInfo> cellsInfo) {
    // Timestamp in system nanoseconds since boot, including time spent in sleep.
    long nanoTime = SystemClock.elapsedRealtimeNanos() + mNanosOffset;
    // System local time in millis
    long currentMillis = (new Date()).getTime();
    String message = String.format("%s", currentMillis) + ";" + String.format("%s", nanoTime) + ";" + String.format("%s", mNanosOffset) + ";" + Integer.toString(cellsInfo.size());
    // The list can include one or more CellInfoGsm, CellInfoCdma, CellInfoLte, and CellInfoWcdma objects, in any combination.
    for (final CellInfo cellInfo : cellsInfo) {
        if (cellInfo instanceof CellInfoGsm) {
            // True if this cell is registered to the mobile network.
            // 0, 1 or more CellInfo objects may return isRegistered() true.
            int isRegistered = (cellInfo.isRegistered()) ? 1 : 0;
            final CellSignalStrengthGsm gsmStrength = ((CellInfoGsm) cellInfo).getCellSignalStrength();
            // Get the signal level as an asu value between 0..31, 99 is unknown Asu is calculated based on 3GPP RSRP.
            int asuLevel = gsmStrength.getAsuLevel();
            // Get the signal strength as dBm
            int dBm = gsmStrength.getDbm();
            // Get signal level as an int from 0..4
            int level = gsmStrength.getLevel();
            final CellIdentityGsm gsmId = ((CellInfoGsm) cellInfo).getCellIdentity();
            // CID Either 16-bit GSM Cell Identity described in TS 27.007, 0..65535, Integer.MAX_VALUE if unknown
            int cid = gsmId.getCid();
            // 16-bit Location Area Code, 0..65535, Integer.MAX_VALUE if unknown
            int lac = gsmId.getLac();
            // 3-digit Mobile Country Code, 0..999, Integer.MAX_VALUE if unknown
            int mcc = gsmId.getMcc();
            // 2 or 3-digit Mobile Network Code, 0..999, Integer.MAX_VALUE if unknown
            int mnc = gsmId.getMnc();
            message += ";GSM;" + isRegistered + ";" + cid + ";" + lac + ";" + mcc + ";" + mnc + ";" + asuLevel + ";" + dBm + ";" + level;
        } else if (cellInfo instanceof CellInfoCdma) {
            // True if this cell is registered to the mobile network.
            // 0, 1 or more CellInfo objects may return isRegistered() true.
            int isRegistered = (cellInfo.isRegistered()) ? 1 : 0;
            final CellSignalStrengthCdma cdmaStength = ((CellInfoCdma) cellInfo).getCellSignalStrength();
            // Get the signal level as an asu value between 0..97, 99 is unknown
            int asuLevel = cdmaStength.getAsuLevel();
            // Get the CDMA RSSI value in dBm
            int cdmaDbm = cdmaStength.getCdmaDbm();
            // Get the CDMA Ec/Io value in dB*10
            int cdmaEcio = cdmaStength.getCdmaEcio();
            // Get cdma as level 0..4
            int cdmaLevel = cdmaStength.getCdmaLevel();
            // Get the signal strength as dBm
            int dBm = cdmaStength.getDbm();
            // Get the EVDO RSSI value in dBm
            int evdoDbm = cdmaStength.getEvdoDbm();
            // Get the EVDO Ec/Io value in dB*10
            int evdoEcio = cdmaStength.getEvdoEcio();
            // Get Evdo as level 0..4
            int evdoLevel = cdmaStength.getEvdoLevel();
            // Get the signal to noise ratio.
            int evdoSnr = cdmaStength.getEvdoSnr();
            // Get signal level as an int from 0..4
            int level = cdmaStength.getLevel();
            final CellIdentityCdma cdmaId = ((CellInfoCdma) cellInfo).getCellIdentity();
            // Base Station Id 0..65535, Integer.MAX_VALUE if unknown
            int basestationId = cdmaId.getBasestationId();
            // Base station latitude, which is a decimal number as specified in 3GPP2 C.S0005-A v6.0.
            // It is represented in units of 0.25 seconds and ranges from -1296000 to 1296000, both
            // values inclusive (corresponding to a range of -90 to +90 degrees). Integer.MAX_VALUE if unknown.
            int latitude = cdmaId.getLatitude();
            // Base station longitude, which is a decimal number as specified in 3GPP2 C.S0005-A v6.0.
            // It is represented in units of 0.25 seconds and ranges from -2592000 to 2592000, both
            // values inclusive (corresponding to a range of -180 to +180 degrees). Integer.MAX_VALUE if unknown.
            int longitude = cdmaId.getLongitude();
            // Network Id 0..65535, Integer.MAX_VALUE if unknown
            int networkId = cdmaId.getNetworkId();
            // System Id 0..32767, Integer.MAX_VALUE if unknown
            int systemId = cdmaId.getSystemId();
            message += ";CDMA;" + isRegistered + ";" + basestationId + ";" + latitude + ";" + longitude + ";" + networkId + ";" + systemId + ";" + asuLevel + ";" + cdmaDbm + ";" + cdmaEcio + ";" + cdmaLevel + ";" + dBm + ";" + evdoDbm + ";" + evdoEcio + ";" + evdoLevel + ";" + evdoSnr + ";" + level;
        } else if (cellInfo instanceof CellInfoLte) {
            // True if this cell is registered to the mobile network.
            // 0, 1 or more CellInfo objects may return isRegistered() true.
            int isRegistered = (cellInfo.isRegistered()) ? 1 : 0;
            final CellSignalStrengthLte lteStrength = ((CellInfoLte) cellInfo).getCellSignalStrength();
            // Get the LTE signal level as an asu value between 0..97, 99 is unknown Asu is calculated based on 3GPP RSRP.
            // Represents a normalized version of the signal strength as dBm
            int asuLevel = lteStrength.getAsuLevel();
            // Get the signal strength as dBm
            // Returns RSRP – Reference Signal Received Power
            int dBm = lteStrength.getDbm();
            // Get signal level as an int from 0..4
            int level = lteStrength.getLevel();
            final CellIdentityLte lteId = ((CellInfoLte) cellInfo).getCellIdentity();
            // 28-bit Cell Identity, Integer.MAX_VALUE if unknown
            int ci = lteId.getCi();
            // 3-digit Mobile Country Code, 0..999, Integer.MAX_VALUE if unknown
            int mcc = lteId.getMcc();
            // 2 or 3-digit Mobile Network Code, 0..999, Integer.MAX_VALUE if unknown
            int mnc = lteId.getMnc();
            // Physical Cell Id 0..503, Integer.MAX_VALUE if unknown
            int pci = lteId.getPci();
            // 16-bit Tracking Area Code, Integer.MAX_VALUE if unknown
            int tac = lteId.getTac();
            message += ";LTE;" + isRegistered + ";" + ci + ";" + mcc + ";" + mnc + ";" + pci + ";" + tac + ";" + asuLevel + ";" + dBm + ";" + level;
        // 13 129108338 114 -1
        // LTE;129108338;234;10;384;144;39;-101;3
        } else if (cellInfo instanceof CellInfoWcdma) {
            // True if this cell is registered to the mobile network.
            // 0, 1 or more CellInfo objects may return isRegistered() true.
            int isRegistered = (cellInfo.isRegistered()) ? 1 : 0;
            final CellSignalStrengthWcdma wcdmaStrength = ((CellInfoWcdma) cellInfo).getCellSignalStrength();
            // Get the signal level as an asu value between 0..31, 99 is unknown Asu is calculated based on 3GPP RSRP.
            int asuLevel = wcdmaStrength.getAsuLevel();
            // Get the signal strength as dBm
            int dBm = wcdmaStrength.getDbm();
            // Get signal level as an int from 0..4
            int level = wcdmaStrength.getLevel();
            final CellIdentityWcdma wcdmaId = ((CellInfoWcdma) cellInfo).getCellIdentity();
            // CID 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455, Integer.MAX_VALUE if unknown
            int cid = wcdmaId.getCid();
            // 16-bit Location Area Code, 0..65535, Integer.MAX_VALUE if unknown
            int lac = wcdmaId.getLac();
            // 3-digit Mobile Country Code, 0..999, Integer.MAX_VALUE if unknown
            int mcc = wcdmaId.getMcc();
            // 2 or 3-digit Mobile Network Code, 0..999, Integer.MAX_VALUE if unknown
            int mnc = wcdmaId.getMnc();
            // 9-bit UMTS Primary Scrambling Code described in TS 25.331, 0..511, Integer.MAX_VALUE if unknown
            int psc = wcdmaId.getPsc();
            message += ";WCDMA;" + isRegistered + ";" + cid + ";" + lac + ";" + mcc + ";" + mnc + ";" + psc + ";" + asuLevel + ";" + dBm + ";" + level;
        } else {
            Log.e(TAG, "Unknown type of cell signal");
        }
    }
    return message;
}
Also used : CellInfoCdma(android.telephony.CellInfoCdma) CellInfoWcdma(android.telephony.CellInfoWcdma) CellIdentityGsm(android.telephony.CellIdentityGsm) CellSignalStrengthWcdma(android.telephony.CellSignalStrengthWcdma) Date(java.util.Date) CellInfoGsm(android.telephony.CellInfoGsm) CellSignalStrengthLte(android.telephony.CellSignalStrengthLte) CellInfoLte(android.telephony.CellInfoLte) CellIdentityCdma(android.telephony.CellIdentityCdma) CellInfo(android.telephony.CellInfo) CellSignalStrengthGsm(android.telephony.CellSignalStrengthGsm) CellIdentityLte(android.telephony.CellIdentityLte) CellSignalStrengthCdma(android.telephony.CellSignalStrengthCdma) CellIdentityWcdma(android.telephony.CellIdentityWcdma)

Example 8 with CellSignalStrengthCdma

use of android.telephony.CellSignalStrengthCdma in project android_packages_apps_Settings by omnirom.

the class RadioInfo method buildCdmaInfoString.

private final String buildCdmaInfoString(CellInfoCdma ci) {
    CellIdentityCdma cidCdma = ci.getCellIdentity();
    CellSignalStrengthCdma ssCdma = ci.getCellSignalStrength();
    return String.format("%-3.3s %-5.5s %-5.5s %-5.5s %-6.6s %-6.6s %-6.6s %-6.6s %-5.5s", ci.isRegistered() ? "S  " : "   ", getCellInfoDisplayString(cidCdma.getSystemId()), getCellInfoDisplayString(cidCdma.getNetworkId()), getCellInfoDisplayString(cidCdma.getBasestationId()), getCellInfoDisplayString(ssCdma.getCdmaDbm()), getCellInfoDisplayString(ssCdma.getCdmaEcio()), getCellInfoDisplayString(ssCdma.getEvdoDbm()), getCellInfoDisplayString(ssCdma.getEvdoEcio()), getCellInfoDisplayString(ssCdma.getEvdoSnr()));
}
Also used : CellIdentityCdma(android.telephony.CellIdentityCdma) CellSignalStrengthCdma(android.telephony.CellSignalStrengthCdma)

Example 9 with CellSignalStrengthCdma

use of android.telephony.CellSignalStrengthCdma in project android_packages_apps_Settings by crdroidandroid.

the class RadioInfo method buildCdmaInfoString.

private final String buildCdmaInfoString(CellInfoCdma ci) {
    CellIdentityCdma cidCdma = ci.getCellIdentity();
    CellSignalStrengthCdma ssCdma = ci.getCellSignalStrength();
    return String.format("%-3.3s %-5.5s %-5.5s %-5.5s %-6.6s %-6.6s %-6.6s %-6.6s %-5.5s", ci.isRegistered() ? "S  " : "   ", getCellInfoDisplayString(cidCdma.getSystemId()), getCellInfoDisplayString(cidCdma.getNetworkId()), getCellInfoDisplayString(cidCdma.getBasestationId()), getCellInfoDisplayString(ssCdma.getCdmaDbm()), getCellInfoDisplayString(ssCdma.getCdmaEcio()), getCellInfoDisplayString(ssCdma.getEvdoDbm()), getCellInfoDisplayString(ssCdma.getEvdoEcio()), getCellInfoDisplayString(ssCdma.getEvdoSnr()));
}
Also used : CellIdentityCdma(android.telephony.CellIdentityCdma) CellSignalStrengthCdma(android.telephony.CellSignalStrengthCdma)

Example 10 with CellSignalStrengthCdma

use of android.telephony.CellSignalStrengthCdma in project assertj-android by square.

the class CellInfoCdmaAssert method hasCellSignalStrength.

public CellInfoCdmaAssert hasCellSignalStrength(CellSignalStrengthCdma cellSignalStrength) {
    isNotNull();
    CellSignalStrengthCdma actualCellSignalStrength = actual.getCellSignalStrength();
    // 
    assertThat(actualCellSignalStrength).overridingErrorMessage("Expected cell signal strength <%s> but was <%s>.", cellSignalStrength, // 
    actualCellSignalStrength).isEqualTo(cellSignalStrength);
    return this;
}
Also used : CellSignalStrengthCdma(android.telephony.CellSignalStrengthCdma)

Aggregations

CellSignalStrengthCdma (android.telephony.CellSignalStrengthCdma)14 CellIdentityCdma (android.telephony.CellIdentityCdma)13 CellIdentityGsm (android.telephony.CellIdentityGsm)6 CellInfoCdma (android.telephony.CellInfoCdma)6 CellInfoGsm (android.telephony.CellInfoGsm)6 CellSignalStrengthGsm (android.telephony.CellSignalStrengthGsm)6 CellIdentityLte (android.telephony.CellIdentityLte)3 CellIdentityWcdma (android.telephony.CellIdentityWcdma)3 CellInfo (android.telephony.CellInfo)3 CellInfoLte (android.telephony.CellInfoLte)3 CellInfoWcdma (android.telephony.CellInfoWcdma)3 CellSignalStrengthLte (android.telephony.CellSignalStrengthLte)3 CellSignalStrengthWcdma (android.telephony.CellSignalStrengthWcdma)3 Date (java.util.Date)1