[Tinyos Core WG] TEP 116 last call

David Moss dmm at rincon.com
Wed Mar 28 15:45:37 PDT 2007


The Receive interface defines two "len" variables with the same name and
different meanings.  This is probably intentional due to the reflection of
the Packet interface in Receive, but it tripped me up.  Maybe the variable
name itself should indicate what type of length it is?

"len" in this case is actual size of the payload:
event message_t *Receive.receive(message_t *msg, void *payload, uint8_t
len);

"len" in this case is the maximum size of the payload: 
command void *Receive.getPayload(message_t *msg, uint8_t *len)

I expected the latter to be the actual size of the payload like the rest of
the Receive interface, but had to refer to the TEP to understand what was
going on.  On receive, we're interested only in the actual size of the
payload, not the maximum size the payload could be... even though
Packet.getPayload() returns the max, which I agree is still completely
valid.

Maybe changing "len" in each to "maxLen" or "actualLen" would make it
clearer?  Alternatively, changing the behavior of Receive.getPayload() so
that it fills in the actual length would also make sense.

-David



-----Original Message-----
From: tinyos-2.0wg-bounces at Mail.Millennium.Berkeley.EDU
[mailto:tinyos-2.0wg-bounces at Mail.Millennium.Berkeley.EDU] On Behalf Of
Philip Levis
Sent: Wednesday, March 28, 2007 9:12 AM
To: TinyOS Core WG
Subject: [Tinyos Core WG] TEP 116 last call

TEP 116 is entering last call. This last call will end on Friday,  
3/30.  If you have any edits or comments before it goes to the SC,  
please give them now. The document is attached.

Phil





More information about the Tinyos-2.0wg mailing list