[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/rf2xx/layers ActiveMessageLayer.h, NONE, 1.1 ActiveMessageLayerP.nc, NONE, 1.1 IEEE154MessageConfig.nc, NONE, 1.1 IEEE154MessageLayer.h, NONE, 1.1 IEEE154MessageLayer.nc, NONE, 1.1 IEEE154MessageLayerC.nc, NONE, 1.1 IEEE154MessageLayerP.nc, NONE, 1.1 LowPowerListeningConfig.nc, NONE, 1.1 LowpanNetworkConfig.nc, NONE, 1.1 LowpanNetworkLayer.h, NONE, 1.1 LowpanNetworkLayerC.nc, NONE, 1.1 ActiveMessageConfig.nc, 1.1, 1.2 ActiveMessageLayerC.nc, 1.1, 1.2 LowPowerListeningLayerC.nc, 1.3, 1.4 LowPowerListeningLayerP.nc, 1.3, 1.4 IEEE154NetworkLayerC.nc, 1.3, NONE IEEE154NetworkLayerP.nc, 1.3, NONE IEEE154PacketLayer.h, 1.1, NONE IEEE154PacketLayer.nc, 1.1, NONE IEEE154PacketLayerC.nc, 1.1, NONE IEEE154PacketLayerP.nc, 1.1, NONE

Miklos Maroti mmaroti at users.sourceforge.net
Fri Apr 3 17:43:57 PDT 2009


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32361/layers

Modified Files:
	ActiveMessageConfig.nc ActiveMessageLayerC.nc 
	LowPowerListeningLayerC.nc LowPowerListeningLayerP.nc 
Added Files:
	ActiveMessageLayer.h ActiveMessageLayerP.nc 
	IEEE154MessageConfig.nc IEEE154MessageLayer.h 
	IEEE154MessageLayer.nc IEEE154MessageLayerC.nc 
	IEEE154MessageLayerP.nc LowPowerListeningConfig.nc 
	LowpanNetworkConfig.nc LowpanNetworkLayer.h 
	LowpanNetworkLayerC.nc 
Removed Files:
	IEEE154NetworkLayerC.nc IEEE154NetworkLayerP.nc 
	IEEE154PacketLayer.h IEEE154PacketLayer.nc 
	IEEE154PacketLayerC.nc IEEE154PacketLayerP.nc 
Log Message:
reorganized packet header handling

--- NEW FILE: ActiveMessageLayer.h ---
/*
 * Copyright (c) 2007, Vanderbilt University
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
 * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 *
 * Author: Miklos Maroti
 */

#ifndef __ACTIVEMESSAGELAYER_H__
#define __ACTIVEMESSAGELAYER_H__

typedef nx_struct activemessage_header_t
{
	nxle_uint8_t type;
} activemessage_header_t;

#endif//__ACTIVEMESSAGELAYER_H__

--- NEW FILE: ActiveMessageLayerP.nc ---
/*
 * Copyright (c) 2007, Vanderbilt University
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
 * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 *
 * Author: Miklos Maroti
 */

module ActiveMessageLayerP
{
	provides
	{
		interface AMPacket;
		interface AMSend[am_id_t id];
		interface Receive[am_id_t id];
		interface Receive as Snoop[am_id_t id];	
	}

	uses
	{
		interface Send as SubSend;
		interface Receive as SubReceive;
		interface ActiveMessageConfig as Config;
		interface ActiveMessageAddress;
	}
}

implementation
{
/*----------------- Send -----------------*/

	command error_t AMSend.send[am_id_t id](am_addr_t addr, message_t* msg, uint8_t len)
	{
		error_t error;

		error = call Config.checkPacket(msg);
		if( error != SUCCESS )
			return error;

		call AMPacket.setSource(msg, call AMPacket.address());
		call AMPacket.setGroup(msg, call AMPacket.localGroup());
		call AMPacket.setType(msg, id);
		call AMPacket.setDestination(msg, addr);

		return call SubSend.send(msg, len);
	}

	inline event void SubSend.sendDone(message_t* msg, error_t error)
	{
		signal AMSend.sendDone[call AMPacket.type(msg)](msg, error);
	}

	inline command error_t AMSend.cancel[am_id_t id](message_t* msg)
	{
		return call SubSend.cancel(msg);
	}

	default event void AMSend.sendDone[am_id_t id](message_t* msg, error_t error)
	{
	}

	inline command uint8_t AMSend.maxPayloadLength[am_id_t id]()
	{
		return call SubSend.maxPayloadLength();
	}

	inline command void* AMSend.getPayload[am_id_t id](message_t* msg, uint8_t len)
	{
		return call SubSend.getPayload(msg, len);
	}

/*----------------- Receive -----------------*/

	event message_t* SubReceive.receive(message_t* msg, void* payload, uint8_t len)
	{
		am_id_t type = call AMPacket.type(msg);

		msg = call AMPacket.isForMe(msg) 
			? signal Receive.receive[type](msg, payload, len)
			: signal Snoop.receive[type](msg, payload, len);

		return msg;
	}

	default event message_t* Receive.receive[am_id_t id](message_t* msg, void* payload, uint8_t len)
	{
		return msg;
	}

	default event message_t* Snoop.receive[am_id_t id](message_t* msg, void* payload, uint8_t len)
	{
		return msg;
	}

/*----------------- AMPacket -----------------*/

	inline command am_addr_t AMPacket.address()
	{
		return call ActiveMessageAddress.amAddress();
	}
 
	inline command am_group_t AMPacket.localGroup()
	{
		return call ActiveMessageAddress.amGroup();
	}

	inline command bool AMPacket.isForMe(message_t* msg)
	{
		am_addr_t addr = call AMPacket.destination(msg);
		return addr == call AMPacket.address() || addr == AM_BROADCAST_ADDR;
	}

	inline command am_addr_t AMPacket.destination(message_t* msg)
	{
		return call Config.destination(msg);
	}
 
	inline command void AMPacket.setDestination(message_t* msg, am_addr_t addr)
	{
		call Config.setDestination(msg, addr);
	}

	inline command am_addr_t AMPacket.source(message_t* msg)
	{
		return call Config.source(msg);
	}

	inline command void AMPacket.setSource(message_t* msg, am_addr_t addr)
	{
		call Config.setSource(msg, addr);
	}

	inline command am_id_t AMPacket.type(message_t* msg)
	{
		return (call Config.getHeader(msg))->type;
	}

	inline command void AMPacket.setType(message_t* msg, am_id_t type)
	{
		(call Config.getHeader(msg))->type = type;
	}
  
	inline command am_group_t AMPacket.group(message_t* msg) 
	{
		return call Config.group(msg);
	}

	inline command void AMPacket.setGroup(message_t* msg, am_group_t grp)
	{
		call Config.setGroup(msg, grp);
	}

	inline async event void ActiveMessageAddress.changed()
	{
	}
}

--- NEW FILE: IEEE154MessageConfig.nc ---
/*
 * Copyright (c) 2009, Vanderbilt University
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
 * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 *
 * Author: Miklos Maroti
 */

#include <IEEE154MessageLayer.h>

interface IEEE154MessageConfig
{
	/**
	 * Returns a pointer to the IEEE 802.15.4 header fields in the message
	 */
	async command ieee154_header_t* getHeader(message_t* msg);
}

--- NEW FILE: IEEE154MessageLayer.h ---
/*
 * Copyright (c) 2007, Vanderbilt University
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
 * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 *
 * Author: Miklos Maroti
 */

#ifndef __IEEE154MESSAGELAYER_H__
#define __IEEE154MESSAGELAYER_H__

typedef nx_struct ieee154_header_t
{
	nxle_uint8_t length;
	nxle_uint16_t fcf;
	nxle_uint8_t dsn;
	nxle_uint16_t destpan;
	nxle_uint16_t dest;
	nxle_uint16_t src;
} ieee154_header_t;

// the actual radio driver might not use this
typedef nx_struct ieee154_footer_t
{ 
	nxle_uint16_t crc;
} ieee154_footer_t;

enum ieee154_fcf_enums {
	IEEE154_FCF_FRAME_TYPE = 0,
	IEEE154_FCF_SECURITY_ENABLED = 3,
	IEEE154_FCF_FRAME_PENDING = 4,
	IEEE154_FCF_ACK_REQ = 5,
	IEEE154_FCF_INTRAPAN = 6,
	IEEE154_FCF_DEST_ADDR_MODE = 10,
	IEEE154_FCF_SRC_ADDR_MODE = 14,
};

enum ieee154_fcf_type_enums {
	IEEE154_TYPE_BEACON = 0,
	IEEE154_TYPE_DATA = 1,
	IEEE154_TYPE_ACK = 2,
	IEEE154_TYPE_MAC_CMD = 3,
	IEEE154_TYPE_MASK = 7,
};

enum iee154_fcf_addr_mode_enums {
	IEEE154_ADDR_NONE = 0,
	IEEE154_ADDR_SHORT = 2,
	IEEE154_ADDR_EXT = 3,
	IEEE154_ADDR_MASK = 3,
};

#endif//__IEEE154MESSAGELAYER_H__

--- NEW FILE: IEEE154MessageLayer.nc ---
/*
 * Copyright (c) 2007, Vanderbilt University
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
 * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 *
 * Author: Miklos Maroti
 */

#include <IEEE154MessageLayer.h>
#include <message.h>

/**
 * This interface encapsulates IEEE 802.15.4 intrapan data frames with 
 * 16-bit destination pan, source and destination addresses. It also 
 * supports 6LowPan interoperability mode, and acknowledgement frames.
 * Note, that this interface does not support the CRC-16 value, which
 * should be verified before the data can be trusted.
 */
interface IEEE154MessageLayer
{
	/**
	 * Returns the raw value (unadjusted) of the length field
	 */
	async command uint8_t getLength(message_t* msg);

	/**
	 * Sets the length field
	 */
	async command void setLength(message_t* msg, uint8_t length);

	/**
	 * Returns the frame control field. This method should not be used, 
	 * isDataFrame and isAckFrame should be used instead.
	 */
	async command uint16_t getFCF(message_t* msg);

	/**
	 * Sets the frame control field. This method should not be used, 
	 * createDataFrame and createAckFrame should be used instead.
	 */
	async command void setFCF(message_t* msg, uint16_t fcf);

	/**
	 * Returns TRUE if the message is a data frame supported by 
	 * this interface (based on the value of the FCF).
	 */
	async command bool isDataFrame(message_t* msg);

	/**
	 * Sets the FCF to create a data frame supported by this interface.
	 * You may call setAckRequired and setFramePending commands after this.
	 */
	async command void createDataFrame(message_t* msg);

	/**
	 * Returns TRUE if the message is an acknowledgement frame supported
	 * by this interface (based on the value of the FCF).
	 */
	async command bool isAckFrame(message_t* msg);

	/**
	 * Sets the FCF to create an acknowledgement frame supported by
	 * this interface. You may call setFramePending after this.
	 */
	async command void createAckFrame(message_t* msg);

	/**
	 * Creates an acknowledgement packet for the given data packet.
	 * This also sets the DSN value. The data message must be a 
	 * data frame, the ack message will be overwritten.
	 */
	async command void createAckReply(message_t* data, message_t* ack);

	/**
	 * Returns TRUE if the acknowledgement packet corresponds to the
	 * data packet. The data message must be a data packet.
	 */
	async command bool verifyAckReply(message_t* data, message_t* ack);

	/**
	 * Returns TRUE if the ACK required field is set in the FCF.
	 */
	async command bool getAckRequired(message_t* msg);

	/**
	 * Sets the ACK required field in the FCF, should never be set
	 * for acknowledgement frames.
	 */
	async command void setAckRequired(message_t* msg, bool ack);

	/**
	 * Returns TRUE if the frame pending field is set in the FCF.
	 */
	async command bool getFramePending(message_t* msg);

	/**
	 * Sets the frame pending field in the FCF.
	 */
	async command void setFramePending(message_t* msg, bool pending);

	/**
	 * Returns the data sequence number
	 */
	async command uint8_t getDSN(message_t* msg);

	/**
	 * Sets the data sequence number
	 */
	async command void setDSN(message_t* msg, uint8_t dsn);

	/**
	 * returns the destination PAN id, values <= 255 are tinyos groups,
	 * valid only for data frames
	 */
	async command uint16_t getDestPan(message_t* msg);

	/**
	 * Sets the destination PAN id, valid only for data frames
	 */
	async command void setDestPan(message_t* msg, uint16_t pan);

	/**
	 * Returns the destination address, valid only for data frames
	 */
	async command uint16_t getDestAddr(message_t* msg);

	/**
	 * Sets the destination address, valid only for data frames
	 */
	async command void setDestAddr(message_t* msg, uint16_t addr);

	/**
	 * Returns the source address, valid only for data frames
	 */
	async command uint16_t getSrcAddr(message_t* msg);

	/**
	 * Sets the source address, valid only for data frames
	 */
	async command void setSrcAddr(message_t* msg, uint16_t addr);

	/**
	 * Returns TRUE if the packet is a data packet, the ACK_REQ field
	 * is set and the destination address is not the broadcast address.
	 */
	async command bool requiresAckWait(message_t* msg);

	/**
	 * Returns TRUE if the packet is a data packet, the ACK_REQ field
	 * is set and the destionation address is this node.
	 */
	async command bool requiresAckReply(message_t* msg);
}

--- NEW FILE: IEEE154MessageLayerC.nc ---
/*
 * Copyright (c) 2007, Vanderbilt University
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
 * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 *
 * Author: Miklos Maroti
 */

configuration IEEE154MessageLayerC
{
	provides
	{
		interface IEEE154MessageLayer;
	}

	uses
	{
		interface IEEE154MessageConfig as Config;
	}
}

implementation
{
	components IEEE154MessageLayerP, ActiveMessageAddressC;
	IEEE154MessageLayerP.ActiveMessageAddress -> ActiveMessageAddressC;

	IEEE154MessageLayer = IEEE154MessageLayerP;
	Config = IEEE154MessageLayerP;
}

--- NEW FILE: IEEE154MessageLayerP.nc ---
/*
 * Copyright (c) 2007, Vanderbilt University
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
 * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 *
 * Author: Miklos Maroti
 */

#include <IEEE154MessageLayer.h>

module IEEE154MessageLayerP
{
	provides 
	{
		interface IEEE154MessageLayer;
		interface Ieee154Packet;
	}

	uses
	{
		interface ActiveMessageAddress;
		interface IEEE154MessageConfig as Config;
	}
}

implementation
{
/*----------------- IEEE154Message -----------------*/

	enum
	{
		IEEE154_DATA_FRAME_MASK = (IEEE154_TYPE_MASK << IEEE154_FCF_FRAME_TYPE) 
			| (1 << IEEE154_FCF_INTRAPAN) 
			| (IEEE154_ADDR_MASK << IEEE154_FCF_DEST_ADDR_MODE) 
			| (IEEE154_ADDR_MASK << IEEE154_FCF_SRC_ADDR_MODE),

		IEEE154_DATA_FRAME_VALUE = (IEEE154_TYPE_DATA << IEEE154_FCF_FRAME_TYPE) 
			| (1 << IEEE154_FCF_INTRAPAN) 
			| (IEEE154_ADDR_SHORT << IEEE154_FCF_DEST_ADDR_MODE) 
			| (IEEE154_ADDR_SHORT << IEEE154_FCF_SRC_ADDR_MODE),

		IEEE154_ACK_FRAME_LENGTH = 5,	// includes the FCF, DSN and FCS
		IEEE154_ACK_FRAME_MASK = (IEEE154_TYPE_MASK << IEEE154_FCF_FRAME_TYPE), 
		IEEE154_ACK_FRAME_VALUE = (IEEE154_TYPE_ACK << IEEE154_FCF_FRAME_TYPE),
	};

	ieee154_header_t* getHeader(message_t* msg)
	{
		return call Config.getHeader(msg);
	}

	async command uint8_t IEEE154MessageLayer.getLength(message_t* msg)
	{
		return getHeader(msg)->length;
	}

	async command void IEEE154MessageLayer.setLength(message_t* msg, uint8_t length)
	{
		getHeader(msg)->length = length;
	}

	async command uint16_t IEEE154MessageLayer.getFCF(message_t* msg)
	{
		return getHeader(msg)->fcf;
	}

	async command void IEEE154MessageLayer.setFCF(message_t* msg, uint16_t fcf)
	{
		getHeader(msg)->fcf = fcf;
	}

	async command bool IEEE154MessageLayer.isDataFrame(message_t* msg)
	{
		return (getHeader(msg)->fcf & IEEE154_DATA_FRAME_MASK) == IEEE154_DATA_FRAME_VALUE;
	}

	async command void IEEE154MessageLayer.createDataFrame(message_t* msg)
	{
		getHeader(msg)->fcf = IEEE154_DATA_FRAME_VALUE;
	}

	async command bool IEEE154MessageLayer.isAckFrame(message_t* msg)
	{
		return (getHeader(msg)->fcf & IEEE154_ACK_FRAME_MASK) == IEEE154_ACK_FRAME_VALUE;
	}

	async command void IEEE154MessageLayer.createAckFrame(message_t* msg)
	{
		ieee154_header_t* header = getHeader(msg);

		header->length = IEEE154_ACK_FRAME_LENGTH;
		header->fcf = IEEE154_ACK_FRAME_VALUE;
	}

	async command void IEEE154MessageLayer.createAckReply(message_t* data, message_t* ack)
	{
		ieee154_header_t* header = getHeader(ack);

		header->length = IEEE154_ACK_FRAME_LENGTH;
		header->fcf = IEEE154_ACK_FRAME_VALUE;
		header->dsn = getHeader(data)->dsn;
	}

	async command bool IEEE154MessageLayer.verifyAckReply(message_t* data, message_t* ack)
	{
		ieee154_header_t* header = getHeader(ack);

		return header->dsn == getHeader(data)->dsn
			&& (header->fcf & IEEE154_ACK_FRAME_MASK) == IEEE154_ACK_FRAME_VALUE;
	}

	async command bool IEEE154MessageLayer.getAckRequired(message_t* msg)
	{
		return getHeader(msg)->fcf & (1 << IEEE154_FCF_ACK_REQ);
	}

	async command void IEEE154MessageLayer.setAckRequired(message_t* msg, bool ack)
	{
		if( ack )
			getHeader(msg)->fcf |= (1 << IEEE154_FCF_ACK_REQ);
		else
			getHeader(msg)->fcf &= ~(uint16_t)(1 << IEEE154_FCF_ACK_REQ);
	}

	async command bool IEEE154MessageLayer.getFramePending(message_t* msg)
	{
		return getHeader(msg)->fcf & (1 << IEEE154_FCF_FRAME_PENDING);
	}

	async command void IEEE154MessageLayer.setFramePending(message_t* msg, bool pending)
	{
		if( pending )
			getHeader(msg)->fcf |= (1 << IEEE154_FCF_FRAME_PENDING);
		else
			getHeader(msg)->fcf &= ~(uint16_t)(1 << IEEE154_FCF_FRAME_PENDING);
	}

	async command uint8_t IEEE154MessageLayer.getDSN(message_t* msg)
	{
		return getHeader(msg)->dsn;
	}

	async command void IEEE154MessageLayer.setDSN(message_t* msg, uint8_t dsn)
	{
		getHeader(msg)->dsn = dsn;
	}

	async command uint16_t IEEE154MessageLayer.getDestPan(message_t* msg)
	{
		return getHeader(msg)->destpan;
	}

	async command void IEEE154MessageLayer.setDestPan(message_t* msg, uint16_t pan)
	{
		getHeader(msg)->destpan = pan;
	}

	async command uint16_t IEEE154MessageLayer.getDestAddr(message_t* msg)
	{
		return getHeader(msg)->dest;
	}

	async command void IEEE154MessageLayer.setDestAddr(message_t* msg, uint16_t addr)
	{
		getHeader(msg)->dest = addr;
	}

	async command uint16_t IEEE154MessageLayer.getSrcAddr(message_t* msg)
	{
		return getHeader(msg)->src;
	}

	async command void IEEE154MessageLayer.setSrcAddr(message_t* msg, uint16_t addr)
	{
		getHeader(msg)->src = addr;
	}

	async command bool IEEE154MessageLayer.requiresAckWait(message_t* msg)
	{
		return call IEEE154MessageLayer.getAckRequired(msg)
			&& call IEEE154MessageLayer.isDataFrame(msg)
			&& call IEEE154MessageLayer.getDestAddr(msg) != 0xFFFF;
	}

	async command bool IEEE154MessageLayer.requiresAckReply(message_t* msg)
	{
		return call IEEE154MessageLayer.getAckRequired(msg)
			&& call IEEE154MessageLayer.isDataFrame(msg)
			&& call IEEE154MessageLayer.getDestAddr(msg) == call ActiveMessageAddress.amAddress();
	}

	async event void ActiveMessageAddress.changed()
	{
	}

/*----------------- Ieee154Packet -----------------*/

	command ieee154_saddr_t Ieee154Packet.address()
	{
		return call ActiveMessageAddress.amAddress();
	}

	command ieee154_saddr_t Ieee154Packet.destination(message_t* msg)
	{
		return call IEEE154MessageLayer.getDestAddr(msg);
	}
 
	command ieee154_saddr_t Ieee154Packet.source(message_t* msg)
	{
		return call IEEE154MessageLayer.getSrcAddr(msg);
	}

	command void Ieee154Packet.setDestination(message_t* msg, ieee154_saddr_t addr)
	{
		call IEEE154MessageLayer.setDestAddr(msg, addr);
	}

	command void Ieee154Packet.setSource(message_t* msg, ieee154_saddr_t addr)
	{
		call IEEE154MessageLayer.setSrcAddr(msg, addr);
	}

	command bool Ieee154Packet.isForMe(message_t* msg)
	{
		ieee154_saddr_t addr = call Ieee154Packet.destination(msg);
		return addr == call Ieee154Packet.address() || addr == IEEE154_BROADCAST_ADDR;
	}

	command ieee154_panid_t Ieee154Packet.pan(message_t* msg)
	{
		return call IEEE154MessageLayer.getDestPan(msg);
	}

	command void Ieee154Packet.setPan(message_t* msg, ieee154_panid_t grp)
	{
		call IEEE154MessageLayer.setDestPan(msg, grp);
	}

	command ieee154_panid_t Ieee154Packet.localPan()
	{
		return call ActiveMessageAddress.amGroup();
	}
}

--- NEW FILE: LowPowerListeningConfig.nc ---
/*
 * Copyright (c) 2009, Vanderbilt University
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
 * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 *
 * Author: Miklos Maroti
 */

#include <LowPowerListeningLayer.h>

interface LowPowerListeningConfig
{
	/**
	 * Returns a pointer to the low power listening metadata fields in 
	 * the message
	 */
	async command lpl_metadata_t* metadata(message_t* msg);

	/**
	 * Clears the low power listening metadata fields in order to disable 
	 * low power listening for the message
	 */
	async event void clear(message_t* msg);

	/**
	 * Returns TRUE if an acknowledgement is requested for this message.
	 */
	async command bool getAckRequired(message_t* msg);
}

--- NEW FILE: LowpanNetworkConfig.nc ---
/*
 * Copyright (c) 2007, Vanderbilt University
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
 * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 *
 * Author: Miklos Maroti
 */

#include <LowpanNetworkLayer.h>

interface LowpanNetworkConfig
{
	/**
	 * Returns a pointer to the 6LowPAN header field in the message
	 */
	command lowpan_header_t* getHeader(message_t* msg);
}

--- NEW FILE: LowpanNetworkLayer.h ---
/*
 * Copyright (c) 2007, Vanderbilt University
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
 * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 *
 * Author: Miklos Maroti
 */

#ifndef __LOWPANNETWORKLAYER_H__
#define __LOWPANNETWORKLAYER_H__

typedef nx_struct lowpan_header_t
{
	nxle_uint8_t network;
} lowpan_header_t;

#endif//__LOWPANNETWORKLAYER_H__

--- NEW FILE: LowpanNetworkLayerC.nc ---
/*
 * Copyright (c) 2007, Vanderbilt University
 * All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose, without fee, and without written agreement is
 * hereby granted, provided that the above copyright notice, the following
 * two paragraphs and the author appear in all copies of this software.
 * 
 * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT
 * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 *
 * Author: Miklos Maroti
 */

module LowpanNetworkLayerC
{
	provides
	{
		interface Send;
		interface Receive;

		interface Receive as NonTinyosReceive[uint8_t network];
	}

	uses
	{
		interface Send as SubSend;
		interface Receive as SubReceive;
		interface LowpanNetworkConfig as Config;
	}
}

implementation
{
#ifndef TINYOS_6LOWPAN_NETWORK_ID
#define TINYOS_6LOWPAN_NETWORK_ID 0x3f
#endif

	command error_t Send.send(message_t* msg, uint8_t len)
	{
		(call Config.getHeader(msg))->network = TINYOS_6LOWPAN_NETWORK_ID;
		return call SubSend.send(msg, len);
	}

	command error_t Send.cancel(message_t* msg)
	{
		return call SubSend.cancel(msg);
	}

	command uint8_t Send.maxPayloadLength()
	{
		return call SubSend.maxPayloadLength();
	}

	command void* Send.getPayload(message_t* msg, uint8_t len)
	{
		return call SubSend.getPayload(msg, len);
	}
  
	event void SubSend.sendDone(message_t* msg, error_t error)
	{
		signal Send.sendDone(msg, error);
	}
  
	event message_t *SubReceive.receive(message_t *msg, void *payload, uint8_t len)
	{
		uint8_t network = (call Config.getHeader(msg))->network;
		if( network == TINYOS_6LOWPAN_NETWORK_ID )
			return signal Receive.receive(msg, payload, len);
		else
			return signal NonTinyosReceive.receive[network](msg, payload, len);
	}

	default event message_t *NonTinyosReceive.receive[uint8_t network](message_t *msg, void *payload, uint8_t len)
	{
		return msg;
	}
}

Index: ActiveMessageConfig.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/ActiveMessageConfig.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ActiveMessageConfig.nc	10 Mar 2009 20:37:58 -0000	1.1
--- ActiveMessageConfig.nc	4 Apr 2009 00:43:55 -0000	1.2
***************
*** 22,25 ****
--- 22,27 ----
   */
  
+ #include <ActiveMessageLayer.h>
+ 
  interface ActiveMessageConfig
  {
***************
*** 30,32 ****
--- 32,57 ----
  	 */
  	command error_t checkPacket(message_t* msg);
+ 
+ 	/**
+ 	 * Returns a pointer to the ActiveMessage header field in the message
+ 	 */
+ 	command activemessage_header_t* getHeader(message_t* msg);
+ 
+ 	/** Same as AMPacket.destination */
+ 	command am_addr_t destination(message_t* msg);
+ 
+ 	/** Same as AMPacket.setDestination */
+ 	command void setDestination(message_t* msg, am_addr_t addr);
+ 
+ 	/** Same as AMPacket.source */
+ 	command am_addr_t source(message_t* msg);
+ 
+ 	/** Same as AMPacket.setSource */
+ 	command void setSource(message_t* msg, am_addr_t addr);
+ 
+ 	/** Same as AMPacket.group */
+ 	command am_group_t group(message_t* msg);
+ 
+ 	/** Same as AMPacket.setGroup */
+ 	command void setGroup(message_t* msg, am_group_t grp);
  }

Index: ActiveMessageLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/ActiveMessageLayerC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ActiveMessageLayerC.nc	10 Mar 2009 20:37:58 -0000	1.1
--- ActiveMessageLayerC.nc	4 Apr 2009 00:43:55 -0000	1.2
***************
*** 1,4 ****
  /*
!  * Copyright (c) 2007, Vanderbilt University
   * All rights reserved.
   *
--- 1,4 ----
  /*
!  * Copyright (c) 2009, Vanderbilt University
   * All rights reserved.
   *
***************
*** 22,38 ****
   */
  
! module ActiveMessageLayerC
  {
  	provides
  	{
  		interface AMSend[am_id_t id];
  		interface Receive[am_id_t id];
  		interface Receive as Snoop[am_id_t id];	
  	}
  	uses
  	{
  		interface Send as SubSend;
  		interface Receive as SubReceive;
- 		interface AMPacket;
  		interface ActiveMessageConfig as Config;
  	}
--- 22,41 ----
   */
  
! #include <ActiveMessageLayer.h>
! 
! configuration ActiveMessageLayerC
  {
  	provides
  	{
+ 		interface AMPacket;
  		interface AMSend[am_id_t id];
  		interface Receive[am_id_t id];
  		interface Receive as Snoop[am_id_t id];	
  	}
+ 
  	uses
  	{
  		interface Send as SubSend;
  		interface Receive as SubReceive;
  		interface ActiveMessageConfig as Config;
  	}
***************
*** 41,107 ****
  implementation
  {
! /*----------------- Send -----------------*/
! 
! 	command error_t AMSend.send[am_id_t id](am_addr_t addr, message_t* msg, uint8_t len)
! 	{
! 		error_t error;
! 
! 		error = call Config.checkPacket(msg);
! 		if( error != SUCCESS )
! 			return error;
! 
! 		call AMPacket.setSource(msg, call AMPacket.address());
! 		call AMPacket.setGroup(msg, call AMPacket.localGroup());
! 		call AMPacket.setType(msg, id);
! 		call AMPacket.setDestination(msg, addr);
! 
! 		return call SubSend.send(msg, len);
! 	}
! 
! 	inline event void SubSend.sendDone(message_t* msg, error_t error)
! 	{
! 		signal AMSend.sendDone[call AMPacket.type(msg)](msg, error);
! 	}
! 
! 	inline command error_t AMSend.cancel[am_id_t id](message_t* msg)
! 	{
! 		return call SubSend.cancel(msg);
! 	}
! 
! 	default event void AMSend.sendDone[am_id_t id](message_t* msg, error_t error)
! 	{
! 	}
! 
! 	inline command uint8_t AMSend.maxPayloadLength[am_id_t id]()
! 	{
! 		return call SubSend.maxPayloadLength();
! 	}
! 
! 	inline command void* AMSend.getPayload[am_id_t id](message_t* msg, uint8_t len)
! 	{
! 		return call SubSend.getPayload(msg, len);
! 	}
! 
! /*----------------- Receive -----------------*/
! 
! 	event message_t* SubReceive.receive(message_t* msg, void* payload, uint8_t len)
! 	{
! 		am_id_t type = call AMPacket.type(msg);
! 
! 		msg = call AMPacket.isForMe(msg) 
! 			? signal Receive.receive[type](msg, payload, len)
! 			: signal Snoop.receive[type](msg, payload, len);
! 
! 		return msg;
! 	}
! 
! 	default event message_t* Receive.receive[am_id_t id](message_t* msg, void* payload, uint8_t len)
! 	{
! 		return msg;
! 	}
  
! 	default event message_t* Snoop.receive[am_id_t id](message_t* msg, void* payload, uint8_t len)
! 	{
! 		return msg;
! 	}
  }
--- 44,57 ----
  implementation
  {
! 	components ActiveMessageLayerP, ActiveMessageAddressC;
! 	ActiveMessageLayerP.ActiveMessageAddress -> ActiveMessageAddressC;
  
! 	AMPacket = ActiveMessageLayerP;
! 	AMSend = ActiveMessageLayerP;
! 	Receive = ActiveMessageLayerP.Receive;
! 	Snoop = ActiveMessageLayerP.Snoop;
! 	
! 	SubSend = ActiveMessageLayerP;
! 	SubReceive = ActiveMessageLayerP;
! 	Config = ActiveMessageLayerP;
  }

Index: LowPowerListeningLayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/LowPowerListeningLayerC.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** LowPowerListeningLayerC.nc	2 Apr 2009 22:10:03 -0000	1.3
--- LowPowerListeningLayerC.nc	4 Apr 2009 00:43:55 -0000	1.4
***************
*** 42,47 ****
  		interface Receive as SubReceive;
  
! 		interface PacketData<lpl_metadata_t> as PacketLplMetadata;
! 		interface IEEE154PacketLayer;
  		interface PacketAcknowledgements;
  	}
--- 42,46 ----
  		interface Receive as SubReceive;
  
! 		interface LowPowerListeningConfig as Config;
  		interface PacketAcknowledgements;
  	}
***************
*** 60,65 ****
  	SubSend = LowPowerListeningLayerP;
  	SubReceive = LowPowerListeningLayerP;
! 	PacketLplMetadata = LowPowerListeningLayerP;
! 	IEEE154PacketLayer = LowPowerListeningLayerP;
  	PacketAcknowledgements = LowPowerListeningLayerP;
  	
--- 59,63 ----
  	SubSend = LowPowerListeningLayerP;
  	SubReceive = LowPowerListeningLayerP;
! 	Config = LowPowerListeningLayerP;
  	PacketAcknowledgements = LowPowerListeningLayerP;
  	

Index: LowPowerListeningLayerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** LowPowerListeningLayerP.nc	2 Apr 2009 22:10:04 -0000	1.3
--- LowPowerListeningLayerP.nc	4 Apr 2009 00:43:55 -0000	1.4
***************
*** 42,48 ****
  		interface Receive as SubReceive;
  
- 		interface PacketData<lpl_metadata_t> as PacketLplMetadata;
- 		interface IEEE154PacketLayer;
  		interface PacketAcknowledgements;
  		interface Timer<TMilli>;
  	}
