
Title: TestDip Application
Author: Kaisen Lin (kaisenl@cs.ucsd.edu)

1. SETTING UP THE TEST

You need to first generate the code for compilation. The gentest.py
script reads in the Master files and creates TestDipC.nc (the
configuration) and TestDipP.nc (the module). It takes two parameters,
the total number of items and the number of new items. The items that
are random are chosen randomly.

If you want 128 total items in the dissemination set, where 96 of
those 128 items are new, you would type:

python gentest.py 128 96

After the configuration and module have been generated, you can use
the normal compilation method (e.g. make telosb).

2, READING THE LEDS

When an node receives a new item, it toggles LED0. When a node
completes all items, it turns all LEDs on.

3. SERIAL MESSAGES

typedef nx_struct dip_test_msg_t {
  nx_am_addr_t id;
  nx_uint8_t count;
  nx_uint8_t isOk;
} dip_test_msg_t;

When a node receives a new item, it sends a dip_test_msg_t through the
serial interface.

id is the node id
count is how many new items it has received so far
isOk will be true if the data value was as expected

4. PACKET INJECTOR

You can also use the injector to send data packets via a
basestation. The syntax to do that is:

java DipInject [key] [version] [data in quotes delimited by space]

key is the data key in hexadecimal
version is the version number in decimal
data is the actual data in quotes delimited by space

For example, if you want to send key 10, version 2, and data "ab cd
ef". You would type:

java DipInject 0a 2 "ab cd ef"

For this specific test application, your data needs to be "ef be". You
will need a SerialForwarder running for this work.

5. TIMING

With a single sender and single receiver on a table using TelosB
nodes, it takes approximately:

3.5 minutes for a node to receive 128 out of 128 items. 
4.0 minutes for a node to receive 240 out of 240 items.

With a single sender and two receivers on Mirage MicaZ nodes, it takes
approximately:

2 minutes for both nodes to receive 96 out of 96 items.
With 128 items or more, MicaZ nodes don't receive anything. Memory limitation?

6. BASESTATION

If you are using the Basestation application to sniff what packets are
being sent in the air, you will need to adjust the packet size to match
the test application. You can add the following to your Makefile:

CFLAGS += -DTOSH_DATA_LENGTH=XX

where XX is your payload size
