private static Bundle getCellLocationInternal(VCell cell) { if (cell != null) { Bundle cellData = new Bundle(); if (cell.type == 2) { try { CdmaCellLocation cellLoc = new CdmaCellLocation(); cellLoc.setCellLocationData(cell.baseStationId, Integer.MAX_VALUE, Integer.MAX_VALUE, cell.systemId, cell.networkId); cellLoc.fillInNotifierBundle(cellData); } catch (Throwable e) { cellData.putInt("baseStationId", cell.baseStationId); cellData.putInt("baseStationLatitude", Integer.MAX_VALUE); cellData.putInt("baseStationLongitude", Integer.MAX_VALUE); cellData.putInt("systemId", cell.systemId); cellData.putInt("networkId", cell.networkId); } } else { try { GsmCellLocation cellLoc = new GsmCellLocation(); cellLoc.setLacAndCid(cell.lac, cell.cid); cellLoc.fillInNotifierBundle(cellData); } catch (Throwable e) { cellData.putInt("lac", cell.lac); cellData.putInt("cid", cell.cid); cellData.putInt("psc", cell.psc); } } return cellData; } return null; }
public CdmaCellLocationAssert hasSystemId(int id) { isNotNull(); int actualId = actual.getSystemId(); assertThat(actualId) // .overridingErrorMessage("Expected system ID <%s> but was <%s>.", id, actualId) // .isEqualTo(id); return this; } }
public CdmaCellLocationAssert hasBaseStationLongitude(int longitude) { isNotNull(); int actualLongitude = actual.getBaseStationLongitude(); assertThat(actualLongitude) // .overridingErrorMessage("Expected base station longitude <%s> but was <%s>.", longitude, actualLongitude) // .isEqualTo(longitude); return this; }
/** * A valid cdma cell must have basestation id, network id and system id set * * @param cdmaLocation {@link CdmaCellLocation} * @return true if valid cdma id */ private boolean isValidCdmaCell(final CdmaCellLocation cdmaLocation) { if (cdmaLocation == null) { return false; } return ((cdmaLocation.getBaseStationId() != -1) && (cdmaLocation.getNetworkId() != -1) && (cdmaLocation.getSystemId() != -1)); }
CdmaCellLocation cdmaCellLocation = (CdmaCellLocation) cellLocation; CellIdentityCdma identity = CellIdentityCdma.class.getConstructor(int.class, int.class, int.class, int.class, int.class) .newInstance(cdmaCellLocation.getNetworkId(), cdmaCellLocation.getSystemId(), cdmaCellLocation.getBaseStationId(), cdmaCellLocation.getBaseStationLongitude(), cdmaCellLocation.getBaseStationLatitude()); CellSignalStrengthCdma strength = CellSignalStrengthCdma.class.newInstance(); CellInfoCdma info = CellInfoCdma.class.newInstance();
static CellLocationSingleData fromCellLocation(CellLocation location) { int cid, lac; if (location != null) { if (location instanceof GsmCellLocation) { cid = ((GsmCellLocation) location).getCid(); lac = ((GsmCellLocation) location).getLac(); } else if (location instanceof CdmaCellLocation) { cid = ((CdmaCellLocation) location).getBaseStationId(); lac = ((CdmaCellLocation) location).getSystemId(); } else { return null; } return new CellLocationSingleData(cid, lac); } return null; }
public static String getIpBaseStation() { TelephonyManager telMgr = (TelephonyManager) FDApplication .getInstance().getSystemService(Context.TELEPHONY_SERVICE); int cid = 0; int lac = 0; try { if (telMgr != null) { GsmCellLocation gc = (GsmCellLocation) telMgr.getCellLocation(); if (null == gc) { return "0_0"; } cid = gc.getCid(); lac = gc.getLac(); } } catch (Exception e) { if (telMgr != null) { CdmaCellLocation location = (CdmaCellLocation) telMgr .getCellLocation(); if (null == location) { return "0_0"; } lac = location.getNetworkId(); cid = location.getBaseStationId(); cid /= 16; } } return lac + "_" + cid; }
public CdmaCellLocationAssert hasBaseStationId(int id) { isNotNull(); int actualId = actual.getBaseStationId(); assertThat(actualId) // .overridingErrorMessage("Expected base station ID <%s> but was <%s>.", id, actualId) // .isEqualTo(id); return this; }
public CdmaCellLocationAssert hasNetworkId(int id) { isNotNull(); int actualId = actual.getNetworkId(); assertThat(actualId) // .overridingErrorMessage("Expected network ID <%s> but was <%s>.", id, actualId) // .isEqualTo(id); return this; }
public CdmaCellLocationAssert hasBaseStationLatitude(int latitude) { isNotNull(); int actualLatitude = actual.getBaseStationLatitude(); assertThat(actualLatitude) // .overridingErrorMessage("Expected base station latitude <%s> but was <%s>.", latitude, actualLatitude) // .isEqualTo(latitude); return this; }
serving.setBaseId(String.valueOf(cdmaLocation.getBaseStationId())); serving.setNetworkId(String.valueOf(cdmaLocation.getNetworkId())); serving.setSystemId(String.valueOf(cdmaLocation.getSystemId()));
static CellLocationSingleData fromCellLocation(CellLocation location) { int cid, lac; if (location != null) { if (location instanceof GsmCellLocation) { cid = ((GsmCellLocation) location).getCid(); lac = ((GsmCellLocation) location).getLac(); } else if (location instanceof CdmaCellLocation) { cid = ((CdmaCellLocation) location).getBaseStationId(); lac = ((CdmaCellLocation) location).getSystemId(); } else { return null; } return new CellLocationSingleData(cid, lac); } return null; }
public CdmaCellLocationAssert hasBaseStationId(int id) { isNotNull(); int actualId = actual.getBaseStationId(); assertThat(actualId) // .overridingErrorMessage("Expected base station ID <%s> but was <%s>.", id, actualId) // .isEqualTo(id); return this; }
private static Bundle getCellLocationInternal(VCell cell) { if (cell != null) { Bundle cellData = new Bundle(); if (cell.type == 2) { try { CdmaCellLocation cellLoc = new CdmaCellLocation(); cellLoc.setCellLocationData(cell.baseStationId, Integer.MAX_VALUE, Integer.MAX_VALUE, cell.systemId, cell.networkId); cellLoc.fillInNotifierBundle(cellData); } catch (Throwable e) { cellData.putInt("baseStationId", cell.baseStationId); cellData.putInt("baseStationLatitude", Integer.MAX_VALUE); cellData.putInt("baseStationLongitude", Integer.MAX_VALUE); cellData.putInt("systemId", cell.systemId); cellData.putInt("networkId", cell.networkId); } } else { try { GsmCellLocation cellLoc = new GsmCellLocation(); cellLoc.setLacAndCid(cell.lac, cell.cid); cellLoc.fillInNotifierBundle(cellData); } catch (Throwable e) { cellData.putInt("lac", cell.lac); cellData.putInt("cid", cell.cid); cellData.putInt("psc", cell.psc); } } return cellData; } return null; }
public CdmaCellLocationAssert hasSystemId(int id) { isNotNull(); int actualId = actual.getSystemId(); assertThat(actualId) // .overridingErrorMessage("Expected system ID <%s> but was <%s>.", id, actualId) // .isEqualTo(id); return this; } }
public CdmaCellLocationAssert hasNetworkId(int id) { isNotNull(); int actualId = actual.getNetworkId(); assertThat(actualId) // .overridingErrorMessage("Expected network ID <%s> but was <%s>.", id, actualId) // .isEqualTo(id); return this; }
public CdmaCellLocationAssert hasBaseStationLongitude(int longitude) { isNotNull(); int actualLongitude = actual.getBaseStationLongitude(); assertThat(actualLongitude) // .overridingErrorMessage("Expected base station longitude <%s> but was <%s>.", longitude, actualLongitude) // .isEqualTo(longitude); return this; }
public CdmaCellLocationAssert hasBaseStationLatitude(int latitude) { isNotNull(); int actualLatitude = actual.getBaseStationLatitude(); assertThat(actualLatitude) // .overridingErrorMessage("Expected base station latitude <%s> but was <%s>.", latitude, actualLatitude) // .isEqualTo(latitude); return this; }
Log.i(TAG, "Assuming cdma for cell " + cdmaLocation.getBaseStationId()); return processCdma(position, cdmaLocation);
private static Bundle getCellLocationInternal(VCell cell) { if (cell != null) { Bundle cellData = new Bundle(); if (cell.type == 2) { try { CdmaCellLocation cellLoc = new CdmaCellLocation(); cellLoc.setCellLocationData(cell.baseStationId, Integer.MAX_VALUE, Integer.MAX_VALUE, cell.systemId, cell.networkId); cellLoc.fillInNotifierBundle(cellData); } catch (Throwable e) { cellData.putInt("baseStationId", cell.baseStationId); cellData.putInt("baseStationLatitude", Integer.MAX_VALUE); cellData.putInt("baseStationLongitude", Integer.MAX_VALUE); cellData.putInt("systemId", cell.systemId); cellData.putInt("networkId", cell.networkId); } } else { try { GsmCellLocation cellLoc = new GsmCellLocation(); cellLoc.setLacAndCid(cell.lac, cell.cid); cellLoc.fillInNotifierBundle(cellData); } catch (Throwable e) { cellData.putInt("lac", cell.lac); cellData.putInt("cid", cell.cid); cellData.putInt("psc", cell.psc); } } return cellData; } return null; }