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

DeviceApi18.java 文件源码 项目:AIMSICDL 阅读 17 收藏 0 点赞 0 评论 0
public static void loadCellInfo(TelephonyManager tm, Device pDevice) {
    int lCurrentApiVersion = android.os.Build.VERSION.SDK_INT;
    try {
        if (pDevice.mCell == null) {
            pDevice.mCell = new Cell();
        }
        List<CellInfo> cellInfoList = tm.getAllCellInfo();
        if (cellInfoList != null) {
            for (final CellInfo info : cellInfoList) {

                //Network Type
                pDevice.mCell.setNetType(tm.getNetworkType());

                if (info instanceof CellInfoGsm) {
                    final CellSignalStrengthGsm gsm = ((CellInfoGsm) info).getCellSignalStrength();
                    final CellIdentityGsm identityGsm = ((CellInfoGsm) info).getCellIdentity();
                    // Signal Strength
                    pDevice.mCell.setDBM(gsm.getDbm()); // [dBm]
                    // Cell Identity
                    pDevice.mCell.setCID(identityGsm.getCid());
                    pDevice.mCell.setMCC(identityGsm.getMcc());
                    pDevice.mCell.setMNC(identityGsm.getMnc());
                    pDevice.mCell.setLAC(identityGsm.getLac());

                } else if (info instanceof CellInfoCdma) {
                    final CellSignalStrengthCdma cdma = ((CellInfoCdma) info).getCellSignalStrength();
                    final CellIdentityCdma identityCdma = ((CellInfoCdma) info).getCellIdentity();
                    // Signal Strength
                    pDevice.mCell.setDBM(cdma.getDbm());
                    // Cell Identity
                    pDevice.mCell.setCID(identityCdma.getBasestationId());
                    pDevice.mCell.setMNC(identityCdma.getSystemId());
                    pDevice.mCell.setLAC(identityCdma.getNetworkId());
                    pDevice.mCell.setSID(identityCdma.getSystemId());

                } else if (info instanceof CellInfoLte) {
                    final CellSignalStrengthLte lte = ((CellInfoLte) info).getCellSignalStrength();
                    final CellIdentityLte identityLte = ((CellInfoLte) info).getCellIdentity();
                    // Signal Strength
                    pDevice.mCell.setDBM(lte.getDbm());
                    pDevice.mCell.setTimingAdvance(lte.getTimingAdvance());
                    // Cell Identity
                    pDevice.mCell.setMCC(identityLte.getMcc());
                    pDevice.mCell.setMNC(identityLte.getMnc());
                    pDevice.mCell.setCID(identityLte.getCi());

                } else if  (lCurrentApiVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2 && info instanceof CellInfoWcdma) {
                    final CellSignalStrengthWcdma wcdma = ((CellInfoWcdma) info).getCellSignalStrength();
                    final CellIdentityWcdma identityWcdma = ((CellInfoWcdma) info).getCellIdentity();
                    // Signal Strength
                    pDevice.mCell.setDBM(wcdma.getDbm());
                    // Cell Identity
                    pDevice.mCell.setLAC(identityWcdma.getLac());
                    pDevice.mCell.setMCC(identityWcdma.getMcc());
                    pDevice.mCell.setMNC(identityWcdma.getMnc());
                    pDevice.mCell.setCID(identityWcdma.getCid());
                    pDevice.mCell.setPSC(identityWcdma.getPsc());

                } else {
                    Log.i(TAG, mTAG + "Unknown type of cell signal!"
                            + "\n ClassName: " + info.getClass().getSimpleName()
                            + "\n ToString: " + info.toString());
                }
                if (pDevice.mCell.isValid()) {
                    break;
                }
            }
        }
    } catch (NullPointerException npe) {
       Log.e(TAG, mTAG + "loadCellInfo: Unable to obtain cell signal information: ", npe);
    }
}
MethodProxies.java 文件源码 项目:TPlayer 阅读 38 收藏 0 点赞 0 评论 0
private static CellInfo createCellInfo(VCell cell) {
    if (cell.type == 2) { // CDMA
        CellInfoCdma cdma = mirror.android.telephony.CellInfoCdma.ctor.newInstance();
        CellIdentityCdma identityCdma = mirror.android.telephony.CellInfoCdma.mCellIdentityCdma.get(cdma);
        CellSignalStrengthCdma strengthCdma = mirror.android.telephony.CellInfoCdma.mCellSignalStrengthCdma.get(cdma);
        mirror.android.telephony.CellIdentityCdma.mNetworkId.set(identityCdma, cell.networkId);
        mirror.android.telephony.CellIdentityCdma.mSystemId.set(identityCdma, cell.systemId);
        mirror.android.telephony.CellIdentityCdma.mBasestationId.set(identityCdma, cell.baseStationId);
        mirror.android.telephony.CellSignalStrengthCdma.mCdmaDbm.set(strengthCdma, -74);
        mirror.android.telephony.CellSignalStrengthCdma.mCdmaEcio.set(strengthCdma, -91);
        mirror.android.telephony.CellSignalStrengthCdma.mEvdoDbm.set(strengthCdma, -64);
        mirror.android.telephony.CellSignalStrengthCdma.mEvdoSnr.set(strengthCdma, 7);
        return cdma;
    } else { // GSM
        CellInfoGsm gsm = mirror.android.telephony.CellInfoGsm.ctor.newInstance();
        CellIdentityGsm identityGsm = mirror.android.telephony.CellInfoGsm.mCellIdentityGsm.get(gsm);
        CellSignalStrengthGsm strengthGsm = mirror.android.telephony.CellInfoGsm.mCellSignalStrengthGsm.get(gsm);
        mirror.android.telephony.CellIdentityGsm.mMcc.set(identityGsm, cell.mcc);
        mirror.android.telephony.CellIdentityGsm.mMnc.set(identityGsm, cell.mnc);
        mirror.android.telephony.CellIdentityGsm.mLac.set(identityGsm, cell.lac);
        mirror.android.telephony.CellIdentityGsm.mCid.set(identityGsm, cell.cid);
        mirror.android.telephony.CellSignalStrengthGsm.mSignalStrength.set(strengthGsm, 20);
        mirror.android.telephony.CellSignalStrengthGsm.mBitErrorRate.set(strengthGsm, 0);
        return gsm;
    }
}
CellId.java 文件源码 项目:tabulae 阅读 21 收藏 0 点赞 0 评论 0
public static void fill(TheDictionary map, CellIdentityCdma value) throws Exception {
    if (value != null) {
        map.put("type", "1");
        int i;
        i = value.getBasestationId();
        if (i != Integer.MAX_VALUE) map.put("basestation_id", i);
        i = value.getLatitude();
        if (i != Integer.MAX_VALUE) map.put("latitude", i);
        i = value.getLongitude();
        if (i != Integer.MAX_VALUE) map.put("longitude", i);
        i = value.getNetworkId();
        if (i != Integer.MAX_VALUE) map.put("network_id", i);
        i = value.getSystemId();
        if (i != Integer.MAX_VALUE) map.put("system_id", i);
    }
}
CellTowerListCdma.java 文件源码 项目:satstat 阅读 15 收藏 0 点赞 0 评论 0
/**
 * Adds or updates a cell tower.
 * <p>
 * If the cell tower is already in the list, it is replaced; if not, a new
 * entry is created.
 * <p>
 * This method will set the cell's identity data, its signal strength and
 * whether it is the currently serving cell. If the API level is 18 or 
 * higher, it will also set the generation.
 * @return The new or updated entry.
 */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public CellTowerCdma update(CellInfoCdma cell) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) 
        return null;
    CellIdentityCdma cid = cell.getCellIdentity();
    CellTowerCdma result = this.get(cid.getSystemId(), cid.getNetworkId(), cid.getBasestationId());
    if (result == null) {
        result = new CellTowerCdma(cid.getSystemId(), cid.getNetworkId(), cid.getBasestationId());
        this.put(result.getText(), result);
    }
    result.setCellInfo(true);
    result.setDbm(cell.getCellSignalStrength().getDbm());
    result.setServing(cell.isRegistered());
    return result;
}
CellInfoUtil.java 文件源码 项目:proto-collecte 阅读 24 收藏 0 点赞 0 评论 0
private static CommonCellInfo toCellularInfo(CellInfoCdma cellInfo) {

        CommonCellInfo res = new CommonCellInfo();
        CellIdentityCdma identityCdma = cellInfo.getCellIdentity();
        CellSignalStrength signalStrength = cellInfo.getCellSignalStrength();

        return res;
    }
