]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/tossim/SerialActiveMessageC.nc
Incorporate new modular tos-bsl.
[tinyos-2.x.git] / tos / lib / tossim / SerialActiveMessageC.nc
index 0bc2694bc630ce621d25b63140711bdff6828611..9b0fe461ecc12154f3ce90006d2ff0e36df025db 100644 (file)
@@ -72,14 +72,7 @@ implementation {
   command error_t AMSend.send[am_id_t id](am_addr_t addr,
                                          message_t* amsg,
                                          uint8_t len) {
-    int i;
-    char* payload = call Packet.getPayload(amsg, NULL);
     dbg("Serial", "Serial: sending a packet of size %d\n", len);
-    for (i = 0; i < len; i++)
-      printf("%02x ", payload[i]);
-
-    printf("\n");
-
     return FAIL;
   }
 
@@ -92,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();
   }
@@ -178,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) {