bt747.model
Class Model

java.lang.Object
  extended by bt747.model.AppSettings
      extended by bt747.model.Model
All Implemented Interfaces:
EventPoster, BT747Thread, GPSListener
Direct Known Subclasses:
J2SEAppModel

public class Model
extends AppSettings
implements GPSListener, EventPoster

The model in the Model-View-Controller pattern. Information regarding the state of the GPS device or settings must use this model interface.

Author:
Mario De Weerd

Field Summary
static int ARRAY_LOGTYPE
          log type (Array log type - must call specific function to get array).
static int BIN_LOGTYPE
          log type (BIN log type).
static int CSV_LOGTYPE
          CSV log type (Comma Separated Values).
static int DOWNLOAD_FILLED
          Download reported filled memory.
static int DOWNLOAD_FULL
          Download full memory.
static int DOWNLOAD_SMART
          Download reported memory - incremental.
static int EXTERNAL_LOGTYPE
          Call upon an external tool.
static int GMAP_LOGTYPE
          GMAP log type (Google Map - html output).
static int GOOGLE_MAP_STATIC_URL_LOGTYPE
          Get static google map.
static int GPX_LOGTYPE
          GPX log type (gpx format).
static int KML_LOGTYPE
          KML log type ('Google Earth' format).
static int KMZ_LOGTYPE
          log type (KMZ log type).
static int MULTI_LOGTYPE
          log type (Array log type - must call specific function to get array).
static int NMEA_LOGTYPE
          NMEA log type (NMEA strings - text format - similar to GPS output).
static int NO_LOG_LOGTYPE
          Indicate that the log type does not reference any log type.
static int OSM_LOGTYPE
          GPX for OSM log type (gpx format) [same as GPX but limited output).
static int OSM_UPLOAD_LOGTYPE
          Upload GPX for OSM (upload handled by caller, specific output file).
static int PLT_LOGTYPE
          Compe GPS log type (Writes PLT and WPT files).
static int POSTGIS_LOGTYPE
          Get PostGis commands.
static int SQL_LOGTYPE
          Get Sql commands.
static int SR_LOGTYPE
          log type (TRL holux log type).
static int TRK_LOGTYPE
          log type (Writes TRK and WPT files).
static int TRL_LOGTYPE
          log type (TRL holux log type).
 
