Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ka2ddo.yaac.gps
Class GPSDistributor

    java.lang.Object
      org.ka2ddo.yaac.gps.GPSDistributor

    public class GPSDistributor

extends java.lang.Object

This class collects GPS data from GPS data sources and accumulates current position data for use by other parts of the application. It also allows collecting GPS data from remote GPS's (such as relayed over unlicensed ISM links from an amateur rocket) for display and reporting.

Method Summary
`void` | `addGpsDataListener(GpsDataListener l)` Register to be informed when local GPS position data is updated.
`java.lang.Object` | `extractGpsdJsonInfo(java.util.Map<java.lang.String,java.lang.Object> jsonMsg, boolean isLocal, java.lang.String source)` Decode a JSON message from GPSD.
`GpsFix` | `getCurrentFix()` get the current GPS fix information.
`static GPSDistributor` | `getInstance()` Get the singleton instance of GPSDistributor.
`float` | `getLocalBearingDegN(int stepBack)` Returns the current direction of motion in degrees relative to True North.
`float` | `getLocalSpeedKnots()` Return the current movement speed of the local station in knots (nautical miles per hour).
`GpsFix` | `getNamedGpsFix(java.lang.String name)` Get the current GPS fix information for the named source.
`SatelliteCatalog` | `getNamedSatCatalog(java.lang.String name)` Get the current GPS satellite catalog for the named source.
`java.lang.String[]` | `getNamedSources()` Get the names for the currently known named remote GPS receivers.
`SatelliteCatalog` | `getSatCatalog()` Get the current state of the GPS satellite constellation.
`java.util.ArrayList<GpsFix>` | `getShortTermHistory()` Get a copy of the recent position history of this station.
`java.lang.Object` | `parseNMEA0183DataLine(java.lang.String line, PortConnector connector, boolean isLocal, java.lang.String source)` Parse an NMEA-0183 standard data sentence into GPS data structure values.
`void` | `removeGpsDataListener(GpsDataListener l)` Stop being informed when GPS data is updated.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getInstance

    public static GPSDistributor getInstance()

  Get the singleton instance of GPSDistributor.

  Returns:
    single GPSDistributor instance

### parseNMEA0183DataLine

    public java.lang.Object parseNMEA0183DataLine(java.lang.String line,
                                                  PortConnector connector,
                                                  boolean isLocal,
                                                  java.lang.String source)

  Parse an NMEA-0183 standard data sentence into GPS data structure values.

  Parameters:
    `line` - String line to parse
    `connector` - PortConnector that received the sentence
    `isLocal` - boolean true if this is from this station's own GPS, not from some other station
    `source` - callsign of source (used only for error messages)
  Returns:
    populated data structure if valid sentence parsed, or null if parse failed or DeLorme TripMate was trying to be initialized

### extractGpsdJsonInfo

    public java.lang.Object extractGpsdJsonInfo(java.util.Map<java.lang.String,java.lang.Object> jsonMsg,
                                                boolean isLocal,
                                                java.lang.String source)

  Decode a JSON message from GPSD.

  Parameters:
    `jsonMsg` - Map<String,Object> as returned by Json.decodeJSON()
    `isLocal` - boolean true if this is for the GPS local to this station (not a remote GPS)
    `source` - String name of source, used for identifying specific remote GPS ports
  Returns:
    local GPS data structure filled in by the message, or null if not parseable
  See Also:
    `Json.decodeJSON(java.io.Reader, org.ka2ddo.yaac.io.PortConnector)`

### addGpsDataListener

    public void addGpsDataListener(GpsDataListener l)

  Register to be informed when local GPS position data is updated.

  Parameters:
    `l` - GpsDataListener to call when the GPS data is updated

### removeGpsDataListener

    public void removeGpsDataListener(GpsDataListener l)

  Stop being informed when GPS data is updated.

  Parameters:
    `l` - GpsDataListener to unregister

### getCurrentFix

    public GpsFix getCurrentFix()

  get the current GPS fix information.

  Returns:
    the active GpsFix object

### getNamedSources

    public java.lang.String[] getNamedSources()

  Get the names for the currently known named remote GPS receivers.

  Returns:
    array of String names for remote GPS receivers

### getNamedGpsFix

    public GpsFix getNamedGpsFix(java.lang.String name)

  Get the current GPS fix information for the named source. This cannot return the local GPS source for this station, but is intended for remote GPS sources connected to this YAAC by distance links.

  Parameters:
    `name` - String name of source
  Returns:
    GpsFix if data has been received for the specified name, or null if no data for the name

### getLocalSpeedKnots

    public float getLocalSpeedKnots()

  Return the current movement speed of the local station in knots (nautical miles per hour).

  Returns:
    speed in knots

### getLocalBearingDegN

    public float getLocalBearingDegN(int stepBack)

  Returns the current direction of motion in degrees relative to True North.

  Parameters:
    `stepBack` - number of position samples to use to get direction (larger numbers average out motion more)
  Returns:
    movement bearing in degrees from True North

### getSatCatalog

    public SatelliteCatalog getSatCatalog()

  Get the current state of the GPS satellite constellation. Note this information may be empty if the GPS receiver does not report $GPGSA or $GPGSV records.

  Returns:
    the SatelliteCatalog object containing the currently visible satellites

### getNamedSatCatalog

    public SatelliteCatalog getNamedSatCatalog(java.lang.String name)

  Get the current GPS satellite catalog for the named source. This cannot return the local GPS source for this station, but is intended for remote GPS sources connected to this YAAC by distance links.

  Parameters:
    `name` - String name of source
  Returns:
    SatelliteCatalog if data has been received for the specified name, or null if no data for the name

### getShortTermHistory

    public java.util.ArrayList<GpsFix> getShortTermHistory()

  Get a copy of the recent position history of this station.

  Returns:
    ArrayList containing GpsFix objects for the last 5 minutes

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD