Apps     Components     Interfaces     All Files     Source Tree     source: tos.interfaces.Send.nc

Interface: Send

Author: Philip Levis

Components providing this interface:
tos.lib.Route.MultiHopEngineM
tos.lib.Route.MultiHopRouter

Components requiring this interface:
apps.Surge.SurgeM
tos.lib.TinyDB.NetworkMultiHopM
tos.lib.VM.opcodes.OPsendM

Commands

Events

Commands - Details

send

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.

getBuffer

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.

Events - Details

sendDone

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.