Fields inherited from class bt747.model.AppSettings
ADVFILTACTIVE, AGPSURL, BAUDRATE, C_GMAP_KEY_FILENAME, CARD, COLOR_INVALIDTRACK, COLOR_VALIDTRACK, CSV_DECIMAL, CSV_FIELD_SEP, CSV_SAT_SEP, DECODEGPS, DEVICE_PROTOCOL, DISABLELOGDURINGDOWNLOAD, DISTANCE_CALC_MODE_ALWAYS, DISTANCE_CALC_MODE_NONE, DISTANCE_CALC_MODE_WHEN_MISSING, DISTANCE_CALCULATION_MODE, DUMMY_AGPS_STRING, EXTCOMMAND, EXTTYPE, FILEFIELDFORMAT, FILETIMEOFFSET, FILETIMEOFFSETOLD, FONTSCALE, FORCE_HOLUXM241, FREETEXTPORT, GOOGLEMAPKEY, GPSTIMEOFFSETHOURS_OBSOLETE, GPSTIMEOFFSETQUARTERS, GPSTYPE, GPX_LINK_INFO, GPXTRKSEGBIG, GPXUTC0, HEIGHT_AUTOMATIC, HEIGHT_CONVERSION_MODE, HEIGHT_MSL_TO_WGS84, HEIGHT_NOCHANGE, HEIGHT_WGS84_TO_MSL, IMAGEDIR, IMPERIAL, IS_FIRST_CONNECTION_TO_INIT, IS_GPX_1_1, IS_NEW_TRACK_WHEN_LOG_ON, IS_RECORDNBR_IN_LOGS, IS_STOP_LOGGING_ON_CONNECT, IS_TRAVERSABLE, IS_USE_PRECISE_GEOID, IS_WRITE_TRACKPOINT_COMMENT, IS_WRITE_TRACKPOINT_NAME, KML_ALTITUDEMODE, LANGUAGE, LOGAHEAD, LOGFILEPATH, LOGFILERELPATH, logFiles, MAPCACHEDIRECTORY, MAPTYPE, MAX_DISTANCE, MAX_HDOP, MAX_PDOP, MAX_RECCOUNT, MAX_SPEED, MAX_VDOP, MIN_DISTANCE, MIN_NSAT, MIN_RECCOUNT, MIN_SPEED, NMEAUTC0, OPENPORTATSTARTUP, OSMLOGIN, OSMPASS, OUTPUTDIRPATH, OUTPUTFILESPLITTYPE, OUTPUTLOGCONDITIONS, PORTNBR, POS_SRV_AUTOSTART, POS_SRV_FILE, POS_SRV_HOSTNAME, POS_SRV_PASS, POS_SRV_PERIOD, POS_SRV_PORT, POS_SRV_USER, REPORTFILEBASE, REPORTFILEBASEPATH, SETTING1_DGPS, SETTING1_DIST, SETTING1_FIX, SETTING1_LOG_FORMAT, SETTING1_LOG_OVR, SETTING1_NMEA, SETTING1_SBAS, SETTING1_SPEED, SETTING1_TEST, SETTING1_TIME, SIZE, SPLIT_DISTANCE, SPLIT_ONE_FILE, SPLIT_ONE_FILE_PER_DAY, SPLIT_ONE_FILE_PER_TRACK, TAG_MAXTIMEDIFFERENCE, TAG_OVERRIDEPOSITIONS, TAGGEDFILE_TEMPLATE, TRKPT_RCR, TRKPT_VALID, TRKSEP, VERSION, WAYPT_RCR, WAYPT_VALID
 
Constructor Summary
Model()
          The default constructor of the model.
 
Method Summary
 java.lang.String getBTAddr()
           
 int getDatum()
           
 int getDgpsMode()
           
 int getDownloadMethod()
          Get the download method.
 int getDtBaudRate()
           
 int getDtGGA_Period()
           
 int getDtGLL_Period()
           
 int getDtGSA_Period()
           
 int getDtGSV_Period()
           
 int getDtMCHN_Period()
           
 int getDtRMC_Period()
           
 int getDtUpdateRate()
           
 int getDtUserOptionTimesLeft()
           
 int getDtVTG_Period()
           
 int getDtZDA_Period()
           
 int getEndAddr()
          Get the end address for the log download.
 int getEstimatedNbrRecords(int logFormat)
          Get the maximum number of record that can be logged with the provided log format.
 int getEstimatedNbrRecordsFree(int logFormat)
           
 int getFilterEndTime()
          Get the filter end time.
 int getFilterStartTime()
          Get the filter start date.
 java.lang.String getFirmwareVersion()
           
 java.lang.String getFlashDesc()
           
 int getFlashManuProdID()
          Get the manufacturer id of the flash memory.
 java.lang.String getHoluxName()
           
 int getLastConversionOngoing()
           
 int getLogDistanceInterval()
           
 GPSFilter[] getLogFilters()
           
 int getLogFixPeriod()
           
 int getLogFormat()
           
 int getLogSpeedInterval()
           
 int getLogTimeInterval()
           
 java.lang.String getMainVersion()
           
 java.lang.String getModelStr()
           
 java.lang.String getMtkLogVersion()
          Get the SW Logger Version of the MTK device.
 int getNextReadAddr()
          Get the log address that we are now expecting to receive data for.
 int getNMEAPeriod(int i)
           
 int getOutstandingCommandsCount()
           
 int getRcrMask(int logFilterType)
          Get the record reason mask.
 int getStartAddr()
          Get the start address for the log download.
 int getValidMask(int logFilterType)
          Get the log point validity mask.
 void gpsEvent(GpsEvent event)
           
 boolean isAvailable(int dataType)
          Indicates if the given data is available.
 boolean isConnected()
          Determine the connection status
 boolean isConversionOngoing()
           
