当前位置: 首页>>代码示例>>Java>>正文


Java CellSignalStrengthLte类代码示例

本文整理汇总了Java中android.telephony.CellSignalStrengthLte的典型用法代码示例。如果您正苦于以下问题:Java CellSignalStrengthLte类的具体用法?Java CellSignalStrengthLte怎么用?Java CellSignalStrengthLte使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CellSignalStrengthLte类属于android.telephony包,在下文中一共展示了CellSignalStrengthLte类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadCellInfo

import android.telephony.CellSignalStrengthLte; //导入依赖的package包/类
public static void loadCellInfo(TelephonyManager tm, Device pDevice) {
    int lCurrentApiVersion = android.os.Build.VERSION.SDK_INT;
    try {
        if (pDevice.mCell == null) {
            pDevice.mCell = new Cell();
        }
        List<CellInfo> cellInfoList = tm.getAllCellInfo();
        if (cellInfoList != null) {
            for (final CellInfo info : cellInfoList) {

                //Network Type
                pDevice.mCell.setNetType(tm.getNetworkType());

                if (info instanceof CellInfoGsm) {
                    final CellSignalStrengthGsm gsm = ((CellInfoGsm) info).getCellSignalStrength();
                    final CellIdentityGsm identityGsm = ((CellInfoGsm) info).getCellIdentity();
                    // Signal Strength
                    pDevice.mCell.setDBM(gsm.getDbm()); // [dBm]
                    // Cell Identity
                    pDevice.mCell.setCID(identityGsm.getCid());
                    pDevice.mCell.setMCC(identityGsm.getMcc());
                    pDevice.mCell.setMNC(identityGsm.getMnc());
                    pDevice.mCell.setLAC(identityGsm.getLac());

                } else if (info instanceof CellInfoCdma) {
                    final CellSignalStrengthCdma cdma = ((CellInfoCdma) info).getCellSignalStrength();
                    final CellIdentityCdma identityCdma = ((CellInfoCdma) info).getCellIdentity();
                    // Signal Strength
                    pDevice.mCell.setDBM(cdma.getDbm());
                    // Cell Identity
                    pDevice.mCell.setCID(identityCdma.getBasestationId());
                    pDevice.mCell.setMNC(identityCdma.getSystemId());
                    pDevice.mCell.setLAC(identityCdma.getNetworkId());
                    pDevice.mCell.setSID(identityCdma.getSystemId());

                } else if (info instanceof CellInfoLte) {
                    final CellSignalStrengthLte lte = ((CellInfoLte) info).getCellSignalStrength();
                    final CellIdentityLte identityLte = ((CellInfoLte) info).getCellIdentity();
                    // Signal Strength
                    pDevice.mCell.setDBM(lte.getDbm());
                    pDevice.mCell.setTimingAdvance(lte.getTimingAdvance());
                    // Cell Identity
                    pDevice.mCell.setMCC(identityLte.getMcc());
                    pDevice.mCell.setMNC(identityLte.getMnc());
                    pDevice.mCell.setCID(identityLte.getCi());

                } else if  (lCurrentApiVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2 && info instanceof CellInfoWcdma) {
                    final CellSignalStrengthWcdma wcdma = ((CellInfoWcdma) info).getCellSignalStrength();
                    final CellIdentityWcdma identityWcdma = ((CellInfoWcdma) info).getCellIdentity();
                    // Signal Strength
                    pDevice.mCell.setDBM(wcdma.getDbm());
                    // Cell Identity
                    pDevice.mCell.setLAC(identityWcdma.getLac());
                    pDevice.mCell.setMCC(identityWcdma.getMcc());
                    pDevice.mCell.setMNC(identityWcdma.getMnc());
                    pDevice.mCell.setCID(identityWcdma.getCid());
                    pDevice.mCell.setPSC(identityWcdma.getPsc());

                } else {
                    Log.i(TAG, mTAG + "Unknown type of cell signal!"
                            + "\n ClassName: " + info.getClass().getSimpleName()
                            + "\n ToString: " + info.toString());
                }
                if (pDevice.mCell.isValid()) {
                    break;
                }
            }
        }
    } catch (NullPointerException npe) {
       Log.e(TAG, mTAG + "loadCellInfo: Unable to obtain cell signal information: ", npe);
    }
}
 
开发者ID:5GSD,项目名称:AIMSICDL,代码行数:73,代码来源:DeviceApi18.java

示例2: cellInfoLTEJSON

