2009-01-08 18:11:06 +01:00
|
|
|
TIMEOUT(120000, log.log(nr_packets[1] + ", " + nr_packets[2] + ", " + nr_packets[3] + ", " + nr_packets[4] + ", " + nr_packets[5] + ", " + nr_packets[6] + ", " + nr_packets[7] + ", " + nr_packets[8] + ", " + nr_packets[9] + ", " + nr_packets[10] + "\n"));
|
2008-10-02 23:18:59 +02:00
|
|
|
|
2009-01-08 18:11:06 +01:00
|
|
|
nr_packets = new Array();
|
|
|
|
for (i=1; i <= 10; i++) {
|
|
|
|
nr_packets[i] = 0;
|
2008-10-02 23:18:59 +02:00
|
|
|
}
|
|
|
|
|
2009-01-08 18:11:06 +01:00
|
|
|
WAIT_UNTIL(id == 1 && msg.contains('Starting'));
|
|
|
|
log.log("Node 1 started. Clicking node button.\n");
|
|
|
|
mote.getInterfaces().getButton().clickButton()
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
/* Only handle receive messages */
|
2009-01-08 18:46:25 +01:00
|
|
|
YIELD_THEN_WAIT_UNTIL(msg.contains('received'));
|
2008-10-02 23:18:59 +02:00
|
|
|
|
2009-01-08 18:11:06 +01:00
|
|
|
/* Remember receiving node */
|
|
|
|
log.log(id + " received a message\n");
|
|
|
|
nr_packets[id]++;
|
2008-10-02 23:18:59 +02:00
|
|
|
|
2009-01-08 18:11:06 +01:00
|
|
|
/* Did all nodes (2-10) receive a message? */
|
|
|
|
for (i = 2; i <= 10; i++) {
|
|
|
|
if (nr_packets[i] < 1) break;
|
2009-05-26 16:52:09 +02:00
|
|
|
if (i == 10) log.testOK(); /* Report test success */
|
2008-10-02 23:18:59 +02:00
|
|
|
}
|
|
|
|
}
|