]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/cc1000/CC1000ActiveMessageP.nc
The big interface switchover for Packet, Send, Receive, and AMSend.
[tinyos-2.x.git] / tos / chips / cc1000 / CC1000ActiveMessageP.nc
index 09bbe0a866c97e2d347dd4eb8d94cf8fbc9bd3f4..118c8a810fb8667f2a168a65d650c15f8c28a1a2 100644 (file)
@@ -32,7 +32,7 @@
  * Implementation component for CC1000ActiveMessageC.
  *
  * @author Philip Levis
- * @date June 19 2005
+ * @date June 19 2006
  */
 
 module CC1000ActiveMessageP {
@@ -60,7 +60,8 @@ implementation {
                                          uint8_t len) {
     cc1000_header_t* header = getHeader(amsg);
     header->type = id;
-    header->addr = addr;
+    header->dest = addr;
+    header->source = call AMPacket.address();
     header->group = TOS_AM_GROUP;
     return call SubSend.send(amsg, len);
   }
@@ -77,8 +78,8 @@ implementation {
     return call Packet.maxPayloadLength();
   }
 
-  command void* AMSend.getPayload[am_id_t id](message_t* m) {
-    return call Packet.getPayload(m, NULL);
+  command void* AMSend.getPayload[am_id_t id](message_t* m, uint8_t len) {
+    return call Packet.getPayload(m, len);
   }
 
   /* Receiving a packet */
@@ -92,34 +93,28 @@ implementation {
     }
   }
   
-  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) {
-    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();
   }
  
   command am_addr_t AMPacket.destination(message_t* amsg) {
     cc1000_header_t* header = getHeader(amsg);
-    return header->addr;
+    return header->dest;
+  }
+
+  command am_addr_t AMPacket.source(message_t* amsg) {
+    cc1000_header_t* header = getHeader(amsg);
+    return header->source;
   }
 
   command void AMPacket.setDestination(message_t* amsg, am_addr_t addr) {
     cc1000_header_t* header = getHeader(amsg);
-    header->addr = addr;
+    header->dest = addr;
+  }
+
+  command void AMPacket.setSource(message_t* amsg, am_addr_t addr) {
+    cc1000_header_t* header = getHeader(amsg);
+    header->source = addr;
   }
   
   command bool AMPacket.isForMe(message_t* amsg) {
@@ -137,9 +132,19 @@ implementation {
     header->type = type;
   }
   
-  //command am_group_t AMPacket.group(message_t* amsg) {
-  //  return amsg->header.group;
-  //}
+  command void AMPacket.setGroup(message_t* msg, am_group_t group) {
+    cc1000_header_t* header = getHeader(msg);
+    header->group = group;
+  }
+
+  command am_group_t AMPacket.group(message_t* msg) {
+    cc1000_header_t* header = getHeader(msg);
+    return header->group;
+  }
+
+  command am_group_t AMPacket.localGroup() {
+    return TOS_AM_GROUP;
+  }
   
  default event message_t* Receive.receive[am_id_t id](message_t* msg, void* payload, uint8_t len) {
     return msg;