CellIdentityCdmaSubject.java 文件源码 项目:truth-android 阅读 19 收藏 0 点赞 0 评论 0
public static SubjectFactory<CellIdentityCdmaSubject, CellIdentityCdma> type() {
  return new SubjectFactory<CellIdentityCdmaSubject, CellIdentityCdma>() {
    @Override
    public CellIdentityCdmaSubject getSubject(FailureStrategy fs, CellIdentityCdma that) {
      return new CellIdentityCdmaSubject(fs, that);
    }
  };
}
CdmaCellIdentityValidator.java 文件源码 项目:TowerCollector 阅读 22 收藏 0 点赞 0 评论 0
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public boolean isValid(CellIdentityCdma cell) {
    boolean valid = (isBidInRange(cell.getBasestationId()) && isNidInRange(cell.getNetworkId())
            && isSidInRange(cell.getSystemId()));
    if (!valid) {
        Log.w("isValid(): Invalid CellIdentityCdma [sid=%s, nid=%s, bid=%s]", cell.getSystemId(), cell.getNetworkId(), cell.getBasestationId());
        Log.w("isValid(): Invalid CellIdentityCdma %s", cell);
    }
    return valid;
}
DeviceApi18.java 文件源码 项目:Android-IMSI-Catcher-Detector 阅读 16 收藏 0 点赞 0 评论 0
public static void loadCellInfo(TelephonyManager tm, Device pDevice) {
    int lCurrentApiVersion = Build.VERSION.SDK_INT;
    try {
        if (pDevice.cell == null) {
            pDevice.cell = new Cell();
        }
        List<CellInfo> cellInfoList = tm.getAllCellInfo();
        if (cellInfoList != null) {
            for (final CellInfo info : cellInfoList) {

                //Network Type
                pDevice.cell.setNetType(tm.getNetworkType());

                if (info instanceof CellInfoGsm) {
                    final CellSignalStrengthGsm gsm = ((CellInfoGsm) info).getCellSignalStrength();
                    final CellIdentityGsm identityGsm = ((CellInfoGsm) info).getCellIdentity();
                    // Signal Strength
                    pDevice.cell.setDbm(gsm.getDbm()); // [dBm]
                    // Cell Identity
                    pDevice.cell.setCellId(identityGsm.getCid());
                    pDevice.cell.setMobileCountryCode(identityGsm.getMcc());
                    pDevice.cell.setMobileNetworkCode(identityGsm.getMnc());
                    pDevice.cell.setLocationAreaCode(identityGsm.getLac());

                } else if (info instanceof CellInfoCdma) {
                    final CellSignalStrengthCdma cdma = ((CellInfoCdma) info).getCellSignalStrength();
                    final CellIdentityCdma identityCdma = ((CellInfoCdma) info).getCellIdentity();
                    // Signal Strength
                    pDevice.cell.setDbm(cdma.getDbm());
                    // Cell Identity
                    pDevice.cell.setCellId(identityCdma.getBasestationId());
                    pDevice.cell.setMobileNetworkCode(identityCdma.getSystemId());
                    pDevice.cell.setLocationAreaCode(identityCdma.getNetworkId());
                    pDevice.cell.setSid(identityCdma.getSystemId());

                } else if (info instanceof CellInfoLte) {
                    final CellSignalStrengthLte lte = ((CellInfoLte) info).getCellSignalStrength();
                    final CellIdentityLte identityLte = ((CellInfoLte) info).getCellIdentity();
                    // Signal Strength
                    pDevice.cell.setDbm(lte.getDbm());
                    pDevice.cell.setTimingAdvance(lte.getTimingAdvance());
                    // Cell Identity
                    pDevice.cell.setMobileCountryCode(identityLte.getMcc());
                    pDevice.cell.setMobileNetworkCode(identityLte.getMnc());
                    pDevice.cell.setCellId(identityLte.getCi());

                } else if  (lCurrentApiVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2 && info instanceof CellInfoWcdma) {
                    final CellSignalStrengthWcdma wcdma = ((CellInfoWcdma) info).getCellSignalStrength();
                    final CellIdentityWcdma identityWcdma = ((CellInfoWcdma) info).getCellIdentity();
                    // Signal Strength
                    pDevice.cell.setDbm(wcdma.getDbm());
                    // Cell Identity
                    pDevice.cell.setLocationAreaCode(identityWcdma.getLac());
                    pDevice.cell.setMobileCountryCode(identityWcdma.getMcc());
                    pDevice.cell.setMobileNetworkCode(identityWcdma.getMnc());
                    pDevice.cell.setCellId(identityWcdma.getCid());
                    pDevice.cell.setPrimaryScramblingCode(identityWcdma.getPsc());

                } else {
                    log.info("Unknown type of cell signal!"
                            + "\n ClassName: " + info.getClass().getSimpleName()
                            + "\n ToString: " + info.toString());
                }
                if (pDevice.cell.isValid()) {
                    break;
                }
            }
        }
    } catch (NullPointerException npe) {
        log.error("loadCellInfo: Unable to obtain cell signal information: ", npe);
    }
}
WirelessLoggerService.java 文件源码 项目:openbmap 阅读 27 收藏 0 点赞 0 评论 0
/**
 * A valid cdma location must have basestation id, network id and system id set
 * @param cdmaIdentity {@link CellInfoCdma}
 * @return true if valid cdma id
 */
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private boolean isValidCdmaCell(final CellIdentityCdma cdmaIdentity) {
    if (cdmaIdentity == null) {
        return false;
    }
    return ((cdmaIdentity.getBasestationId() != -1) && (cdmaIdentity.getNetworkId() != -1) && (cdmaIdentity.getSystemId() != -1));
}
PlatformNetworksManager.java 文件源码 项目:365browser 阅读 17 收藏 0 点赞 0 评论 0
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private static VisibleCell getVisibleCellPostJellyBeanMr1(
        @Nullable CellInfo cellInfo, long elapsedTime, long currentTime) {
    if (cellInfo == null) {
        return VisibleCell.UNKNOWN_VISIBLE_CELL;
    }
    long cellInfoAge = elapsedTime - TimeUnit.NANOSECONDS.toMillis(cellInfo.getTimeStamp());
    long cellTimestamp = currentTime - cellInfoAge;
    if (cellInfo instanceof CellInfoCdma) {
        CellIdentityCdma cellIdentityCdma = ((CellInfoCdma) cellInfo).getCellIdentity();
        return VisibleCell.builder(VisibleCell.CDMA_RADIO_TYPE)
                .setCellId(cellIdentityCdma.getBasestationId())
                .setLocationAreaCode(cellIdentityCdma.getNetworkId())
                .setMobileNetworkCode(cellIdentityCdma.getSystemId())
                .setTimestamp(cellTimestamp)
                .build();
    }
    if (cellInfo instanceof CellInfoGsm) {
        CellIdentityGsm cellIdentityGsm = ((CellInfoGsm) cellInfo).getCellIdentity();
        return VisibleCell.builder(VisibleCell.GSM_RADIO_TYPE)
                .setCellId(cellIdentityGsm.getCid())
                .setLocationAreaCode(cellIdentityGsm.getLac())
                .setMobileCountryCode(cellIdentityGsm.getMcc())
                .setMobileNetworkCode(cellIdentityGsm.getMnc())
                .setTimestamp(cellTimestamp)
                .build();
    }
    if (cellInfo instanceof CellInfoLte) {
        CellIdentityLte cellIdLte = ((CellInfoLte) cellInfo).getCellIdentity();
        return VisibleCell.builder(VisibleCell.LTE_RADIO_TYPE)
                .setCellId(cellIdLte.getCi())
                .setMobileCountryCode(cellIdLte.getMcc())
                .setMobileNetworkCode(cellIdLte.getMnc())
                .setPhysicalCellId(cellIdLte.getPci())
                .setTrackingAreaCode(cellIdLte.getTac())
                .setTimestamp(cellTimestamp)
                .build();
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2
            && cellInfo instanceof CellInfoWcdma) {
        // CellInfoWcdma is only usable JB MR2 upwards.
        CellIdentityWcdma cellIdentityWcdma = ((CellInfoWcdma) cellInfo).getCellIdentity();
        return VisibleCell.builder(VisibleCell.WCDMA_RADIO_TYPE)
                .setCellId(cellIdentityWcdma.getCid())
                .setLocationAreaCode(cellIdentityWcdma.getLac())
                .setMobileCountryCode(cellIdentityWcdma.getMcc())
                .setMobileNetworkCode(cellIdentityWcdma.getMnc())
                .setPrimaryScramblingCode(cellIdentityWcdma.getPsc())
                .setTimestamp(cellTimestamp)
                .build();
    }
    return VisibleCell.UNKNOWN_VISIBLE_CELL;
}
PhoneStateScanner.java 文件源码 项目:PhoneProfilesPlus 阅读 20 收藏 0 点赞 0 评论 0
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void getAllCellInfo(List<CellInfo> cellInfo) {
    // only for registered cells is returned identify
    // SlimKat in Galaxy Nexus - returns null :-/
    // Honor 7 - returns empty list (not null), Dual SIM?

    if (cellInfo!=null) {

        if (Permissions.checkLocation(context.getApplicationContext())) {

            //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "---- start ----------------------------");

            for (CellInfo _cellInfo : cellInfo) {
                //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "registered="+_cellInfo.isRegistered());

                if (_cellInfo instanceof CellInfoGsm) {
                    //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "gsm info="+_cellInfo);
                    CellIdentityGsm identityGsm = ((CellInfoGsm) _cellInfo).getCellIdentity();
                    if (identityGsm.getCid() != Integer.MAX_VALUE) {
                        //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "gsm mCid="+identityGsm.getCid());
                        if (_cellInfo.isRegistered()) {
                            registeredCell = identityGsm.getCid();
                            lastConnectedTime = Calendar.getInstance().getTimeInMillis();
                        }
                    }
                } else if (_cellInfo instanceof CellInfoLte) {
                    //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "lte info="+_cellInfo);
                    CellIdentityLte identityLte = ((CellInfoLte) _cellInfo).getCellIdentity();
                    if (identityLte.getCi() != Integer.MAX_VALUE) {
                        //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "lte mCi="+identityLte.getCi());
                        if (_cellInfo.isRegistered()) {
                            registeredCell = identityLte.getCi();
                            lastConnectedTime = Calendar.getInstance().getTimeInMillis();
                        }
                    }
                } else if (_cellInfo instanceof CellInfoWcdma) {
                    //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "wcdma info="+_cellInfo);
                    //if (android.os.Build.VERSION.SDK_INT >= 18) {
                        CellIdentityWcdma identityWcdma = ((CellInfoWcdma) _cellInfo).getCellIdentity();
                        if (identityWcdma.getCid() != Integer.MAX_VALUE) {
                            //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "wcdma mCid=" + identityWcdma.getCid());
                            if (_cellInfo.isRegistered()) {
                                registeredCell = identityWcdma.getCid();
                                lastConnectedTime = Calendar.getInstance().getTimeInMillis();
                            }
                        }
                    //}
                    //else {
                    //    PPApplication.logE("PhoneStateScanner.getAllCellInfo", "wcdma mCid=not supported for API level < 18");
                    //}
                } else if (_cellInfo instanceof CellInfoCdma) {
                    //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "cdma info="+_cellInfo);
                    CellIdentityCdma identityCdma = ((CellInfoCdma) _cellInfo).getCellIdentity();
                    if (identityCdma.getBasestationId() != Integer.MAX_VALUE) {
                        //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "wcdma mCid="+identityCdma.getBasestationId());
                        if (_cellInfo.isRegistered()) {
                            registeredCell = identityCdma.getBasestationId();
                            lastConnectedTime = Calendar.getInstance().getTimeInMillis();
                        }
                    }
                }
                //else {
                //    PPApplication.logE("PhoneStateScanner.getAllCellInfo", "unknown info="+_cellInfo);
                //}
            }

            //PPApplication.logE("PhoneStateScanner.getAllCellInfo", "---- end ----------------------------");

            PPApplication.logE("PhoneStateScanner.getAllCellInfo", "registeredCell=" + registeredCell);
        }

    }
    else
        PPApplication.logE("PhoneStateScanner.getAllCellInfo", "cell info is null");
}
WirelessLoggerService.java 文件源码 项目:radiocells-scanner-android 阅读 22 收藏 0 点赞 0 评论 0
/**
 * A valid cdma location must have basestation id, network id and system id set
 *
 * @param cdmaIdentity {@link CellInfoCdma}
 * @return true if valid cdma id
 */
