gps.mvc
Class MtkModel

java.lang.Object
  extended by gps.mvc.MtkModel
All Implemented Interfaces:
EventPoster
Direct Known Subclasses:
HoluxModel, SkytraqModel, WPModel

public class MtkModel
extends java.lang.Object
implements EventPoster

Model for Mtk devices. Refactoring ongoing.

Author:
Mario De Weerd.

Field Summary
static int C_OK_DATUM
           
static int C_OK_DGPS
           
static int C_OK_DIST
           
static int C_OK_FIX
           
static int C_OK_FORMAT
           
static int C_OK_NMEA
           
static int C_OK_SBAS
           
static int C_OK_SBAS_TEST
           
static int C_OK_SPEED
           
static int C_OK_TIME
           
static int DATA_AGPS_STORED_RANGE
          The stored AGPS data range.
static int DATA_BT_MAC_ADDR
          The device's BT mac address.
static int DATA_DATUM_MODE
          The DATUM used by the logger.
static int DATA_DEVICE_NAME
          The Holux name of the device.
static int DATA_DGPS_MODE
          The DGPS usage mode.
static int DATA_FIX_PERIOD
          The fix period.
static int DATA_FLASH_TYPE
           
static int DATA_FLASH_USER_OPTION
          The User Configurable Options stored in flash.
static int DATA_INITIAL_LOG
          Some information from the log regarding the initial log format.
static int DATA_LAST_LOG_BLOCK
          Some significant data in the last block.
static int DATA_LOG_DISTANCE_INTERVAL
          The log distance interval.
static int DATA_LOG_FLASH_SECTOR_STATUS
          The flash sector status.
static int DATA_LOG_FLASH_STATUS
          The flash status - needed for erase.
static int DATA_LOG_FORMAT
          Current device log format.
static int DATA_LOG_OVERWRITE_STATUS
          Indicates if data is in overwrite or stop mode.
static int DATA_LOG_SPEED_INTERVAL
          The log speed interval.
static int DATA_LOG_STATUS
          Get logger status.
static int DATA_LOG_TIME_INTERVAL
          The log time interval.
static int DATA_LOG_VERSION
          The Logger Version.
static int DATA_MEM_PTS_LOGGED
          The number of positions logged in logger memory.
static int DATA_MEM_USED
          Amount of memory used by the device.
static int DATA_MTK_RELEASE
           
static int DATA_MTK_VERSION
           
static int DATA_NMEA_OUTPUT_PERIODS
          The NMEA output period.
static int DATA_POWERSAVE_STATUS
          Indicates the power save status (for testing only).
static int DATA_SBAS_STATUS
          Indicates if SBAS satellites are used.
static int DATA_SBAS_TEST_STATUS
          Indicates if SBAS test satellites are used.
 boolean loggerIsFull
           
 int logMemUsedPercent
           
 int logNbrLogPts
           
 
Constructor Summary
MtkModel(GpsModel context, GpsLinkHandler handler)
           
 
Method Summary
 boolean analyseMtkBinData(MtkBinTransportMessageModel response)
           
 boolean analyseMtkNmea(java.lang.String[] sNmea)
           
 int getAgpsDataCount()
           
 BT747Time getAgpsEnd2Time()
           
 BT747Time getAgpsEndTime()
           
 BT747Time getAgpsStart2Time()
           
 BT747Time getAgpsStartTime()
           
 java.lang.String getBtMacAddr()
          Returns the current mac address for bluetooth (Holux 241 devices).
 GpsModel getContext()
           
 int getDatum()
           
 int getDgpsMode()
           
 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.
 java.lang.String getFirmwareVersion()
           
 java.lang.String getFlashDesc()
           
 int getFlashManuProdID()
           
 GpsLinkHandler getHandler()
           
 java.lang.String getHoluxName()
           
 int getLogDistanceInterval()
           
 int getLogFixPeriod()
           
 int getLogFormat()
           
 int getLogMemSize()
          Get the total size of the memory.
 int getLogMemUsed()
           
 int getLogSpeedInterval()
           
 int getLogTimeInterval()
           
 java.lang.String getMainVersion()
           
 java.lang.String getModel()
           
 java.lang.String getMtkLogVersion()
           
 int getNextReadAddr()
          Get the log address that we are now expecting to receive data for.
 int getNMEAPeriod(int i)
           
 int getStartAddr()
          Get the start address for the log download.
 boolean hasAgps()
           
 boolean isDataAvailable(int dataType)
           
 boolean isDataOK(int mask)
           
 boolean isDataSupported(int dataType)
           
 boolean isHolux()
           
 boolean isInitialLogOverwrite()
           
 boolean isLogDownloadOngoing()
          Get 'download ongoing' status.
 boolean isLogFullOverwrite()
           
 boolean isLoggerNeedsFormat()
           
 boolean isLoggingActive()
          Get the 'logging activation' status of the device.
 boolean isLoggingDisabled()
          Get the 'automatic logging activation' status of the device.
 boolean isPowerSaveEnabled()
           
 boolean isSBASEnabled()
           
 boolean isSBASTestEnabled()
           
 boolean isTimeDistanceLogConditionExclusive()
           
 int logFreeMemUsefullSize()
           
 int logMemUsefullSize()
           
 void postEvent(ModelEvent e)
           
 void setAutoFetch(boolean isAuto)
           
 void setDatum(int datum)
           
 void setHolux(boolean forceHolux)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logNbrLogPts

public int logNbrLogPts

logMemUsedPercent

public int logMemUsedPercent

loggerIsFull

public boolean loggerIsFull

C_OK_FIX

public static final int C_OK_FIX
See Also:
Constant Field Values

C_OK_DGPS

public static final int C_OK_DGPS
See Also:
Constant Field Values

C_OK_SBAS

public static final int C_OK_SBAS
See Also:
Constant Field Values

C_OK_NMEA

public static final int C_OK_NMEA
See Also:
Constant Field Values

C_OK_SBAS_TEST

public static final int C_OK_SBAS_TEST
See Also:
Constant Field Values

C_OK_DATUM

public static final int C_OK_DATUM
See Also:
Constant Field Values

C_OK_TIME

public static final int C_OK_TIME
See Also:
Constant Field Values

C_OK_SPEED

public static final int C_OK_SPEED
See Also:
Constant Field Values

C_OK_DIST

public static final int C_OK_DIST
See Also:
Constant Field Values

C_OK_FORMAT

public static final int C_OK_FORMAT
See Also:
Constant Field Values

DATA_FLASH_TYPE

public static final int DATA_FLASH_TYPE
See Also:
Constant Field Values

DATA_MEM_PTS_LOGGED

public static final int DATA_MEM_PTS_LOGGED
The number of positions logged in logger memory.

See Also:
Constant Field Values

DATA_MEM_USED

public static final int DATA_MEM_USED
Amount of memory used by the device.

See Also:
Constant Field Values

DATA_LOG_FORMAT

public static final int DATA_LOG_FORMAT
Current device log format. Get value through getLogFormat()

See Also:
Constant Field Values

DATA_MTK_VERSION

public static final int DATA_MTK_VERSION
See Also:
Constant Field Values

DATA_MTK_RELEASE

public static final int DATA_MTK_RELEASE
See Also:
Constant Field Values

DATA_INITIAL_LOG

public static final int DATA_INITIAL_LOG
Some information from the log regarding the initial log format.

See Also:
Constant Field Values

DATA_LOG_STATUS

public static final int DATA_LOG_STATUS
Get logger status.
Retrieve actual values through getters: one can retrieve the data using:
- isLoggingActive()
- loggerIsFull (not currently public)
- isLoggerNeedsFormat()
- isLoggingDisabled() (not currently public)

See Also:
Constant Field Values

