There are scripts on net2 website to parse the debug messages sent by
the nodes.
+To test, start with two motes with no program that transmits
+packets. Example., erase the mote or install Blink. Program a mote with
+node id 0. The mote will toggle led1 (green on TelosB) approximately
+every 8s. Then program the second mote with id 1. Once programming is
+complete, the mote with id 0 will toggle led1 twice every 8s. Each
+toggle corresponds to the reception of collection message (once from
+itself, and once from the mote with id 1).
+
+Errors indications:
+
+Motes 0 and 1 will set led0 (red on TelosB) if there are errors while
+sending the packet.
+
+Mote 0 will set led2 (blue on TelosB) if the gap in sequence number on
+consecutive packet reception from node 1 is greater than 1. This is
+expected to be a rare event while doing experiment on a desk.
+
+
Known bugs/limitations:
None.
event void Timer.fired() {
uint32_t nextInt;
- call Leds.led0Toggle();
dbg("TestNetworkC", "TestNetworkC: Timer fired.\n");
nextInt = call Random.rand32() % SEND_INTERVAL;
nextInt += SEND_INTERVAL >> 1;
event void Send.sendDone(message_t* m, error_t err) {
if (err != SUCCESS) {
- // call Leds.led0On();
+ call Leds.led0On();
}
sendBusy = FALSE;
dbg("TestNetworkC", "Send completed.\n");
call Timer.startPeriodic(*newVal);
}
+
+ uint8_t prevSeq = 0;
+ uint8_t firstMsg = 0;
+
event message_t*
Receive.receive(message_t* msg, void* payload, uint8_t len) {
dbg("TestNetworkC", "Received packet at %s from node %hhu.\n", sim_time_string(), call CollectionPacket.getOrigin(msg));
- call Leds.led1Toggle();
- if (!call Pool.size() <= (TEST_NETWORK_QUEUE_SIZE < 4)? 1:3) {
- // call CtpCongestion.setClientCongested(TRUE);
+ call Leds.led1Toggle();
+
+ if (call CollectionPacket.getOrigin(msg) == 1) {
+ if (firstMsg == 1) {
+ if (call CollectionPacket.getSequenceNumber(msg) - prevSeq > 1) {
+ call Leds.led2On();
+ }
+ } else {
+ firstMsg = 1;
+ }
+ prevSeq = call CollectionPacket.getSequenceNumber(msg);
}
+
if (!call Pool.empty() && call Queue.size() < call Queue.maxSize()) {
message_t* tmp = call Pool.get();
call Queue.enqueue(msg);