Code Monkey home page Code Monkey logo

android_hal_gpsbds's Introduction

Android HAL driver for GPS and BDS

This is an GNSS HAL driver project for both GPS and BDS satellites system. And use SUPL2.0 for AGPS.

This project is for Android4, Android5 or Android6.

For Android7 or Anroid8, please use android7_gnss_hal_driver.

For Android9 or above, please use android9_gnss_hal_driver.

Basics

  1. This project is about to make a gps.xxxx.so lib, which loaded by android system at the booting time.
  2. When gps.xxxx.so is loaded, it start an new thread to listen the gnss tty.
  3. The gnss device outputs navigation data in the format of NMEA 0183 protocol to gnss tty.
  4. The gps.xxxx.so lib draw location information and satellite's status from navigation data.
  5. The gps.xxxx.so lib contains some "callback" functions, which used to report location information and satellite's status to android framework.

A little trick

As android's original location service only support prn from 1 to 32(for it's use an int32 to hold all the satellites's in_use_fix_flag), that's only enough for GPS system.

To support BDS system, we need something more tricky.

As satellite's azimuth is always in range [0, 360), but with a float type, that's quite enough to hold something more.

So I add in_use_fix_flag to azimuth.

If the satellite is used in fix, it's azimuth will plus 720, else nothing changed.

And when the LocationAPI request satellite's status, if it's azimuth is bigger than 720, then it's used in fix, else, it's not.

I use different satellite's id range to distinguish GPS and BDS satellites. [1, 32] for GPS satellites, and [201, 216] for BDS satellites.

As we do all the things in android's hal(parse nmea and conceal satellites's in_use_fix_flag) and framework(reveal satellites's in_use_fix_flag and restore azimuth to normal), so any 3rd party application can work with it.

Requirements

  1. Android source code.
  2. Android build enviroment.
  3. Build the android source.

Sepcial notes

  1. This project is build and tested on origin android v4.0.4.
  2. It definitelly NOT work on any MTK android version.
  3. Not guarantee anything on other android versions.

How to use

  1. Replace android's old /frameworks/base/location/java/android/locaton/GpsStatus.java file with the new one in this project.
  2. Copy folder /hardware/libgps/ to android source path.
  3. Rebuild android source code.
  4. Update your device with the new image.
  5. Change the settings in /system/etc/gnss.conf and copy it to android device.

Snapshots of GPSTest

alt tag

  • Dots are GPS satellites.
  • Triangles are BDS satellites.

alt tag

  • 02,05,13,15,20,21,24,29 and 30 with white foreground and black background are GPS satellites.
  • 201, 202 and 203 with black foreground and white background are BDS satellites.
  • The maximum display satellites number of GPSTest are 12, but there are 21 satellites in view, so the rest are not displayed.

SUPL2

  1. SUPL2 is an optional feature, which can improves the gnss devices's startup performance.
  2. All my SUPL codes are based on tajuma/supl.
  3. To support LTE(4G) network, I update asn-rrlp and asn-supl to SUPL2.0.
  4. To enable/disable SUPL2, edit hardware/libgps/Android.mk and set SUPL_ENABLED := 1/0.

android_hal_gpsbds's People

Contributors

zxcwhale avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.