public class GPSConnection
extends java.lang.Object
implements java.beans.PropertyChangeListener
Constructor and Description |
---|
GPSConnection(java.lang.String serialPort,
int baudRate)
Class constructor - creates a new GPSConnection with the given parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
addGPSListener(GPSListener listener)
Add a GPSListener to this connection - Every time the GPSState changes, the listeners will be informed
|
boolean |
connect()
Activates the connection and start receiving data.
|
void |
disconnect()
Closes the current connection with the device.
|
GPSState |
getCurrentState()
Returns the current values read by the GPS
|
void |
logReceivedData(java.lang.String logFile) |
static void |
main(java.lang.String[] args)
Unit testing
|
void |
propertyChange(java.beans.PropertyChangeEvent evt)
Every time a value of the GPS changes, this method is called
|
void |
removeGPSListener(GPSListener listener)
Stop sending events for the given GPSListener
|
boolean |
showConnectionDialog()
Presents a dialog with the connection parameters.
|
void |
simulateGPS(java.lang.String gpsLogFile) |
public GPSConnection(java.lang.String serialPort, int baudRate)
serialPort
- The serial port where to listen for the GPS device (Examples: 'COM2', '/dev/ttyS0')baudRate
- The baud rate of the connection (Examples: '9600', '1200')public void simulateGPS(java.lang.String gpsLogFile)
public void logReceivedData(java.lang.String logFile)
public boolean connect()
public void disconnect()
public void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
public void addGPSListener(GPSListener listener)
listener
- The GPSListener that will be informed of the GPS state changespublic void removeGPSListener(GPSListener listener)
listener
- The GPSListener that will no longer receive GPS eventspublic boolean showConnectionDialog()
public GPSState getCurrentState()
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- java.lang.Exception
Copyright © 2004-2014 FEUP-LSTS and Neptus developers. All Rights Reserved.