org.opengts.util
Class Nmea0183

java.lang.Object
  extended by org.opengts.util.Nmea0183

public class Nmea0183
extends java.lang.Object

A container for a NMEA-0183 record


Field Summary
protected  double altitudeM
           
static java.lang.String CUSTOM_GT_
           
protected  long ddmmyy
           
static java.lang.String DNAME_GPGGA
           
static java.lang.String DNAME_GPRMC
           
static java.lang.String DNAME_GPVTG
           
static java.lang.String DNAME_GPZDA
           
static java.lang.String DNAME_GTEVT
           
static java.lang.String DNAME_GTSTC
           
static java.lang.String DNAME_GTUID
           
protected  java.lang.Object eventCode
           
protected  java.lang.String[] extraData
           
protected static long FIELD_ALTITUDE
           
protected static long FIELD_DDMMYY
           
protected static long FIELD_EVENT_CODE
           
protected static long FIELD_FIX_TYPE
           
protected static long FIELD_GPS_AGE
           
protected static long FIELD_HDOP
           
protected static long FIELD_HEADING
           
protected static long FIELD_HHMMSS
           
protected static long FIELD_LATITUDE
           
protected static long FIELD_LONGITUDE
           
protected static long FIELD_MAG_VARIATION
           
protected static long FIELD_MOBILE_ID
           
protected static long FIELD_NUMBER_SATS
           
protected static long FIELD_RECORD_TYPE
           
protected static long FIELD_RECORD_VERSION
           
protected static long FIELD_SPEED
           
protected static long FIELD_STATUS_CODE
           
protected static long FIELD_VALID_FIX
           
protected  long fieldMask
           
protected  long fixtime
           
protected  int fixType
           
protected  GeoPoint geoPoint
           
protected  long gpsAge
           
protected  double hdop
           
protected  double heading
           
protected  long hhmmss
           
protected  boolean ignoredInvalidGPS
           
protected  boolean ignoreGpsFlag
           
protected  boolean isValidGPS
           
static double KILOMETERS_PER_KNOT
           
static double KNOTS_PER_KILOMETER
           
protected  java.lang.String lastRcdType
           
protected  double latitude
           
protected  double longitude
           
protected  double magVariation
           
protected  java.lang.String mobileID
           
static java.lang.String NAME_GPGGA
           
static java.lang.String NAME_GPRMC
           
static java.lang.String NAME_GPVTG
           
static java.lang.String NAME_GPZDA
           
static java.lang.String NAME_GTEVT
           
static java.lang.String NAME_GTSTC
           
static java.lang.String NAME_GTUID
           
static java.lang.String NAME_NONE
           
static java.lang.String NMEA_GP_
           
protected  int numSats
           
protected  long parsedRcdTypes
           
protected  java.lang.String rcdVersion
           
protected  double speedKnots
           
static int STATUS_CODE_MASK
           
static int STATUS_NONE
           
protected  int statusCode
           
static long TYPE_CUSTOM_1
           
static long TYPE_CUSTOM_2
           
static long TYPE_CUSTOM_3
           
static long TYPE_CUSTOM_4
           
static long TYPE_CUSTOM_5
           
static long TYPE_CUSTOM_6
           
static long TYPE_CUSTOM_7
           
static long TYPE_CUSTOM_8
           
static long TYPE_GPGGA
           
static long TYPE_GPRMC
           
static long TYPE_GPVTG
           
static long TYPE_GPZDA
           
static long TYPE_GTEVT
           
static long TYPE_GTSTC
           
static long TYPE_GTUID
           
static long TYPE_NONE
           
protected  boolean validChecksum
           
static java.lang.String VERSION
           
 
Constructor Summary
Nmea0183()
          Constructor
Nmea0183(java.lang.String rcd)
          Constructor
Nmea0183(java.lang.String[] rcds)
          Constructor
Nmea0183(java.lang.String[] rcds, boolean ignoreChecksum)
          Constructor
Nmea0183(java.lang.String rcd, boolean ignoreChecksum)
          Constructor
 
Method Summary
protected  int _getStatusCode()
          Gets the status-code
protected static long _getUTCSeconds(long dmy, long hms)
          Computes seconds in UTC time given values from GPS device.
protected  boolean _hasValidChecksum(java.lang.String str)
          Checks if NMEA-0183 formatted String has valid checksum by calculating the checksum of the payload and comparing that to the received checksum.
protected  boolean _parse_GPGGA(java.lang.String[] fld)
          Parses "$GPGGA"
protected  boolean _parse_GPRMC(java.lang.String[] fld)
          Parses "$GPRMC"
protected  boolean _parse_GPVTG(java.lang.String[] fld)
          Parses "$GPVTG" (speed/heading)
protected  boolean _parse_GPZDA(java.lang.String[] fld)
          Parses "$GPZDA"
protected  boolean _parse_GTEVT(java.lang.String[] fld)
          Parses "$GTEVT" (Event Record)