DATA_LOG_VERSION

public static final int DATA_LOG_VERSION
The Logger Version. Get value using getMtkLogVersion().

See Also:
Constant Field Values

DATA_LAST_LOG_BLOCK

public static final int DATA_LAST_LOG_BLOCK
Some significant data in the last block. If not 0xFFFFFFFF, last block is in use.

See Also:
Constant Field Values

DATA_DEVICE_NAME

public static final int DATA_DEVICE_NAME
The Holux name of the device.

See Also:
Constant Field Values

DATA_LOG_TIME_INTERVAL

public static final int DATA_LOG_TIME_INTERVAL
The log time interval.
Get value through getLogTimeInterval().

See Also:
Constant Field Values

DATA_LOG_SPEED_INTERVAL

public static final int DATA_LOG_SPEED_INTERVAL
The log speed interval.
Get value through getLogSpeedInterval().

See Also:
Constant Field Values

DATA_LOG_DISTANCE_INTERVAL

public static final int DATA_LOG_DISTANCE_INTERVAL
The log distance interval.
Get value through getLogDistanceInterval().

See Also:
Constant Field Values

DATA_LOG_FLASH_STATUS

public static final int DATA_LOG_FLASH_STATUS
The flash status - needed for erase.

See Also:
Constant Field Values

DATA_LOG_FLASH_SECTOR_STATUS

public static final int DATA_LOG_FLASH_SECTOR_STATUS
The flash sector status.

See Also:
Constant Field Values

DATA_FIX_PERIOD

public static final int DATA_FIX_PERIOD
The fix period.
Need to get the actual value through getLogFixPeriod().

See Also:
Constant Field Values

DATA_AGPS_STORED_RANGE

public static final int DATA_AGPS_STORED_RANGE
The stored AGPS data range.

See Also:
Constant Field Values

DATA_LOG_OVERWRITE_STATUS

public static final int DATA_LOG_OVERWRITE_STATUS
Indicates if data is in overwrite or stop mode. Use isLogFullOverwrite() to get the data.

See Also:
Constant Field Values

DATA_SBAS_TEST_STATUS

public static final int DATA_SBAS_TEST_STATUS
Indicates if SBAS test satellites are used.
Actual value to be retrieved through isSBASTestEnabled().

See Also:
Constant Field Values

DATA_SBAS_STATUS

public static final int DATA_SBAS_STATUS
Indicates if SBAS satellites are used.
Actual value to be retrieved later with isSBASEnabled().

See Also:
Constant Field Values

DATA_POWERSAVE_STATUS

public static final int DATA_POWERSAVE_STATUS
Indicates the power save status (for testing only).
Need to get the actual setting later with isPowerSaveEnabled() .

See Also:
Constant Field Values

DATA_DATUM_MODE

public static final int DATA_DATUM_MODE
The DATUM used by the logger.
To be retrieved using getDatum().

See Also:
Constant Field Values

DATA_NMEA_OUTPUT_PERIODS

public static final int DATA_NMEA_OUTPUT_PERIODS
The NMEA output period.

See Also:
Constant Field Values

DATA_DGPS_MODE

public static final int DATA_DGPS_MODE
The DGPS usage mode.
Get actual setting with getDgpsMode() later.

See Also:
Constant Field Values

DATA_BT_MAC_ADDR

public static final int DATA_BT_MAC_ADDR
The device's BT mac address.

See Also:
Constant Field Values

DATA_FLASH_USER_OPTION

public static final int DATA_FLASH_USER_OPTION
The User Configurable Options stored in flash.
Request the flash user settings from the device. Following the relevant event, the settings must be retrieved using getDtUpdateRate()
- getDtGLL_Period()
- getDtRMC_Period()
- getDtVTG_Period()
- getDtGSA_Period()
- getDtGSV_Period()
- getDtGGA_Period()
- getDtZDA_Period()
- getDtMCHN_Period()
- getDtBaudRate()
- getDtUserOptionTimesLeft()
-

