* Implementation component for CC1000ActiveMessageC.
*
* @author Philip Levis
- * @date June 19 2005
+ * @date June 19 2006
*/
module CC1000ActiveMessageP {
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);
}
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 */
}
}
- 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) {
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;