java类android.telephony.cdma.CdmaCellLocation的实例源码

PhoneStateHelper.java 文件源码 项目:SignalAnalysis 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Set network info related to the connected cell: MCC, MNC, LAC, CellId
 */
public void setNetworkInfo() {
    if (DBG)
        Log.d(Config.TAG, TAG + "setNetworkInfo called");
    String temp = mTelMgr.getNetworkOperator();
    if ((temp != null) && (temp.length() >= 5)) {
        mMcc = temp.substring(0, 3);
        mMnc = temp.substring(3);
    }
    CellLocation oCell = mTelMgr.getCellLocation();
    if (oCell instanceof GsmCellLocation) {
        mLac = String.valueOf(((GsmCellLocation) oCell).getLac());
        mCellId = String.valueOf(((GsmCellLocation) oCell).getCid());
        mPsc = String.valueOf(((GsmCellLocation) oCell).getPsc());
    }
    if (oCell instanceof CdmaCellLocation) {
        String t = null;
        // (CdmaCellLocation) oCell

        t = "Base station id : "
                + ((CdmaCellLocation) oCell).getBaseStationId()
                + "base station latitude "
                + ((CdmaCellLocation) oCell).getBaseStationLatitude()
                + " base station longitude"
                + ((CdmaCellLocation) oCell).getBaseStationLongitude()
                + " network id" + ((CdmaCellLocation) oCell).getNetworkId()
                + " system id " + ((CdmaCellLocation) oCell).getSystemId();

        Log.d(Config.TAG, TAG + t);
    }

}
CellIdPre17API.java 文件源码 项目:Simplicissimus 阅读 22 收藏 0 点赞 0 评论 0
@Override
public TheDictionary next() {
    if (DEBUG) Log.d(TAG, "next:");
    TheDictionary map = new TheDictionary();
    try {
        if (i < 0) {
            if (cellLocation instanceof GsmCellLocation) {
                fill(map, ((GsmCellLocation)cellLocation));
            }
            else if (cellLocation instanceof CdmaCellLocation) {
                fill(map, ((CdmaCellLocation)cellLocation));
            }
            else {
                map.put("class", cellLocation.getClass().getName());
                map.put("string", cellLocation.toString());
            }
        }
        else {
            fill(map, neighboringCellInfoList.get(i));
        }
    }
    catch (Exception e) {
        throw new RuntimeException(e);
    }
    i++;
    if (DEBUG) Log.d(TAG, "next: map=" + map);
    return map;
}
CellIdPre17API.java 文件源码 项目:Simplicissimus 阅读 26 收藏 0 点赞 0 评论 0
public void fill(TheDictionary map, CdmaCellLocation value) throws Exception {
    if (value != null) {
        map.put("mcc", mcc);
        map.put("mnc", mnc);
        map.put("base_station_id", value.getBaseStationId());
        map.put("latitude", value.getBaseStationLatitude() / 14400.0);
        map.put("longitude", value.getBaseStationLongitude() / 14400.0);
        map.put("network_id", value.getNetworkId());
        map.put("systen_id", value.getSystemId());
        map.put("registered", true);
        determine_type(map);
    }
}
CellTowersData.java 文件源码 项目:skandroid-core 阅读 24 收藏 0 点赞 0 评论 0
@SuppressLint("NewApi")
private void addCellData(List<String> list) {
    DCSStringBuilder builder = new DCSStringBuilder();

    if (cellLocation == null) {
        // No location information currently available!
    } else if (cellLocation instanceof GsmCellLocation) {
        GsmCellLocation gsmLocation = (GsmCellLocation) cellLocation;
        builder.append(ID + GSM + VERSION);
        builder.append(time/1000);
        builder.append(GSM);
        builder.append(gsmLocation.getCid());
        builder.append(gsmLocation.getLac());
        builder.append(Build.VERSION.SDK_INT >= 9 ? gsmLocation.getPsc() : -1 );

    } else if (cellLocation instanceof CdmaCellLocation) {
        CdmaCellLocation cdmaLocation = (CdmaCellLocation) cellLocation;
        builder.append(ID + CDMA);
        builder.append(time/1000);
        builder.append(CDMA);
        builder.append(cdmaLocation.getBaseStationId());
        builder.append(cdmaLocation.getBaseStationLatitude());
        builder.append(cdmaLocation.getBaseStationLongitude());
        builder.append(cdmaLocation.getNetworkId());
        builder.append(cdmaLocation.getSystemId());
    }

    if (signal == null) {
        // No signal information currently available!
    } else if (signal.isGsm()) {
        builder.append(SKGsmSignalStrength.getGsmSignalStrength(signal));
        builder.append(signal.getGsmBitErrorRate());
    } else {
        builder.append(signal.getCdmaDbm());
        builder.append(signal.getCdmaEcio());
    }
    list.add(builder.build());
}
CellTowersData.java 文件源码 项目:skandroid-core 阅读 23 收藏 0 点赞 0 评论 0
@Override
public List<JSONObject> getPassiveMetric() {
    List<JSONObject> ret = new ArrayList<>();

    if (cellLocation == null) {
        // No location information currently available!
    } else if(cellLocation instanceof GsmCellLocation){
        ret.add(PassiveMetric.create(PassiveMetric.METRIC_TYPE.GSMLAC,time,((GsmCellLocation) cellLocation).getLac()+""));
        ret.add(PassiveMetric.create(PassiveMetric.METRIC_TYPE.GSMCID,time,((GsmCellLocation) cellLocation).getCid()+""));
    }else if(cellLocation instanceof CdmaCellLocation){
        CdmaCellLocation cdmaLocation = (CdmaCellLocation) cellLocation;
        ret.add(PassiveMetric.create(PassiveMetric.METRIC_TYPE.CDMABSID, time, cdmaLocation.getBaseStationId()+""));
        if (cdmaLocation.getBaseStationLatitude() != Integer.MAX_VALUE) {
            ret.add(PassiveMetric.create(PassiveMetric.METRIC_TYPE.CDMABSLAT, time,cdmaLocation.getBaseStationLatitude()+""));
        } 
        if (cdmaLocation.getBaseStationLongitude() != Integer.MAX_VALUE) {
            ret.add(PassiveMetric.create(PassiveMetric.METRIC_TYPE.CDMABSLNG, time, cdmaLocation.getBaseStationLongitude()+""));
        }
        ret.add(PassiveMetric.create(PassiveMetric.METRIC_TYPE.CDMANETWORKID,time,cdmaLocation.getNetworkId()+""));
        ret.add(PassiveMetric.create(PassiveMetric.METRIC_TYPE.CDMASYSTEMID,time, cdmaLocation.getSystemId()+""));
    }

    if (signal == null) {
        // No signal information currently available!
    } else if (signal.isGsm()) {
        ret.add(PassiveMetric.create(PassiveMetric.METRIC_TYPE.GSMSIGNALSTRENGTH,time, DCSConvertorUtil.convertGsmSignalStrength(SKGsmSignalStrength.getGsmSignalStrength(signal))));
    //  ret.add(PassiveMetric.create(PassiveMetric.METRIC_TYPE.GSMBER, time, DCSConvertorUtil.convertGsmBitErroRate(signal.getGsmBitErrorRate())));
    } else {
        ret.add(PassiveMetric.create(PassiveMetric.METRIC_TYPE.CDMADBM,time, signal.getCdmaDbm()+""));
        ret.add(PassiveMetric.create(PassiveMetric.METRIC_TYPE.CDMAECIO,time, signal.getCdmaEcio()+""));
    }
    return ret;
}
CellInput.java 文件源码 项目:MoST 阅读 22 收藏 0 点赞 0 评论 0
@Override
public void workToDo() {
    CellLocation cellLocation = _telephonyManager.getCellLocation();
    DataBundle b = _bundlePool.borrowBundle();
    if (cellLocation instanceof GsmCellLocation) {
        GsmCellLocation gsmLocation = (GsmCellLocation) cellLocation;
        b.putInt(KEY_GSM_CELL_ID, gsmLocation.getCid());
        b.putInt(KEY_GSM_LAC, gsmLocation.getLac());
        // gsmLocation.getPsc() require api 9
        // b.putInt(KEY_GSM_PSC, gsmLocation.getPsc());
        b.putInt(KEY_PHONE_TYPE, TelephonyManager.PHONE_TYPE_GSM);
    } else if (cellLocation instanceof CdmaCellLocation) {
        CdmaCellLocation cdmaLocation = (CdmaCellLocation) cellLocation;
        b.putInt(KEY_BASE_STATION_ID, cdmaLocation.getBaseStationId());
        b.putInt(KEY_BASE_STATION_LATITUDE, cdmaLocation.getBaseStationLatitude());
        b.putInt(KEY_BASE_STATION_LONGITUDE, cdmaLocation.getBaseStationLongitude());
        b.putInt(KEY_BASE_NETWORK_ID, cdmaLocation.getNetworkId());
        b.putInt(KEY_BASE_SYSTEM_ID, cdmaLocation.getSystemId());
        b.putInt(KEY_PHONE_TYPE, TelephonyManager.PHONE_TYPE_CDMA);
    } else {
        b.putInt(KEY_PHONE_TYPE, TelephonyManager.PHONE_TYPE_NONE);
    }

    b.putLong(Input.KEY_TIMESTAMP, System.currentTimeMillis());
    b.putInt(Input.KEY_TYPE, Input.Type.CELL.toInt());
    post(b);
    scheduleNextStart();
}
CellIdPre17API.java 文件源码 项目:pyneo-wirelesslocation 阅读 23 收藏 0 点赞 0 评论 0
@Override
public TheDictionary next() {
    if (DEBUG) Log.d(TAG, "next:");
    TheDictionary map = new TheDictionary();
    try {
        if (i < 0) {
            if (cellLocation instanceof GsmCellLocation) {
                fill(map, ((GsmCellLocation)cellLocation));
            }
            else if (cellLocation instanceof CdmaCellLocation) {
                fill(map, ((CdmaCellLocation)cellLocation));
            }
            else {
                map.put("class", cellLocation.getClass().getName());
                map.put("string", cellLocation.toString());
            }
        }
        else {
            fill(map, neighboringCellInfoList.get(i));
        }
    }
    catch (Exception e) {
        throw new RuntimeException(e);
    }
    i++;
    if (DEBUG) Log.d(TAG, "next: map=" + map);
    return map;
}
CellIdPre17API.java 文件源码 项目:pyneo-wirelesslocation 阅读 24 收藏 0 点赞 0 评论 0
public void fill(TheDictionary map, CdmaCellLocation value) throws Exception {
    if (value != null) {
        map.put("mcc", mcc);
        map.put("mnc", mnc);
        map.put("base_station_id", value.getBaseStationId());
        map.put("latitude", value.getBaseStationLatitude() / 14400.0);
        map.put("longitude", value.getBaseStationLongitude() / 14400.0);
        map.put("network_id", value.getNetworkId());
        map.put("systen_id", value.getSystemId());
        map.put("registered", true);
        determine_type(map);
    }
}
NetworkInfoActivity.java 文件源码 项目:femtocatcher 阅读 23 收藏 0 点赞 0 评论 0
public void getCellNetworkInfo() {

    if(mTelephonyManager != null) {
        text1 = "";
        Log.v(TAG, "getting cell network info");
        int phoneType = mTelephonyManager.getPhoneType();

        /* Check whether you are connected to a CDMA network */
        if(TelephonyManager.PHONE_TYPE_CDMA == phoneType) {
            text1 = text1 + "Cell on CDMA Phone network";
        }
        else {
            text1 = text1 + "Cell is not on CDMA Phone network";
            tv1.setText(text1);
            return;
        }

        /* Get the network type and name*/
        if(mTelephonyManager!=null) {
            int networkType = mTelephonyManager.getNetworkType();
            text1 = text1 + "\nNetwork Type = " + MainActivity.getNetworkTypeName(networkType);

            /* get network operator name */
            String operatorName = mTelephonyManager.getNetworkOperatorName();
            text1 = text1 +"\nNetwork Operator Name: "+operatorName;

            /* get CDMA cell location information */
            CdmaCellLocation c = (CdmaCellLocation) mTelephonyManager.getCellLocation();
            if(c!=null) {
                text1 = text1 + "\nBaseStation ID: "+c.getBaseStationId();
                text1 = text1 + "\nNetwork ID: "+c.getNetworkId();
                text1 = text1 + "\nSystem ID: "+c.getSystemId();                
                text1 = text1 + "\nLatitude: "+c.getBaseStationLatitude();
                text1 = text1 + "\nLongitude: "+c.getBaseStationLongitude();

                tv1.setText(text1);
            }
        }
    }
}
CellTowersData.java 文件源码 项目:mobile-mba-androidapp 阅读 22 收藏 0 点赞 0 评论 0
private void addCellData(List<String> list) {
    DCSStringBuilder builder = new DCSStringBuilder();

    if (cellLocation instanceof GsmCellLocation) {
        GsmCellLocation gsmLocation = (GsmCellLocation) cellLocation;
        builder.append(ID + GSM + VERSION);
        builder.append(time/1000);
        builder.append(GSM);
        builder.append(gsmLocation.getCid());
        builder.append(gsmLocation.getLac());
        builder.append(Build.VERSION.SDK_INT >= 9 ? gsmLocation.getPsc() : -1 );

    } else if (cellLocation instanceof CdmaCellLocation) {
        CdmaCellLocation cdmaLocation = (CdmaCellLocation) cellLocation;
        builder.append(ID + CDMA);
        builder.append(time/1000);
        builder.append(CDMA);
        builder.append(cdmaLocation.getBaseStationId());
        builder.append(cdmaLocation.getBaseStationLatitude());
        builder.append(cdmaLocation.getBaseStationLongitude());
        builder.append(cdmaLocation.getNetworkId());
        builder.append(cdmaLocation.getSystemId());
    }

    if (signal.isGsm()) {
        builder.append(signal.getGsmSignalStrength());
        builder.append(signal.getGsmBitErrorRate());
    } else {
        builder.append(signal.getCdmaDbm());
        builder.append(signal.getCdmaEcio());
    }
    list.add(builder.build());
}


问题


面经


文章

微信
公众号

扫码关注公众号