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

Interface: ReceiveMsg

Receiving TinyOS packets.

Components providing this interface:
tos.platform.avrmote.InjectMsg
tos.platform.mica.MicaHighSpeedRadioM
tos.platform.mica.RadioCRCPacket
tos.system.AMStandard
tos.system.CrcFilter
tos.system.GenericComm
tos.system.NoCRCPacket
tos.system.UARTNoCRCPacket

Components requiring this interface:
tos.lib.TinyDB.NetworkC
tos.system.AMStandard
tos.system.CrcFilter

Events

Events - Details

receive

TOS_MsgPtr receive(TOS_MsgPtr m)

A packet has been received. The packet received is passed as a pointer parameter. The event handler should return a pointer to a packet buffer for the reception layer to use for the next reception. This allows an application to swap buffers back and forth with the messaging layer, preventing the need for copying. The signaled component should not maintain a reference to the buffer that it returns. It may return the buffer it was passed. For example:
 event TOS_MsgPtr ReceiveMsg.receive(TOS_MsgPtr m) {
    return m;
 }
 
A more common example:
 TOS_MsgPtr buffer;
 event TOS_MsgPtr ReceiveMsg.receive(TOS_MsgPtr m) {
    TOS_MsgPtr tmp;
    tmp = buffer;
    buffer = m;
	post receiveTask();
	return tmp;
 }
 
Returns: A buffer for the provider to use for the next packet.