/** * This file is part of license combination gpl version 3 license and eCos. * The corresponding license terms are below. * * gpl version 3 Licence: * * The file were developed during the student thesis "Datensammlung in Wireless * Sensor Networks fuer Autonomic Home NetworkingÒ of Thomas Kothmayr and is * included in the dissertation "Secure Data Transmission in Wireless * Sensor Networks" by Corinna Schmitt during employment at the Technische * UniversitŠt MŸnchen, Department Computer Science, Chair Network * Architectures and Services (Germany). * Copyright (C) 2013 * Authors: Thomas Kothmayr and Corinna Schmitt (schmitt[at]net.in.tum.de) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * * eCos Licence: (http://ecos.sourceware.org) * * This file is part of eCos, the Embedded Configurable Operating System. * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, * 2007, 2008, 2009 Free Software Foundation, Inc. * * eCos is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free * Software Foundation; either version 3 any later version. * * eCos is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with eCos; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * As a special exception, if other files instantiate templates or use * macros or inline functions from this file, or you compile this file and * link it with other works to produce a work based on this file, this file * does not by itself cause the resulting work to be covered by the GNU * General Public License. However the source code for this file must still * be made available in accordance with section (3) of the GNU General * Public License v2. * * This exception does not invalidate any other reasons why a work based on * this file might be covered by the GNU General Public License. * */ Interface: tos.interfaces.Send

Interface: tos.interfaces.Send

interface Send

Author:
Phil Levis
David Gay Revision: $Revision: 1.11 $ Defines global error codes for error_t in TinyOS.

Commands
command error_t cancel(message_t *msg) Cancel a requested transmission.
command void *getPayload(message_t *msg, uint8_t len) Return a pointer to a protocol's payload region in a packet which at least a certain length.
command uint8_t maxPayloadLength() Return the maximum payload length that this communication layer can provide.
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 in its entirety). Note that the component may not know if the send was successfully cancelled, if the radio is handling much of the logic; in this case, a component should be conservative and return an appropriate error code.

Parameters:
'message_t* ONE msg' the packet whose transmission should be cancelled
Returns:
SUCCESS if the packet was successfully cancelled, FAIL otherwise

getPayload

command void *getPayload(message_t *msg, uint8_t len)

Return a pointer to a protocol's payload region in a packet which at least a certain length. If the payload region is smaller than the len parameter, then getPayload returns NULL. This command behaves identicallt to Packet.getPayload and is included in this interface as a convenience.

Parameters:
'message_t* ONE msg' the packet
Returns:
'void* COUNT_NOK(len)' a pointer to the packet's payload

maxPayloadLength

command uint8_t maxPayloadLength()

Return the maximum payload length that this communication layer can provide. This command behaves identically to Packet.maxPayloadLength and is included in this interface as a convenience.

Returns:
the maximum payload length

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:
'message_t* ONE 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:
'message_t* ONE 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