gps.mvc
Class GpsModel

java.lang.Object
  extended by gps.mvc.GpsModel
All Implemented Interfaces:
ProtocolConstants

public class GpsModel
extends java.lang.Object
implements ProtocolConstants

Refactoring ongoing (split in Model and Controller). GPSstate maintains a higher level state of communication with the GPS device. It currently contains very specific commands MTK loggers but that could change in the future by extending GPSstate with such features in a derived class. Must still move stuff to MtkController, move to MtkModel mostly done.

Author:
Mario De Weerd
See Also:
GPSrxtx

Field Summary
 
Fields inherited from interface gps.ProtocolConstants
PROTOCOL_HOLUX_PHLX, PROTOCOL_INVALID, PROTOCOL_MTK, PROTOCOL_SIRFIII, PROTOCOL_SKYTRAQ, PROTOCOL_WONDEPROUD
 
Constructor Summary
GpsModel(GPSrxtx gpsRxTx, int protocol)
          Initialiser.
 
Method Summary
 void addListener(GPSListener l)
          add a listener to event thrown by this class
 boolean analyseNMEA(java.lang.String[] sNmea)
           
 int getEndAddr()
          Get the end address for the log download.
 GPSRecord getGpsRecord()
           
 GpsLinkHandler getHandler()
          Start of code that should be part of the final interface after refactoring.
 MtkModel getMtkModel()
           
 int getNextReadAddr()
          Get the log address that we are now expecting to receive data for.
 int getOutStandingCmdsCount()
          Get the number of Cmds that are still waiting to be sent and/or waiting for acknowledgement.
 int getStartAddr()
          Get the start address for the log download.
 boolean getStats()
           
 boolean isGpsDecode()
           
 boolean isLogDownloadOnGoing()
          Get 'download ongoing' status.
 void removeListener(GPSListener l)
           
 void sendCmd(GpsLinkExecCommand s)
          Send an NMEA string to the link.
 void setAllUnavailable()
          Invalidates any data previously fetched from the device.
 void setGpsDecode(boolean gpsDecode)
           
 void setGPSRxtx(GPSrxtx gpsRxTx)
          Start
 void setProtocol(int protocol)
           
 void setStats(boolean stats)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GpsModel

public GpsModel(GPSrxtx gpsRxTx,
                int protocol)
Initialiser. Will also create the model(s) in the lower layers.

Method Detail

setProtocol

public final void setProtocol(int protocol)

getMtkModel

public final MtkModel getMtkModel()

getHandler

public final GpsLinkHandler getHandler()
Start of code that should be part of the final interface after refactoring.


setGPSRxtx

public final void setGPSRxtx(GPSrxtx gpsRxTx)
Start

Parameters:
gpsRxTx -

setStats

public final void setStats(boolean stats)

getStats

public final boolean getStats()

setAllUnavailable

public void setAllUnavailable()
Invalidates any data previously fetched from the device.


analyseNMEA

public final boolean analyseNMEA(java.lang.String[] sNmea)

isGpsDecode

public final boolean isGpsDecode()
Returns:
Returns the gpsDecode.

setGpsDecode

public final void setGpsDecode(boolean gpsDecode)
Parameters:
gpsDecode - Activate gps decoding if true, do not decode if false. This may improve performance.

getGpsRecord

public final GPSRecord getGpsRecord()

addListener

public final void addListener(GPSListener l)
add a listener to event thrown by this class


removeListener

public final void removeListener(GPSListener l)

sendCmd

public final void sendCmd(GpsLinkExecCommand s)
Send an NMEA string to the link. The parameter should not include the checksum - this is added by the method.

Parameters:
s - NMEA string to send.

getOutStandingCmdsCount

public final int getOutStandingCmdsCount()
Get the number of Cmds that are still waiting to be sent and/or waiting for acknowledgement.

Returns:
Number of commands still waiting to be sent.

getStartAddr

public final int getStartAddr()
Get the start address for the log download. To be used for the download progress bar.

Returns:
the startAddr

getEndAddr

public final int getEndAddr()
Get the end address for the log download. To be used for the download progress bar.

Returns:
the endAddr

isLogDownloadOnGoing

public final boolean isLogDownloadOnGoing()
Get 'download ongoing' status.

Returns:
true if the download is currently ongoing. This is usefull for the download progress bar.

getNextReadAddr

public final int getNextReadAddr()
Get the log address that we are now expecting to receive data for. This is usefull for the download progress bar.

Returns:
the nextReadAddr