]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/net/Deluge/DelugeManagerP.nc
Add a translation between imgNum to volumeId. This should allow non-Deluge images...
[tinyos-2.x.git] / tos / lib / net / Deluge / DelugeManagerP.nc
index 15dbeedc0989f9c01178414f57cebba93e275347..2417de6cf5c4cd80c7e1e794a301b0a177bde083 100644 (file)
@@ -55,6 +55,12 @@ implementation
 
   message_t serialMsg;
   DelugeCmd delugeCmd;
+  uint8_t imgNum2volumeId[] = {
+    VOLUME_GOLDENIMAGE,
+    VOLUME_DELUGE1,
+    VOLUME_DELUGE2,
+    VOLUME_DELUGE3
+  };
 
   void sendReply(error_t error)
   {
@@ -85,14 +91,14 @@ implementation
     case DELUGE_CMD_ONLY_DISSEMINATE:
     case DELUGE_CMD_DISSEMINATE_AND_REPROGRAM:
       if (call Resource.immediateRequest() == SUCCESS) {
-       call DelugeMetadata.read(request->imgNum);
+       call DelugeMetadata.read(imgNum2volumeId[request->imgNum]);
       } else {
        sendReply(FAIL);
       }
       break;
     case DELUGE_CMD_REPROGRAM:
     case DELUGE_CMD_REBOOT:
-      delugeCmd.imgNum = request->imgNum;
+      delugeCmd.imgNum = imgNum2volumeId[request->imgNum];
       call DelayTimer.startOneShot(1024);
       sendReply(SUCCESS);
       break;