protected  boolean _parse_GTSTC(java.lang.String[] fld)
          Parses "$GTSTC" (Status Code)
protected  boolean _parse_GTUID(java.lang.String[] fld)
          Parses "$GTUID" (Unique-ID)
protected  boolean _parseValidGPSIndicator(java.lang.String AV)
          Parse valid GPS indicator "A"/"V"
protected  void appendCustomTypes(java.lang.StringBuffer sb, java.lang.String sep)
          Callback to append any contained custom record types to the specified StringBuffer
static int calcXORChecksum(java.lang.String str, boolean includeAll)
          Calculates/Returns the checksum for a NMEA-0183 formatted String
 void clearFieldMask(long fld)
           
 boolean didIgnoreInvalidGPS()
          Returns true if ignoring invalid GPS flags, and the flag indicator was not "A"
 double getAltitudeMeters()
          Gets the altitude in meters
static long getCurrentHHMMSS(java.util.TimeZone tz)
          Returns the current HHMMSS
 long getDDMMYY()
          Gets the day/month/year of the fix
 java.lang.Object getEventCode()
          Gets the event-code
 java.lang.String[] getExtraData()
          Gets any data that may follow the checksum
 long getFieldMask()
          Gets the mask of available fields
 long getFixtime()
          Gets the epoch fix time
 long getFixtime(boolean dftToCurrentTOD)
          Gets the epoch fix time
 int getFixType()
          Gets the "$GPGGA" fix type (0=no fix, 1=GPS, 2=DGPS, 3=PPS?, 6=dead-reckoning)
 GeoPoint getGeoPoint()
          Gets the lat/lon as a GeoPoint
 long getGpsAge()
          Gets the GPS age in seconds
 double getHDOP()
          Gets the horizontal-dilution-of-precision
 double getHeading()
          Gets the heading/course in degrees
 long getHHMMSS()
          Gets the hour/minute/seconds of the fix
 boolean getIgnoreInvalidGpsFlag()
          gets whether the A|V (valid|invalid) GPS location flag should be ignored.
 java.lang.String getLastRecordType()
          Gets the last record type
 double getLatitude()
          Gets the latitude
 double getLongitude()
          Gets the longitude
 double getMagneticVariation()
          Gets the magnetic variation in degrees
 java.lang.String getMobileID()
          Gets the mobile-id
 int getNumberOfSatellites()
          Gets the number of satellites used in fix
protected  long getParsedRecordTypes()
          Gets all parsed record types (mask)
 java.lang.String getRecordVersion()
          Gets the record version
 double getSpeedKnots()
          Returns the speed in knots
 double getSpeedKPH()
          Gets the speed in KPH
 int getStatusCode()
          Gets the status-code
 java.lang.String getTypeNames()
          Gets the record type String from the type mask
 boolean hasAltitude()
          Returns true if the altitude has been defined
 boolean hasEventCode()
          Returns true if an event-code has been defined
 boolean hasExtraData()
          Returns true if extra-data was found
 boolean hasField(long fld)
          Returns true if specified field is available
 boolean hasFixtime()
          Returns true if the fixtime has been defined
 boolean hasFixType()
          Returns true if the fix type has been defined
 boolean hasGeoPoint()
          Returns true if the latitude/longitude have been defined
 boolean hasGPGGA()
          Returns true if a $GPGGA record has been parsed
 boolean hasGPRMC()
          Returns true if a $GPRMC record has been parsed
 boolean hasGpsAge()
          Returns true if the GPS age has been defined
 boolean hasGPVTG()
          Returns true if a $GPVTG record has been parsed
 boolean hasGPZDA()
          Returns true if a $GPZDA record has been parsed
 boolean hasGTEVT()
          Returns true if a $GTEVT record has been parsed
 boolean hasGTSTC()
          Returns true if a $GTSTC record has been parsed
 boolean hasGTUID()
          Returns true if a $GTUID record has been parsed
 boolean hasHDOP()
          Returns true if the HDOP has been defined
 boolean hasHeading()
          Returns true if the heading has been defined
 boolean hasLatitude()
          Returns true if the latitude has been defined
 boolean hasLongitude()
          Returns true if the longitude has been defined
 boolean hasMagneticVariation()
          Returns true if the magnetic variation has been defined
 boolean hasMobileID()
          Returns true if a mobile-id is defined
 boolean hasNumberOfSatellites()
          Returns true if the number of satellites has been defined
 boolean hasParsedRecordTypes()
          Returns true if this instance has at least one parsed record type
 boolean hasRecordVersion()
          Returns true if the record version has been defined
 boolean hasSpeed()
          Returns true if the speed has been defined
 boolean hasStatusCode()
          Returns true if the status-code has been defined
 boolean isEventCode(java.lang.Object ec)
          Returns true if the specified event code is non-null/blank
 boolean isValidChecksum()
          Returns true if the checksum is valid
 boolean isValidGPS()
          Returns true if the GPS fix is valid