static boolean isDebug()
          Get the debug status.
 boolean isDebugConn()
          Get the connection debug status.
 boolean isDownloadOnGoing()
          Get 'download ongoing' status.
 boolean isHolux()
           
 boolean isIncremental()
          Deprecated.  
 boolean isInitialLogOverwrite()
           
 boolean isLogFullOverwrite()
          Get the devices 'log overwrite' or 'log stop when full' status.
 boolean isLoggerNeedsFormat()
          Value provided by the logger indicating that the device needs to be initialised/formatted.
 boolean isLoggingActive()
          Get the 'logging activation' status of the device.
 boolean isPowerSaveEnabled()
           
 boolean isSBASEnabled()
           
 boolean isSBASTestEnabled()
           
 int logFreeMemUsefullSize()
           
 int logMemSize()
          Get memory size.
 int logMemUsed()
          Get the amount of memory that is filled with data on the device.
 int logMemUsedPercent()
          Get the amount of memory that is filled with data on the device.
 int logMemUsefullSize()
           
 int logNbrLogPts()
          Get the number of positions that are currently stored in the memory of the GPS device.
 MtkModel mtkModel()
           
 void setDownloadMethod(int downloadMethod)
          Set the download method.
 
Methods inherited from class bt747.model.AppSettings
addListener, defaultSettings, getBooleanOpt, getChunkSize, getDefaultBaseDirPath, getDefaultChunkSize, getDownloadTimeOut, getFloatOpt, getIntOpt, getNMEAset, getPath, getStringOpt, init, isDefaultTraversable, isSolveMacLagProblem, isStoredSetting1, postEvent, removeListener, run, setChunkSize, setDefaultBaseDirPath, setDefaultChunkSize, setDefaultTraversable, setDownloadTimeOut, setSolveMacLagProblem, started, stopped
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface bt747.model.EventPoster
postEvent
 

Field Detail

NO_LOG_LOGTYPE

public static final int NO_LOG_LOGTYPE
Indicate that the log type does not reference any log type.

See Also:
Constant Field Values

CSV_LOGTYPE

public static final int CSV_LOGTYPE
CSV log type (Comma Separated Values).

See Also:
Constant Field Values

GMAP_LOGTYPE

public static final int GMAP_LOGTYPE
GMAP log type (Google Map - html output).

See Also:
Constant Field Values

GPX_LOGTYPE

public static final int GPX_LOGTYPE
GPX log type (gpx format).

See Also:
Constant Field Values

KML_LOGTYPE

public static final int KML_LOGTYPE
KML log type ('Google Earth' format).

See Also:
Constant Field Values

NMEA_LOGTYPE

public static final int NMEA_LOGTYPE
NMEA log type (NMEA strings - text format - similar to GPS output).

See Also:
Constant Field Values

PLT_LOGTYPE

public static final int PLT_LOGTYPE
Compe GPS log type (Writes PLT and WPT files).

See Also:
Constant Field Values

TRK_LOGTYPE

public static final int TRK_LOGTYPE
log type (Writes TRK and WPT files).

See Also:
Constant Field Values

BIN_LOGTYPE

public static final int BIN_LOGTYPE
log type (BIN log type).

See Also:
Constant Field Values

TRL_LOGTYPE

public static final int TRL_LOGTYPE
log type (TRL holux log type).

See Also:
Constant Field Values

SR_LOGTYPE

public static final int SR_LOGTYPE
log type (TRL holux log type).

See Also:
Constant Field Values

KMZ_LOGTYPE

public static final int KMZ_LOGTYPE
log type (KMZ log type).
Not provided by the default controller since not implemented on all systems.
Log type provided for application implementation.

See Also:
Constant Field Values

ARRAY_LOGTYPE

public static final int ARRAY_LOGTYPE
log type (Array log type - must call specific function to get array).
Not provided by the default controller since not implemented on all systems.
Log type provided for application implementation.

See Also:
Constant Field Values

MULTI_LOGTYPE

public static final int MULTI_LOGTYPE
log type (Array log type - must call specific function to get array).
Not provided by the default controller since not implemented on all systems.
Log type provided for application implementation.

