]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/net/Deluge/extra/NetProgM.nc
This commit from Chieh-Jan (Mike) Liang fixes the following issues:
[tinyos-2.x.git] / tos / lib / net / Deluge / extra / NetProgM.nc
index 93bed42cc8ec49aa145b1717e863e78e9d5cd87b..ab122f4d1ccf3bf88e70db5b77ec82b26eb3aed0 100644 (file)
@@ -42,6 +42,8 @@ module NetProgM {
     interface Crc;
     interface DelugeMetadata;
     interface Leds;
+    interface CC2420Config;
+    async command void setAmAddress(am_addr_t a);
   }
 }
 
@@ -76,13 +78,20 @@ implementation {
 
     if (tosInfo.crc == computeTosInfoCrc(&tosInfo)) {
       // TOS_AM_GROUP is not a variable in T2
-      //      TOS_AM_GROUP = tosInfo.groupId;
-      atomic TOS_NODE_ID = tosInfo.addr;
+      //   TOS_AM_GROUP = tosInfo.groupId;
+      
+      // Updates local node ID
+      atomic {
+        TOS_NODE_ID = tosInfo.addr;
+        call setAmAddress(tosInfo.addr);
+      }
+      call CC2420Config.setShortAddr(tosInfo.addr);
+      call CC2420Config.sync();
     }
     else {
       writeTOSinfo();
     }
+    
     return SUCCESS;
   }
   
@@ -123,6 +132,8 @@ implementation {
     return FAIL;
   }
 
+  event void CC2420Config.syncDone(error_t error) {}
+
   default command storage_addr_t DelugeStorage.getPhysicalAddress[uint8_t img_num](storage_addr_t addr) { return 0xFFFFFFFF; }
 
 }