static void main(java.lang.String[] argv)
          Main entry point for testing/debugging
 boolean parse(java.lang.String rcd)
          Parses a NMEA-0183 record
 boolean parse(java.lang.String[] rcds)
          Parses a NMEA-0183 record
 boolean parse(java.lang.String[] rcds, boolean ignoreChecksum)
          Parses an array of NMEA-0183 records
 boolean parse(java.lang.String rcd, boolean ignoreChecksum)
          Parses a NMEA-0183 record
protected  boolean parseCustomReord(java.lang.String[] fld)
          Callback to parse custom record type
static long parseFixtime(long ddmmyy, long hhmmss, boolean dftToCurrentTOD)
          Returns the parsed epoch fix time
static long parseFixtime(java.lang.String DDMMYY, java.lang.String HHMMSS, boolean dftToCurrentTOD)
          Returns the parsed epoch fix time
static double ParseLatitude(java.lang.String sd)
          Parses latitude given values from GPS device.
static double ParseLatitude(java.lang.String sd, double dft)
          Parses latitude given values from GPS device.
static double ParseLatitude(java.lang.String s, java.lang.String d)
          Parses latitude given values from GPS device.
static double ParseLatitude(java.lang.String s, java.lang.String d, double dft)
          Parses latitude given values from GPS device.
static double ParseLongitude(java.lang.String sd)
          Parses longitude given values from GPS device.
static double ParseLongitude(java.lang.String sd, double dft)
          Parses longitude given values from GPS device.
static double ParseLongitude(java.lang.String s, java.lang.String d)
          Parses longitude given values from GPS device.
static double ParseLongitude(java.lang.String s, java.lang.String d, double dft)
          Parses longitude given values from GPS device.
 void setAltitudeMeters(double alt)
          Sets the magnetic variation in degrees
 void setDDMMYY(long ddmmyy)
          Sets the day/month/year
 void setEventCode(java.lang.Object ec)
          Sets the event-code
 void setFieldMask(long fld)
           
 void setFixType(int ft)
          Sets the fix type
 void setGeoPoint(double lat, double lon)
          Sets the lat/lon as a GeoPoint
 void setGeoPoint(GeoPoint gp)
          Sets the lat/lon as a GeoPoint
 void setGpsAge(long age)
          Sets the GPS age
 void setHDOP(double dop)
          Sets the HDOP value
 void setHeading(double dir)
          Sets the heading value, in degrees
 void setHHMMSS(long hhmmss)
          Sets the hours/minutes/seconds
 void setIgnoreInvalidGpsFlag(boolean ignore)
          Sets whether the A|V (valid|invalid) GPS location flag should be ignored.
Setting to "true" is not recommended as invalid GPS locations may be returned.
 void setMagneticVariation(double mv)
          Sets the magnetic variation in degrees
 void setMobileID(java.lang.String id)
          Sets the mobile-id
 void setNumberOfSatellites(int sats)
          Sets the number of satellites in view
protected  void setParsedRecordType(long type, java.lang.String typeS)
          Adds the parsed record types (mask)
 void setRecordVersion(java.lang.String vers)
          Sets the record version
 void setSpeedKnots(double knots)
          Sets the speed value, in Knots
 void setSpeedKPH(double kph)
          Sets the speed value, in km/h
 void setStatusCode(int sc)
          Sets the status-code
 java.lang.String toGPRMC()
          Return a formatted $GPRMC record from the values in this instance
 java.lang.String toString()
          Returns a string representation of this object
 java.lang.StringBuffer toStringBuffer(java.lang.StringBuffer sb)
          Returns a string representation of this object
 int translateEventCodeToStatusCode(java.util.Map<java.lang.Object,java.lang.Integer> evCodeMap)
          Translates the event-code to status-code, using the specified map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values

NMEA_GP_

public static final java.lang.String NMEA_GP_
See Also:
Constant Field Values

CUSTOM_GT_

public static final java.lang.String CUSTOM_GT_
See Also:
Constant Field Values

NAME_NONE

public static final java.lang.String NAME_NONE
See Also:
Constant Field Values

NAME_GPRMC

public static final java.lang.String NAME_GPRMC
See Also:
Constant Field Values

NAME_GPGGA

public static final java.lang.String NAME_GPGGA
See Also:
Constant Field Values

NAME_GPVTG

public static final java.lang.String NAME_GPVTG
See Also:
Constant Field Values

NAME_GPZDA

public static final java.lang.String NAME_GPZDA
See Also:
Constant Field Values

NAME_GTUID

public static final java.lang.String NAME_GTUID
See Also:
Constant Field Values

NAME_GTSTC

public static final java.lang.String NAME_GTSTC
See Also:
Constant Field Values

NAME_GTEVT

public static final java.lang.String NAME_GTEVT
See Also:
Constant Field Values

DNAME_GPRMC

public static final java.lang.String DNAME_GPRMC
See Also:
Constant Field Values

DNAME_GPGGA

