[Tinyos-help] Enquiry on modifying data

Muhammad Azhar leo_az_83 at hotmail.com
Mon Feb 19 21:39:35 PST 2007


Hi all,
   (I'm using TinyOS 2)
   In Receive.receive(message_t* bufPtr, void* payload, uint8_t len), 
supposing the payload is of "some" struct (assume it contains nodeid, data, 
seqNo):
some* rcvd = (some*)payload;
   Supposing I'd wanna change some value in this payload before forwarding 
it to node x, should I simply do:
(1)
rcvd->data = 0xffff;
memcpy(&buffer, bufPtr, sizeof(message_t));
//assume buffer is a message_t structure
//then call "AMSend.send(x, &buffer, sizeof(some));" in another task
OR
(2)
some* rcvd = (some*)call Packet.getPayload(&buffer);
rcvd->data = 0xffff;
//I'm a bit lost as to how to continue from here

   Thanks.

Regards,
Azhar




More information about the Tinyos-help mailing list