Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jflight.gps.garmin
Class GarminGps  view GarminGps download GarminGps.java

java.lang.Object
  extended byjflight.gps.Gps
      extended byjflight.gps.garmin.GarminGps

public class GarminGps
extends jflight.gps.Gps

Support for the Garmin GPS-devices.

Since:
JDK1.1.x

Field Summary
private  int bufSize
           
private  int BUG_WORKAROUND
           
private  int CMD_START_PVT_DATA
           
private  int CMD_STOP_PVT_DATA
           
private  int CMD_TRANSFER_POS
           
private  int CMD_TRANSFER_PRX
           
private  int CMD_TRANSFER_RTE
           
private  int CMD_TRANSFER_TIME
           
private  int CMD_TRANSFER_TRK
           
private  int CMD_TRANSFER_WPT
           
private  byte[] dataBuf
           
private  int DEFAULT_GPS
           
private  java.lang.String Delim
           
private  int DLE
           
private  int ETX
           
private  Caps GpsCaps
           
private  int[][] GpsCapsList
          Capabilities of selected Garmin GPS Some Garmin devices behave different depending on the version.
private  int MAX_INT
           
private  byte[] msg
           
private  int NUM_GPS
           
private  int pid
           
private  int PID_ACK
           
private  int PID_CMD_DATA
           
private  int PID_NACK
           
private  int PID_PROD_DATA
           
private  int PID_PROD_REQ
           
private  int PID_RECORDS
           
private  int PID_RTE_HDR
           
private  int PID_RTE_LNK
           
private  int PID_RTE_WPT_DATA
           
private  int PID_TRK_DATA
           
private  int PID_TRK_HDR
           
private  int PID_WPT_DATA
           
private  int PID_XFER_CMPLT
           
private  int RTE_MODE
           
private  int RX_TIMEOUT
           
private  int TX_RETRY
           
private  int WPT_MODE
           
 
Fields inherited from class jflight.gps.Gps
ALL, APPEND, BAD_CRC, curRte, curWpt, dbg, debug, DIFF_UTC_GPS_TIME, GPS_TIMEOUT, gpsId, gpsID, IO_NOT_INITIALIZED, ioInit, is, os, prodDescr, PROTOCOL_NOT_SUPPORTED, REPLACE, RTE, RTE_NOT_FOUND_ERROR, rteCont, serialNrGPS, sPort, stdOutput, SUCCESS, swVersion, thermCont, today, TRK, TRK_ONLY, trkCont, TX_RETRY_ERROR, tz, WPT, WPT_NOT_FOUND_ERROR, wptCont, WRONG_INDEX_ERROR
 
Constructor Summary
GarminGps()
          Constructor GarminGps
 
Method Summary
 int getGpsId()
          Identify the GPS connected and return some descriptive information.
 java.lang.String getManufactoringID()
           
private  int getPacket(boolean idMode)
          Get packet Shall be able to deal with an unstable or lost connection.
 int getRte(int mode)
          Read all storted routes from the GPS and store it locally.
 int getTrack(long date, int trackNumber, int mode)
          Get the track (may consist of multiple segments) from the Gps.
private  void getWpt(java.io.DataInputStream in, int rteWptMode)
          Read a single waypoint from the input stream and save it in curWpt Data types D108/109 are required for devices passing altitude too
 int getWpts(int mode)
          Read all waypoints from the GPS and store them locally.
private  int sendASingleWpt(int index, byte packetId, int rteWptMode)
          send a single waypoint, without any header- or end-package:
 int sendRte(int rteNr, int index)
          Sends one route to the GPS.
private  int sendVarPacket(byte packetId, byte[] data, byte num)
          Send a packet with a variable size to the GPS If an IOException occurs, it retries some time, then rethrows the Exception Wait for (n)ack, if required Resends packet on NACK until too much retries Uses class-variable "msg"
 int sendWpt(int index)
          Sends one or all waypoint(s) to the GPS.
 