@TargetApi(JELLY_BEAN_MR1)
private boolean isValidCdmaCell(final CellIdentityCdma cdmaIdentity) {
    if (cdmaIdentity == null) {
        return false;
    }
    return ((cdmaIdentity.getBasestationId() != -1) && (cdmaIdentity.getNetworkId() != -1) && (cdmaIdentity.getSystemId() != -1));
}
CellId.java 文件源码 项目:Simplicissimus 阅读 19 收藏 0 点赞 0 评论 0
public static void fill(TheDictionary map, CellIdentityCdma value) throws Exception {
    if (value != null) {
        map.put("type", "1");
        int i;
        i = value.getBasestationId(); if (i != Integer.MAX_VALUE) map.put("basestation_id", i);
        i = value.getLatitude(); if (i != Integer.MAX_VALUE) map.put("latitude", i);
        i = value.getLongitude(); if (i != Integer.MAX_VALUE) map.put("longitude", i);
        i = value.getNetworkId(); if (i != Integer.MAX_VALUE) map.put("network_id", i);
        i = value.getSystemId(); if (i != Integer.MAX_VALUE) map.put("system_id", i);
    }
}
CellId.java 文件源码 项目:pyneo-wirelesslocation 阅读 21 收藏 0 点赞 0 评论 0
public static void fill(TheDictionary map, CellIdentityCdma value) throws Exception {
    if (value != null) {
        map.put("type", "1");
        int i;
        i = value.getBasestationId(); if (i != Integer.MAX_VALUE) map.put("basestation_id", i);
        i = value.getLatitude(); if (i != Integer.MAX_VALUE) map.put("latitude", i);
        i = value.getLongitude(); if (i != Integer.MAX_VALUE) map.put("longitude", i);
        i = value.getNetworkId(); if (i != Integer.MAX_VALUE) map.put("network_id", i);
        i = value.getSystemId(); if (i != Integer.MAX_VALUE) map.put("system_id", i);
    }
}
CellInfoCdmaAssert.java 文件源码 项目:assertj-android 阅读 18 收藏 0 点赞 0 评论 0
public CellInfoCdmaAssert hasCellIdentity(CellIdentityCdma cellIdentity) {
  isNotNull();
  CellIdentityCdma actualCellIdentity = actual.getCellIdentity();
  assertThat(actualCellIdentity) //
      .overridingErrorMessage("Expected cell identity <%s> but was <%s>.", cellIdentity, actualCellIdentity) //
      .isEqualTo(cellIdentity);
  return this;
}
CellInformationWrapper.java 文件源码 项目:open-rmbt 阅读 25 收藏 0 点赞 0 评论 0
public CellIdentity(CellIdentityCdma cellIdentity) {
    this.setLocationId(cellIdentity.getBasestationId());
}
JSONHelper.java 文件源码 项目:localcloud_fe 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Converts CellInfoCdma into JSON
 * @param cellInfo CellInfoCdma
 * @return JSON
 */