import android.telephony.CellSignalStrengthLte; //导入依赖的package包/类
/**
 * Converts CellInfoLte into JSON
 * @param cellInfo CellInfoLte
 * @return JSON
 */
public static String cellInfoLTEJSON(CellInfoLte cellInfo, boolean returnSignalStrength){

    final Calendar calendar = Calendar.getInstance();
    final JSONObject json = new JSONObject();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && cellInfo != null) {
        try {
            json.put("provider", CELLINFO_PROVIDER);
            json.put("type", LTE);
            json.put("timestamp", calendar.getTimeInMillis());

            final CellIdentityLte identityLte = cellInfo.getCellIdentity();

            json.put("ci", identityLte.getCi());
            json.put("mcc", identityLte.getMcc());
            json.put("mnc", identityLte.getMnc());
            json.put("pci", identityLte.getPci());
            json.put("tac", identityLte.getTac());

            if (returnSignalStrength){
                final JSONObject jsonSignalStrength = new JSONObject();
                final CellSignalStrengthLte cellSignalStrengthLte = cellInfo.getCellSignalStrength();
                jsonSignalStrength.put("asuLevel", cellSignalStrengthLte.getAsuLevel());
                jsonSignalStrength.put("dbm", cellSignalStrengthLte.getDbm());
                jsonSignalStrength.put("level", cellSignalStrengthLte.getLevel());
                jsonSignalStrength.put("timingAdvance", cellSignalStrengthLte.getTimingAdvance());

                json.put("cellSignalStrengthLte", jsonSignalStrength);
            }
        }
        catch(JSONException exc) {
            logJSONException(exc);
        }
    }
    return json.toString();
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:42,代码来源:JSONHelper.java

示例3: getCellularInfo

import android.telephony.CellSignalStrengthLte; //导入依赖的package包/类
public String getCellularInfo(TelephonyManager telephonyManager)
{
    String cellularInfo = "";
    String log = "";
    if(telephonyManager.getAllCellInfo()==null) {
        Log.v(TAG, "getAllCellInfo returned null");
    }
    else {
        for (final CellInfo info : telephonyManager.getAllCellInfo()) {
            if (info instanceof CellInfoGsm) {
                log += "[email protected]";
                CellIdentityGsm gsm_cell = ((CellInfoGsm) info).getCellIdentity();
                log += gsm_cell.getCid() + "#" + gsm_cell.getLac() + "#" + gsm_cell.getMcc() + "#" + gsm_cell.getMnc() + "_";

                final CellSignalStrengthGsm gsm = ((CellInfoGsm) info).getCellSignalStrength();
                log += gsm.getDbm() + "#" + gsm.getLevel()+"#"+gsm.getAsuLevel()+":";
            } else if (info instanceof CellInfoCdma) {
                log += "[email protected]";
                CellIdentityCdma cdma_cell = ((CellInfoCdma) info).getCellIdentity();
                log += cdma_cell.getBasestationId() + "#" + cdma_cell.getNetworkId() + "#" + cdma_cell.getSystemId() + "#" + cdma_cell.getSystemId() + "_";

                final CellSignalStrengthCdma cdma = ((CellInfoCdma) info).getCellSignalStrength();
                log += cdma.getDbm() + "#" + cdma.getLevel()+"#"+cdma.getAsuLevel()+":";
            } else if (info instanceof CellInfoLte) {
                log += "[email protected]";
                CellIdentityLte lte_cell = ((CellInfoLte) info).getCellIdentity();
                log += lte_cell.getCi() + "#" + lte_cell.getPci() + "#" + lte_cell.getMcc() + "#" + lte_cell.getMnc() + "_";

                final CellSignalStrengthLte lte = ((CellInfoLte) info).getCellSignalStrength();
                log += lte.getDbm() + "#" + lte.getLevel()+"#"+lte.getAsuLevel()+":";
            } else if (info instanceof CellInfoWcdma) {
                log += "[email protected]";
                CellIdentityWcdma wcdma_cell = ((CellInfoWcdma) info).getCellIdentity();
                log += wcdma_cell.getCid() + "#" + wcdma_cell.getLac() + "#" + wcdma_cell.getMcc() + "#" + wcdma_cell.getMnc() + "_";

                final CellSignalStrengthWcdma wcdma = ((CellInfoWcdma) info).getCellSignalStrength();
                log += wcdma.getDbm() + "#" + wcdma.getLevel()+"#"+wcdma.getAsuLevel()+":";
            } else {
                Log.v(TAG, "Unknown Network Type");
            }
        }
    }
    cellularInfo = log;
    return cellularInfo;
}
 
开发者ID:gautamgitspace,项目名称:CellularNetworkMonitor,代码行数:46,代码来源:CellularDataRecorder.java

示例4: CellSignalStrength

import android.telephony.CellSignalStrengthLte; //导入依赖的package包/类
public CellSignalStrength(CellSignalStrengthLte ss) {
    String desc = ss.toString();
    setRsrp(getSignalStrengthValueFromDescriptionString(desc,"rsrp"));
    setRsrq(getSignalStrengthValueFromDescriptionString(desc,"rsrq"));
    setRssnr(getSignalStrengthValueFromDescriptionString(desc,"rssnr"));
    setCqi(getSignalStrengthValueFromDescriptionString(desc,"cqi"));
    setTimingAdvance(ss.getTimingAdvance());
    //setSignal(ss.getDbm());
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:10,代码来源:CellInformationWrapper.java

示例5: type

import android.telephony.CellSignalStrengthLte; //导入依赖的package包/类
public static SubjectFactory<CellSignalStrengthLteSubject, CellSignalStrengthLte> type() {
  return new SubjectFactory<CellSignalStrengthLteSubject, CellSignalStrengthLte>() {
    @Override
    public CellSignalStrengthLteSubject getSubject(FailureStrategy fs, CellSignalStrengthLte that) {
      return new CellSignalStrengthLteSubject(fs, that);
    }
  };
}
 
开发者ID:pkware,项目名称:truth-android,代码行数:9,代码来源:CellSignalStrengthLteSubject.java

示例6: loadCellInfo

import android.telephony.CellSignalStrengthLte; //导入依赖的package包/类
public static void loadCellInfo(TelephonyManager tm, Device pDevice) {
    int lCurrentApiVersion = Build.VERSION.SDK_INT;
    try {
        if (pDevice.cell == null) {
            pDevice.cell = new Cell();
        }
        List<CellInfo> cellInfoList = tm.getAllCellInfo();
        if (cellInfoList != null) {
            for (final CellInfo info : cellInfoList) {

                //Network Type
                pDevice.cell.setNetType(tm.getNetworkType());

                if (info instanceof CellInfoGsm) {
                    final CellSignalStrengthGsm gsm = ((CellInfoGsm) info).getCellSignalStrength();
                    final CellIdentityGsm identityGsm = ((CellInfoGsm) info).getCellIdentity();
                    // Signal Strength
                    pDevice.cell.setDbm(gsm.getDbm()); // [dBm]
                    // Cell Identity
                    pDevice.cell.setCellId(identityGsm.getCid());
                    pDevice.cell.setMobileCountryCode(identityGsm.getMcc());
                    pDevice.cell.setMobileNetworkCode(identityGsm.getMnc());
                    pDevice.cell.setLocationAreaCode(identityGsm.getLac());

                } else if (info instanceof CellInfoCdma) {
                    final CellSignalStrengthCdma cdma = ((CellInfoCdma) info).getCellSignalStrength();
                    final CellIdentityCdma identityCdma = ((CellInfoCdma) info).getCellIdentity();
                    // Signal Strength
                    pDevice.cell.setDbm(cdma.getDbm());
                    // Cell Identity
                    pDevice.cell.setCellId(identityCdma.getBasestationId());
                    pDevice.cell.setMobileNetworkCode(identityCdma.getSystemId());
                    pDevice.cell.setLocationAreaCode(identityCdma.getNetworkId());
                    pDevice.cell.setSid(identityCdma.getSystemId());

                } else if (info instanceof CellInfoLte) {
                    final CellSignalStrengthLte lte = ((CellInfoLte) info).getCellSignalStrength();
                    final CellIdentityLte identityLte = ((CellInfoLte) info).getCellIdentity();
                    // Signal Strength
                    pDevice.cell.setDbm(lte.getDbm());
                    pDevice.cell.setTimingAdvance(lte.getTimingAdvance());
                    // Cell Identity
                    pDevice.cell.setMobileCountryCode(identityLte.getMcc());
                    pDevice.cell.setMobileNetworkCode(identityLte.getMnc());
                    pDevice.cell.setCellId(identityLte.getCi());

                } else if  (lCurrentApiVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2 && info instanceof CellInfoWcdma) {
                    final CellSignalStrengthWcdma wcdma = ((CellInfoWcdma) info).getCellSignalStrength();
                    final CellIdentityWcdma identityWcdma = ((CellInfoWcdma) info).getCellIdentity();
                    // Signal Strength
                    pDevice.cell.setDbm(wcdma.getDbm());
                    // Cell Identity
                    pDevice.cell.setLocationAreaCode(identityWcdma.getLac());
                    pDevice.cell.setMobileCountryCode(identityWcdma.getMcc());
                    pDevice.cell.setMobileNetworkCode(identityWcdma.getMnc());
                    pDevice.cell.setCellId(identityWcdma.getCid());
                    pDevice.cell.setPrimaryScramblingCode(identityWcdma.getPsc());

                } else {
                    log.info("Unknown type of cell signal!"
                            + "\n ClassName: " + info.getClass().getSimpleName()
                            + "\n ToString: " + info.toString());
                }
                if (pDevice.cell.isValid()) {
                    break;
                }
            }
        }
    } catch (NullPointerException npe) {
        log.error("loadCellInfo: Unable to obtain cell signal information: ", npe);
    }
}
 
开发者ID:anticomarley,项目名称:Android-IMSI-Catcher-Detector,代码行数:73,代码来源:DeviceApi18.java

示例7: fill

import android.telephony.CellSignalStrengthLte; //导入依赖的package包/类
public static void fill(TheDictionary map, CellSignalStrengthLte value) throws Exception {
	if (value != null) {
		int i;
		i = value.getTimingAdvance();
		if (i != Integer.MAX_VALUE) map.put("timing_advance", i);
		i = value.getAsuLevel();
		if (i != 99) map.put("asu_level", i);
		map.put("dbm", value.getDbm());
		map.put("level", value.getLevel());
	}
}
 
开发者ID:emdete,项目名称:tabulae,代码行数:12,代码来源:CellId.java

示例8: fill

import android.telephony.CellSignalStrengthLte; //导入依赖的package包/类
public static void fill(TheDictionary map, CellSignalStrengthLte value) throws Exception {
	if (value != null) {
		int i;
		i = value.getTimingAdvance(); if (i != Integer.MAX_VALUE) map.put("timing_advance", i);
		i = value.getAsuLevel(); if (i != 99) map.put("asu_level", i);
		map.put("dbm", value.getDbm());
		map.put("level", value.getLevel());
	}
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:10,代码来源:CellId.java

示例9: hasCellSignalStrength

import android.telephony.CellSignalStrengthLte; //导入依赖的package包/类
public CellInfoLteAssert hasCellSignalStrength(CellSignalStrengthLte cellSignalStrength) {
  isNotNull();
  CellSignalStrengthLte actualCellSignalStrength = actual.getCellSignalStrength();
  assertThat(actualCellSignalStrength) //
      .overridingErrorMessage("Expected cell signal strength <%s> but was <%s>.", cellSignalStrength, actualCellSignalStrength) //
      .isEqualTo(cellSignalStrength);
  return this;
}
 
开发者ID:square,项目名称:assertj-android,代码行数:9,代码来源:CellInfoLteAssert.java

示例10: hasCellSignalStrength

import android.telephony.CellSignalStrengthLte; //导入依赖的package包/类
public CellInfoLteSubject hasCellSignalStrength(CellSignalStrengthLte cellSignalStrength) {
  assertThat(actual().getCellSignalStrength())
      .named("cell signal strength")
      .isEqualTo(cellSignalStrength);
  return this;
}
 
开发者ID:pkware,项目名称:truth-android,代码行数:7,代码来源:CellInfoLteSubject.java

示例11: CellSignalStrengthLteSubject

import android.telephony.CellSignalStrengthLte; //导入依赖的package包/类
private CellSignalStrengthLteSubject(FailureStrategy failureStrategy, CellSignalStrengthLte subject) {
  super(failureStrategy, subject);
}
 
开发者ID:pkware,项目名称:truth-android,代码行数:4,代码来源:CellSignalStrengthLteSubject.java

示例12: CellSignalStrengthLteAssert

import android.telephony.CellSignalStrengthLte; //导入依赖的package包/类
public CellSignalStrengthLteAssert(CellSignalStrengthLte actual) {
  super(actual, CellSignalStrengthLteAssert.class);
}
 
开发者ID:square,项目名称:assertj-android,代码行数:4,代码来源:CellSignalStrengthLteAssert.java


注:本文中的android.telephony.CellSignalStrengthLte类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。