]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/tossim/SerialActiveMessageC.nc
The big interface switchover for Packet, Send, Receive, and AMSend.
[tinyos-2.x.git] / tos / lib / tossim / SerialActiveMessageC.nc
index d436e355216b8dfb1ca4482d41dd573efd47aa57..9b0fe461ecc12154f3ce90006d2ff0e36df025db 100644 (file)
@@ -85,26 +85,10 @@ implementation {
     return call Packet.maxPayloadLength();
   }
 
-  command void* AMSend.getPayload[am_id_t id](message_t* m) {
-    return call Packet.getPayload(m, NULL);
-  }
-
-  command void* Receive.getPayload[am_id_t id](message_t* m, uint8_t* len) {
-    return call Packet.getPayload(m, len);
-  }
-
-  command uint8_t Receive.payloadLength[am_id_t id](message_t* m) {
-    return call Packet.payloadLength(m);
-  }
-  
-  command void* Snoop.getPayload[am_id_t id](message_t* m, uint8_t* len) {
+  command void* AMSend.getPayload[am_id_t id](message_t* m, uint8_t len) {
     return call Packet.getPayload(m, len);
   }
 
-  command uint8_t Snoop.payloadLength[am_id_t id](message_t* m) {
-    return call Packet.payloadLength(m);
-  }
-  
   command am_addr_t AMPacket.address() {
     return call amAddress();
   }
@@ -171,11 +155,13 @@ implementation {
     return TOSH_DATA_LENGTH;
   }
   
-  command void* Packet.getPayload(message_t* msg, uint8_t* len) {
-    if (len != NULL) {
-      *len = call Packet.payloadLength(msg);
+  command void* Packet.getPayload(message_t* msg, uint8_t len) {
+    if (len <= TOSH_DATA_LENGTH) {
+      return msg->data;
+    }
+    else {
+      return NULL;
     }
-    return msg->data;
   }
 
   async command error_t Acks.requestAck(message_t* msg) {