lordgreg / Sfen

13 stars 4 forks source link

Identifications of cells #30

Open gerhardol opened 10 years ago

gerhardol commented 10 years ago

For me, psc is always -1. I have mostly 3G around I believe, but psc does not seem to be available. Samsung Galaxy S2 with CM11 psc is for sure always -1 in 2g/GSM I believe that psc should not be included for identifying with GsmCellLocation. For sure not when -1, as that should trigger the isError() psc is scrambling code, not sure if that is applicable to identify sectors for instance.

On the other hand, I believe Lac should be included for CellIdentityGsm/Wcdma too, in addition to Mnc/Mcc/Cid. LTE probably ok with Mnc/Mcc/Ci.

Open as an issue rather than a patch, as you likely have done more research than me, but maybe not see the psc=-1 issue

gerhardol commented 10 years ago

Related - a separate issue or pull request:

lordgreg commented 10 years ago

I've tested switching cells yesterday in a way that I used Airplane mode, then turned Airplane mode off. When doing that, getCid() always returned -1 at first! However, switching network mode in system settings, WCDMA<>GSM<>WCDMA pref<>LTE pre never gave -1.

-1 always returns "unknown" from calls like getCid, getLac and getPsc

I will do few recordings today when driving home and to work tomorrow with different cell type modes. Will report back on what do I get. :+1:

Concerning other issues- will fix those, I'm also bothered when opening "pick cellid" dialog and it shows me current cellid but with old stored date. And sorry about sorting history dialog- its an obvious bug, since picking them up in condition shows them okay.

gerhardol commented 10 years ago

It seems like Psc is set in some phones. Maybe it is the HW. But at least my SGS2 w CM11 always have -1.That should be sufficient to not use Psc... For cdma GPS position could be used... I do not know why I get CellLocation rather than CellInfo too. There should be a way to get the antenna sectors too, is it hidden in the lac/cid.

gerhardol commented 10 years ago

I suggest the following changes:

This will invalidate the saved cell id lists, so it should be done before released on Google Play. Submitting a pull request too.

gerhardol commented 10 years ago

Note: The comments about sorting etc is implemented already.

gerhardol commented 10 years ago

Pull request implemented, I have only used "GsmCellLocation", not "CellInfo", so I will not close it myself...

lordgreg commented 10 years ago

Checking it tomorrow over highway (constantly switching 2g, 3g, lte).

Current LTE cell id shows: 293:41.3.212600:31 :smile_cat:

gerhardol commented 10 years ago

Plan to submit a new patch:

Incompatible changes (ie cells have to be added again) should be carefully considered first (but at least CDMA should be done).

mvglasow commented 7 years ago

It seems like Psc is set in some phones. Maybe it is the HW. But at least my SGS2 w CM11 always have -1.

Yes, Samsung phones (at least of that generation) are known not to report the PSC, or any neighboring cells. This is a limitation of the firmware.

A list of the limitations of a few devices can be found at https://docs.cellmapper.net/mw/index.php/Tested_Phones

I believe that psc should not be included for identifying with GsmCellLocation.

+1, the MCC/MNC/LAC/CID tuple are unique (at least within the same network type—not sure if collisions between, say, a 2G cell and a 3G cell are possible). PSC is a local identifier—no two neighboring cells can have the same PSC, and no cell can have two neighbors with the same PSC. Some have suggested that carriers occasionally change the PSCs for a cell (while keeping the CID), but I have no reliable information on that.

I do not know why I get CellLocation rather than CellInfo too.

Again, limitation of the phone firmware. There are three different API calls, and not all phones implement all of them.

There should be a way to get the antenna sectors too, is it hidden in the lac/cid.

Some carriers indeed encode antenna sectors in the CID (the LAC is an area code, thus different antenna sectors of the same tower would normally share the same LAC). However, this is purely by convention and entirely at the whim of the carrier—schemes vary from carrier to carrier, and are subject to change without notice.