[Tinyos-devel] purpose of the Packet.clear() function

Miklos Maroti mmaroti at math.u-szeged.hu
Mon Oct 8 02:40:06 PDT 2007


Hi Andreas,

> How many protocols and function calls did you design? In how many cases
> were you safe to rely on (other!) users to ensure your preconditions,
> especially when you did not express them? Because that is the case here.

I have designed many interfaces, and know what you talk about.

> AMSend does express preconditions, but mentions no meta data that the
> user must set properly. So the protocol stack must make sure that it
> works and gives reliable results even if the fields in the meta data
> contain rubbish.

AMSend is not properly documented in my opinion. At least it should
say that if you have received a message buffer from another protocol
stack (e.g. serial), then you should call Packet.clear() to set up the
default settings.

> Once the user stops to think about what he intended, he can express it.

Yes, exactly, but only with Packet.clear()! So this just proves my
point that the Packet.clear() command is needed. Just because it is
not used currently, it does not mean that it is not needed. People
will realize that in certain situations they need to clear the packet,
and instead of getting rid of that command we should educate the
users.

Miklos


More information about the Tinyos-devel mailing list