/** * 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.AMSend

Interface: tos.interfaces.AMSend

interface AMSend

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.
command uint8_t maxPayloadLength() Return the maximum payload length that this communication layer can provide.
command error_t send(am_addr_t addr, message_t *msg, uint8_t len) Send a packet with a data payload of len to address addr.

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 canceled properly (not sent in its entirety). Note that the component may not know if the send was successfully canceled, if the radio is handling much of the logic; in this case, a component should be conservative and return an appropriate error code. A successful call to cancel must always result in a sendFailed event, and never a sendSucceeded event.

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

getPayload

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

Return a pointer to a protocol's payload region in a packet. This command behaves identically to Packet.getPayload (minus the length parameter) and is included in this interface as a convenience.

Parameters:
'message_t* ONE msg' the packet
Returns:
'void* COUNT(len)' the payload of the packet

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(am_addr_t addr, message_t *msg, uint8_t len)

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

Parameters:
addr - address to which to send the packet
'message_t* ONE msg' the packet
len - the length of the data in the packet payload
Returns:
SUCCESS if the request to send succeeded and a sendDone will be signaled later, EBUSY if the abstraction cannot send now but will be able to later, or FAIL if the communication layer is not in a state that can send (e.g., off).
See:
sendDone

Events - Details

sendDone

event void sendDone(message_t *msg, error_t error)

Signaled in response to an accepted send request. msg is the message buffer sent, and error indicates whether the send was successful.

Parameters:
'message_t* ONE msg' the packet which was submitted as a send request
error - SUCCESS if it was sent successfully, FAIL if it was not, ECANCEL if it was cancelled
See:
send
cancel