no.ubicollab.osgi
Class SerialPortGPS

java.lang.Object
  extended by no.ubicollab.osgi.SerialPortGPS

public class SerialPortGPS
extends java.lang.Object

Class for accessing and retrieving positiondata from a gps device via the com-port. It requires the java comm api to be installed on the platform where it is run.
An implementation of the java comm api for Pocketpc can be found here: http://www2s.biglobe.ne.jp/~dat/java/project/jvm/index_en.html (Download the comm api only. The whole JVM is not needed).

This class has been tested with the ITerNet PS-3100 Bluetooth GPS, on Windows Xp and Windows Mobile 2003, but should also work with other GPS devices as long as they can be accessed through a com-port and the GPS returns $GPRMC commands from the NMEA-0183 GPS standard (see Parser for details)

Author:
Andreas Brustad
See Also:
Parser

Constructor Summary
SerialPortGPS(java.lang.String comPort)
           
 
Method Summary
 java.lang.String[] getPosition()
          Gets the position from a GPS device.
 void setTimeout(int timeoutValue)
          Sets the maximum number unsuccessfully parsed commands to read from the GPS before timeout.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerialPortGPS

public SerialPortGPS(java.lang.String comPort)
Parameters:
comPort -
Method Detail

getPosition

public java.lang.String[] getPosition()
Gets the position from a GPS device.
Opens a connection to the GPS, retrieves the position from it and closes the connection.

Returns:
a String[] of length 3. Where [0] = longitude, [1] = latitude, [2] = altitude, or null if no contact with the GPS could be estblished.

setTimeout

public void setTimeout(int timeoutValue)
Sets the maximum number unsuccessfully parsed commands to read from the GPS before timeout. Default is 50

Parameters:
timeoutValue - Max attempts before timeout