public static final java.lang.String DNAME_GPGGA
See Also:
Constant Field Values

DNAME_GPVTG

public static final java.lang.String DNAME_GPVTG
See Also:
Constant Field Values

DNAME_GPZDA

public static final java.lang.String DNAME_GPZDA
See Also:
Constant Field Values

DNAME_GTUID

public static final java.lang.String DNAME_GTUID
See Also:
Constant Field Values

DNAME_GTSTC

public static final java.lang.String DNAME_GTSTC
See Also:
Constant Field Values

DNAME_GTEVT

public static final java.lang.String DNAME_GTEVT
See Also:
Constant Field Values

TYPE_NONE

public static final long TYPE_NONE
See Also:
Constant Field Values

TYPE_GPRMC

public static final long TYPE_GPRMC
See Also:
Constant Field Values

TYPE_GPGGA

public static final long TYPE_GPGGA
See Also:
Constant Field Values

TYPE_GPVTG

public static final long TYPE_GPVTG
See Also:
Constant Field Values

TYPE_GPZDA

public static final long TYPE_GPZDA
See Also:
Constant Field Values

TYPE_GTUID

public static final long TYPE_GTUID
See Also:
Constant Field Values

TYPE_GTSTC

public static final long TYPE_GTSTC
See Also:
Constant Field Values

TYPE_GTEVT

public static final long TYPE_GTEVT
See Also:
Constant Field Values

TYPE_CUSTOM_1

public static final long TYPE_CUSTOM_1
See Also:
Constant Field Values

TYPE_CUSTOM_2

public static final long TYPE_CUSTOM_2
See Also:
Constant Field Values

TYPE_CUSTOM_3

public static final long TYPE_CUSTOM_3
See Also:
Constant Field Values

TYPE_CUSTOM_4

public static final long TYPE_CUSTOM_4
See Also:
Constant Field Values

TYPE_CUSTOM_5

public static final long TYPE_CUSTOM_5
See Also:
Constant Field Values

TYPE_CUSTOM_6

public static final long TYPE_CUSTOM_6
See Also:
Constant Field Values

TYPE_CUSTOM_7

public static final long TYPE_CUSTOM_7
See Also:
Constant Field Values

TYPE_CUSTOM_8

public static final long TYPE_CUSTOM_8
See Also:
Constant Field Values

FIELD_RECORD_TYPE

protected static final long FIELD_RECORD_TYPE
See Also:
Constant Field Values

FIELD_VALID_FIX

protected static final long FIELD_VALID_FIX
See Also:
Constant Field Values

FIELD_DDMMYY

protected static final long FIELD_DDMMYY
See Also:
Constant Field Values

FIELD_HHMMSS

protected static final long FIELD_HHMMSS
See Also:
Constant Field Values

FIELD_LATITUDE

protected static final long FIELD_LATITUDE
See Also:
Constant Field Values

FIELD_LONGITUDE

protected static final long FIELD_LONGITUDE
See Also:
Constant Field Values

FIELD_SPEED

protected static final long FIELD_SPEED
See Also:
Constant Field Values

FIELD_HEADING

protected static final long FIELD_HEADING
See Also:
Constant Field Values

FIELD_HDOP

protected static final long FIELD_HDOP
See Also:
Constant Field Values

FIELD_NUMBER_SATS

protected static final long FIELD_NUMBER_SATS
See Also:
Constant Field Values

FIELD_ALTITUDE

protected static final long FIELD_ALTITUDE
See Also:
Constant Field Values

FIELD_FIX_TYPE

protected static final long FIELD_FIX_TYPE
See Also:
Constant Field Values

FIELD_MAG_VARIATION

protected static final long FIELD_MAG_VARIATION
See Also:
Constant Field Values

FIELD_RECORD_VERSION

protected static final long FIELD_RECORD_VERSION
See Also:
Constant Field Values

FIELD_MOBILE_ID

protected static final long FIELD_MOBILE_ID
See Also:
Constant Field Values

FIELD_EVENT_CODE

protected static final long FIELD_EVENT_CODE
See Also:
Constant Field Values

FIELD_STATUS_CODE

protected static final long FIELD_STATUS_CODE
See Also:
Constant Field Values

FIELD_GPS_AGE

protected static final long FIELD_GPS_AGE
See Also:
Constant Field Values

KILOMETERS_PER_KNOT

public static final double KILOMETERS_PER_KNOT
See Also:
Constant Field Values

KNOTS_PER_KILOMETER

public static final double KNOTS_PER_KILOMETER
See Also:
Constant Field Values

STATUS_NONE

public static final int STATUS_NONE
See Also:
Constant Field Values

STATUS_CODE_MASK

public static final int STATUS_CODE_MASK
See Also:
Constant Field Values

validChecksum

protected boolean validChecksum

parsedRcdTypes

protected long parsedRcdTypes

lastRcdType

protected java.lang.String lastRcdType

fieldMask

protected long fieldMask

ddmmyy

protected long ddmmyy

hhmmss

