|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--cse466.Tester
This is the main class for the tester. It controls the parsing and running of the tests. At this point, it just logs what happens to System.out, but it would probably be nice to add some other type of checking later. This tester is designed to be used with the net.tinyos.sf.SerialForwarder to do the serial communication with the mote.
Nested Class Summary | |
protected class |
Tester.SocketReader
Reads from the socket and logs when packets come in. |
Field Summary | |
protected static cse466.Tester |
_self
My singleton instance |
protected java.net.Socket |
_sock
The socket to the SerialForwarder |
protected java.io.InputStream |
_sockIs
The input stream from the SerialForwarder |
protected java.io.OutputStream |
_sockOs
The output stream to the SerialForwarder |
protected long |
_startTime
The time that this test was started. |
protected java.lang.Object |
_stdOutLock
A lock to prevent interleaved writes to System.out There is the potential since the receiving from the SerialForwarder and sending to the SerialForwarder are on separate threads |
Constructor Summary | |
protected |
Tester()
This class is a singleton, so this is protected |
Method Summary | |
static cse466.Tester |
getInstance()
Get the singleton instance of the tester |
void |
logReceivedPacket(cse466.packets.CSE466Packet pkt)
Log to System.out that a packet was received |
void |
logSentPacket(cse466.packets.CSE466Packet pkt)
Log to System.out that a packet was sent |
static void |
main(java.lang.String[] args)
|
java.util.List |
parseFile(java.lang.String filename,
boolean ignoreBadAMValues)
Parses the input file that should contain a list of actions. |
static void |
printUsage()
|
void |
run(java.util.List actionsList)
Run through the list and do the actions |
void |
setupSocket(java.lang.String host,
int port)
Sets up the connection to the SerialForwarder. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.net.Socket _sock
protected java.io.OutputStream _sockOs
protected java.io.InputStream _sockIs
protected java.lang.Object _stdOutLock
protected long _startTime
protected static cse466.Tester _self
Constructor Detail |
protected Tester()
Method Detail |
public static cse466.Tester getInstance()
public java.util.List parseFile(java.lang.String filename, boolean ignoreBadAMValues) throws ParserException, java.io.IOException
packet <packetType>
<fieldName> <value>
<fieldName> <value>
end
And it must have as many fieldNames as are in the packet. The delay
is simple:
delay <delayInMilliseconds>
filename
- The name of the file that contains the actions.ignoreBadAMValues
- if false, it will validate the am values of
the packets
ParserException
- if the input is malformed.
java.io.IOException
- if there was a problem reading from the file.public void setupSocket(java.lang.String host, int port) throws java.io.IOException
host
- the name of the host where the SerialForwarder is
runningport
- the port on which the SerialForwarder is listening
java.io.IOException
- if there was a problem connecting to the
SerialForwarderpublic void run(java.util.List actionsList) throws java.io.IOException
actionsList
- The list of actions to perform. The run method will
be called on each one in order
java.io.IOException
- if there was a problem writing to the SerialForwarder.public static void printUsage()
public void logReceivedPacket(cse466.packets.CSE466Packet pkt)
public void logSentPacket(cse466.packets.CSE466Packet pkt)
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |