本文整理匯總了Java中android.telephony.NeighboringCellInfo.getRssi方法的典型用法代碼示例。如果您正苦於以下問題:Java NeighboringCellInfo.getRssi方法的具體用法?Java NeighboringCellInfo.getRssi怎麽用?Java NeighboringCellInfo.getRssi使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.telephony.NeighboringCellInfo
的用法示例。
在下文中一共展示了NeighboringCellInfo.getRssi方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: d
import android.telephony.NeighboringCellInfo; //導入方法依賴的package包/類
public final int[] d() {
if (this.c == 0) {
return new int[0];
}
List<NeighboringCellInfo> neighboringCellInfo = this.q.getNeighboringCellInfo();
if (neighboringCellInfo == null || neighboringCellInfo.size() == 0) {
return new int[]{this.c};
}
Object obj = new int[((neighboringCellInfo.size() * 2) + 2)];
obj[0] = this.c;
obj[1] = this.a;
int i = 2;
for (NeighboringCellInfo neighboringCellInfo2 : neighboringCellInfo) {
int cid = neighboringCellInfo2.getCid();
if (cid > 0 && cid != SupportMenu.USER_MASK) {
int i2 = i + 1;
obj[i] = cid;
i = i2 + 1;
obj[i2] = neighboringCellInfo2.getRssi();
}
}
Object obj2 = new int[i];
System.arraycopy(obj, 0, obj2, 0, i);
return obj2;
}
示例2: fill
import android.telephony.NeighboringCellInfo; //導入方法依賴的package包/類
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: getCellInfo
import android.telephony.NeighboringCellInfo; //導入方法依賴的package包/類
/**
* Returns the information about cell towers in range. Returns null if the information is
* not available
*
* TODO(wenjiezeng): As folklore has it and Wenjie has confirmed, we cannot get cell info from
* Samsung phones.
*/
public String getCellInfo(boolean cidOnly) {
initNetwork();
List<NeighboringCellInfo> infos = telephonyManager.getNeighboringCellInfo();
StringBuffer buf = new StringBuffer();
String tempResult = "";
if (infos.size() > 0) {
for (NeighboringCellInfo info : infos) {
tempResult = cidOnly ? info.getCid() + ";" : info.getLac() + ","
+ info.getCid() + "," + info.getRssi() + ";";
buf.append(tempResult);
}
// Removes the trailing semicolon
buf.deleteCharAt(buf.length() - 1);
return buf.toString();
} else {
return null;
}
}
示例4: parseCellInfo
import android.telephony.NeighboringCellInfo; //導入方法依賴的package包/類
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;
}
示例5: getNeighboringCellInfo
import android.telephony.NeighboringCellInfo; //導入方法依賴的package包/類
/**
* 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;
}
示例6: fill
import android.telephony.NeighboringCellInfo; //導入方法依賴的package包/類
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);
}
}
示例7: getNeighboringCellId
import android.telephony.NeighboringCellInfo; //導入方法依賴的package包/類
private void getNeighboringCellId() {
List<NeighboringCellInfo> neighCell = null;
neighCell = telephonyManager.getNeighboringCellInfo();
for (int i = 0; i < neighCell.size(); i++) {
NeighboringCellInfo thisCell = neighCell.get(i);
int cid = thisCell.getCid();
int rssi = thisCell.getRssi();
int psc = thisCell.getPsc();
Log.d(TAG, " " + cid + " - " + rssi + " - " + psc);
}
}
示例8: updateNeighbouringCells
import android.telephony.NeighboringCellInfo; //導入方法依賴的package包/類
/**
* Description: Updates Neighbouring Cell details
*
* TODO: add more details...
*
*
*/
public List<Cell> updateNeighbouringCells() {
List<Cell> neighboringCells = new ArrayList<>();
List<NeighboringCellInfo> neighboringCellInfo = tm.getNeighboringCellInfo();
if (neighboringCellInfo == null) {
neighboringCellInfo = new ArrayList<>();
}
Boolean nclp = tinydb.getBoolean("nc_list_present"); // Is NC list present? (default is false)
//if nclp = true then check for neighboringCellInfo
//if (neighboringCellInfo != null && neighboringCellInfo.size() == 0 && nclp) {
//if (!neighboringCellInfo.isEmpty() && neighboringCellInfo.size() == 0 && nclp) {
if (neighboringCellInfo.size() == 0 && nclp) {
Log.i(TAG, mTAG + "NeighbouringCellInfo is empty: start polling...");
// Try to poll the neighboring cells for a few seconds
neighboringCellBlockingQueue = new LinkedBlockingQueue<>(100); // Max 100 NC's before blocking (?)
// ToDo: rename... (We don't use API's <18 anymore.)
DeviceApi18.startListening(tm, phoneStatelistener);
// ToDo: Move or remove. This should now be done by getAllCellInfo() in new RadioAPI "collector" module.
for (int i = 0; i < 10 && neighboringCellInfo.size() == 0; i++) {
try {
Log.d(TAG, mTAG + "NeighbouringCellInfo empty: trying " + i);
NeighboringCellInfo info = neighboringCellBlockingQueue.poll(1, TimeUnit.SECONDS);
if (info == null) {
neighboringCellInfo = tm.getNeighboringCellInfo();
if (neighboringCellInfo != null) {
if (neighboringCellInfo.size() > 0) {
// Can we think of a better log message here?
Log.d(TAG, mTAG + "NeighbouringCellInfo found on " + i + " try. (time based)");
break;
} else {
continue;
}
}
}
List<NeighboringCellInfo> cellInfoList =
new ArrayList<>(neighboringCellBlockingQueue.size() + 1);
while (info != null) {
cellInfoList.add(info);
info = neighboringCellBlockingQueue.poll(1, TimeUnit.SECONDS);
}
neighboringCellInfo = cellInfoList;
} catch (InterruptedException e) {
Log.e(TAG, mTAG + "Interrupted BlockingQueue Exception: " + e);
}
}
}
//log.debug(mTAG + ": neighbouringCellInfo size: " + neighboringCellInfo.size());
// Add NC list to DBi_measure:nc_list
for (NeighboringCellInfo neighbourCell : neighboringCellInfo) {
Log.i(TAG, mTAG + "NeighbouringCellInfo -" +
" LAC:" + neighbourCell.getLac() +
" CID:" + neighbourCell.getCid() +
" PSC:" + neighbourCell.getPsc() +
" RSSI:" + neighbourCell.getRssi());
final Cell cell = new Cell(
neighbourCell.getCid(),
neighbourCell.getLac(),
neighbourCell.getRssi(),
neighbourCell.getPsc(),
neighbourCell.getNetworkType(), false);
neighboringCells.add(cell);
}
return neighboringCells;
}