public static String cellInfoCDMAJSON(CellInfoCdma cellInfo, boolean returnSignalStrength){

    final Calendar calendar = Calendar.getInstance();
    final JSONObject json = new JSONObject();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && cellInfo != null) {
        try {
            json.put("provider", CELLINFO_PROVIDER);
            json.put("type", CDMA);
            json.put("timestamp", calendar.getTimeInMillis());

            final CellIdentityCdma identityCdma = cellInfo.getCellIdentity();

            json.put("latitude", CdmaCellLocation.convertQuartSecToDecDegrees(identityCdma.getLatitude()));
            json.put("longitude", CdmaCellLocation.convertQuartSecToDecDegrees(identityCdma.getLongitude()));
            json.put("basestationId", identityCdma.getBasestationId());
            json.put("networkId", identityCdma.getNetworkId());
            json.put("systemId", identityCdma.getSystemId());

            if (returnSignalStrength){
                final JSONObject jsonSignalStrength = new JSONObject();
                final CellSignalStrengthCdma cellSignalStrengthCdma = cellInfo.getCellSignalStrength();
                jsonSignalStrength.put("asuLevel", cellSignalStrengthCdma.getAsuLevel());
                jsonSignalStrength.put("cdmaDbm", cellSignalStrengthCdma.getCdmaDbm());
                jsonSignalStrength.put("cdmaEcio", cellSignalStrengthCdma.getCdmaEcio());
                jsonSignalStrength.put("cdmaLevel", cellSignalStrengthCdma.getCdmaLevel());
                jsonSignalStrength.put("dbm", cellSignalStrengthCdma.getDbm());
                jsonSignalStrength.put("evdoDbm", cellSignalStrengthCdma.getEvdoDbm());
                jsonSignalStrength.put("evdoEcio", cellSignalStrengthCdma.getEvdoEcio());
                jsonSignalStrength.put("evdoLevel", cellSignalStrengthCdma.getEvdoLevel());
                jsonSignalStrength.put("evdoSnr", cellSignalStrengthCdma.getEvdoSnr());
                jsonSignalStrength.put("level", cellSignalStrengthCdma.getLevel());

                json.put("cellSignalStrengthCdma", jsonSignalStrength);
            }
        }
        catch(JSONException exc) {
            logJSONException(exc);
        }
    }

    return json.toString();
}
JSONHelper.java 文件源码 项目:localcloud_fe 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Converts CellInfoCdma into JSON
 * @param cellInfo CellInfoCdma
 * @return JSON
 */
public static String cellInfoCDMAJSON(CellInfoCdma cellInfo, boolean returnSignalStrength){

    final Calendar calendar = Calendar.getInstance();
    final JSONObject json = new JSONObject();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && cellInfo != null) {
        try {
            json.put("provider", CELLINFO_PROVIDER);
            json.put("type", CDMA);
            json.put("timestamp", calendar.getTimeInMillis());

            final CellIdentityCdma identityCdma = cellInfo.getCellIdentity();

            json.put("latitude", CdmaCellLocation.convertQuartSecToDecDegrees(identityCdma.getLatitude()));
            json.put("longitude", CdmaCellLocation.convertQuartSecToDecDegrees(identityCdma.getLongitude()));
            json.put("basestationId", identityCdma.getBasestationId());
            json.put("networkId", identityCdma.getNetworkId());
            json.put("systemId", identityCdma.getSystemId());

            if (returnSignalStrength){
                final JSONObject jsonSignalStrength = new JSONObject();
                final CellSignalStrengthCdma cellSignalStrengthCdma = cellInfo.getCellSignalStrength();
                jsonSignalStrength.put("asuLevel", cellSignalStrengthCdma.getAsuLevel());
                jsonSignalStrength.put("cdmaDbm", cellSignalStrengthCdma.getCdmaDbm());
                jsonSignalStrength.put("cdmaEcio", cellSignalStrengthCdma.getCdmaEcio());
                jsonSignalStrength.put("cdmaLevel", cellSignalStrengthCdma.getCdmaLevel());
                jsonSignalStrength.put("dbm", cellSignalStrengthCdma.getDbm());
                jsonSignalStrength.put("evdoDbm", cellSignalStrengthCdma.getEvdoDbm());
                jsonSignalStrength.put("evdoEcio", cellSignalStrengthCdma.getEvdoEcio());
                jsonSignalStrength.put("evdoLevel", cellSignalStrengthCdma.getEvdoLevel());
                jsonSignalStrength.put("evdoSnr", cellSignalStrengthCdma.getEvdoSnr());
                jsonSignalStrength.put("level", cellSignalStrengthCdma.getLevel());

                json.put("cellSignalStrengthCdma", jsonSignalStrength);
            }
        }
        catch(JSONException exc) {
            logJSONException(exc);
        }
    }

    return json.toString();
}
JSONHelper.java 文件源码 项目:localcloud_fe 阅读 30 收藏 0 点赞 0 评论 0
/**
 * Converts CellInfoCdma into JSON
 * @param cellInfo CellInfoCdma
 * @return JSON
 */
