Interface: tos.interfaces.Send

interface Send

Author:
Philip Levis

Commands
command void *getBuffer(TOS_MsgPtr msg, uint16_t *length) Given a TinyOS message buffer, provide a pointer to the data buffer within it that an application can use as well as its length.
command result_t send(TOS_MsgPtr msg, uint16_t length) Send a message buffer with a data payload of a specific length.

Events
event result_t sendDone(TOS_MsgPtr msg, result_t success) Signaled when a packet sent with send() completes.

Commands - Details

getBuffer

command void *getBuffer(TOS_MsgPtr msg, uint16_t *length)

Given a TinyOS message buffer, provide a pointer to the data buffer within it that an application can use as well as its length. If a protocol-unaware application is sending a packet with this interface, it must first call getBuffer() to get a pointer to the valid data region. This allows the application to send a specific buffer while not requiring knowledge of the packet structure. When getBuffer() is called, protocol fields should be set to note that this packet requires those fields to be later filled in properly. Protocol-aware components (such as a routing layer that use this interface to send) should not use getBuffer(); they can have their own separate calls for getting the buffer.

Parameters:
msg - The message to get the data region of.
length - Pointer to a field to store the length of the data region.
Returns:
A pointer to the data region.

send

command result_t send(TOS_MsgPtr msg, uint16_t length)

Send a message buffer with a data payload of a specific length. The buffer should have its protocol fields set already, either through a protocol-aware component or by getBuffer().

Parameters:
msg - The buffer to send.
length - The length of the data buffer sent using this component. This must be <= the maximum length provided by getBuffer().
Returns:
Whether the send request was successful: SUCCESS means a sendDone() event will be signaled later, FAIL means one will not.

Events - Details

sendDone

event result_t sendDone(TOS_MsgPtr msg, result_t success)

Signaled when a packet sent with send() completes.

Parameters:
msg - The message sent.
success - Whether the send was successful.
Returns:
Should always return SUCCESS.