Giter Site home page Giter Site logo

android-nmea-parser's Introduction

android-nmea-parser

Light-weight Android Java library for NMEA sentences parsing

Supported sentences:

  • GPRMC/GNRMC
  • GPGGA/GNGGA
  • GPGSV/GNGSV
  • GPGSA/GNGSA

NMEA Parser

flow parser build on top of the BasicNMEAParser that maps raw NMEA data to useful Android objects such as Location and GpsSatellite

Location parsing

To get an Android Location object you have to parse both RMC and GGA with the same time.

val handler = object: NMEAHandler() {
    ...
    override fun onLocation(location: Location) {

    }
    ...
}
val parser = NMEAParser(handler)
parser.parse("$GPRMC,163407.000,A,5004.7485,N,01423.8956,E,0.04,36.97,180416,,*38")
parser.parse("$GPGGA,163407.000,5004.7485,N,01423.8956,E,1,07,1.7,285.7,M,45.5,M,,0000*5F")

Satellites parsing

To get a list of gps satellites you have to parse all of GSVs and at least one GSA sentence. Since Android GpsSatellite class is inaccessible (only through reflection), the package level GpsSatellite is introduced.

val handler = object: NMEAHandler() {
    ...
    override fun onSatellites(satellites: List<GpsSatellite>) {

    }
    ...
}
val parser = NMEAParser(handler)
parser.parse("$GPGSV,3,1,11,29,86,273,30,25,60,110,38,31,52,278,47,02,28,050,39*7D")
parser.parse("$GPGSV,3,2,11,12,23,110,34,26,18,295,29,21,17,190,30,05,11,092,25*72")
parser.parse("$GPGSV,3,3,11,14,02,232,13,23,02,346,12,20,01,135,13*48")
parser.parse("$GPGSA,A,3,25,02,26,05,29,31,21,12,,,,,1.6,1.0,1.3*3B")

if you don't need all methods there's also an Adapter

Basic NMEA Parser

flow parser that allows you to access raw NMEA data

val handler = object: BasicNMEAHandler() {
    ...
    override fun onRMC(date: Long?, time: Long, posStatus: String, latitude: Double?, longitude: Double?, speed: Float?, direction: Float?, magVar: Float?, magVarDir: String?, modeInc: String?, isGN: Boolean) {
        
    }
    ...
}
val parser = new BasicNMEAParser(handler)
parser.parse("$GPRMC,163407.000,A,5004.7485,N,01423.8956,E,0.04,36.97,180416,,*38")

if you don't need all methods there's also an Adapter

android-nmea-parser's People

Contributors

srwoerner avatar petr-s avatar jaap-smd 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.