public static String cellInfoCDMAJSON(CellInfoCdma cellInfo, boolean returnSignalStrength){

    final Calendar calendar = Calendar.getInstance();
    final JSONObject json = new JSONObject();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && cellInfo != null) {
        try {
            json.put("provider", CELLINFO_PROVIDER);
            json.put("type", CDMA);
            json.put("timestamp", calendar.getTimeInMillis());

            final CellIdentityCdma identityCdma = cellInfo.getCellIdentity();

            json.put("latitude", CdmaCellLocation.convertQuartSecToDecDegrees(identityCdma.getLatitude()));
            json.put("longitude", CdmaCellLocation.convertQuartSecToDecDegrees(identityCdma.getLongitude()));
            json.put("basestationId", identityCdma.getBasestationId());
            json.put("networkId", identityCdma.getNetworkId());
            json.put("systemId", identityCdma.getSystemId());

            if (returnSignalStrength){
                final JSONObject jsonSignalStrength = new JSONObject();
                final CellSignalStrengthCdma cellSignalStrengthCdma = cellInfo.getCellSignalStrength();
                jsonSignalStrength.put("asuLevel", cellSignalStrengthCdma.getAsuLevel());
                jsonSignalStrength.put("cdmaDbm", cellSignalStrengthCdma.getCdmaDbm());
                jsonSignalStrength.put("cdmaEcio", cellSignalStrengthCdma.getCdmaEcio());
                jsonSignalStrength.put("cdmaLevel", cellSignalStrengthCdma.getCdmaLevel());
                jsonSignalStrength.put("dbm", cellSignalStrengthCdma.getDbm());
                jsonSignalStrength.put("evdoDbm", cellSignalStrengthCdma.getEvdoDbm());
                jsonSignalStrength.put("evdoEcio", cellSignalStrengthCdma.getEvdoEcio());
                jsonSignalStrength.put("evdoLevel", cellSignalStrengthCdma.getEvdoLevel());
                jsonSignalStrength.put("evdoSnr", cellSignalStrengthCdma.getEvdoSnr());
                jsonSignalStrength.put("level", cellSignalStrengthCdma.getLevel());

                json.put("cellSignalStrengthCdma", jsonSignalStrength);
            }
        }
        catch(JSONException exc) {
            logJSONException(exc);
        }
    }

    return json.toString();
}
JSONHelper.java 文件源码 项目:cordova-plugin-advanced-geolocation 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Converts CellInfoCdma into JSON
 * @param cellInfo CellInfoCdma
 * @return JSON
 */
