Interface: tos.lib.byte_radio.MacReceive

interface MacReceive

This interface is similar to the Receive interface. The interface provides one event in async context which indicates that a packet was received. It Is provided by the MAC layer ofi a byte radio.

See:
Receive
Author:
Philipp Huppertz

Events
event message_t *receiveDone(message_t *msg) Receive a packet buffer, returning a buffer for the signaling component to use for the next reception.

Events - Details

receiveDone

event message_t *receiveDone(message_t *msg)

Receive a packet buffer, returning a buffer for the signaling component to use for the next reception. The return value can be the same as msg, as long as the handling component copies out the data it needs. Note that misuse of this interface is one of the most common bugs in TinyOS code. For example, if a component both calls a send on the passed message and returns it, then it is possible the buffer will be reused before the send occurs, overwriting the component's data. This would cause the mote to possibly instead send a packet it most recently received.

Parameters:
msg - the received packet
Returns:
a packet buffer for the stack to use for the next received packet.