java类android.telephony.CellInfoGsm的实例源码

CellInfoGsmSubject.java 文件源码 项目:truth-android 阅读 17 收藏 0 点赞 0 评论 0
private CellInfoGsmSubject(FailureStrategy failureStrategy, CellInfoGsm subject) {
  super(failureStrategy, subject);
}
RadioInfo.java 文件源码 项目:CellularSignal 阅读 18 收藏 0 点赞 0 评论 0
@Override
public void onCellInfoChanged(List<CellInfo> cellInfoList) {
    super.onCellInfoChanged(cellInfoList);


    if (cellInfoList == null) {
        //Log.e(Tag,"onCellInfoChanged is null");
        return;
    }

    //Log.e(Tag,"onCellInfoChanged size "+cellInfoList.size());

    for (CellInfo cellInfo : cellInfoList) {

        if (!cellInfo.isRegistered())
            continue;

        if (cellInfo instanceof CellInfoLte) {

            CellInfoLte lteinfo = (CellInfoLte) cellInfo;

            lte_MCC = lteinfo.getCellIdentity().getMcc();
            lte_MNC = lteinfo.getCellIdentity().getMnc();
            lte_CI = lteinfo.getCellIdentity().getCi();
            lte_PCI = lteinfo.getCellIdentity().getPci();
            lte_TAC = lteinfo.getCellIdentity().getTac();
            //Log.e(Tag,lteinfo.toString());

        } else if (cellInfo instanceof CellInfoCdma) {

            CellInfoCdma cdmainfo = (CellInfoCdma) cellInfo;

            cdma_SID = cdmainfo.getCellIdentity().getSystemId();
            cdma_NID = cdmainfo.getCellIdentity().getNetworkId();
            cdma_BSID = cdmainfo.getCellIdentity().getBasestationId();

            //Log.e(Tag,cdmainfo.toString());
        } else if (cellInfo instanceof CellInfoGsm) {
            CellInfoGsm gsmInfo = (CellInfoGsm) cellInfo;

            gsm_MCC = gsmInfo.getCellIdentity().getMcc();
            gsm_MNC = gsmInfo.getCellIdentity().getMnc();
            gsm_CID = gsmInfo.getCellIdentity().getCid();
            gsm_LAC = gsmInfo.getCellIdentity().getLac();

        } else if (cellInfo instanceof CellInfoWcdma) {
            CellInfoWcdma wcdmaInfo = (CellInfoWcdma) cellInfo;

            wcdma_MCC = wcdmaInfo.getCellIdentity().getMcc();
            wcdma_MNC = wcdmaInfo.getCellIdentity().getMnc();
            wcdma_CID = wcdmaInfo.getCellIdentity().getCid();
            wcdma_LAC = wcdmaInfo.getCellIdentity().getLac();
            wcdma_PSC = wcdmaInfo.getCellIdentity().getPsc();
        }
    }

    ((MainActivity)mcontext).mSectionsPagerAdapter.notifyDataSetChanged();
}
RadioInfo.java 文件源码 项目:CellularSignal 阅读 20 收藏 0 点赞 0 评论 0
private void getCellIdentity() {
    List<CellInfo> cellInfoList = mTM.getAllCellInfo();

    if (cellInfoList == null) {
        //Log.e(Tag,"getAllCellInfo is null");
        return;
    }
    //Log.e(Tag,"getAllCellInfo size "+cellInfoList.size());

    for (CellInfo cellInfo : cellInfoList) {

        if (!cellInfo.isRegistered())
            continue;

        if (cellInfo instanceof CellInfoLte) {

            CellInfoLte lteinfo = (CellInfoLte) cellInfo;

            lte_MCC = lteinfo.getCellIdentity().getMcc();
            lte_MNC = lteinfo.getCellIdentity().getMnc();
            lte_CI = lteinfo.getCellIdentity().getCi();
            lte_PCI = lteinfo.getCellIdentity().getPci();
            lte_TAC = lteinfo.getCellIdentity().getTac();
            //Log.e(Tag,lteinfo.toString());

        } else if (cellInfo instanceof CellInfoCdma) {

            CellInfoCdma cdmainfo = (CellInfoCdma) cellInfo;

            cdma_SID = cdmainfo.getCellIdentity().getSystemId();
            cdma_NID = cdmainfo.getCellIdentity().getNetworkId();
            cdma_BSID = cdmainfo.getCellIdentity().getBasestationId();

            //Log.e(Tag,cdmainfo.toString());
        } else if (cellInfo instanceof CellInfoGsm) {
            CellInfoGsm gsmInfo = (CellInfoGsm) cellInfo;

            gsm_MCC = gsmInfo.getCellIdentity().getMcc();
            gsm_MNC = gsmInfo.getCellIdentity().getMnc();
            gsm_CID = gsmInfo.getCellIdentity().getCid();
            gsm_LAC = gsmInfo.getCellIdentity().getLac();

        } else if (cellInfo instanceof CellInfoWcdma) {
            CellInfoWcdma wcdmaInfo = (CellInfoWcdma) cellInfo;

            wcdma_MCC = wcdmaInfo.getCellIdentity().getMcc();
            wcdma_MNC = wcdmaInfo.getCellIdentity().getMnc();
            wcdma_CID = wcdmaInfo.getCellIdentity().getCid();
            wcdma_LAC = wcdmaInfo.getCellIdentity().getLac();
            wcdma_PSC = wcdmaInfo.getCellIdentity().getPsc();
        }
    }
}
ScanService.java 文件源码 项目:spidey 阅读 16 收藏 0 点赞 0 评论 0
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void startScan() {

    logMessage("starting tower scan... ");
    Scan scan = new Scan();

    // TODO: Get location from user?
    scan.setLocation(lastScanName);

    // TODO: use actual GPS Coordinates
    scan.setLatitude(lastScanLat);
    scan.setLongitude(lastScanLon);

    long scan_id = db.createScan(scan);

    List<CellInfo> cellInfos = (List<CellInfo>) this.telephonyManager
            .getAllCellInfo();

    // TODO: better error handling of null cellinfos
    if (cellInfos != null) {
        for (CellInfo cellInfo : cellInfos) {

            if (cellInfo instanceof CellInfoGsm) {
                CellInfoGsm cellInfoGsm = (CellInfoGsm) cellInfo;

                CellIdentityGsm cellIdentity = cellInfoGsm
                        .getCellIdentity();
                CellSignalStrengthGsm cellSignalStrengthGsm = cellInfoGsm
                        .getCellSignalStrength();

                int dbmLevel = cellSignalStrengthGsm.getDbm();

                com.spideyapp.sqlite.model.CellInfo cell = new com.spideyapp.sqlite.model.CellInfo(
                        cellIdentity.getCid(), cellIdentity.getLac(),
                        cellIdentity.getMcc(), cellIdentity.getMnc(),dbmLevel);

                db.createCell(cell, scan_id);

                shareCellInfo (cell);

            }
        }
    }

}
CellTowerListGsm.java 文件源码 项目:satstat 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Adds or updates a cell tower.
 * <p>
 * If the cell tower is already in the list, its data is updated; if not, a
 * new entry is created.
 * <p>
 * This method will set the cell's identity data, its signal strength and
 * whether it is the currently serving cell. If the API level is 18 or 
 * higher, it will also set the generation.
 * @return The new or updated entry.
 */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public CellTowerGsm update(CellInfoGsm cell) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) 
        return null;
    CellIdentityGsm cid = cell.getCellIdentity();
    CellTowerGsm result = null;
    CellTowerGsm cand = this.get(cid.getMcc(), cid.getMnc(), cid.getLac(), cid.getCid());
    if ((cand != null) && CellTower.matches(cid.getPsc(), cand.getPsc()))
        result = cand;
    if (result == null) {
        cand = this.get(cid.getPsc());
        if ((cand != null)
                && ((cid.getMcc() == Integer.MAX_VALUE) || CellTower.matches(cid.getMcc(), cand.getMcc()))
                && ((cid.getMnc() == Integer.MAX_VALUE) || CellTower.matches(cid.getMnc(), cand.getMnc()))
                && ((cid.getLac() == Integer.MAX_VALUE) || CellTower.matches(cid.getLac(), cand.getLac()))
                && ((cid.getCid() == Integer.MAX_VALUE) ||CellTower.matches(cid.getCid(), cand.getCid())))
            result = cand;
    }
    if (result == null)
        result = new CellTowerGsm(cid.getMcc(), cid.getMnc(), cid.getLac(), cid.getCid(), cid.getPsc());
    if (result.getMcc() == CellTower.UNKNOWN)
        result.setMcc(cid.getMcc());
    if (result.getMnc() == CellTower.UNKNOWN)
        result.setMnc(cid.getMnc());
    if (result.getLac() == CellTower.UNKNOWN)
        result.setLac(cid.getLac());
    if (result.getCid() == CellTower.UNKNOWN)
        result.setCid(cid.getCid());
    if (result.getPsc() == CellTower.UNKNOWN)
        result.setPsc(cid.getPsc());
    this.put(result.getText(), result);
    this.put(result.getAltText(), result);
    result.setCellInfo(true);
    result.setDbm(cell.getCellSignalStrength().getDbm());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
        result.setGeneration(2);
    result.setServing(cell.isRegistered());
    if ((result.getText() == null) && (result.getAltText() == null))
        Log.d(this.getClass().getSimpleName(), String.format("Added %d G cell with no data from CellInfoGsm", result.getGeneration()));
    return result;
}
CellInfoGsmAssert.java 文件源码 项目:assertj-android 阅读 22 收藏 0 点赞 0 评论 0
public CellInfoGsmAssert(CellInfoGsm actual) {
  super(actual, CellInfoGsmAssert.class);
}


问题


面经


文章

微信
公众号

扫码关注公众号