private void addCellSpecsFromNeighboringCellInfo(
      Collection<CellSpec> cellSpecs,
      int mcc,
      int mnc,
      List<NeighboringCellInfo> neighboringCellInfo) {
    if (neighboringCellInfo == null) {
      return;
    }
    for (NeighboringCellInfo cellInfo : neighboringCellInfo) {
      int lac = cellInfo.getLac();
      int cid = cellInfo.getCid();
      int psc = cellInfo.getPsc();
      // TODO handle rssi: int rssi = cellInfo.getRssi();
      if ((lac != NeighboringCellInfo.UNKNOWN_CID) && (cid != NeighboringCellInfo.UNKNOWN_CID)) {

        if (psc != NeighboringCellInfo.UNKNOWN_CID) {
          CellSpec cellSpec = new CellSpec(Radio.UMTS, mcc, mnc, lac, cid);
          cellSpec.setPsc(psc);
          cellSpecs.add(cellSpec);
        } else {
          cellSpecs.add(new CellSpec(Radio.GSM, mcc, mnc, lac, cid));
        }
      }
    }
  }
 private void addCellSpecFromCellLocation(
     Collection<CellSpec> cellSpecs, int mcc, int mnc, CellLocation cellLocation) {
   if (cellLocation instanceof GsmCellLocation) {
     GsmCellLocation gsmCellLocation = (GsmCellLocation) cellLocation;
     int cid = gsmCellLocation.getCid();
     int lac = gsmCellLocation.getLac();
     int psc = gsmCellLocation.getPsc();
     if (psc == -1) {
       cellSpecs.add(new CellSpec(Radio.GSM, mcc, mnc, lac, cid));
     } else {
       CellSpec cellSpec = new CellSpec(Radio.UMTS, mcc, mnc, lac, cid);
       cellSpec.setPsc(psc);
       cellSpecs.add(cellSpec);
     }
   } else if (cellLocation instanceof CdmaCellLocation) {
     CdmaCellLocation cdmaCellLocation = (CdmaCellLocation) cellLocation;
     int sid = cdmaCellLocation.getSystemId(); // as mnc
     int nid = cdmaCellLocation.getNetworkId(); // as lac
     int bid = cdmaCellLocation.getBaseStationId(); // as cid
     cellSpecs.add(new CellSpec(Radio.CDMA, mcc, sid, nid, bid));
   } else {
     if (MainService.DEBUG) {
       Log.d(TAG, "Not connected to network or using LTE, which is not supported for SDK <= 16");
     }
   }
 }