The receive code reuses a small buffer pool. In T1 receive() returns the message pointer that it got as an argument to tell the underlying code that it is done with the buffer -- I will presume that this is the same in T2. If you need to keep the contents longer you need to copy the whole message, not just the pointer.
MS giorgio wrote: > When I receive a messagge using interface Receive with tinyos 2.1 I use the > event > event message_t * Receive.receive(message_t *msg, void *payload, uint8_t len) > to save or elaborate what I have received using void *payload but what happen > when I receive a new message ? The previous void*payload is rewrite . > If I save the pointer > void*payload as void *pay=payload > and I use that (pay) I think that I don't have the problem of rewrite of the > pointer but payload is a pointer and so it points to the same position ?so > when I receive a message I must save the pointer pyload but it is better to > save the contents of the pointer because that content is rewrite everytime a > message is received ? > Any suggestion is important for me. > Thank in advance > > > Giorgio > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
