|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttriptracker.client.gps.core.GPSClientModel
public class GPSClientModel
GPS Client sends coordinates to a server. This is the model for the GPS client in the MVC separation.
Constructor Summary | |
---|---|
GPSClientModel()
|
Method Summary | |
---|---|
void |
addGPSListener(GPSListener listener)
Register a listener for GPS device events. |
void |
addSocketListener(GPSSocketListener listener)
Register a listener for server events. |
void |
autoTransfer(boolean enable)
Sets the autotransfer variable |
boolean |
bufferFileExists()
Checks wheter the buffer file exists or not. |
void |
changeGPSState()
Changes the state of recieving from GPS-unit. |
void |
changeTransferState()
Changes the state of transferToServer, this decides if the coordinates should be buffered locally, og sent to server |
void |
closeGPSPort()
Closes the GPS port |
void |
createRoute(String routeDesc)
Creates a new route on server with the given description. |
boolean |
currCoordSet()
Gets the current coordinates |
void |
disconnectFromSocket()
Disconnects from socket. |
Route |
getActiveRoute()
Returns the active route |
boolean |
getAutoTransferState()
Checks if autotransfer is set |
List<String> |
getComPorts()
Gets a list of the available COM ports. |
boolean |
getCompression()
Checks if the client should use compression to send the buffered coordinates to the server |
String |
getCoordDate()
Gets the date/time the coordinate was recieved. |
Coordinate |
getCurrentCoord()
Gets the current coordinate |
boolean |
getGPSState()
Gets the state of recieving from GPS-unit |
int |
getInterval()
Gets the interval for recieving coordinates from the GPS-unit |
Coordinate |
getOldCoord()
Gets the old coordinate |
String |
getPort()
Get the COM-port |
String |
getRouteDesc(Route route)
Returns a route's desciption |
int |
getRouteId(Route route)
Returns a route's id |
void |
getRoutes(String user)
Gets the routes for a given user |
String |
getStringLat()
|
String |
getStringLon()
|
boolean |
getTransferState()
Gets the state of transferToServer |
String |
getUsername()
Gets the current username |
boolean |
hasActiveRoute()
Checks if active route is set locally. |
boolean |
hasSignal()
Checks if the GPS-unit has a fixed position from the satellites. |
boolean |
isConnected()
Checks if connected to socket. |
boolean |
isConnectedToGPS()
Checks if connected to the GPS-unit |
boolean |
isLoggedIn()
Checks if logged in to server |
void |
logon(String user,
String pass)
Logs on to the server. |
void |
openFile(String file)
Opens the given file |
void |
openGPSPort()
Connects to the GPS on the set serial port. |
void |
removeGPSListener(GPSListener listener)
Remove listener from listener queue. |
void |
removeSocketListener(GPSSocketListener listener)
Remove listener from listener queue. |
void |
saveCoord()
Saves the coordinates, based on connected to server or not. |
void |
setActiveRoute(Route route)
Sets current route as active route locally. |
void |
setCompression(boolean compression)
Set if you want compression or not. |
void |
setHost(String host)
|
void |
setInterval(int inte)
Set interval for recieving coordinates from the GPS-unit |
void |
setPort(int port)
|
void |
setPort(String port)
Sets a port to the active COM-port |
void |
setRouteOnServer(Route route)
Sets the given route as the active route on server |
void |
startRecieveFromGPS()
Starts recieving from the GPS-unit |
void |
stopRecieveFromGPS()
Stops recieving from the GPS-unit |
void |
storeTmpCoords(Coordinate coord)
Stores temporary coordinates while without internet connection. |
void |
syncCoords()
Gets the current coordinate from the GPS. |
boolean |
transferTmpCoords()
Transfers coordinates stored in a temporary file while network was unreachable. |
void |
writeGPSData(String data)
Write data from GPS-reciever to a file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GPSClientModel()
Method Detail |
---|
public void storeTmpCoords(Coordinate coord) throws IOException
IOException
public boolean transferTmpCoords() throws FileNotFoundException, IllegalStateException, IOException
FileNotFoundException
IllegalStateException
IOException
public void openFile(String file) throws FileNotFoundException
file
- the given file
FileNotFoundException
public void writeGPSData(String data) throws IOException
data
- GPS data to write to file
IOException
- if write failspublic void logon(String user, String pass) throws IOException
user
- usernamepass
- password
IOException
public void openGPSPort() throws gnu.io.PortInUseException, TooManyListenersException, gnu.io.UnsupportedCommOperationException, IOException
gnu.io.PortInUseException
TooManyListenersException
gnu.io.UnsupportedCommOperationException
IOException
public void addGPSListener(GPSListener listener)
listener
- event receiver to registerpublic void removeGPSListener(GPSListener listener)
listener
- event receiver to removepublic void addSocketListener(GPSSocketListener listener)
listener
- event receiver to registerpublic void removeSocketListener(GPSSocketListener listener)
listener
- event receiver to removepublic void disconnectFromSocket() throws IOException
IOException
public List<String> getComPorts()
public String getPort()
public void setPort(String port)
port
- the port you want to set as activepublic void setCompression(boolean compression)
compression
- true for compression, otherwise falsepublic boolean getCompression()
public void setInterval(int inte)
inte
- the interval in s.public int getInterval()
public boolean isConnected()
public boolean isLoggedIn()
public String getCoordDate()
public String getStringLat()
public String getStringLon()
public void syncCoords()
public Coordinate getCurrentCoord()
public Coordinate getOldCoord()
public void saveCoord() throws IOException
IOException
public void changeTransferState()
public boolean getTransferState()
public void createRoute(String routeDesc)
routeDesc
- the description of the routepublic void getRoutes(String user)
user
- get this users routespublic String getUsername()
public void setRouteOnServer(Route route)
route
- the active routepublic int getRouteId(Route route)
route
- the route to get id from
public String getRouteDesc(Route route)
route
- the route to get description from
public void setActiveRoute(Route route)
route
- route to set activepublic Route getActiveRoute()
public boolean hasSignal()
public boolean bufferFileExists()
public void changeGPSState()
public boolean getGPSState()
public void closeGPSPort()
public boolean currCoordSet()
public void startRecieveFromGPS()
public void stopRecieveFromGPS() throws IllegalArgumentException, gnu.io.PortInUseException, TooManyListenersException, gnu.io.UnsupportedCommOperationException, IOException
IOException
gnu.io.UnsupportedCommOperationException
TooManyListenersException
gnu.io.PortInUseException
IllegalArgumentException
public boolean isConnectedToGPS()
public boolean getAutoTransferState()
public void autoTransfer(boolean enable)
enable
- true if autotransfer, else falsepublic boolean hasActiveRoute()
public void setHost(String host)
public void setPort(int port)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |