|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object triptracker.client.gps.core.GPSConnection
public class GPSConnection
Field Summary | |
---|---|
static int |
BAUDRATE
|
protected Set<GPSListener> |
listeners
Listener set for Model View Controller (MVC) separation. |
static int |
TIMEOUT
|
Constructor Summary | |
---|---|
GPSConnection()
|
Method Summary | |
---|---|
void |
addListener(GPSListener listener)
Register a listener for server events. |
protected void |
brokenListener(GPSListener listener,
RuntimeException exception)
Reports a broken listener, removes it from the listener queue and logs the error. |
void |
closePort()
Closes the current COM port |
protected void |
connectedEvent(boolean connected)
Publish a connected event. |
boolean |
currCoordSet()
|
Coordinate |
getCurrentCoordinate()
|
String |
getPortOwner()
|
List<String> |
getPorts()
Returns a list of available serial ports. |
boolean |
hasSignal()
Checks wheter the GPS has connection to the satellites |
boolean |
isConnected()
Checks if connected to the COM port |
boolean |
isValidSignal()
Checks if the signal is valid |
void |
open(String port)
Connects to the GPS-unit at the given port |
void |
openFile()
Opens the given file |
protected void |
readExcepion(IOException ioe)
Read exception has occured. |
void |
removeListener(GPSListener listener)
Remove listener from listener queue. |
void |
startRecieve()
Start recieve from the GPS-unit |
void |
stopRecieve()
Stop/pause recieve from the GPS-unit |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Set<GPSListener> listeners
public static final int BAUDRATE
public static final int TIMEOUT
Constructor Detail |
---|
public GPSConnection()
Method Detail |
---|
public void open(String port) throws gnu.io.PortInUseException, TooManyListenersException, gnu.io.UnsupportedCommOperationException, IOException, IllegalArgumentException
port
- Port to connect
gnu.io.PortInUseException
TooManyListenersException
gnu.io.UnsupportedCommOperationException
IOException
IllegalArgumentException
public Coordinate getCurrentCoordinate()
public boolean hasSignal()
public List<String> getPorts()
public boolean isConnected()
protected void brokenListener(GPSListener listener, RuntimeException exception)
listener
- broken listenerexception
- exception thrown by listenerprotected void connectedEvent(boolean connected)
connected
- true if connected, false if disconnectedpublic void addListener(GPSListener listener)
listener
- event receiver to registerpublic void removeListener(GPSListener listener)
listener
- event receiver to removepublic void closePort()
public String getPortOwner()
public boolean currCoordSet()
public void startRecieve()
public void stopRecieve()
public boolean isValidSignal()
public void openFile() throws FileNotFoundException
FileNotFoundException
protected void readExcepion(IOException ioe)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |