问题
I'm trying to determine the CGI (the Cell Global Identifier) the UE is connected to.
From the 3GPP specs, it's defined as follows:
- 3G: CGI = PLMN-ID + LA code + CID
- 4G: ECGI = PLMN-ID + ECI
I can already get the LAC (location area code) and CID (Cell ID) from the system. And I can generate the PLMN-ID from the MCC (Mobile Country Code) and MNC (Mobile Network Code).
My question is can I also get the CGI from the system?
回答1:
The CGI (2G and 3G) and eCGI (ofr 4G) is always a 15 decimal digit code
For 2G 3G and 4g networks the five first digits are the MCC (Mobile Country Code) and the MNC (Mobile Network Code)
For 2G and 3G networs the next 5 digits are the LAC (Location Area Code) and the last five the Cell ID within the LAC
For 4G networs the 10 digits are then eNB and split in a 7 digits code plus a 3 digits code for the Cell ID.
The point is that some systems or applications works with de whole CGI or eCGI and other systems works with the spparate blocks: (MCC-MNC-LAC-CID or MCC-MCC-eNB)
Translating from a 15 digit code to the blocks requiere knowing the cell technology in order to know if you have to split the las 10 digits in two 5 digits blocks or in a 7 and 3 digits blocks.
In the other hand, if you want to "translate" the blocks into a 15 digits code, you have to pad then blocks to reach the 15 digits length, so if you have 213-01-123-5 it can be 213010012300005 (2G or 3G) or 21301000012305
Google API ofr geolocation has a non-mandatory field for technology, but I think that it should be mandatory.
I'm afraid that it is really going to be a problem.
来源:https://stackoverflow.com/questions/20981074/ecgi-and-cgi-for-lte-and-gsm-networks