移动基站问题
1.獲取附近基站的信息:
package myapplication.com.myapp.activity;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.telephony.CellInfo;
import android.telephony.CellInfoCdma;
import android.telephony.CellInfoGsm;
import android.telephony.CellInfoLte;
import android.telephony.TelephonyManager;
import android.telephony.gsm.GsmCellLocation;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.List;
import myapplication.com.myapp.R;
import myapplication.com.myapp.adapter.MyAdapter;
import myapplication.com.myapp.entity.jizhanBean;
public class JizhanFujin_Activity extends AppCompatActivity {
TelephonyManager telephonyManager;
List<jizhanBean> datas;
ListView listView;
ImageView image_back;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_jizhan_fujin);
initview();
List<CellInfo> cellInfoList = telephonyManager.getAllCellInfo();
if(cellInfoList.size()>0){
for (CellInfo cellInfo : cellInfoList) {
// 這里輸出附近基站信息<1>
System.out.println("*****@ALL"+cellInfo.toString());
}
// 判斷GSM基站信息
if(cellInfo instanceof CellInfoGsm){
}
}
}
}
}
public void initview(){
datas=new ArrayList<>();
listView= (ListView) findViewById(R.id.listview);
telephonyManager = (TelephonyManager) JizhanFujin_Activity.this.getSystemService(Context.TELEPHONY_SERVICE);
image_back= (ImageView) findViewById(R.id.image_back);
image_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
/**
*
* */
// String operator = telephonyManager.getNetworkOperator();
// /**通過operator獲取 MCC 和MNC */
// int mcc = Integer.parseInt(operator.substring(0, 3));
// int mnc = Integer.parseInt(operator.substring(3));
// GsmCellLocation location = (GsmCellLocation) telephonyManager.getCellLocation();
//
//
// /**通過GsmCellLocation獲取中國移動和聯通 LAC 和cellID */
// int lac = location.getLac();
// int cellid = location.getCid();
// // 開始*************
// StringBuilder str = new StringBuilder();
/*
*
*
*
* **/
}
2.
<1>輸出附近所有信息為:
這里有個mRegistered=YES 表示當前服務基站?
<2>
LTE物理小區標識(PCI): 0-503
GSM Cell ID (CI): 0-65535
PCI: 物理小區標識,用來區分來自不同LTE小區的信號,類似UMTS中的PCS。
CI: 小區標識,網絡中小區的編號,與MCC,MNC及LAC號組合得到小區全球識別碼,用來在全球范圍內唯一識別某一小區。
MCC:移動國家號碼,由3位數字組成,唯一地識別移動用戶所屬的國家。我國為460。
MNC:移動網號,由兩位數字組成,用于識別移動用戶所歸屬的移動網。在移動為00,聯通為01
<2>
TAC LTE的追蹤區
LAC GSM的位置區
一般LTE的TAC配置的就是區域內GSM的LAC,如果配置不一致會導致呼叫失敗無法接通
<MCC,MNC為固定值那么這里LAC用于區分標示基站唯一標示的話,見下面的輸出信息:只有當mRegistered=YES時才能得到TAC,那樣怎么得到附近所有基站標示?>
PCI:504個PCI分成168組,每組包含連續的3個PCI, 同eNodeB的三個小區的PCI要求來自同一組,全網復用。
CI: 沒有特殊限制條件,可在0-65535中任意取值,但在同一個LAC下不能重復。
<!--而 if(cellInfo instanceof CellInfoCdma)代碼這里,能找到cellinfoLTE,CDMA,GSM,卻找不到移動的TD-SCDMA?-->
CellInfoLte:{mRegistered=YES mTimeStampType=oem_ril mTimeStamp=1267052294487436ns CellIdentityLte:{ mMcc=460 mMnc=0 mCi=219105291 mPci=133 mTac=20951}CellSignalStrengthLte: ss=23 rsrp=-93 rsrq=-6 rssnr=2147483647 cqi=2147483647 ta=2147483647}
CellInfoLte:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052294487436ns CellIdentityLte:{ mMcc=2147483647 mMnc=2147483647 mCi=2147483647 mPci=127 mTac=2147483647}CellSignalStrengthLte: ss=12 rsrp=-104 rsrq=-4 rssnr=2147483647 cqi=2147483647 ta=2147483647}
CellInfoLte:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052294487436ns CellIdentityLte:{ mMcc=2147483647 mMnc=2147483647 mCi=2147483647 mPci=44 mTac=2147483647} CellSignalStrengthLte: ss=12 rsrp=-126 rsrq=-20 rssnr=2147483647 cqi=2147483647 ta=2147483647}
CellInfoLte:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052294487436ns CellIdentityLte:{ mMcc=2147483647 mMnc=2147483647 mCi=2147483647 mPci=241 mTac=2147483647} CellSignalStrengthLte: ss=18 rsrp=-92 rsrq=-5 rssnr=2147483647 cqi=2147483647 ta=2147483647}
CellInfoLte:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052294487436ns CellIdentityLte:{ mMcc=2147483647 mMnc=2147483647 mCi=2147483647 mPci=0 mTac=2147483647} CellSignalStrengthLte: ss=31 rsrp=0 rsrq=0 rssnr=2147483647 cqi=2147483647 ta=2147483647}
CellInfoGsm:{mRegistered=YES mTimeStampType=oem_ril mTimeStamp=1267052311836811ns CellIdentityGsm:{ mMcc=460 mMnc=0 mLac=20951 mCid=38417} CellSignalStrengthGsm: ss=13 ber=99}
CellInfoGsm:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052311836811ns CellIdentityGsm:{ mMcc=460 mMnc=0 mLac=20951 mCid=38411} CellSignalStrengthGsm: ss=16 ber=99}
CellInfoGsm:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052311836811ns CellIdentityGsm:{ mMcc=460 mMnc=0 mLac=20951 mCid=38413} CellSignalStrengthGsm: ss=18 ber=99}
CellInfoGsm:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052311836811ns CellIdentityGsm:{ mMcc=460 mMnc=0 mLac=20951 mCid=46942} CellSignalStrengthGsm: ss=13 ber=99}
CellInfoGsm:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052311836811ns CellIdentityGsm:{ mMcc=460 mMnc=0 mLac=20951 mCid=3115} CellSignalStrengthGsm: ss=16 ber=99}
CellInfoGsm:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052311836811ns CellIdentityGsm:{ mMcc=0 mMnc=0 mLac=0 mCid=-1} CellSignalStrengthGsm: ss=12 ber=99}
CellInfoGsm:{mRegistered=NO mTimeStampType=oem_ril mTimeStamp=1267052311836811ns CellIdentityGsm:{ mMcc=460 mMnc=0 mLac=20951 mCid=11562} CellSignalStrengthGsm: ss=11 ber=99}
3.是不是有其他什么方法實現?能夠得到附近基站的標識?
今天多一點積累,明天少一分煩惱
總結
- 上一篇: 802.11(wi-fi)的PHY层(编
- 下一篇: 华为aicamera是什么型号(华为技术