[Tinyos-help] Buffering message_t structures
schip at santafe.edu
Mon Apr 12 09:04:12 PDT 2010
There shouldn't be any magic in saving message_t structs.
memcpy() or structure assignment as you show should work
fine. Note that messages can be smaller than the total
struct size and this is indicated in the length field.
Look at how you are doing the send(), it may be trying to
fill in a different destination address or otherwise mess
with the message. Perhaps try explicitly specifying the
length and destination address by extracting them from
the original message.
David Piotrowski wrote:
> A Pool won't work for me for I need more differentiated access to the
> buffered entries than a Pool can provide.
> The actual Issue that I'm having with those message_t objects I read
> from my buffer component is that for example after sending them to a
> node with address 1 I get signaled that I got no Ack for the sent packet
> from node 0 allthough it was send to node 1. Does that sound somehow
> familiar to someone?
> Am 12.04.2010 um 15:13 schrieb Arik Sapojnik:
>> How about using a Pool like this:
>> interface Pool<message_t>
>> And wire it like this:
>> components new PoolC(message_t, POOL_SIZE);
>> App.Pool -> PoolC;
>> On Mon, Apr 12, 2010 at 15:08, David Piotrowski <tinyos at zeroflag.eu
>> <mailto:tinyos at zeroflag.eu>> wrote:
>> I'm trying to implement a buffer for message_t structures and am
>> having some trouble with it.
>> Basicly what I want to do is create a component with an array of
>> message_t structures. A command like "storeMessage(message_t*
>> msg)" would memcpy the contents of the message pointed at by the
>> msg-pointer to one of the message_t structures in the array. But
>> after reading the buffered message_t structures out of the buffer
>> again and sending them I get strange results. Now I wonder whether
>> this can be done the way I expected or whether I would have to try
>> an entirely different approach. Also I am not sure if message_t
>> structures can be handled this way or if I have to use some
>> special interfaces/components for handling these structures.
>> Btw, using code a la
>> bufferedMessageT = *msg;
>> instead of memcpy() leads to the same results.
>> Thx, David
>> Tinyos-help mailing list
>> Tinyos-help at millennium.berkeley.edu
>> <mailto:Tinyos-help at millennium.berkeley.edu>
>> Best Regards,
>> Arik Sapojnik
> Tinyos-help mailing list
> Tinyos-help at millennium.berkeley.edu
More information about the Tinyos-help