See Also:
Constant Field Values

OSM_LOGTYPE

public static final int OSM_LOGTYPE
GPX for OSM log type (gpx format) [same as GPX but limited output).

See Also:
Constant Field Values

OSM_UPLOAD_LOGTYPE

public static final int OSM_UPLOAD_LOGTYPE
Upload GPX for OSM (upload handled by caller, specific output file).

See Also:
Constant Field Values

EXTERNAL_LOGTYPE

public static final int EXTERNAL_LOGTYPE
Call upon an external tool.

See Also:
Constant Field Values

GOOGLE_MAP_STATIC_URL_LOGTYPE

public static final int GOOGLE_MAP_STATIC_URL_LOGTYPE
Get static google map.

See Also:
Constant Field Values

SQL_LOGTYPE

public static final int SQL_LOGTYPE
Get Sql commands.

See Also:
Constant Field Values

POSTGIS_LOGTYPE

public static final int POSTGIS_LOGTYPE
Get PostGis commands.

See Also:
Constant Field Values

DOWNLOAD_FILLED

public static final int DOWNLOAD_FILLED
Download reported filled memory.

See Also:
Constant Field Values

DOWNLOAD_SMART

public static final int DOWNLOAD_SMART
Download reported memory - incremental.

See Also:
Constant Field Values

DOWNLOAD_FULL

public static final int DOWNLOAD_FULL
Download full memory.

See Also:
Constant Field Values
Constructor Detail

Model

public Model()
The default constructor of the model.

Method Detail

isConnected

public final boolean isConnected()
Determine the connection status

Returns:
true if the connection is made

getOutstandingCommandsCount

public final int getOutstandingCommandsCount()
Returns:
Get the number of commands waiting for a response.

getLastConversionOngoing

public final int getLastConversionOngoing()
Returns:
The type of the last conversion that was ongoing lastConversionOngoing

isConversionOngoing

public final boolean isConversionOngoing()
Returns:
the conversionOngoing

getValidMask

public final int getValidMask(int logFilterType)
Get the log point validity mask.

Parameters:
logFilterType - The type of log filter that we request the information for (index of the log filter).
Returns:
The log point validity filter mask. This corresponds to 'no fix', '2d fix', '3d fix', 'Estimated', ... filtering.

getRcrMask

public final int getRcrMask(int logFilterType)
Get the record reason mask.

Parameters:
logFilterType - The type of log filter that we request the information for (index of the log filter).
Returns:
The record reason filter mask. This corresponds to time, speed, distance, button, ... record reasons filtering.

getLogFilters

public final GPSFilter[] getLogFilters()
Returns:
the logFilters

getFilterStartTime

public final int getFilterStartTime()
Get the filter start date.

Returns:
the startDate

getFilterEndTime

public final int getFilterEndTime()
Get the filter end time.

Returns:
the filter end time.

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

isDownloadOnGoing

public final boolean isDownloadOnGoing()
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

isIncremental

public final boolean isIncremental()
Deprecated. 

Get the 'incremental download' status.

Returns:
true if the Incremental log download is activated.

getDownloadMethod

public final int getDownloadMethod()
Get the download method.

Returns:
The set download method. Possible values: DOWNLOAD_FILLED DOWNLOAD_FULL DOWNLOAD_SMART

setDownloadMethod

public final void setDownloadMethod(int downloadMethod)
Set the download method.
Possible values: DOWNLOAD_FILLED DOWNLOAD_FULL DOWNLOAD_SMART


mtkModel

public final MtkModel mtkModel()
Returns:
The gpsModel instantiation.

isLoggingActive

public final boolean isLoggingActive()
Get the 'logging activation' status of the device.

Returns:
true if the device is currently logging positions to memory.

isLoggerNeedsFormat

public final boolean isLoggerNeedsFormat()
Value provided by the logger indicating that the device needs to be initialised/formatted.

Returns:
true if the logger needs formatting.

logMemSize

public final int logMemSize()
Get memory size.

Returns:
The ammount of memory available in bytes.

logMemUsed

public final int logMemUsed()
Get the amount of memory that is filled with data on the device.

