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

WirelessLoggerService.java 文件源码 项目:openbmap 阅读 22 收藏 0 点赞 0 评论 0
/**
 * @param ci
 * @return
 */
private boolean isValidNeigbor(final NeighboringCellInfo ci) {
    if (ci == null) {
        return false;
    }
    return (ci.getCid() !=  NeighboringCellInfo.UNKNOWN_CID || ci.getLac() != NeighboringCellInfo.UNKNOWN_CID || ci.getPsc() !=  NeighboringCellInfo.UNKNOWN_CID);
}
CellBackendHelper.java 文件源码 项目:android_external_UnifiedNlpApi 阅读 25 收藏 0 点赞 0 评论 0
private Cell parseCellInfo(NeighboringCellInfo info) {
    try {
        if (getCellType(info.getNetworkType()) != Cell.CellType.GSM) return null;
        return new Cell(Cell.CellType.GSM, getMcc(), getMnc(), info.getLac(), info.getCid(),
                info.getPsc(), info.getRssi());
    } catch (Exception ignored) {
    }
    return null;
}
ai.java 文件源码 项目:MiBandDecompiled 阅读 31 收藏 0 点赞 0 评论 0
protected final List m()
{
    ArrayList arraylist = new ArrayList();
    if (b == null)
    {
        return arraylist;
    }
    if (!c())
    {
        return arraylist;
    }
    Iterator iterator = b.getNeighboringCellInfo().iterator();
    int i1 = 0;
    do
    {
        if (!iterator.hasNext())
        {
            break;
        }
        NeighboringCellInfo neighboringcellinfo = (NeighboringCellInfo)iterator.next();
        if (i1 > 15)
        {
            break;
        }
        if (neighboringcellinfo.getLac() != 0 && neighboringcellinfo.getLac() != 65535 && neighboringcellinfo.getCid() != 65535 && neighboringcellinfo.getCid() != 0xfffffff)
        {
            arraylist.add(neighboringcellinfo);
            i1++;
        }
    } while (true);
    return arraylist;
}
PhoneStateHelper.java 文件源码 项目:SignalAnalysis 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Get current neighboring cell info
 * 
 * @return neighboring cell information format as {@link String}
 */
public String getNeighboringCellInfo() {
    if (DBG)
        Log.d(Config.TAG, TAG + "getNeighboringCellInfo called");
    String ret = null;
    List<NeighboringCellInfo> listNeighboringCellInfo = mTelMgr
            .getNeighboringCellInfo();
    if (listNeighboringCellInfo != null)
        for (NeighboringCellInfo a_Info : listNeighboringCellInfo)
            ret = ret + "\nCell neighboring info : " + a_Info.getRssi()
                    + " - " + a_Info.getCid();
    return ret;
}
NetworkUtils.java 文件源码 项目:Office-365-SDK-for-Android 阅读 47 收藏 0 点赞 0 评论 0
/**
 * Retrieves network info data. *
 *
 * @return Current network info data.
 */
public static NetworkState getNetworkState(Context context) {
    NetworkState callInfoData = null;
    try {
        TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        GsmCellLocation location = (GsmCellLocation) telephonyManager.getCellLocation();
        String mcc = "0";
        String mnc = "0";
        String networkOperator = telephonyManager.getNetworkOperator();
        if (networkOperator != null && networkOperator.length() > 0) {
            mcc = telephonyManager.getNetworkOperator().substring(0, 3);
            mnc = telephonyManager.getNetworkOperator().substring(3);
        }

        int[] neighborCellId;
        int[] neighborCellRssi;

        List<NeighboringCellInfo> neighboringList = telephonyManager.getNeighboringCellInfo();
        if (neighboringList != null && !neighboringList.isEmpty()) {
            neighborCellId = new int[neighboringList.size()];
            neighborCellRssi = new int[neighboringList.size()];
            for (int i = 0; i < neighboringList.size(); i++) {
                neighborCellRssi[i] = neighboringList.get(i).getRssi();
                neighborCellId[i] = neighboringList.get(i).getCid();
            }
        } else {
            neighborCellId = new int[] { -1 };
            neighborCellRssi = new int[] { -1 };
        }

        callInfoData = new NetworkState(System.currentTimeMillis(), (location != null) ? location.getCid() : 0, /* rssi, dbm, asu, */0, 0, 0,
                mcc, mnc, (location != null) ? location.getLac() : 0, NetworkUtils.isInRoaming(context),
                NetworkUtils.getDataConnectionState(context), NetworkUtils.getSimState(context), NetworkUtils.getNetworkType(context),
                NetworkUtils.isWiFiEnabled(context), neighborCellId, neighborCellRssi);
    } catch (final Exception e) {
        Logger.logApplicationException(e, NetworkUtils.class.getSimpleName() + ".getNetworkInfoData(): Failed.");
        e.printStackTrace();
    }
    return callInfoData;
}
CellIdPre17API.java 文件源码 项目:Simplicissimus 阅读 21 收藏 0 点赞 0 评论 0
public void fill(TheDictionary map, NeighboringCellInfo value) throws Exception {
    if (value != null) {
        map.put("mcc", mcc);
        map.put("mnc", mnc);
        int i;
        i = value.getPsc(); if (i != NeighboringCellInfo.UNKNOWN_CID) map.put("psc", i);
        i = value.getRssi(); if (i != NeighboringCellInfo.UNKNOWN_CID) map.put("rssi", i);
        i = value.getLac(); if (i != NeighboringCellInfo.UNKNOWN_CID) map.put("lac", i);
        i = value.getCid(); if (i != NeighboringCellInfo.UNKNOWN_CID) map.put("cid", i);
        map.put("registered", false);
        determine_type(map);
    }
}
CellTowerDatabase.java 文件源码 项目:LocalGSMLocationProvider 阅读 15 收藏 0 点赞 0 评论 0
/**
 * Perform a (cached) DB query for a given cell tower. Note that MCC and MNC can be null.
 * @param mcc
 * @param mnc
 * @param cid
 * @param lac
 * @return
 */
