[Tinyos-devel] Interface change proposals for 2.1

J. Ryan Stinnett jryans at rice.edu
Sat Aug 11 08:33:18 PDT 2007


Philip Levis wrote:
> PROPOSED SOLUTION: The getPayload call will change from
> 
>   command void* getPayload(message_t* msg, uint8_t* len);
> 
> to
> 
>   command void* getPayload(message_t* msg, uint8_t minLen);
> 
> such that the caller tells the callee the size it requires. If the 
> callee cannot provide a payload of that size, then it returns NULL. (The 
> memory checking tools handle null pointers, so you don't smash your 
> control registers.)

I'm not quite sure I understand how the minLen parameter would be used 
in practice.  In a sending context, I suppose you'd always know what 
length you are sending and can use that as minLen, though the Send 
interface has its own getPayload which doesn't currently require a 
length parameter.  In a receiving context, you could be dealing with 
data of arbitrary size, in which case you could also pass 0 for minLen, 
though that would seem to defeat the purpose of such a thing.  It seems 
you would just want to get at whatever data there is and don't "require" 
anything.  It makes a bit more sense with static data sizes.  Overall, 
I'm not sure I understand the intended use of the parameter.

Aside from my own confusion above, both changes sound like a good idea 
to me.

- Ryan


More information about the Tinyos-devel mailing list