Returns:
The amount of memory used in bytes. This includes the memory used for other information than locations (e.g., headers)

logMemUsedPercent

public final int logMemUsedPercent()
Get the amount of memory that is filled with data on the device.

Returns:
The amount of memory used in percent. The percentage represents the fraction of useful memory. The device may have more memory, but not all memory can be used to log actual points.

logNbrLogPts

public final int logNbrLogPts()
Get the number of positions that are currently stored in the memory of the GPS device.

Returns:
The number of logged positions.

getMtkLogVersion

public final java.lang.String getMtkLogVersion()
Get the SW Logger Version of the MTK device.

Returns:
Version of the MTK Logger SW.

getMainVersion

public final java.lang.String getMainVersion()

getFirmwareVersion

public final java.lang.String getFirmwareVersion()

getModelStr

public final java.lang.String getModelStr()

getFlashManuProdID

public final int getFlashManuProdID()
Get the manufacturer id of the flash memory.

Returns:
The letter code of the manufacturer.

getFlashDesc

public final java.lang.String getFlashDesc()

getLogFormat

public final int getLogFormat()

isHolux

public final boolean isHolux()

logMemUsefullSize

public final int logMemUsefullSize()

logFreeMemUsefullSize

public final int logFreeMemUsefullSize()

getDtUpdateRate

public final int getDtUpdateRate()

getDtGLL_Period

public final int getDtGLL_Period()

getDtRMC_Period

public final int getDtRMC_Period()

getDtVTG_Period

public final int getDtVTG_Period()

getDtGSA_Period

public final int getDtGSA_Period()

getDtGSV_Period

public final int getDtGSV_Period()

getDtGGA_Period

public final int getDtGGA_Period()

getDtZDA_Period

public final int getDtZDA_Period()

getDtMCHN_Period

public final int getDtMCHN_Period()

getDtBaudRate

public final int getDtBaudRate()

getDtUserOptionTimesLeft

public final int getDtUserOptionTimesLeft()

getHoluxName

public final java.lang.String getHoluxName()

getBTAddr

public final java.lang.String getBTAddr()

getNMEAPeriod

public final int getNMEAPeriod(int i)

getLogTimeInterval

public final int getLogTimeInterval()

getLogSpeedInterval

public final int getLogSpeedInterval()

getLogDistanceInterval

public final int getLogDistanceInterval()

getLogFixPeriod

public final int getLogFixPeriod()

getDgpsMode

public final int getDgpsMode()

isLogFullOverwrite

public final boolean isLogFullOverwrite()
Get the devices 'log overwrite' or 'log stop when full' status.

Returns:
true - The device will overwrite data when the logger memory is full.
false - The device will stop logging data when the logger memory is full.

isInitialLogOverwrite

public final boolean isInitialLogOverwrite()

isSBASEnabled

public final boolean isSBASEnabled()

isSBASTestEnabled

public final boolean isSBASTestEnabled()

isPowerSaveEnabled

public final boolean isPowerSaveEnabled()

getDatum

public final int getDatum()

getEstimatedNbrRecords

public final int getEstimatedNbrRecords(int logFormat)
Get the maximum number of record that can be logged with the provided log format.

Parameters:
logFormat - The log format to use to calculate the number of records.
Returns:
The number of records that can be logged at most.

getEstimatedNbrRecordsFree

public final int getEstimatedNbrRecordsFree(int logFormat)

isDebug

public static final boolean isDebug()
Get the debug status. This concerns 'high level' debug information.

Returns:
true - Debug is active

isAvailable

public final boolean isAvailable(int dataType)
Indicates if the given data is available. That means that a request was issued to the device and that the device responded with a value.

Parameters:
dataType - For example: MtkModel.DATA_MEM_USED.
Returns:
true if data is already available.

isDebugConn

public final boolean isDebugConn()
Get the connection debug status. This concerns the low level debug information regarding the GPS connection.

Returns:
true - connection debug is active.

gpsEvent

public final void gpsEvent(GpsEvent event)
Specified by:
gpsEvent in interface GPSListener