]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
explain test procedure and how to interpret results; change code to use leds to indic...
authorgnawali <gnawali>
Thu, 14 Jan 2010 21:53:58 +0000 (21:53 +0000)
committergnawali <gnawali>
Thu, 14 Jan 2010 21:53:58 +0000 (21:53 +0000)
apps/tests/TestNetwork/README.txt
apps/tests/TestNetwork/TestNetworkC.nc

index ed52205076f267e36aa3ab6974127e4b7c593c97..b533acdc7bea27d38a88a6eba93ac102d338ef6d 100644 (file)
@@ -14,6 +14,24 @@ Collection Tree Protocol for details.
 There are scripts on net2 website to parse the debug messages sent by
 the nodes.
 
 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.
 Known bugs/limitations:
 
 None.
index 7e7278246969bada93f08868e56da9b5c8f035f0..05e44d2fbf2ca1b41a5fc246a7d4864d233e1e0c 100644 (file)
@@ -114,7 +114,6 @@ implementation {
  
   event void Timer.fired() {
     uint32_t nextInt;
  
   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;
     dbg("TestNetworkC", "TestNetworkC: Timer fired.\n");
     nextInt = call Random.rand32() % SEND_INTERVAL;
     nextInt += SEND_INTERVAL >> 1;
@@ -125,7 +124,7 @@ implementation {
 
   event void Send.sendDone(message_t* m, error_t err) {
     if (err != SUCCESS) {
 
   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");
     }
     sendBusy = FALSE;
     dbg("TestNetworkC", "Send completed.\n");
@@ -137,13 +136,26 @@ implementation {
     call Timer.startPeriodic(*newVal);
   }
 
     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));
   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);
     if (!call Pool.empty() && call Queue.size() < call Queue.maxSize()) {
       message_t* tmp = call Pool.get();
       call Queue.enqueue(msg);