frog.plugin.spot.onspot
Class ConnectionManager

java.lang.Object
  extended by frog.plugin.spot.onspot.ConnectionManager
All Implemented Interfaces:
Frog_Spot_Constants, Killable

public class ConnectionManager
extends Object
implements Frog_Spot_Constants, Killable

Manages the connection to the host. Deals with the messages coming in that tell the SPOT to do things and sends gesture data and keep alive signals back.

Author:
Team Better Recognize

Field Summary
 
Fields inherited from interface frog.plugin.spot.Frog_Spot_Constants
CORRUPT_DATA, END_OF_DATA, INT_CORRUPT_DATA, INT_END_OF_DATA, MSG_ACK, MSG_ADD_FILTER, MSG_ALIVE, MSG_DISCONNECT, MSG_DISCOVER, MSG_END_OF_DATA, MSG_ERROR, MSG_GESTURE, MSG_REMOVE_FILTERS, MSG_RESEND, MSG_SAMPLE_RATE, PORT_BCAST, PORT_MAX, PORT_REPLY, PORT_START, SPOT1, SPOT1_PORT, SPOT2, SPOT2_PORT, SPOT3, SPOT3_PORT, SPOT4, SPOT4_PORT, SPOT5, SPOT5_PORT, SPOT6, SPOT6_PORT, SPOT7, SPOT7_PORT, SPOT8, SPOT8_PORT, SPOTB1, SPOTB1_PORT, SPOTB2, SPOTB2_PORT, SPOTB3, SPOTB3_PORT, SPOTB4, SPOTB4_PORT
 
Constructor Summary
ConnectionManager(FrogSpot frog, String address, short txPort, short rxPort)
          Creates the ConnectionManager object with a given address and port to connect to.
 
Method Summary
 void kill()
          Attempt to unconditionally stop all threads and release all resources.
 void send(Queue gesture)
          Helper method for adding a gesture to the send queue.
 void sendMessage(byte message)
          Helper method for sending a message to the host
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionManager

public ConnectionManager(FrogSpot frog,
                         String address,
                         short txPort,
                         short rxPort)
                  throws IOException
Creates the ConnectionManager object with a given address and port to connect to.

Parameters:
frog - reference to the FrogSpot object
address - host address to connect to
txPort - destination port to connect to
rxPort - port to receive Radiogram messages on
Throws:
IOException - if any error occurs setting up the connections
Method Detail

kill

public void kill()
Description copied from interface: Killable
Attempt to unconditionally stop all threads and release all resources.

Specified by:
kill in interface Killable

send

public void send(Queue gesture)
Helper method for adding a gesture to the send queue.

Parameters:
gesture - the gesture to be transmitted to the host

sendMessage

public void sendMessage(byte message)
Helper method for sending a message to the host

Parameters:
message - the message to be sent
See Also:
Frog_Spot_Constants