]> oss.titaniummirror.com Git - tinyos-2.x.git/blob - tos/system/AMQueueEntryP.nc
c1c0f3809b2ea6c6e6a8073cd27593f5d2044cba
[tinyos-2.x.git] / tos / system / AMQueueEntryP.nc
1 // $Id$
2 /*
3 * "Copyright (c) 2005 Stanford University. All rights reserved.
4 *
5 * Permission to use, copy, modify, and distribute this software and
6 * its documentation for any purpose, without fee, and without written
7 * agreement is hereby granted, provided that the above copyright
8 * notice, the following two paragraphs and the author appear in all
9 * copies of this software.
10 *
11 * IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE TO ANY PARTY FOR
12 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
13 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
14 * IF STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
15 * DAMAGE.
16 *
17 * STANFORD UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
18 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
20 * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND STANFORD UNIVERSITY
21 * HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
22 * ENHANCEMENTS, OR MODIFICATIONS."
23 */
24
25 /**
26 * Internal AM component that fills in needed packet fields for the
27 * AMSend -> Send transformation.
28 *
29 * @author Philip Levis
30 * @date Jan 16 2006
31 */
32
33 #include "AM.h"
34
35 generic module AMQueueEntryP(am_id_t amId) {
36 provides interface AMSend;
37 uses{
38 interface Send;
39 interface AMPacket;
40 }
41 }
42
43 implementation {
44
45 command error_t AMSend.send(am_addr_t dest,
46 message_t* msg,
47 uint8_t len) {
48 call AMPacket.setDestination(msg, dest);
49 call AMPacket.setType(msg, amId);
50 return call Send.send(msg, len);
51 }
52
53 command error_t AMSend.cancel(message_t* msg) {
54 return call Send.cancel(msg);
55 }
56
57 event void Send.sendDone(message_t* m, error_t err) {
58 signal AMSend.sendDone(m, err);
59 }
60
61 command uint8_t AMSend.maxPayloadLength() {
62 return call Send.maxPayloadLength();
63 }
64
65 command void* AMSend.getPayload(message_t* m) {
66 return call Send.getPayload(m);
67 }
68
69 }