|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object triptracker.client.net.GPSSocketAdapter
public class GPSSocketAdapter
An abstract adapter class for receiving GPS socket events. The methods in this class are empty. This class exists as convenience for creating listener objects.
Extend this class to create a GPSSocketConnection listener and override the methods for the events of interest. (If you implement the GPSSocketListener interface, you have to define all of the methods in it. This abstract class defines null methods for them all, so you only have to define methods for events you care about.)
Create a listener object using the extended class and then register it with a GPSSocketConnection using the socket's addListener method. When the socket's status changes, the relevant method in the listener object is invoked.
Constructor Summary | |
---|---|
GPSSocketAdapter()
|
Method Summary | |
---|---|
void |
connectionUpdate(ConnectionState state)
Invoked when the connection state of the underlying socket has changed. |
void |
invalidMessage(String message)
Invoked when an invalid or unsupported message is received from the server. |
void |
routeCreated(int routeId)
Invoked when a route creation confirmation is received. |
void |
routeList(List<Route> routes)
Invoked when a list of routes is received. |
void |
socketError(IOException e)
Invoked when a socket error is encountered. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GPSSocketAdapter()
Method Detail |
---|
public void routeList(List<Route> routes)
routeList
in interface GPSSocketListener
routes
- list of routespublic void invalidMessage(String message)
SocketConnection.messageHandler(String)
) fails to understand
the message, or if it contains invalid data.
invalidMessage
in interface SocketListener
message
- the message that triggered the eventpublic void socketError(IOException e)
socketError
in interface SocketListener
e
- the error that triggered the eventpublic void connectionUpdate(ConnectionState state)
connectionUpdate
in interface SocketListener
state
- new connection statepublic void routeCreated(int routeId)
routeCreated
in interface GPSSocketListener
routeId
- ID of new route
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |