rsudp.t_testdata (test pre-producer)

class rsudp.t_testdata.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 TERM string as the last line of the file or when an ENDTEST packet arrives on this thread’s queue.

For a diagram of TestData’s position in the data hierarchy, see Data flow during testing.

Parameters:
run()

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 ENDTEST packet arrives on the queue, or until the reader reaches the end of the file. Then, sends a TERM message to the localhost port and exits.

send()

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 = False and prepare to exit.


Back to top ↑