]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - apps/tests/TestNetwork/TestNetworkC.nc
ECN bit was not being set properly
[tinyos-2.x.git] / apps / tests / TestNetwork / TestNetworkC.nc
index a2ba9e11711dcc6dff9d20da514f2a4171a0f7fb..28e248f0d3e42589b593df059c1a1ee2a278b88c 100644 (file)
@@ -19,6 +19,7 @@ module TestNetworkC {
   uses interface SplitControl as RadioControl;
   uses interface SplitControl as SerialControl;
   uses interface StdControl as RoutingControl;
+  uses interface StdControl as DisseminationControl;
   uses interface DisseminationValue<uint16_t> as DisseminationPeriod;
   uses interface Send;
   uses interface Leds;
@@ -35,6 +36,7 @@ module TestNetworkC {
   uses interface Pool<message_t>;
   uses interface CollectionDebug;
   uses interface AMPacket;
+  uses interface Packet as RadioPacket;
 }
 implementation {
   task void uartEchoTask();
@@ -63,6 +65,7 @@ implementation {
       call RadioControl.start();
     }
     else {
+      call DisseminationControl.start();
       call RoutingControl.start();
       if (TOS_NODE_ID % 500 == 0) {
        call RootControl.setRoot();
@@ -82,7 +85,7 @@ implementation {
 
    
   void sendMessage() {
-    TestNetworkMsg* msg = (TestNetworkMsg*)call Send.getPayload(&packet);
+    TestNetworkMsg* msg = (TestNetworkMsg*)call Send.getPayload(&packet, sizeof(TestNetworkMsg));
     uint16_t metric;
     am_addr_t parent;
 
@@ -139,7 +142,7 @@ implementation {
     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 CtpCongestion.setClientCongested(TRUE);
     }
     if (!call Pool.empty() && call Queue.size() < call Queue.maxSize()) {
       message_t* tmp = call Pool.get();
@@ -160,14 +163,14 @@ implementation {
    else if (!uartbusy) {
      message_t* msg = call Queue.dequeue();
      dbg("Traffic", "Sending packet to UART.\n");
-     if (call UARTSend.send(0xffff, recvPtr, call Receive.payloadLength(msg) + 4) == SUCCESS) {
+     if (call UARTSend.send(0xffff, msg, call RadioPacket.payloadLength(msg)) == SUCCESS) {
        uartbusy = TRUE;
      }
      else {
       call CollectionDebug.logEventMsg(NET_C_DBG_2,
-                                      call CollectionPacket.getSequenceNumber(recvPtr),
-                                      call CollectionPacket.getOrigin(recvPtr),
-                                      call AMPacket.destination(recvPtr));
+                                      call CollectionPacket.getSequenceNumber(msg),
+                                      call CollectionPacket.getOrigin(msg),
+                                      call AMPacket.destination(msg));
      }
    }
  }
@@ -180,7 +183,7 @@ implementation {
       post uartEchoTask();
     } 
     else {
-        call CtpCongestion.setClientCongested(FALSE);
+      //        call CtpCongestion.setClientCongested(FALSE);
     }
   }