]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/net/Deluge/DelugePageTransferP.nc
The big interface switchover for Packet, Send, Receive, and AMSend.
[tinyos-2.x.git] / tos / lib / net / Deluge / DelugePageTransferP.nc
index c2b4074246a6a504dd39453a3d2bfcf58cd78d74..2ceb3ed0c1e44c751eed687cf7d83dc5947b78c4 100644 (file)
@@ -101,8 +101,10 @@ implementation
   
   void setupReqMsg()
   {
-    DelugeReqMsg *pReqMsg = (DelugeReqMsg *)(call SendReqMsg.getPayload(&pMsgBuf));
-    
+    DelugeReqMsg *pReqMsg = (DelugeReqMsg *)(call SendReqMsg.getPayload(&pMsgBuf, sizeof(DelugeReqMsg)));
+    if (pReqMsg == NULL) {
+      return;
+    }
     if (state == S_RX_LOCKING) {
       if (isBusy_pMsgBuf) {
         return;
@@ -151,7 +153,7 @@ implementation
   
   void setupDataMsg()
   {
-    DelugeDataMsg *pDataMsg = (DelugeDataMsg *)(call SendDataMsg.getPayload(&pMsgBuf));
+    DelugeDataMsg *pDataMsg = (DelugeDataMsg *)(call SendDataMsg.getPayload(&pMsgBuf, sizeof(DelugeDataMsg)));
     uint16_t nextPkt;
     
     if (state != S_SENDING && state != S_TX_LOCKING) {
@@ -363,7 +365,10 @@ implementation
   
   event void SendDataMsg.sendDone(message_t* msg, error_t error)
   {
-    DelugeDataMsg *pDataMsg = (DelugeDataMsg *)(call SendDataMsg.getPayload(&pMsgBuf));
+    DelugeDataMsg *pDataMsg = (DelugeDataMsg *)(call SendDataMsg.getPayload(&pMsgBuf, sizeof (DelugeDataMsg)));
+    if (pDataMsg == NULL) {
+      return;
+    }
     BITVEC_CLEAR(pktsToSend, pDataMsg->pktNum);
     call Timer.startOneShot(2);
     
@@ -417,7 +422,7 @@ call Leds.led1Toggle();
   
   event void BlockRead.readDone[uint8_t img_num](storage_addr_t addr, void* buf, storage_len_t len, error_t error)
   {
-    DelugeDataMsg *pDataMsg = (DelugeDataMsg *)(call SendDataMsg.getPayload(&pMsgBuf));
+    DelugeDataMsg *pDataMsg = (DelugeDataMsg *)(call SendDataMsg.getPayload(&pMsgBuf, sizeof(DelugeDataMsg)));
     // make sure this event for us
     if (buf != pDataMsg->data) {
       return;
@@ -490,4 +495,5 @@ dbg("Deluge", "%.3f 115 116 116 117 115 2 %d\n", ((float)((sim_time() * 1000) /
   
   default command error_t BlockRead.read[uint8_t img_num](storage_addr_t addr, void* buf, storage_len_t len) { return FAIL; }
   default command error_t BlockWrite.write[uint8_t img_num](storage_addr_t addr, void* buf, storage_len_t len) { return FAIL; }
+  default async command void Leds.led1Toggle() {}
 }