gps.mvc
Class GpsController

java.lang.Object
  extended by gps.mvc.GpsController
All Implemented Interfaces:
BT747Thread, DeviceControllerIF, ProtocolConstants

public class GpsController
extends java.lang.Object
implements BT747Thread, ProtocolConstants, DeviceControllerIF

Refactoring ongoing.

Author:
Mario

Field Summary
 
Fields inherited from interface gps.ProtocolConstants
PROTOCOL_HOLUX_PHLX, PROTOCOL_INVALID, PROTOCOL_MTK, PROTOCOL_SIRFIII, PROTOCOL_SKYTRAQ, PROTOCOL_WONDEPROUD
 
Method Summary
 boolean cmd(int cmd)
          Perform a command.
 boolean cmd(int cmd, CmdParam param)
          Perform a command.
 void eraseLog()
          Erase the log.
static GpsController getInstance(GpsModel model, int protocol)
           
 void getLog(BT747Path log)
           
 GpsModel getModel()
           
 MtkController getMtkController()
          TODO: Should no longer exist after refactoring.
 void initConnection()
          Start the timer To be called once the port is opened.
 boolean isSupportedCmd(int cmd)
          Check if a command is supported.
 void reqDeviceInfo()
           
 void reqLogOnOffStatus()
           
 void reqStatus()
          Get the current status of the device
 void run()
           
 void setAgpsData(byte[] agpsData)
           
 void setDataNeeded(int dataType)
          Indicates that the application requires the given data.
 void setDeviceOperationHandler(DeviceOperationHandlerIF h)
           
 void setDownloadTimeOut(int downloadTimeOut)
           
 void setGpsDecode(boolean gpsDecode)
           
 void setProtocol(int newProtocol)
          Sets or changes the protocol on the link.
 void started()
          Called just before the thread is started.
 void stopErase()
          The log is being erased - the user request to abandon waiting for the end of this operation.
 void stopped()
          Called just after the thread is stopped.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static final GpsController getInstance(GpsModel model,
                                              int protocol)

setProtocol

public final void setProtocol(int newProtocol)
Sets or changes the protocol on the link. This will result in a change in the GPS Controller (e.g., MtkController). Refactoring will change this code but in principle not its interface.

Parameters:
newProtocol - The new protocol. Chosen from ProtocolConstants.PROTOCOL_MTK, ProtocolConstants.PROTOCOL_SIRFIII, ProtocolConstants.PROTOCOL_HOLUX_PHLX

getModel

public final GpsModel getModel()

getMtkController

public final MtkController getMtkController()
TODO: Should no longer exist after refactoring.

Returns:
MtkController instance.

setGpsDecode

public final void setGpsDecode(boolean gpsDecode)

setDataNeeded

public final void setDataNeeded(int dataType)
Indicates that the application requires the given data. Checks if the data is available and if it is not, requests it.

Parameters:
dataType -

reqDeviceInfo

public final void reqDeviceInfo()

setDownloadTimeOut

public final void setDownloadTimeOut(int downloadTimeOut)

reqStatus

public final void reqStatus()
Get the current status of the device


reqLogOnOffStatus

public final void reqLogOnOffStatus()

eraseLog

public final void eraseLog()
Erase the log.


stopErase

public final void stopErase()
The log is being erased - the user request to abandon waiting for the end of this operation.


initConnection

public final void initConnection()
Start the timer To be called once the port is opened. The timer is used to launch functions that will check if there is information on the serial connection or to send to the GPS device.


setDeviceOperationHandler

public final void setDeviceOperationHandler(DeviceOperationHandlerIF h)

run

public final void run()
Specified by:
run in interface BT747Thread

started

public final void started()
Description copied from interface: BT747Thread
Called just before the thread is started.

Specified by:
started in interface BT747Thread

stopped

public final void stopped()
Description copied from interface: BT747Thread
Called just after the thread is stopped.

Specified by:
stopped in interface BT747Thread

cmd

public final boolean cmd(int cmd)
Description copied from interface: DeviceControllerIF
Perform a command.

Specified by:
cmd in interface DeviceControllerIF
Parameters:
cmd - Command identification.
Returns:
true is command is supported.

cmd

public final boolean cmd(int cmd,
                         CmdParam param)
Description copied from interface: DeviceControllerIF
Perform a command.

Specified by:
cmd in interface DeviceControllerIF
Parameters:
cmd - Command identification.
Returns:
true is command is supported.

isSupportedCmd

public final boolean isSupportedCmd(int cmd)
Description copied from interface: DeviceControllerIF
Check if a command is supported.

Specified by:
isSupportedCmd in interface DeviceControllerIF
Parameters:
cmd - Command identification.
Returns:
true is command is supported.

setAgpsData

public final void setAgpsData(byte[] agpsData)

getLog

public void getLog(BT747Path log)
Specified by:
getLog in interface DeviceControllerIF