protected long hhmmss

fixtime

protected long fixtime

ignoreGpsFlag

protected boolean ignoreGpsFlag

ignoredInvalidGPS

protected boolean ignoredInvalidGPS

isValidGPS

protected boolean isValidGPS

latitude

protected double latitude

longitude

protected double longitude

geoPoint

protected GeoPoint geoPoint

speedKnots

protected double speedKnots

heading

protected double heading

gpsAge

protected long gpsAge

hdop

protected double hdop

numSats

protected int numSats

altitudeM

protected double altitudeM

fixType

protected int fixType

magVariation

protected double magVariation

rcdVersion

protected java.lang.String rcdVersion

mobileID

protected java.lang.String mobileID

eventCode

protected java.lang.Object eventCode

statusCode

protected int statusCode

extraData

protected java.lang.String[] extraData
Constructor Detail

Nmea0183

public Nmea0183()
Constructor


Nmea0183

public Nmea0183(java.lang.String rcd)
Constructor

Parameters:
rcd - The NMEA-0183 record

Nmea0183

public Nmea0183(java.lang.String[] rcds)
Constructor

Parameters:
rcds - An array of NMEA-0183 records

Nmea0183

public Nmea0183(java.lang.String rcd,
                boolean ignoreChecksum)
Constructor

Parameters:
rcd - The NMEA-0183 record
ignoreChecksum - True if the record's checksum is to be ignored

Nmea0183

public Nmea0183(java.lang.String[] rcds,
                boolean ignoreChecksum)
Constructor

Parameters:
rcds - An array of NMEA-0183 records
ignoreChecksum - True if the record's checksum is to be ignored
Method Detail

getTypeNames

public java.lang.String getTypeNames()
Gets the record type String from the type mask

Returns:
The record types read by this instance as a string

appendCustomTypes

protected void appendCustomTypes(java.lang.StringBuffer sb,
                                 java.lang.String sep)
Callback to append any contained custom record types to the specified StringBuffer


setIgnoreInvalidGpsFlag

public void setIgnoreInvalidGpsFlag(boolean ignore)
Sets whether the A|V (valid|invalid) GPS location flag should be ignored.
Setting to "true" is not recommended as invalid GPS locations may be returned.


getIgnoreInvalidGpsFlag

public boolean getIgnoreInvalidGpsFlag()
gets whether the A|V (valid|invalid) GPS location flag should be ignored.

Returns:
True if the GPS A|V flag should be ignored, false otherwise.

getFieldMask

public long getFieldMask()
Gets the mask of available fields

Returns:
The mask of available fields

setFieldMask

public void setFieldMask(long fld)

clearFieldMask

public void clearFieldMask(long fld)

hasField

public boolean hasField(long fld)
Returns true if specified field is available

Returns:
True if specified field is available

hasParsedRecordTypes

public boolean hasParsedRecordTypes()
Returns true if this instance has at least one parsed record type

Returns:
all parsed record types (mask)

getParsedRecordTypes

protected long getParsedRecordTypes()
Gets all parsed record types (mask)

Returns:
all parsed record types (mask)

setParsedRecordType

protected void setParsedRecordType(long type,
                                   java.lang.String typeS)
Adds the parsed record types (mask)

Parameters:
type - The parsed record type to add to the parsed record type bitmask
typeS - A String representation of the parsed record type

getLastRecordType

public java.lang.String getLastRecordType()
Gets the last record type

Returns:
The last record type

isValidChecksum

public boolean isValidChecksum()
Returns true if the checksum is valid

Returns:
True if the checksum is valid

getDDMMYY

public long getDDMMYY()
Gets the day/month/year of the fix

Returns:
The day/month/year of the fix

setDDMMYY

public void setDDMMYY(long ddmmyy)
Sets the day/month/year

Parameters:
ddmmyy - The day/month/year [CHECK](as what?)

getHHMMSS

public long getHHMMSS()
Gets the hour/minute/seconds of the fix

Returns:
The hour/minute/seconds of the fix

setHHMMSS

public void setHHMMSS(long hhmmss)
Sets the hours/minutes/seconds

Parameters:
hhmmss - The ours/minutes/seconds

hasFixtime

public boolean hasFixtime()
Returns true if the fixtime has been defined

Returns:
True if the fixtime has been defined

getFixtime

public long getFixtime()
Gets the epoch fix time

Returns:
the epoch fix time

getFixtime

public long getFixtime(boolean dftToCurrentTOD)
Gets the epoch fix time

Returns:
the epoch fix time

_parseValidGPSIndicator

protected boolean _parseValidGPSIndicator(java.lang.String AV)
Parse valid GPS indicator "A"/"V"


isValidGPS

public boolean isValidGPS()
Returns true if the GPS fix is valid

Returns:
True if the GPS fix is valid

didIgnoreInvalidGPS

public boolean didIgnoreInvalidGPS()
Returns true if ignoring invalid GPS flags, and the flag indicator was not "A"