Methods inherited from class jflight.gps.Gps
absByte, deinitIOStreams, delay, findNearestWpts, getDebug, getNextWptForCheck, getShortInfo, initIOStreams, initNamesCheck, printDebug, printMessage, sendNearestWpts, setDebug, setMessageDestination, swap16, swap32, updateCheckedWpt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pid

private int pid

bufSize

private int bufSize

dataBuf

private byte[] dataBuf

GpsCaps

private Caps GpsCaps

msg

private byte[] msg

PID_ACK

private final int PID_ACK
See Also:
Constant Field Values

PID_NACK

private final int PID_NACK
See Also:
Constant Field Values

PID_CMD_DATA

private final int PID_CMD_DATA
See Also:
Constant Field Values

PID_XFER_CMPLT

private final int PID_XFER_CMPLT
See Also:
Constant Field Values

PID_RECORDS

private final int PID_RECORDS
See Also:
Constant Field Values

PID_WPT_DATA

private final int PID_WPT_DATA
See Also:
Constant Field Values

PID_TRK_DATA

private final int PID_TRK_DATA
See Also:
Constant Field Values

PID_RTE_WPT_DATA

private final int PID_RTE_WPT_DATA
See Also:
Constant Field Values

PID_RTE_HDR

private final int PID_RTE_HDR
See Also:
Constant Field Values

PID_RTE_LNK

private final int PID_RTE_LNK
See Also:
Constant Field Values

PID_TRK_HDR

private final int PID_TRK_HDR
See Also:
Constant Field Values

PID_PROD_REQ

private final int PID_PROD_REQ
See Also:
Constant Field Values

PID_PROD_DATA

private final int PID_PROD_DATA
See Also:
Constant Field Values

CMD_START_PVT_DATA

private final int CMD_START_PVT_DATA
See Also:
Constant Field Values

CMD_STOP_PVT_DATA

private final int CMD_STOP_PVT_DATA
See Also:
Constant Field Values

CMD_TRANSFER_WPT

private final int CMD_TRANSFER_WPT
See Also:
Constant Field Values

CMD_TRANSFER_TRK

private final int CMD_TRANSFER_TRK
See Also:
Constant Field Values

CMD_TRANSFER_TIME

private final int CMD_TRANSFER_TIME
See Also:
Constant Field Values

CMD_TRANSFER_RTE

private final int CMD_TRANSFER_RTE
See Also:
Constant Field Values

CMD_TRANSFER_PRX

private final int CMD_TRANSFER_PRX
See Also:
Constant Field Values

CMD_TRANSFER_POS

private final int CMD_TRANSFER_POS
See Also:
Constant Field Values

DLE

private final int DLE
See Also:
Constant Field Values

ETX

private final int ETX
See Also:
Constant Field Values

RX_TIMEOUT

private final int RX_TIMEOUT
See Also:
Constant Field Values

TX_RETRY

private final int TX_RETRY
See Also:
Constant Field Values

Delim

private final java.lang.String Delim
See Also:
Constant Field Values

WPT_MODE

private final int WPT_MODE
See Also:
Constant Field Values

RTE_MODE

private final int RTE_MODE
See Also:
Constant Field Values

BUG_WORKAROUND

private final int BUG_WORKAROUND
See Also:
Constant Field Values

MAX_INT

private final int MAX_INT
See Also:
Constant Field Values

GpsCapsList

private final int[][] GpsCapsList
Capabilities of selected Garmin GPS Some Garmin devices behave different depending on the version. The interval can be set in sw_version_beg / _end.


NUM_GPS

private final int NUM_GPS
See Also:
Constant Field Values

DEFAULT_GPS

private final int DEFAULT_GPS
See Also:
Constant Field Values
Constructor Detail

GarminGps

public GarminGps()
Constructor GarminGps

Method Detail

getManufactoringID