public static String cellInfoCDMAJSON(CellInfoCdma cellInfo, boolean returnSignalStrength){

    final Calendar calendar = Calendar.getInstance();
    final JSONObject json = new JSONObject();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && cellInfo != null) {
        try {
            json.put("provider", CELLINFO_PROVIDER);
            json.put("type", CDMA);
            json.put("timestamp", calendar.getTimeInMillis());

            final CellIdentityCdma identityCdma = cellInfo.getCellIdentity();

            json.put("latitude", CdmaCellLocation.convertQuartSecToDecDegrees(identityCdma.getLatitude()));
            json.put("longitude", CdmaCellLocation.convertQuartSecToDecDegrees(identityCdma.getLongitude()));
            json.put("basestationId", identityCdma.getBasestationId());
            json.put("networkId", identityCdma.getNetworkId());
            json.put("systemId", identityCdma.getSystemId());

            if (returnSignalStrength){
                final JSONObject jsonSignalStrength = new JSONObject();
                final CellSignalStrengthCdma cellSignalStrengthCdma = cellInfo.getCellSignalStrength();
                jsonSignalStrength.put("asuLevel", cellSignalStrengthCdma.getAsuLevel());
                jsonSignalStrength.put("cdmaDbm", cellSignalStrengthCdma.getCdmaDbm());
                jsonSignalStrength.put("cdmaEcio", cellSignalStrengthCdma.getCdmaEcio());
                jsonSignalStrength.put("cdmaLevel", cellSignalStrengthCdma.getCdmaLevel());
                jsonSignalStrength.put("dbm", cellSignalStrengthCdma.getDbm());
                jsonSignalStrength.put("evdoDbm", cellSignalStrengthCdma.getEvdoDbm());
                jsonSignalStrength.put("evdoEcio", cellSignalStrengthCdma.getEvdoEcio());
                jsonSignalStrength.put("evdoLevel", cellSignalStrengthCdma.getEvdoLevel());
                jsonSignalStrength.put("evdoSnr", cellSignalStrengthCdma.getEvdoSnr());
                jsonSignalStrength.put("level", cellSignalStrengthCdma.getLevel());

                json.put("cellSignalStrengthCdma", jsonSignalStrength);
            }
        }
        catch(JSONException exc) {
            logJSONException(exc);
        }
    }

    return json.toString();
}
CellIdentityCdmaSubject.java 文件源码 项目:truth-android 阅读 16 收藏 0 点赞 0 评论 0
private CellIdentityCdmaSubject(FailureStrategy failureStrategy, CellIdentityCdma subject) {
  super(failureStrategy, subject);
}
CellInfoCdmaSubject.java 文件源码 项目:truth-android 阅读 20 收藏 0 点赞 0 评论 0
public CellInfoCdmaSubject hasCellIdentity(CellIdentityCdma cellIdentity) {
  assertThat(actual().getCellIdentity())
      .named("cell identity")
      .isEqualTo(cellIdentity);
  return this;
}
CellIdentityCdmaAssert.java 文件源码 项目:assertj-android 阅读 19 收藏 0 点赞 0 评论 0
public CellIdentityCdmaAssert(CellIdentityCdma actual) {
  super(actual, CellIdentityCdmaAssert.class);
}


问题


面经


文章

微信
公众号

扫码关注公众号