Returns:
True if ignoring invalid GPS flags, and the flag indicator was not "A"

hasLatitude

public boolean hasLatitude()
Returns true if the latitude has been defined

Returns:
Ttrue if the latitude has have been defined

getLatitude

public double getLatitude()
Gets the latitude

Returns:
The latitude

hasLongitude

public boolean hasLongitude()
Returns true if the longitude has been defined

Returns:
Ttrue if the longitude has have been defined

getLongitude

public double getLongitude()
Gets the longitude

Returns:
The longitude

hasGeoPoint

public boolean hasGeoPoint()
Returns true if the latitude/longitude have been defined

Returns:
Ttrue if the latitude/longitude have been defined

getGeoPoint

public GeoPoint getGeoPoint()
Gets the lat/lon as a GeoPoint

Returns:
the lat/lon as a GeoPoint

setGeoPoint

public void setGeoPoint(GeoPoint gp)
Sets the lat/lon as a GeoPoint

Parameters:
gp - The GeoPoint

setGeoPoint

public void setGeoPoint(double lat,
                        double lon)
Sets the lat/lon as a GeoPoint

Parameters:
lat - The Latitude
lon - The Longitude

hasSpeed

public boolean hasSpeed()
Returns true if the speed has been defined

Returns:
True if the speed has been defined

getSpeedKnots

public double getSpeedKnots()
Returns the speed in knots

Returns:
The speed in knots

getSpeedKPH

public double getSpeedKPH()
Gets the speed in KPH

Returns:
The speed in KPH

setSpeedKnots

public void setSpeedKnots(double knots)
Sets the speed value, in Knots


setSpeedKPH

public void setSpeedKPH(double kph)
Sets the speed value, in km/h


hasHeading

public boolean hasHeading()
Returns true if the heading has been defined

Returns:
True if the heading has been defined

getHeading

public double getHeading()
Gets the heading/course in degrees

Returns:
The heading/course in degrees

setHeading

public void setHeading(double dir)
Sets the heading value, in degrees


hasFixType

public boolean hasFixType()
Returns true if the fix type has been defined

Returns:
True if the fix type has been defined

getFixType

public int getFixType()
Gets the "$GPGGA" fix type (0=no fix, 1=GPS, 2=DGPS, 3=PPS?, 6=dead-reckoning)

Returns:
The "$GPGGA fix type

setFixType

public void setFixType(int ft)
Sets the fix type


hasNumberOfSatellites

public boolean hasNumberOfSatellites()
Returns true if the number of satellites has been defined

Returns:
True if the number of satellites has been defined

getNumberOfSatellites

public int getNumberOfSatellites()
Gets the number of satellites used in fix

Returns:
The number of satellites used in fix

setNumberOfSatellites

public void setNumberOfSatellites(int sats)
Sets the number of satellites in view


hasHDOP

public boolean hasHDOP()
Returns true if the HDOP has been defined

Returns:
True if the HDOP has been defined

getHDOP

public double getHDOP()
Gets the horizontal-dilution-of-precision

Returns:
The horizontal-dilution-of-precision

setHDOP

public void setHDOP(double dop)
Sets the HDOP value


hasAltitude

public boolean hasAltitude()
Returns true if the altitude has been defined

Returns:
True if the altitude has been defined

getAltitudeMeters

public double getAltitudeMeters()
Gets the altitude in meters

Returns:
The altitude in meters

setAltitudeMeters

public void setAltitudeMeters(double alt)
Sets the magnetic variation in degrees

Parameters:
alt - The magnetic variation in degrees

hasMagneticVariation

public boolean hasMagneticVariation()
Returns true if the magnetic variation has been defined

Returns:
True if the magnetic variation has been defined

getMagneticVariation

public double getMagneticVariation()
Gets the magnetic variation in degrees

Returns:
The magnetic variation in degrees

setMagneticVariation

public void setMagneticVariation(double mv)
Sets the magnetic variation in degrees

Parameters:
mv - The magnetic variation in degrees

hasRecordVersion

public boolean hasRecordVersion()
Returns true if the record version has been defined

Returns:
True if the record version has been defined

getRecordVersion

public java.lang.String getRecordVersion()
Gets the record version

Returns:
The record version

setRecordVersion

public void setRecordVersion(java.lang.String vers)
Sets the record version


hasMobileID

public boolean hasMobileID()
Returns true if a mobile-id is defined

Returns:
True if the mobile-id has been defined

getMobileID

public java.lang.String getMobileID()
Gets the mobile-id

Returns:
The mobile-id (or null if undefined)

setMobileID

public void setMobileID(java.lang.String id)
Sets the mobile-id


isEventCode

public boolean isEventCode(java.lang.Object ec)
Returns true if the specified event code is non-null/blank


hasEventCode

public boolean hasEventCode()
Returns true if an event-code has been defined

Returns:
True if an event-code has been defined

getEventCode

public java.lang.Object getEventCode()
Gets the event-code

Returns:
The event-code (may be null)

