rsudp.t_testdata (test pre-producer)¶
TestData(q, data_file, port)¶
New in version 0.4.3.
A simple module that reads lines formatted as Raspberry Shake UDP packets from a file on disk, and sends them to the specified localhost port. Designed to quit on seeing a
TERMstring as the last line of the file or when an
ENDTESTpacket arrives on this thread’s queue.
For a diagram of
TestData’s position in the data hierarchy, see Data flow during testing.
Start the thread. First, opens a file, determines the speed of data flow, then opens a socket and begins sending data at that transmission rate.
Continues sending data until an
ENDTESTpacket arrives on the queue, or until the reader reaches the end of the file. Then, sends a
TERMmessage to the localhost port and exits.
Send the latest line in the open file to the specified port at localhost. If the next line’s timestamp is the same, that line will also be sent immediately. If the next line does not contain the same timestamp, the program will seek back to the last line read and then break for a new loop.
If the line contains
TERM, the program will set
self.alive = Falseand prepare to exit.