edu.washington.cs.rfid.gateway
Class ReaderConnection

java.lang.Object
  extended by java.lang.Thread
      extended by edu.washington.cs.rfid.gateway.ReaderConnection
All Implemented Interfaces:
java.lang.Runnable

public class ReaderConnection
extends java.lang.Thread

Maintains a connection to a reader, accepts incoming TRE packets and forwards them to the ReaderGateway. Connection is established with SSL (128 bit AES).

Author:
Evan

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ReaderConnection(RdrMetadata rdr, int[] antIDs, java.lang.String keyStorePath, char[] keyStorePw, long hashSalt)
          Creates a new ReaderConnection with the specified parameters.
 
Method Summary
 void addListener(ReaderConnectionListener l)
          Adds a ReaderConnectionListener to the list of listeners.
 void run()
          The run method from class Thread.
 void stopConnection()
          Stops this ReaderConnection from reading.
 java.lang.String toString()
          Returns a String representing this ReaderConnection.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReaderConnection

public ReaderConnection(RdrMetadata rdr,
                        int[] antIDs,
                        java.lang.String keyStorePath,
                        char[] keyStorePw,
                        long hashSalt)
Creates a new ReaderConnection with the specified parameters.

Parameters:
rdr - Metadata for the reader to connect to
antIDs - The IDs of the reader's antennas in ascending order
keyStorePath - Absolute path to the keystore to use for SSL
keyStorePw - The password for the keystore
hashSalt - The initial salt for the hash function
Method Detail

addListener

public void addListener(ReaderConnectionListener l)
Adds a ReaderConnectionListener to the list of listeners.

Parameters:
l - The ReaderConnectionListener to add

stopConnection

public void stopConnection()
Stops this ReaderConnection from reading.


run

public void run()
The run method from class Thread. Repeatedly tries to connect to the reader via a socket connection. Once the connection handshake succeeds, it repeatedly reads incoming TREs from the reader, parses them, and offers them to the ReaderGateway.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

toString

public java.lang.String toString()
Returns a String representing this ReaderConnection.

Overrides:
toString in class java.lang.Thread
Returns:
A String representing this ReaderConnection