setEventCode

public void setEventCode(java.lang.Object ec)
Sets the event-code


hasStatusCode

public boolean hasStatusCode()
Returns true if the status-code has been defined

Returns:
True if the status-code has been defined

_getStatusCode

protected int _getStatusCode()
Gets the status-code

Returns:
The status-code

getStatusCode

public int getStatusCode()
Gets the status-code

Returns:
The status-code

setStatusCode

public void setStatusCode(int sc)
Sets the status-code


translateEventCodeToStatusCode

public int translateEventCodeToStatusCode(java.util.Map<java.lang.Object,java.lang.Integer> evCodeMap)
Translates the event-code to status-code, using the specified map. Once translated, the resulting status code will be cached and returned on subsequent calls to this method or "getStatusCode". If the event-code is not found in the specified map, the status code will not be set, and 0 (STATUS_NONE) will be returned.

Parameters:
evCodeMap - The Event-Code to Status-Code translation map
Returns:
The translated status-code.

hasGpsAge

public boolean hasGpsAge()
Returns true if the GPS age has been defined

Returns:
True if the GPS age has been defined

getGpsAge

public long getGpsAge()
Gets the GPS age in seconds

Returns:
The GPS age in seconds

setGpsAge

public void setGpsAge(long age)
Sets the GPS age


hasExtraData

public boolean hasExtraData()
Returns true if extra-data was found

Returns:
True if extra-data was found

getExtraData

public java.lang.String[] getExtraData()
Gets any data that may follow the checksum

Returns:
Any data that may follow the checksum (may be null)

toStringBuffer

public java.lang.StringBuffer toStringBuffer(java.lang.StringBuffer sb)
Returns a string representation of this object

Returns:
A string representation of this object

toString

public java.lang.String toString()
Returns a string representation of this object

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this object

toGPRMC

public java.lang.String toGPRMC()
Return a formatted $GPRMC record from the values in this instance

Returns:
A formatted $GPRMC record

parse

public boolean parse(java.lang.String[] rcds)
Parses a NMEA-0183 record

Parameters:
rcds - An array of NMEA-0183 records to parse
Returns:
True if this record was successfully parsed

parse

public boolean parse(java.lang.String rcd)
Parses a NMEA-0183 record

Parameters:
rcd - the NMEA-0183 record to parse
Returns:
True if this record was successfully parsed

parse

public boolean parse(java.lang.String[] rcds,
                     boolean ignoreChecksum)
Parses an array of NMEA-0183 records

Parameters:
rcds - An array of NMEA-0183 records to parse
ignoreChecksum - True to ignore the terminating checksum
Returns:
True if all records were successfully parsed

parse

public boolean parse(java.lang.String rcd,
                     boolean ignoreChecksum)
Parses a NMEA-0183 record

Parameters:
rcd - the NMEA-0183 record to parse
ignoreChecksum - True to ignore the terminating checksum
Returns:
True if this record was successfully parsed

parseCustomReord

protected boolean parseCustomReord(java.lang.String[] fld)
Callback to parse custom record type


hasGPRMC

public boolean hasGPRMC()
Returns true if a $GPRMC record has been parsed


_parse_GPRMC

protected boolean _parse_GPRMC(java.lang.String[] fld)
Parses "$GPRMC"


hasGPGGA

public boolean hasGPGGA()
Returns true if a $GPGGA record has been parsed


_parse_GPGGA

protected boolean _parse_GPGGA(java.lang.String[] fld)
Parses "$GPGGA"


hasGPVTG

public boolean hasGPVTG()
Returns true if a $GPVTG record has been parsed


_parse_GPVTG

protected boolean _parse_GPVTG(java.lang.String[] fld)
Parses "$GPVTG" (speed/heading)


hasGPZDA

public boolean hasGPZDA()
Returns true if a $GPZDA record has been parsed


_parse_GPZDA

protected boolean _parse_GPZDA(java.lang.String[] fld)
Parses "$GPZDA"


hasGTUID

public boolean hasGTUID()
Returns true if a $GTUID record has been parsed


_parse_GTUID

protected boolean _parse_GTUID(java.lang.String[] fld)
Parses "$GTUID" (Unique-ID)


hasGTSTC

public boolean hasGTSTC()
Returns true if a $GTSTC record has been parsed


_parse_GTSTC

protected boolean _parse_GTSTC(java.lang.String[] fld)
Parses "$GTSTC" (Status Code)


hasGTEVT

public boolean hasGTEVT()
Returns true if a $GTEVT record has been parsed


_parse_GTEVT

protected boolean _parse_GTEVT(java.lang.String[] fld)
Parses "$GTEVT" (Event Record)


getCurrentHHMMSS

public static long getCurrentHHMMSS(java.util.TimeZone tz)
Returns the current HHMMSS

Returns:
The current HHMMSS

parseFixtime

public static long parseFixtime(java.lang.String DDMMYY,
                                java.lang.String HHMMSS,
                                boolean dftToCurrentTOD)
