B4A Library GNSS library - an updated GPS library

Discussion in 'Additional libraries, classes and official updates' started by agraham, Aug 29, 2019.

  1. agraham

    agraham Expert Licensed User

    The GNSSS library is an updated GPS library that allows you to get information about visible satellites from the phone's GNSSS device using an enhancement introduced in Android API version 24.

    The GNSS receivers in devices will vary in which constellations that they will recognize depending on when they were designed. Devices from 2019 and later will probably recognise all four of the GPS, GALILEO, GLONASS and BEIDOU constellations. Android devices, if capable, will report location information using all available constellations. However only limited satellite information is available in the original GpsStatus event.

    To access additional data on the satellites a new GnssStatus event is available in Android API 24 and later. This library exposes that event. The library can be used without problem on earlier devices but on these the GnssStatus event will never be raised. The GnssStatus event passes a single GnssStatus object as its only parameter which contains information for the visible satellites of all the constellations available.

    This library is a strict superset of the original GPS library and can be used as a drop-in replacement for the GPS library merely by deselecting the GPS library, selecting the GNSS library and changing the GPS type to GNSS in the code.

    In fact, as I found when I was playing with this library on my latest device, which can see four GNSS constellations, the new GnssStatus data is not really necessary to identify the constellation to which a satellite belongs (which was the original reason for me to implement the GnssStatus event) and so is only useful if you need the other additional information it provides.

    It seems that the GPSSatellite list returned by the GpsStatus event in the existing GPS library contains every satellite visible to the device with the Prn adjusted to avoid duplication by adding a constant value depending upon which constellation the satellite belongs to. I found this by inspection and have not seen this documented anywhere.

    The base values for each constellation are as returned by GnssStatus.Svid(). GPS PRNs are unadjusted and are in the range 1 to 32. Glonass FCNs/OSNs have 64 added and are in the range 65 to 88 or possibly 157 to 172. Beidou PRNs have 200 added and are in the range 201 to 237. Galileo PRNs have 300 added and are in the range 301 to 326. The included demo illustrates this.
     

    Attached Files:

  2. MarcoRome

    MarcoRome Expert Licensed User

    Great Work.
     
  3. f0raster0

    f0raster0 Active Member Licensed User

    super!!
     
  4. lkching7

    lkching7 Member Licensed User

    Great Bro. Thank
     
  5. emexes

    emexes Well-Known Member Licensed User

    I saw this information a couple of months back, but not sure where. I recall that I was investigating augmentation / local offsets, so it might even have been in GPS World journal or similar. Or perhaps in the datasheet for a GNSS module. Naturally, now I can't find it - but I'm sure I will soon, milliseconds after I click "Post Reply"... :)
     
  6. emexes

    emexes Well-Known Member Licensed User

    Yikes! You're right about the sparsity of documentation, and I suspect the reason for it might be touched upon in this forum posting:

    It is unfortunate that more information is not available about NMEA satellite identification. The NMEA organization only provides this information as a for-sale publication, and, even if those publications are purchased, the buyer is forbidden to disclose the information they contain. It is only through third-party disclosures, such as the programming guide for devices that utilize NMEA protocols, that any knowledge is provided about the details.

    Page 7 of this document has a comprehensive table of GNSS satellite numbering systems. I bought a couple of U-Blox USB dongles last year, they work with both GPS and GLONASS, but turns out that it's one-or-the-other, not both at the same time. Boy, was I sad about that. I had the inverse problem with my iPhone 4S - I've always been impressed by how well the GPS works in that (esp. given the antennagate kerfuffle) and it was six years later that I first found out that the hardware supports GLONASS too (not sure if it uses it, but... is sure feels like it does ;-)
     
  7. agraham

    agraham Expert Licensed User

    Yes, I've just bought a U-Blox USB device to play with and encountered that problem :(

    Gnss device support for NMEA sentences supporting Beidou and Galileo seems a mess with various manufacturers doing it differently. I've found that NMEA sentences are also inconsistent across Android devices but the LocationManager API does seems solid and consistent. For NMEA, whatever the dongle or device, at least you seem to be able to rely on getting a GPRMC or a GNRMC sentence, sometimes both!, for the actual fix.
     
  8. agraham

    agraham Expert Licensed User

    As a matter of information some people might be interested in this. I've been looking at using my Android devices as Bluetooth GNSS devices to feed NMEA sentences to a Window laptop or tablet running my mapping program. This would be useful as my latest devices seem to have very sensitive receivers and decent Bluetooth stand-alone receivers supporting Beidou and Galileo are rather expensive. I was going to write my own but before doing that I looked at what was available in the Play Store. As might be expected what I could find was mainly crappily written rubbish - that about sums up my usual experience with apps from the Play Store: mostly ad-ridden rubbish.

    However I did find this which seems to be the best of a bad bunch

    https://play.google.com/store/apps/details?id=com.meowsbox.btgps&hl=en_US

    Unlike other attempts this does seem to connect consistently to my PC with my several Android devices, though you have to know what you are doing at the Windows end to enable SPP on the connected device. Also you need to be in their beta program to get something that more or less works on Android 8+. I am in conversation with them about a couple of problems I have found but in the mean time it does provide a fix and satellite information although which constellation a satellite belongs to is not presently correctly implemented.
     
    emexes likes this.
  9. marcick

    marcick Well-Known Member Licensed User

    @ I bought a couple of U-Blox USB dongles last year, they work with both GPS and GLONASS, but turns out that it's one-or-the-other, not both at the same time

    I've never played with uBlox USB dongle and I don't know your which uBlox module has inside, but wich constelation the module works with (GPS, Glonass or both) is a configurable parameter.
     
  10. emexes

    emexes Well-Known Member Licensed User

    +1
     
  11. mcombatti

    mcombatti New Member Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice