本文整理匯總了Java中android.telephony.NeighboringCellInfo.UNKNOWN_CID屬性的典型用法代碼示例。如果您正苦於以下問題:Java NeighboringCellInfo.UNKNOWN_CID屬性的具體用法?Java NeighboringCellInfo.UNKNOWN_CID怎麽用?Java NeighboringCellInfo.UNKNOWN_CID使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.telephony.NeighboringCellInfo
的用法示例。
在下文中一共展示了NeighboringCellInfo.UNKNOWN_CID屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: update
public void update(Measurement m, CellLocation cellLocation, int mcc, int mnc, NetworkGroup networkType) {
if (cellLocation instanceof GsmCellLocation) {
GsmCellLocation gsmCellLocation = (GsmCellLocation) cellLocation;
if (gsmCellLocation.getCid() <= 65535 && gsmCellLocation.getPsc() == NeighboringCellInfo.UNKNOWN_CID) {
m.setGsmCellLocation(mcc, mnc, gsmCellLocation.getLac(), gsmCellLocation.getCid(), NetworkGroup.Gsm);
} else {
// fix invalid network types (unfortunately not possible to distinguish between UMTS and LTE)
if (networkType == NetworkGroup.Gsm || networkType == NetworkGroup.Cdma)
networkType = NetworkGroup.Unknown;
int psc = gsmCellLocation.getPsc();
if (psc == NeighboringCellInfo.UNKNOWN_CID || psc == Measurement.UNKNOWN_CID) {
psc = Measurement.UNKNOWN_CID;
} else if (psc >= 504) {
// only UMTS networks support larger PSC
networkType = NetworkGroup.Wcdma;
}
m.setGsmCellLocation(mcc, mnc, gsmCellLocation.getLac(), gsmCellLocation.getCid(), psc, networkType);
}
} else if (cellLocation instanceof CdmaCellLocation) {
CdmaCellLocation cdmaCellLocation = (CdmaCellLocation) cellLocation;
m.setCdmaCellLocation(cdmaCellLocation.getSystemId(), cdmaCellLocation.getNetworkId(), cdmaCellLocation.getBaseStationId());
} else {
throw new UnsupportedOperationException("Cell location type not supported `" + cellLocation.getClass().getName() + "`");
}
}
示例2: fill
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);
}
}
示例3: isValidNeigbor
/**
* @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);
}
示例4: fill
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);
}
}
示例5: query
/**
* 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;
}
示例6: _query
/**
* 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;
}
示例7: isValid
public boolean isValid(int cid, int lac, int mnc, int mcc, int psc) {
boolean valid = (isCidOrCiInRange(cid) && isLacOrTacInRange(lac)
&& isMncInRange(mnc) && isMccInRange(mcc)
&& (psc == NeighboringCellInfo.UNKNOWN_CID || psc == Measurement.UNKNOWN_CID || isPscOrPciInRange(psc)));
return valid;
}
示例8: isValidNeigbor
/**
* Tests whether a given neighboring cell is valid
* Check is required as some modems only return dummy values for neighboring cells
*
* Note: PSC is not checked, as PSC may be -1 on GSM networks
* see https://developer.android.com/reference/android/telephony/gsm/GsmCellLocation.html#getPsc()
*
* @param c cell
* @return true if cell has a valid cell id and lac
*/
private boolean isValidNeigbor(final NeighboringCellInfo c) {
if (c == null) {
return false;
}
return (
(c.getCid() != NeighboringCellInfo.UNKNOWN_CID && c.getCid() < 0xffff) &&
(c.getLac() != NeighboringCellInfo.UNKNOWN_CID && c.getLac() < 0xffff));
}