See Also:
Constant Field Values
Constructor Detail

MtkModel

public MtkModel(GpsModel context,
                GpsLinkHandler handler)
Method Detail

getContext

public final GpsModel getContext()

isDataOK

public final boolean isDataOK(int mask)

setAutoFetch

public final void setAutoFetch(boolean isAuto)

isDataAvailable

public final boolean isDataAvailable(int dataType)

isDataSupported

public final boolean isDataSupported(int dataType)

getHandler

public GpsLinkHandler getHandler()

analyseMtkBinData

public final boolean analyseMtkBinData(MtkBinTransportMessageModel response)

analyseMtkNmea

public boolean analyseMtkNmea(java.lang.String[] sNmea)

postEvent

public void postEvent(ModelEvent e)
Specified by:
postEvent in interface EventPoster

logMemUsefullSize

public final int logMemUsefullSize()
Returns:
The useful bytes in the log.

logFreeMemUsefullSize

public final int logFreeMemUsefullSize()
Returns:
Useful free bytes in the log.

getBtMacAddr

public final java.lang.String getBtMacAddr()
Returns the current mac address for bluetooth (Holux 241 devices).

Returns:
Bluetooth Mac Address

getFlashManuProdID

public final int getFlashManuProdID()
Returns:
Returns the flashManuProdID.

getFlashDesc

public final java.lang.String getFlashDesc()
Returns:
Returns the flashDesc.

getMtkLogVersion

public final java.lang.String getMtkLogVersion()
Returns:
Returns the mtkLogVersion.

isHolux

public final boolean isHolux()
Returns:
Returns the holux.

setHolux

public final void setHolux(boolean forceHolux)
Parameters:
forceHolux - Indicates if this device needs special holux decoding.

getHoluxName

public final java.lang.String getHoluxName()
Returns:
Returns the holuxName.

getLogFormat

public final int getLogFormat()

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()

getLogTimeInterval

public final int getLogTimeInterval()

getLogSpeedInterval

public final int getLogSpeedInterval()

getLogDistanceInterval

public final int getLogDistanceInterval()

getLogFixPeriod

public final int getLogFixPeriod()

isSBASEnabled

public final boolean isSBASEnabled()

isSBASTestEnabled

public final boolean isSBASTestEnabled()

isPowerSaveEnabled

public final boolean isPowerSaveEnabled()

isInitialLogOverwrite

public final boolean isInitialLogOverwrite()

getDgpsMode

public final int getDgpsMode()

isLogFullOverwrite

public final boolean isLogFullOverwrite()

setDatum

public final void setDatum(int datum)

getDatum

public final int getDatum()

getNMEAPeriod

public final int getNMEAPeriod(int i)

isLoggingActive

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

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

isLoggingDisabled

public final boolean isLoggingDisabled()
Get the 'automatic logging activation' status of the device.
This concerns time, speed and distance logging.

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

isLoggerNeedsFormat

public final boolean isLoggerNeedsFormat()

getFirmwareVersion

public final java.lang.String getFirmwareVersion()

getMainVersion

public final java.lang.String getMainVersion()

getLogMemSize

public final int getLogMemSize()
Get the total size of the memory.

Returns:
the logMemSize

getLogMemUsed

public final int getLogMemUsed()
Returns:
the logMemUsed

getModel

public final java.lang.String getModel()

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

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

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.

getAgpsDataCount

public final int getAgpsDataCount()

getAgpsStartTime

public final BT747Time getAgpsStartTime()

getAgpsEndTime

public final BT747Time getAgpsEndTime()

getAgpsStart2Time

public final BT747Time getAgpsStart2Time()

getAgpsEnd2Time

public final BT747Time getAgpsEnd2Time()

hasAgps

public final boolean hasAgps()

isTimeDistanceLogConditionExclusive

public boolean isTimeDistanceLogConditionExclusive()