Interface: tos.lib.byte_radio.MacSend

interface MacSend

This interface is similar to the Send interface. It provides the same basic functionality as the Send interface in async context. It is provided by the MAC layer of byte radios.

See:
Send
Author:
Philipp Huppertz

Commands
command error_t cancel(message_t *msg) Cancel a requested transmission.
command error_t send(message_t *msg, uint8_t len) Send a packet with a data payload of len.

Events
event void sendDone(message_t *msg, error_t error) Signaled in response to an accepted send request.

Commands - Details

cancel

command error_t cancel(message_t *msg)

Cancel a requested transmission. Returns SUCCESS if the transmission was cancelled properly (not sent at all)

Parameters:
msg - the packet whose transmission should be cancelled
Returns:
SUCCESS if the packet was successfully cancelled, FAIL otherwise

send

command error_t send(message_t *msg, uint8_t len)

Send a packet with a data payload of len. To determine the maximum available size, use the Packet interface of the component providing Send. If send returns SUCCESS, then the component will signal the sendDone event in the future; if send returns an error, it will not signal sendDone. Note that a component may accept a send request which it later finds it cannot satisfy; in this case, it will signal sendDone with an appropriate error code.

Parameters:
msg - the packet to send
len - the length of the packet payload
Returns:
SUCCESS if the request was accepted and will issue a sendDone event, EBUSY if the component cannot accept the request now but will be able to later, FAIL if the stack is in a state that cannot accept requests (e.g., it's off).

Events - Details

sendDone

event void sendDone(message_t *msg, error_t error)

Signaled in response to an accepted send request. msg is the sent buffer, and error indicates whether the send was succesful, and if not, the cause of the failure.

Parameters:
msg - the message which was requested to send
error - SUCCESS if it was transmitted successfully, FAIL if it was not, ECANCEL if it was cancelled via cancel