Returns the parsed epoch fix time

Parameters:
DDMMYY - The String representation of the "DDMMYY"
HHMMSS - The String representation of the "HHMMSS"
dftToCurrentTOD - True to default to current time-of-day
Returns:
The parsed epoch fix time

parseFixtime

public static long parseFixtime(long ddmmyy,
                                long hhmmss,
                                boolean dftToCurrentTOD)
Returns the parsed epoch fix time

Parameters:
ddmmyy - The Integer representation of the "DDMMYY"
hhmmss - The Integer representation of the "HHMMSS"
Returns:
The parsed epoch fix time

_getUTCSeconds

protected static long _getUTCSeconds(long dmy,
                                     long hms)
Computes seconds in UTC time given values from GPS device.

Parameters:
dmy - Date received from GPS in DDMMYY format, where DD is day, MM is month, YY is year.
hms - Time received from GPS in HHMMSS format, where HH is hour, MM is minute, and SS is second.
Returns:
Time in UTC seconds.

ParseLatitude

public static double ParseLatitude(java.lang.String sd)
Parses latitude given values from GPS device.

Parameters:
sd - Latitude String from GPS device in ddmm.mmN/S format.
Returns:
Latitude parsed from GPS data, with appropriate sign based on hemisphere or '90.0' if invalid latitude provided.

ParseLatitude

public static double ParseLatitude(java.lang.String sd,
                                   double dft)
Parses latitude given values from GPS device.

Parameters:
sd - Latitude String from GPS device in ddmm.mmN/S format.
dft - The default latitude, if the specified latitude cannot be parsed
Returns:
Latitude parsed from GPS data, with appropriate sign based on hemisphere or 'dft' if invalid latitude provided.

ParseLatitude

public static double ParseLatitude(java.lang.String s,
                                   java.lang.String d)
Parses latitude given values from GPS device.

Parameters:
s - Latitude String from GPS device in ddmm.mm format.
d - Latitude hemisphere, "N" for northern, "S" for southern.
Returns:
Latitude parsed from GPS data, with appropriate sign based on hemisphere or '90.0' if invalid latitude provided.

ParseLatitude

public static double ParseLatitude(java.lang.String s,
                                   java.lang.String d,
                                   double dft)
Parses latitude given values from GPS device.

Parameters:
s - Latitude String from GPS device in ddmm.mm format.
d - Latitude hemisphere, "N" for northern, "S" for southern.
dft - The default latitude, if the specified latitude cannot be parsed
Returns:
Latitude parsed from GPS data, with appropriate sign based on hemisphere or 'dft' if invalid latitude provided.

ParseLongitude

public static double ParseLongitude(java.lang.String sd)
Parses longitude given values from GPS device.

Parameters:
sd - Longitude String from GPS device in dddmm.mmE/W format.
Returns:
Longitude parsed from GPS data, with appropriate sign based on hemisphere or '180.0' if invalid longitude provided.

ParseLongitude

public static double ParseLongitude(java.lang.String sd,
                                    double dft)
Parses longitude given values from GPS device.

Parameters:
sd - Longitude String from GPS device in dddmm.mmE/W format.
dft - The default latitude, if the specified latitude cannot be parsed
Returns:
Longitude parsed from GPS data, with appropriate sign based on hemisphere or 'dft' if invalid longitude provided.

ParseLongitude

public static double ParseLongitude(java.lang.String s,
                                    java.lang.String d)
Parses longitude given values from GPS device.

Parameters:
s - Longitude String from GPS device in dddmm.mmE/W format.
d - Longitude hemisphere, "E" for eastern, "W" for western.
Returns:
Longitude parsed from GPS data, with appropriate sign based on hemisphere or '180.0' if invalid longitude provided.

ParseLongitude

public static double ParseLongitude(java.lang.String s,
                                    java.lang.String d,
                                    double dft)
Parses longitude given values from GPS device.

Parameters:
s - Longitude String from GPS device in ddmm.mm format.
d - Longitude hemisphere, "E" for eastern, "W" for western.
dft - The default latitude, if the specified latitude cannot be parsed
Returns:
Longitude parsed from GPS data, with appropriate sign based on hemisphere or 'dft' if invalid longitude provided.

_hasValidChecksum

protected boolean _hasValidChecksum(java.lang.String str)
Checks if NMEA-0183 formatted String has valid checksum by calculating the checksum of the payload and comparing that to the received checksum.

Parameters:
str - NMEA-0183 formatted String to be checked.
Returns:
true if checksum is valid, false otherwise.

calcXORChecksum

public static int calcXORChecksum(java.lang.String str,
                                  boolean includeAll)
Calculates/Returns the checksum for a NMEA-0183 formatted String

Parameters:
str - NMEA-0183 formatted String to be checksummed.
Returns:
Checksum computed from input.

main

public static void main(java.lang.String[] argv)
Main entry point for testing/debugging

Parameters:
argv - Comand-line arguments