com.esf.device.gps.service
Interface IGPSService


public interface IGPSService

Gets data from GPS device.

Author:
larry.lendo

Field Summary
static java.lang.String SERVICE_NAME
          Helper method.
 
Method Summary
 void disableStream()
          Stops the GPS stream and causes the application to close the serial port
 void enableStream()
          Starts the GPS stream and causes the application to open the serial port
 java.lang.String getFOM()
          Returns the most recent FOM message
 java.lang.String getGPGGA()
          Returns the most recent GPGGA message
 java.lang.String getGPGLL()
          Returns the most recent GPGLL message
 java.lang.String getGPGSA()
          Returns the most recent GPGSA message
 java.lang.String getGPGSV1()
          Returns the most recent GPGSV1 message
 java.lang.String getGPGSV2()
          Returns the most recent GPGSV2 message
 java.lang.String getGPGSV3()
          Returns the most recent GPGSV3 message
 java.lang.String getGPGSV4()
          Returns the most recent GPGSV4 message
 java.lang.String getGPRMC()
          Returns the most recent GPRMC message
 boolean getGpsLock()
          Returns a boolean value indicating if the GPS input stream indicates a GPS position fix.
 java.lang.String getGPVTG()
          Returns the most recent GPVTG message
 int getHeading()
          Returns the current heading reported by the GPS modem.
 float getLat()
          Returns the latitude value reported by the GPS modem.
 float getLon()
          Returns the longitude value reported by the GPS modem.
 int getNumOfGSVMessages()
          Returns the number of GPGSV messages currently available
 int getPacc()
          Returns the dilution of precision of the current satellite fix.
 java.lang.String getPPS()
          Returns the most recent PPS message
 int getSats()
          Returns the number satellites locked by the GPS modem.
 float getSpeedKPH()
          Returns the speed reported by the GPS modem.
 float getSpeedMPH()
          Returns the speed reported by the GPS modem.
 int getStat()
          Returns a status indicator for the GPS data.
 long getTime()
          Returns the current GPS time in UTC seconds.
 boolean isStreamEnabled()
          Checks to see if the GPS stream is enabled
 void sendCommand(java.lang.String command)
          Sends a command to the GPS device
 void setGpsBaudRate(int newBaudRate)
          Set the baud rate to be used of the next open of the GPS serial port.
 void setGpsPort(java.lang.String newPortName)
          Set the serial port (Linux device name) that will be used to open a connection to the GPS receiver.
 boolean setSystemTime()
          Sets the system clock based on the GPS time.
 

Field Detail

SERVICE_NAME

public static final java.lang.String SERVICE_NAME
Helper method. Returns the class name of this Interface.

Method Detail

enableStream

public void enableStream()
Starts the GPS stream and causes the application to open the serial port


disableStream

public void disableStream()
Stops the GPS stream and causes the application to close the serial port


isStreamEnabled

public boolean isStreamEnabled()
Checks to see if the GPS stream is enabled

Returns:
the state of the GPS stream. true if enabled, otherwise false.

setGpsPort

public void setGpsPort(java.lang.String newPortName)
Set the serial port (Linux device name) that will be used to open a connection to the GPS receiver. This port will be used on any subsequent call to enableStream().

The default value is "/dev/ttyS6".

Parameters:
newPortName - Linux device name of GPS serial port.

setGpsBaudRate

public void setGpsBaudRate(int newBaudRate)
Set the baud rate to be used of the next open of the GPS serial port. This value will be used on any subsequent call to enableStream().

The default value is 4800.

Parameters:
newBaudRate - serial port baud rate

getGpsLock

public boolean getGpsLock()
Returns a boolean value indicating if the GPS input stream indicates a GPS position fix. If the GPS input stream is not currently available for any reason, then this value will be false.

Returns:
The position fix, as reported by the GPS receiver.

sendCommand

public void sendCommand(java.lang.String command)
                 throws java.lang.Exception
Sends a command to the GPS device

Parameters:
command - the string representing the command to send to the modem
Throws:
java.lang.Exception - if an I/O error occurred on the GPS modem port, or if the GPS is not enabled.

getGPGGA

public java.lang.String getGPGGA()
Returns the most recent GPGGA message

Returns:
the most recent GPGGA message

getGPGLL

public java.lang.String getGPGLL()
Returns the most recent GPGLL message

Returns:
the most recent GPGLL message

getGPGSA

public java.lang.String getGPGSA()
Returns the most recent GPGSA message

Returns:
the most recent GPGSA message

getNumOfGSVMessages

public int getNumOfGSVMessages()
Returns the number of GPGSV messages currently available

Returns:
the total number of GSV messages currently available

getGPGSV1

public java.lang.String getGPGSV1()
Returns the most recent GPGSV1 message

Returns:
the most recent GPGSV1 message

getGPGSV2

public java.lang.String getGPGSV2()
Returns the most recent GPGSV2 message

Returns:
the most recent GPGSV2 message

getGPGSV3

public java.lang.String getGPGSV3()
Returns the most recent GPGSV3 message

Returns:
the most recent GPGSV3 message

getGPGSV4

public java.lang.String getGPGSV4()
Returns the most recent GPGSV4 message

Returns:
the most recent GPGSV4 message

getGPRMC

public java.lang.String getGPRMC()
Returns the most recent GPRMC message

Returns:
the most recent GPRMC message

getGPVTG

public java.lang.String getGPVTG()
Returns the most recent GPVTG message

Returns:
the most recent GPVTG message

getFOM

public java.lang.String getFOM()
Returns the most recent FOM message

Returns:
the most recent FOM message

getPPS

public java.lang.String getPPS()
Returns the most recent PPS message

Returns:
the most recent PPS message

setSystemTime

public boolean setSystemTime()
Sets the system clock based on the GPS time. This will only occur if a valid GPS lock is available. If not, setSystemTime() will return false and not set the system time. Otherwise, the system time will be set and true will be returned

Returns:
boolean, true if the operation completed without errors

getTime

public long getTime()
Returns the current GPS time in UTC seconds.

Returns:
UTC time in seconds since Jan 1, 1970 00:00:00

getStat

public int getStat()
Returns a status indicator for the GPS data. Statuses are: 1 = no GPS response; 2 = error in response; 4 = valid.

Returns:
status

getSats

public int getSats()
Returns the number satellites locked by the GPS modem.

Returns:
number of satellites locked by the GPS modem.

getLat

public float getLat()
Returns the latitude value reported by the GPS modem.

Returns:
latitude, in units of seconds.

getLon

public float getLon()
Returns the longitude value reported by the GPS modem.

Returns:
longitude, in units of seconds, accurate to the nearest minute.

getSpeedMPH

public float getSpeedMPH()
Returns the speed reported by the GPS modem.

Returns:
current speed, in miles per hour.

getSpeedKPH

public float getSpeedKPH()
Returns the speed reported by the GPS modem.

Returns:
current speed, in kilometers per hour.

getHeading

public int getHeading()
Returns the current heading reported by the GPS modem.

Returns:
heading in degrees.

getPacc

public int getPacc()
Returns the dilution of precision of the current satellite fix. DOP (dilution of precision) is an indication of the effect of satellite geometry on the accuracy of the fix. It is a unitless number where smaller is better. For 3D fixes using 4 satellites a 1.0 would be considered to be a perfect number, however for overdetermined solutions it is possible to see numbers below 1.0.

Returns:
dilution of precision


Copyright © 2009 Eurotech Inc. All rights reserved.