barbeau / gpstest

The #1 open-source Android GNSS/GPS test program
Apache License 2.0
1.78k stars 364 forks source link

Include ismock data in the logs #589

Closed tarquinwj closed 2 years ago

tarquinwj commented 2 years ago

I use a device that outputs mocked location data (Trimble Catalyst). When gathering data in a GPSTest log, if the Trimble Catalyst switches off for some reason (cable disconnects, battery runs out, etc.), the device stops using the mocked location, and after a short pause, GPSTest starts using the phone's own GNSS chip data. This is not something I want. I need to make it only use the mocked location data, since that is the highly accurate location data from the Catalyst, while the phone's GNSS chip is located somewhere else, and is relatively poor anyway. Exposing the isMock() result would be an easy way to detect this: https://developer.android.com/reference/android/location/Location#isMock() Right now, the only way to detect it is to look for the SpeedAccuracyMps and BearingAccuracyDegrees data, which is empty in the case of a mocked location, or checking for the relatively imprecise "3.0" estimate of accuracy that comes from the phone's GNSS chip, compared with the Catalyst's "2.5459259".

Describe the solution you'd like Include another column; "mock", in the gnss_log, which says whether the data came from mock or not. It could have the string values "true" or "false". There was another app that did this, using "mock" (lower case), and the values appeared to be those two strings (true/false). Unfortunately, we cannot remember what app that was.

Describe alternatives you've considered Another approach might be to have an option forcing GPSTest to only use the native chip, only use mocked location, or "auto" to use both (the current behaviour).

GPSTest 3.9.16 (18093-google). Samsung Galaxy S20+. Android 12. Trimble Catalyst 1.

barbeau commented 2 years ago

This makes sense - I'll add it as a 0 for false and 1 for true value at the end of the Fix string. Header value will be named IsMockLocation.

Note that this field will be empty on devices below Android S (12) because isMock was added in Android 12.