public java.lang.String getManufactoringID()

sendVarPacket

private int sendVarPacket(byte packetId,
                          byte[] data,
                          byte num)
                   throws jflight.gps.GpsTimeoutException,
                          java.io.IOException
Send a packet with a variable size to the GPS If an IOException occurs, it retries some time, then rethrows the Exception Wait for (n)ack, if required Resends packet on NACK until too much retries Uses class-variable "msg"


getPacket

private int getPacket(boolean idMode)
               throws java.io.IOException,
                      jflight.gps.GpsTimeoutException
Get packet Shall be able to deal with an unstable or lost connection. What may happen: - There is no connection at all: E.g. wrong interface setup -> timeout detection - The connection gets lost: No more chars come in -> timeout detection - The connection is unstable: Some chars are missing -> the sequence 0x10 - 0x03 occurs out-of-order, timeout detection In any case only a single packet (or two, if the devices switch their client-server releationship) can get lost. Detecting a wrong byte-sequence is quite difficult and not implemented so far, just timeout detection. If a timout occurs, the missing bytes will not be resent. In case of (N)ACK, some GPS will resend it after 2-5s, but this cannot be relied on. To be sure a NAVCK should be assumed an the last transfer should be done again. In case of an interrupted data-transfer a NACK should be sent by the PC to request retransmission. changes: pid, dataBuf, bufSize


getGpsId

public int getGpsId()
             throws jflight.gps.GpsTimeoutException,
                    java.io.IOException
Identify the GPS connected and return some descriptive information. For the main class this function is for GPS-type detection (in case other devices are supported too) and informative use.
Modifies gpsId, swVersion, prodDescr


getWpt

private void getWpt(java.io.DataInputStream in,
                    int rteWptMode)
             throws java.io.IOException
Read a single waypoint from the input stream and save it in curWpt Data types D108/109 are required for devices passing altitude too


getWpts

public int getWpts(int mode)
            throws jflight.gps.GpsTimeoutException,
                   java.io.IOException
Read all waypoints from the GPS and store them locally.


sendASingleWpt

private int sendASingleWpt(int index,
                           byte packetId,
                           int rteWptMode)
                    throws java.io.IOException,
                           jflight.gps.GpsTimeoutException
send a single waypoint, without any header- or end-package:


sendWpt

public int sendWpt(int index)
            throws jflight.gps.GpsTimeoutException,
                   java.io.IOException
Sends one or all waypoint(s) to the GPS. Uses the waypoint with the specified index in the Vector of all waypoints. If index is equalt to -1, then all wpts are sent.
Note: It's important that the comment is null-terminated (doesn't match the garmin description).


getTrack

public int getTrack(long date,
                    int trackNumber,
                    int mode)
             throws jflight.gps.GpsTimeoutException,
                    java.io.IOException
Get the track (may consist of multiple segments) from the Gps. Adds only trackpoints from the date specified.
It also removes any segments that are considered not to be a track because the distance moved is too small (tbd: add parameter!).
This function is prepared to manage multiple tracks for displaying / analysis (param: trackNumber).
New: Supports A301 transfer protocol


sendRte

public int sendRte(int rteNr,
                   int index)
            throws jflight.gps.GpsTimeoutException,
                   java.io.IOException
Sends one route to the GPS. Route null is the active route. If a waypoint isn't found in the list, remaining waypoints are not transmitted any more. New: Transfer protocol 201 is supportted, fixed to "line mode"; experimental


getRte

public int getRte(int mode)
           throws jflight.gps.GpsTimeoutException,
                  java.io.IOException
Read all storted routes from the GPS and store it locally. The waypoints that make up a specific route are read in. If they don't already exist, they will be added to the list of existing waypoints. This is checked by the name. Existing routes will be The route's waypoints are defined by the list of names of waypoints only to avoid ambiguities. New: Transfer protocl A201 is partly supported (link data will be ignored)