11About GPSd4Java
22===============
33
4- 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.
4+ GPSd4Java is a library to use data from the GPSd daemon in your Java applications.
5+ It provides a library to connect to gpsd and retrieve data using a socket connection.
56
67Use GPSd4Java
78=============
@@ -17,20 +18,31 @@ You can use GPSd4Java with a Maven project. Just add the following lines to your
1718 </dependencies>
1819
1920
20- To get the latest development snapshot add the following lines to your pom.xml.
21+ Getting Started
22+ ===============
2123
22- <repositories>
23- <repository>
24- <id>sonatype-nexus-snapshots</id>
25- <name>Sonatype Nexus Snapshots</name>
26- <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
27- </repository>
28- </repositories>
24+ The main entrypoint to use GPSd4Java is the class ` GPSdEndpoint ` .
25+ You can create a new instance by providing the host and port of the gpsd daemon.
26+ Further you have to provide a ` ResultParser ` instance which parses all messages sent by the GPS device.
2927
30- <dependencies>
31- <dependency>
32- <groupId>de.taimos</groupId>
33- <artifactId>gpsd4java</artifactId>
34- <version>1.7-SNAPSHOT</version>
35- </dependency>
36- </dependencies>
28+ On the created endpoint you can then add listeners to handle incoming messages.
29+ This listener will receive the message on the appropriate method according to the message type.
30+ The most interesting messages are the ` TPVObjects ` as they contain the positional information provided by the GPS device.
31+
32+ To get the position you just have to call the ` getLatitude() ` and ` getLongitude() ` methods on the received ` TPVObject ` .
33+
34+ If all is set you activate the endpoint using the ` start() ` method.
35+
36+ If this succeeds you can either poll gpsd for new messages or you can enable the watch mode to receive new data on arrival.
37+
38+ ## Polling data
39+
40+ To poll single messages call the ` poll() ` method on the endpoint instance
41+
42+ ## Activating watch mode
43+
44+ To get all new messages call the ` watch(boolean, boolean) ` method.
45+ The first param defines if you want enable or disable the watch mode and the second defines if you want to receive messega details.
46+ So the default use case would be to call ` watch(true, true) ` .
47+
48+ You should now receive incoming messages in your provided listener implementation.
0 commit comments