Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/taimos/gpsd4java
GPSd client library written in Java
https://github.com/taimos/gpsd4java
gpsd gpsd-daemon java listener location
Last synced: 8 days ago
JSON representation
GPSd client library written in Java
- Host: GitHub
- URL: https://github.com/taimos/gpsd4java
- Owner: taimos
- License: apache-2.0
- Created: 2012-03-09T09:13:15.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2023-04-14T17:28:11.000Z (over 1 year ago)
- Last Synced: 2024-04-14T05:52:53.491Z (7 months ago)
- Topics: gpsd, gpsd-daemon, java, listener, location
- Language: Java
- Homepage:
- Size: 403 KB
- Stars: 40
- Watchers: 4
- Forks: 32
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/de.taimos/gpsd4java/badge.svg)](https://maven-badges.herokuapp.com/maven-central/de.taimos/gpsd4java)
About GPSd4Java
===============GPSd4Java is a library to use data from the GPSd daemon in your Java applications.
It provides a library to connect to gpsd and retrieve data using a socket connection.Use GPSd4Java
=============You can use GPSd4Java with a Maven project. Just add the following lines to your pom.xml.
de.taimos
gpsd4java
$VERSION
Getting Started
===============The main entrypoint to use GPSd4Java is the class `GPSdEndpoint`.
You can create a new instance by providing the host and port of the gpsd daemon.
Further you have to provide a `ResultParser` instance which parses all messages sent by the GPS device.On the created endpoint you can then add listeners to handle incoming messages.
This listener will receive the message on the appropriate method according to the message type.
The most interesting messages are the `TPVObjects` as they contain the positional information provided by the GPS device.To get the position you just have to call the `getLatitude()` and `getLongitude()` methods on the received `TPVObject`.
If all is set you activate the endpoint using the `start()` method.
If this succeeds you can either poll gpsd for new messages or you can enable the watch mode to receive new data on arrival.
## Polling data
To poll single messages call the `poll()` method on the endpoint instance
## Activating watch mode
To get all new messages call the `watch(boolean, boolean)` method.
The first param defines if you want enable or disable the watch mode and the second defines if you want to receive messega details.
So the default use case would be to call `watch(true, true)`.You should now receive incoming messages in your provided listener implementation.