--- 42,47 ----
  		interface Receive as SubReceive;
  
  		interface PacketAcknowledgements;
+ 		interface LowPowerListeningConfig as Config;
  		interface Timer<TMilli>;
  	}
***************
*** 337,341 ****
  			|| call LowPowerListening.getRxSleepInterval(msg) == 0
  			|| state == SEND_SUBSEND_DONE_LAST
! 			|| (call IEEE154PacketLayer.getAckRequired(msg) && call PacketAcknowledgements.wasAcked(msg)) )
  		{
  			call Timer.stop();
--- 336,340 ----
  			|| call LowPowerListening.getRxSleepInterval(msg) == 0
  			|| state == SEND_SUBSEND_DONE_LAST
! 			|| (call Config.getAckRequired(msg) && call PacketAcknowledgements.wasAcked(msg)) )
  		{
  			call Timer.stop();
***************
*** 420,429 ****
  			interval = MAX_SLEEP;
  
! 		(call PacketLplMetadata.get(msg))->sleepint = interval;
  	}
  
  	command uint16_t LowPowerListening.getRxSleepInterval(message_t *msg)
  	{
! 		uint16_t sleepint = (call PacketLplMetadata.get(msg))->sleepint;
  
  		return sleepint != 0 ? sleepint : sleepInterval;
--- 419,428 ----
  			interval = MAX_SLEEP;
  
! 		(call Config.metadata(msg))->sleepint = interval;
  	}
  
  	command uint16_t LowPowerListening.getRxSleepInterval(message_t *msg)
  	{
! 		uint16_t sleepint = (call Config.metadata(msg))->sleepint;
  
  		return sleepint != 0 ? sleepint : sleepInterval;
***************
*** 442,448 ****
  	}
  
! 	async event void PacketLplMetadata.clear(message_t* msg)
  	{
! 		(call PacketLplMetadata.get(msg))->sleepint = 0;
  	}
  }
--- 441,447 ----
  	}
  
! 	async event void Config.clear(message_t* msg)
  	{
! 		(call Config.metadata(msg))->sleepint = 0;
  	}
  }

--- IEEE154NetworkLayerC.nc DELETED ---

--- IEEE154NetworkLayerP.nc DELETED ---

--- IEEE154PacketLayer.h DELETED ---

--- IEEE154PacketLayer.nc DELETED ---

--- IEEE154PacketLayerC.nc DELETED ---

--- IEEE154PacketLayerP.nc DELETED ---



More information about the Tinyos-2-commits mailing list