public List<CellInfo> query(final Integer mcc, final Integer mnc, final int cid, final int lac) {
    if (this.reader == null) return null;

    if (cid == NeighboringCellInfo.UNKNOWN_CID || cid == Integer.MAX_VALUE) return null;

    if (mcc != null && mcc == Integer.MAX_VALUE) return query(null, mnc, cid, lac);
    if (mnc != null && mnc == Integer.MAX_VALUE) return query(mcc, null, cid, lac);

    QueryArgs args = new QueryArgs(mcc, mnc, cid, lac);
    Boolean negative = queryResultNegativeCache.get(args);
    if (negative != null && negative.booleanValue()) return null;

    List<CellInfo> cached = queryResultCache.get(args);
    if (cached != null) return cached;

    List<CellInfo> result = _query(mcc, mnc, cid, lac);

    if (result == null) {
        queryResultNegativeCache.put(args, true);
        return null;
    }

    result = Collections.unmodifiableList(result);

    queryResultCache.put(args, result);
    return result;
}
CellTowerDatabase.java 文件源码 项目:LocalGSMLocationProvider 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Internal db query to retrieve all cell tower candidates for a given cid/lac.
 * @param mcc
 * @param mnc
 * @param cid
 * @param lac
 * @return
 */
private List<CellInfo> _query(Integer mcc, Integer mnc, int cid, int lac) {
    if (this.reader == null) return null;

    // we need at least CID/LAC
    if (cid == NeighboringCellInfo.UNKNOWN_CID) return null;

    android.util.Log.d("LNLP/Query", "(" + mcc + "," + mnc + "," + cid + "," + lac + ")");

    List<CellInfo> cil = _queryDirect(mcc, mnc, cid, lac);
    if (cil == null || cil.size() == 0) {
        if (cid > 0xffff) {
            _queryDirect(mcc, mnc, cid & 0xffff, lac);
        }
    }
    if (cil != null && cil.size() > 0) {
        return cil;
    }

    if (mcc != null && mnc != null) {
        return query(mcc, null, cid, lac);
    }

    if (mcc != null || mnc != null) {
        return query(null,null,cid,lac);
    }

    return null;
}
CellTowersDataCollector.java 文件源码 项目:skandroid-core 阅读 70 收藏 0 点赞 0 评论 0
synchronized static void sOnCellInfoChanged(List<CellInfo> cellInfo){
    List<NeighboringCellInfo> n = mTelManager.getNeighboringCellInfo();
    if( n != null && n.size() > 0){
        neighbours.setTime(System.currentTimeMillis());
        neighbours.setNeighbors(n);
    }
}
CellTowersData.java 文件源码 项目:skandroid-core 阅读 20 收藏 0 点赞 0 评论 0
public void setNeighbors(List<NeighboringCellInfo> inNeighbors) {

    // We NEVER allow the neighbors member to be set null.
    // Otherwise, tests might be mis-reported as failing.
    // If we're supplied a null value, set to use an empty list.
    if (inNeighbors == null) {
        // ... we should trap this where possible in the debugger...
        SKPorting.sAssert(getClass(), false);
     neighbors = new ArrayList<>();
    } else {
        neighbors = inNeighbors;
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号