[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/mac/tkn154/interfaces/private DataRequest.nc, NONE, 1.1 EnergyDetection.nc, NONE, 1.1 FrameExtracted.nc, NONE, 1.1 FrameRx.nc, NONE, 1.1 FrameTx.nc, NONE, 1.1 FrameTxNow.nc, NONE, 1.1 FrameUtility.nc, NONE, 1.1 Ieee802154Debug.nc, NONE, 1.1 Purge.nc, NONE, 1.1 RadioOff.nc, NONE, 1.1 RadioRx.nc, NONE, 1.1 RadioTx.nc, NONE, 1.1 ResourceTransferConnector.nc, NONE, 1.1 ResourceTransferControl.nc, NONE, 1.1 ResourceTransfer.nc, NONE, 1.1 ResourceTransferred.nc, NONE, 1.1 TimeCalc.nc, NONE, 1.1 WriteBeaconField.nc, NONE, 1.1

Jan-Hinrich Hauer janhauer at users.sourceforge.net
Mon Jun 16 11:00:36 PDT 2008


Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/interfaces/private
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv30549/tos/lib/mac/tkn154/interfaces/private

Added Files:
	DataRequest.nc EnergyDetection.nc FrameExtracted.nc FrameRx.nc 
	FrameTx.nc FrameTxNow.nc FrameUtility.nc Ieee802154Debug.nc 
	Purge.nc RadioOff.nc RadioRx.nc RadioTx.nc 
	ResourceTransferConnector.nc ResourceTransferControl.nc 
	ResourceTransfer.nc ResourceTransferred.nc TimeCalc.nc 
	WriteBeaconField.nc 
Log Message:
Initial version of TKN15.4, a platform-independent IEEE 802.15.4-2006 MAC implementation (see tinyos-2.x/tos/lib/mac/tkn154/README.txt)

--- NEW FILE: DataRequest.nc ---
/* 
 * Copyright (c) 2008, Technische Universitaet Berlin All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.  - Redistributions in
 * binary form must reproduce the above copyright notice, this list of
 * conditions and the following disclaimer in the documentation and/or other
 * materials provided with the distribution.  - Neither the name of the
 * Technische Universitaet Berlin nor the names of its contributors may be used
 * to endorse or promote products derived from this software without specific
 * prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:32 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */
interface DataRequest
{
  /**
   * Sends a data request frame to the coordinator. 
   *
   * @param CoordAddrMode coordinator address mode
   * @param CoordPANId coordinator PAN ID
   * @param CoordAddressLE points to coordinator address stored in 
   *                       little endian format
   * @param SrcAddrMode source address mode
   * @returns IEEE154_SUCCESS if a data request frame will be transmitted and
   * only then pollDone will be signalled. 
   **/
  command ieee154_status_t poll(uint8_t CoordAddrMode, uint16_t CoordPANId, uint8_t *CoordAddressLE, uint8_t SrcAddrMode);


  /**
   * Signalled in response to a successful poll command
   **/
  event void pollDone();
}

--- NEW FILE: EnergyDetection.nc ---
/*
 * Copyright (c) 2008, Technische Universitaet Berlin
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions 
 * are met:
 * - Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright 
 *   notice, this list of conditions and the following disclaimer in the 
 *   documentation and/or other materials provided with the distribution.
 * - Neither the name of the Technische Universitaet Berlin nor the names 
 *   of its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:32 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */
#include "TKN154_MAC.h"
interface EnergyDetection
{
  /**
   * Requests to measure the energy level on the current channel; the
   * measurement should last for <code>duration<\code> symbols and the  
   * maximum energy level is signalled through the <code>done<\code>
   * event.
   *
   * @param duration Duration of the energy detection measurement 
   * (in symbol time)
   * @return SUCCESS if the request was accepted and only then 
   * the <code>done<\code> event will be signalled, FAIL otherwise
   **/
  command error_t start(uint32_t duration);

  /**
   * Signalled in response to a call to <code>start<\code>;
   * returns the maximum energy measured on the channel over the
   * specified period of time.
   *
   * @param status SUCCESS if the measurement succeeded
   * and only then <code>EnergyLevel<\code> is valid, FAIL 
   * otherwise
   * @param EnergyLevel The maximum energy on the channel
   **/
  event void done(error_t status, int8_t EnergyLevel);
}

--- NEW FILE: FrameExtracted.nc ---
/* 
 * Copyright (c) 2008, Technische Universitaet Berlin All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.  - Redistributions in
 * binary form must reproduce the above copyright notice, this list of
 * conditions and the following disclaimer in the documentation and/or other
 * materials provided with the distribution.  - Neither the name of the
 * Technische Universitaet Berlin nor the names of its contributors may be used
 * to endorse or promote products derived from this software without specific
 * prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:32 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */
#include "TKN154_MAC.h"
interface FrameExtracted
{
  /** 
   * A frame was extracted from the coordinator.
   *
   * @param rxFrame The frame received from the coordinator
   * @param txFrame The data request frame sent to the coordinator
   * @return A frame buffer for the stack to use for the next received frame
   **/
  event message_t* received(message_t* rxFrame, ieee154_txframe_t *txFrame);
}

--- NEW FILE: FrameRx.nc ---
/* 
 * Copyright (c) 2008, Technische Universitaet Berlin All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.  - Redistributions in
 * binary form must reproduce the above copyright notice, this list of
 * conditions and the following disclaimer in the documentation and/or other
 * materials provided with the distribution.  - Neither the name of the
 * Technische Universitaet Berlin nor the names of its contributors may be used
 * to endorse or promote products derived from this software without specific
 * prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:33 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */
#include "TKN154_MAC.h"
interface FrameRx
{
  /**
   * Received a frame buffer, returning a buffer for the signaling
   * component to use for the next reception.
   *
   * @param   frame     the received frame
   * @return            a buffer to be used by the stack for the next 
   *                    incoming frame 
   */
  event message_t* received(message_t* frame);
}

--- NEW FILE: FrameTx.nc ---
/* 
 * Copyright (c) 2008, Technische Universitaet Berlin All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.  - Redistributions in
 * binary form must reproduce the above copyright notice, this list of
 * conditions and the following disclaimer in the documentation and/or other
 * materials provided with the distribution.  - Neither the name of the
 * Technische Universitaet Berlin nor the names of its contributors may be used
 * to endorse or promote products derived from this software without specific
 * prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:33 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */
#include "TKN154_MAC.h"
interface FrameTx
{
  /**
   * Transmits a frame buffer.
   *
   * @param  txFrame    the frame to transmit
   * @return IEEE154_SUCCESS if the request was accepted and
   * only then <code>transmitDone()</code> will be signalled
   */  
  command ieee154_status_t transmit(ieee154_txframe_t *txFrame); 

  /**
   * Signals the completion of the transmission of a frame buffer.
   *
   * @param  txFrame    the frame that was transmitted
   * @param  status     the result of the transmission
   */  
  event void transmitDone(ieee154_txframe_t *txFrame, ieee154_status_t status);
}

--- NEW FILE: FrameTxNow.nc ---
/* 
 * Copyright (c) 2008, Technische Universitaet Berlin All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.  - Redistributions in
 * binary form must reproduce the above copyright notice, this list of
 * conditions and the following disclaimer in the documentation and/or other
 * materials provided with the distribution.  - Neither the name of the
 * Technische Universitaet Berlin nor the names of its contributors may be used
 * to endorse or promote products derived from this software without specific
 * prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:33 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */
#include "TKN154_MAC.h"
interface FrameTxNow
{
  /**
   * Transmits a frame buffer.
   *
   * @param  txFrame    the frame to transmit
   * @return IEEE154_SUCCESS if the request was accepted and
   * only then <code>transmitDone()</code> will be signalled
   */  
  async command ieee154_status_t transmitNow(ieee154_txframe_t *frame); 


  /**
   * Signals the completion of the transmission of a frame buffer.
   *
   * @param  txFrame    the frame that was transmitted
   * @param  status     the result of the transmission
   */  
  
  async event void transmitNowDone(ieee154_txframe_t *frame, ieee154_status_t status);
}

--- NEW FILE: FrameUtility.nc ---
/* 
 * Copyright (c) 2008, Technische Universitaet Berlin All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.  - Redistributions in
 * binary form must reproduce the above copyright notice, this list of
 * conditions and the following disclaimer in the documentation and/or other
 * materials provided with the distribution.  - Neither the name of the
 * Technische Universitaet Berlin nor the names of its contributors may be used
 * to endorse or promote products derived from this software without specific
 * prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $ $Date: 2008/06/16 18:00:33 $ 
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */
#include "TKN154.h" 
interface FrameUtility
{
  /* Writes the addressing fields in the MAC header of a frame
   * and returns number of bytes in the MAC header.*/
  async command uint8_t writeHeader(
      uint8_t* mhr,
      uint8_t DstAddrMode,
      uint16_t DstPANId,
      ieee154_address_t* DstAddr,
      uint8_t SrcAddrMode,
      uint16_t SrcPANId,
      const ieee154_address_t* SrcAddr,
      bool PANIDCompression);

  /* Determines the lenght of the MAC header depending on the frame control field*/ 
  async command error_t getMHRLength(uint8_t fcf1, uint8_t fcf2, uint8_t *len);

  /* Returns TRUE if source address is the current coordinator and
   * src PAN is current PAN */
  command bool isBeaconFromCoord(message_t *frame);

  /* writes the local extended address in little endian format */
  async command void copyLocalExtendedAddressLE(uint8_t *destLE);

  /* writes the coordinator's extended address in little endian format */
  command void copyCoordExtendedAddressLE(uint8_t *destLE);

  /* converts a uint64_t to little endian */
  async command void convertToLE(uint8_t *destLE, const uint64_t *srcNative);

  /* converts little endian to a uint64_t */
  async command void convertToNative(uint64_t *destNative, const uint8_t *srcLE);
}

--- NEW FILE: Ieee802154Debug.nc ---
/*
 * Copyright (c) 2008, Technische Universitaet Berlin
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions 
 * are met:
 * - Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright 
 *   notice, this list of conditions and the following disclaimer in the 
 *   documentation and/or other materials provided with the distribution.
 * - Neither the name of the Technische Universitaet Berlin nor the names 
 *   of its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:33 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */
interface Ieee802154Debug
{
  async command void log(uint8_t priority, uint8_t eventID, uint32_t param1, uint32_t param2, uint32_t param3);
  command void flush();
}

--- NEW FILE: Purge.nc ---
/* 
 * Copyright (c) 2008, Technische Universitaet Berlin All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.  - Redistributions in
 * binary form must reproduce the above copyright notice, this list of
 * conditions and the following disclaimer in the documentation and/or other
 * materials provided with the distribution.  - Neither the name of the
 * Technische Universitaet Berlin nor the names of its contributors may be used
 * to endorse or promote products derived from this software without specific
 * prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:33 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */
#include "TKN154.h"
interface Purge {
  /* purges a frame from the transaction queue */
  command ieee154_status_t purge(uint8_t msduHandle);
  event void purgeDone(ieee154_txframe_t *txFrame, ieee154_status_t status);
}


--- NEW FILE: RadioOff.nc ---
/* 
 * Copyright (c) 2008, Technische Universitaet Berlin
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * - Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the distribution.
 * - Neither the name of the Technische Universitaet Berlin nor the names
 *   of its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:33 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */

interface RadioOff
{

  /** 
   * Switches the radio off and changes the radio state to RADIO_OFF. This
   * command will succeed only if the current state of the radio is either
   * TX_LOADED, RX_PREPARED or RECEIVING.
   *
   * @return EALREADY if radio is already switched off <br> FAIL if radio the
   * current radio state is neither TX_LOADED, RX_PREPARED nor RECEIVING <br>
   * SUCCESS if the command was accepted and the <tt>offDone()</tt> event will
   * be signalled.
   */
  async command error_t off();

  /** 
   * Signalled in response to a successful call to <tt>off()</tt>. The radio is
   * now in the state RADIO_OFF.
   **/  
  async event void offDone();

 /** @return TRUE if the radio is in the state RADIO_OFF, FALSE otherwise */
  async command bool isOff();
}

--- NEW FILE: RadioRx.nc ---
/* 
 * Copyright (c) 2008, Technische Universitaet Berlin
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * - Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the distribution.
 * - Neither the name of the Technische Universitaet Berlin nor the names
 *   of its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:33 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */
#include "TKN154_platform.h"
interface RadioRx
{

  /** 
   * Prepares the radio for receive mode. This command will fail, if the radio
   * is not in the state RADIO_OFF. The actual receive operation will be
   * triggered through a call to <tt>receive()</tt>.  
   *
   * @return SUCCESS if the command was accepted and <tt>prepareDone()</tt>
   * will be signalled; EALREADY if the radio is already in state RX_PREPARED,
   * FAIL otherwise
   **/ 
  async command error_t prepare();

  /** 
   * Signalled in response to a successful call to <tt>prepare()</tt>. This  
   * event is completing the preparation of a receive operation, the radio is
   * now in the state RX_PREPARED. The actual receive operation will be
   * triggered through a call to <tt>receive()</tt>.
   **/    
  async event void prepareDone(); 

  /** @return TRUE if the radio is in the state RX_PREPARED, FALSE otherwise */
  async command bool isPrepared();

  /** 
   * Switches the radio to receive mode at time <tt>t0 + dt</tt>.  If
   * <tt>t0</tt> is NULL, then the callee interprets <tt>t0</tt> as the current
   * time. 
   *
   * @param t0 Reference time for receive operation (NULL means now)  
   *
   * @param dt A positive offset relative to <tt>t0</tt>.  
   *
   * @return SUCCESS if the the command was accepted and the radio will be 
   * switched to receive mode; FAIL, if the radio is not in the state 
   * RX_PREPARED
   */
  async command error_t receive(ieee154_reftime_t *t0, uint32_t dt); 
  
  /** @return TRUE if the radio is in the state RECEIVING, FALSE otherwise */
  async command bool isReceiving();

  /** 
   * A frame was received and passed the filters described in 
   * IEEE 802.15.4-2006 Sec. 7.5.6.2 ("Reception and rejection").
   *
   * @param timestamp The point in time when the first bit of the PPDU
   * was received or NULL if timestamp is not available.
   *
   * @param frame The received frame  
   *
   * @return            a buffer to be used by the driver for the next 
   *                    incoming frame 
   */
  event message_t* received(message_t *frame, ieee154_reftime_t *timestamp); 
}


--- NEW FILE: RadioTx.nc ---
/* 
 * Copyright (c) 2008, Technische Universitaet Berlin
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * - Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the distribution.
 * - Neither the name of the Technische Universitaet Berlin nor the names
 *   of its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:33 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */
#include "TKN154_MAC.h"
#include "TKN154_PHY.h"

interface RadioTx 
{

  /** 
   * Prepares the transmission of a frame. This command will fail, if the
   * radio is neither in state RADIO_OFF nor in state TX_LOADED. The actual
   * transmission will be triggered through a call to <tt>transmit()</tt>. Any
   * frame that was previously prepared for transmission ("loaded") will be
   * overwritten.  The <tt>loadDone()</tt> event signals the completion of the
   * <tt>load()</tt> command.  
   *
   * The frame will be loaded (and the radio will stay in the state
   * TX_LOADED) until either the transmission was successful, i.e.
   * <tt>transmitDone()</tt> was signalled with a status IEEE154_SUCCESS, or
   * the radio is explicitly switched off through the <tt>RadioOff</tt>
   * interface. Until then the callee might have to reserve certain resources
   * (e.g. the bus connected to the radio), so the caller should keep the time
   * while a frame is loaded as short as possible.
   *
   * @param frame The frame to transmit.
   * 
   * @return SUCCESS if the command was accepted and <tt>loadDone()</tt> will 
   * be signalled; FAIL otherwise
   **/ 
  async command error_t load(ieee154_txframe_t *frame); 

  /** 
   * Signalled in response to a successful call to <tt>load()</tt>. This  
   * event is completing the preparation of a transmission, the radio is
   * now in the state TX_LOADED. The actual transmission is triggered 
   * through a call to <tt>transmit()</tt>.
   **/  
  async event void loadDone(); 

  /** 
   * If the radio is in state TX_LOADED then this commands returns the
   * the frame that was loaded last; it returns NULL otherwise.
   *
   * @return last frame loaded if radio is in the state TX_LOADED, 
   * NULL otherwise
   **/  
  async command ieee154_txframe_t* getLoadedFrame();

  /** 
   * Transmits the frame whose transmission has previously been prepared
   * through a call to <tt>load()</tt>. The actual time of transmission -- the
   * point in time when the first symbol of the PPDU is transmitted -- is
   * defined by: <tt>t0 + dt</tt>. The data type of the <tt>t0</tt> parameter
   * is platform-specific (symbol precision or better) while <tt>dt</tt> is
   * expressed in 802.15.4 symbols. If <tt>t0</tt> is NULL, then the callee
   * interprets <tt>t0</tt> as the current time. The caller guarantees (through
   * platform-specific guard times and by calling <tt>transmit</tt> in an
   * atomic block) that the callee can start the transmission on time, taking
   * any prior clear channel assesment(s) into consideration. 
   *
   * A transmission may require 0, 1 or 2 prior clear channel assesments
   * (<tt>numCCA</tt> parameter) to be performed 0, 20 or 40 symbols,
   * respectively, before the actual transmission. If a CCA determines a busy
   * channel, then the frame will not be transmitted. 
   *
   * A successful transmission may also require an acknowledgement from the
   * destination (indicated through the <tt>ackRequest</tt> parameter); then,
   * the callee has to perform the necessary steps for receiving that
   * acknowledgement (switching the radio to Rx mode immediately after
   * transmission, etc.; for details see IEEE 802.15.4-2006).
   *
   * The <tt>transmit()</tt> command will succeed iff the radio is in state
   * TX_LOADED. The <tt>transmitDone()</tt> event will then signal the result
   * of the transmission.
   *
   * @param t0 Reference time for transmission (NULL means now)  
   *
   * @param dt A positive offset relative to <tt>t0</tt>.  
   *
   * @param numCCA Number of clear channel assesments.
   *
   * @param ackRequest TRUE means an acknowledgement is required, FALSE means
   * no acknowledgement is not required
   *
   * @return SUCCESS if the transmission was triggered successfully and only
   * then <tt>transmitDone()</tt> will be signalled; FAIL, if the transmission
   * was not triggered because no frame was loaded.
   */  
  async command error_t transmit(ieee154_reftime_t *t0, uint32_t dt, 
      uint8_t numCCA, bool ackRequest);

  /**
   * Signalled in response to a call to <tt>transmit()</tt>. Depending on the
   * <tt>error</tt> parameter the radio is now in state RADIO_OFF
   * (<tt>error</tt> == IEEE154_SUCCESS) or still in state TX_LOADED
   * (<tt>error</tt> != IEEE154_SUCCESS).  If the transmission succeeded then
   * the time of transmission -- the point in time when the first symbol of the
   * PPDU was transmitted -- will be stored in the metadata field of the frame.
   * In addition, the <tt>t0</tt> parameter will hold a platform-specific
   * representation of the same point in time (possibly with higher precision)
   * to be used as future reference time in a <tt>transmit()</tt> command. If
   * the transmission did not succeed no timestamp will be stored in the
   * metadata portion, but <tt>t0</tt> will still represent the hypothetical
   * transmission time. 
   *
   * If <tt>error</tt> has a value other than IEEE154_SUCCESS the frame will
   * stay loaded and a subsequent call to <tt>transmit</tt> will (re-)transmit
   * the same <tt>frame</tt> again. If <tt>error</tt> has a value of
   * IEEE154_SUCCESS then the frame was automatically un-loaded and a new frame
   * has to be loaded before the <tt>transmit()</tt> command will succeed.
   *
   * When the <tt>transmit()</tt> command was called with an
   * <tt>ackRequest</tt> parameter with value TRUE, and <tt>error</tt> has a
   * value of IEEE154_SUCCESS, then this means that a corresponding
   * acknowledgement was successfully received. In this case, the
   * <tt>ackPendingFlag</tt> represents the "pending" flag in the header of the
   * acknowledgement frame (TRUE means set, FALSE means reset).
   *
   * @param frame The frame that was transmitted.  
   *
   * @param t0 The (hypothetical) transmission time; the pointer is only valid
   * until the eventhandler returns.  
   *
   * @param ackPendingFlag TRUE if an acknowledgement was received and the
   * "pending" flag is set in the header of the ACK frame, FALSE otherwise
   *
   * @param error SUCCESS if the transmission succeeded (including successful
   * CCA and acknowledgement reception, if requested); EBUSY if CCA was
   * unsuccessful (frame was not transmitted); ENOACK if frame was transmitted
   * but no matching acknowledgement was received.
   **/  
  async event void transmitDone(ieee154_txframe_t *frame, ieee154_reftime_t *t0, 
      bool ackPendingFlag, error_t error);   
}

--- NEW FILE: ResourceTransferConnector.nc ---
/* 
 * Copyright (c) 2008, Technische Universitaet Berlin All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.  - Redistributions in
 * binary form must reproduce the above copyright notice, this list of
 * conditions and the following disclaimer in the documentation and/or other
 * materials provided with the distribution.  - Neither the name of the
 * Technische Universitaet Berlin nor the names of its contributors may be used
 * to endorse or promote products derived from this software without specific
 * prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:33 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */

interface ResourceTransferConnector 
{
  async command uint8_t getUserId();
  async command void transfer();
}

--- NEW FILE: ResourceTransferControl.nc ---
/* 
 * Copyright (c) 2008, Technische Universitaet Berlin All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.  - Redistributions in
 * binary form must reproduce the above copyright notice, this list of
 * conditions and the following disclaimer in the documentation and/or other
 * materials provided with the distribution.  - Neither the name of the
 * Technische Universitaet Berlin nor the names of its contributors may be used
 * to endorse or promote products derived from this software without specific
 * prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:34 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */

interface ResourceTransferControl 
{
  async command error_t transfer(uint8_t fromClient, uint8_t toClient);
  async command error_t release(uint8_t client);
}

--- NEW FILE: ResourceTransfer.nc ---
/* 
 * Copyright (c) 2008, Technische Universitaet Berlin All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.  - Redistributions in
 * binary form must reproduce the above copyright notice, this list of
 * conditions and the following disclaimer in the documentation and/or other
 * materials provided with the distribution.  - Neither the name of the
 * Technische Universitaet Berlin nor the names of its contributors may be used
 * to endorse or promote products derived from this software without specific
 * prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:34 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */

interface ResourceTransfer
{

  /** 
   * Transfer control of a resource to another client. Conceptually, this
   * command is similar to calling Resource.release() and then forcing the
   * arbiter to signal the Resource.granted() event to the target client. But
   * there is one difference: when a resource that was transferred through this
   * command is released, it is released on behalf of the "original" client,
   * i.e. who was last signalled the Resource.granted() event.  Releasing a
   * transferred resource is thus equivalent to first transferring it back to
   * the original client and then forcing the latter to release the resource
   * through a call to Resource.release() -- this ensures that the arbitration
   * policy can continue properly (and avoids possible starvation).
   *
   * Note that a resource may be transferred multiple times, before it is
   * released. Then the current owner will change, but the "original" client
   * will stay the same.
   *
   * @return SUCCESS If ownership has been transferred.<br> FAIL ownership has
   * not been transferred, because the caller is not owner of the resource
   */

  async command error_t transfer();
}

--- NEW FILE: ResourceTransferred.nc ---
/* 
 * Copyright (c) 2008, Technische Universitaet Berlin All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.  - Redistributions in
 * binary form must reproduce the above copyright notice, this list of
 * conditions and the following disclaimer in the documentation and/or other
 * materials provided with the distribution.  - Neither the name of the
 * Technische Universitaet Berlin nor the names of its contributors may be used
 * to endorse or promote products derived from this software without specific
 * prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:34 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */

interface ResourceTransferred 
{

  /** 
   * Control of a resource was transferred to this component from another
   * client. This event is similar to the Resource.granted() event, but when a
   * the resource is released, it is released on behalf of the client who was
   * last signalled the Resource.granted() event.
   *
   * @see ResourceTransfer interface
   */
  async event void transferred();

  /** 
   *
   * Release control of a resource - this command is equivalent to calling
   * Resource.release() and included for convenience. 
   *
   * @return SUCCESS The resource has been released <br> FAIL You tried to
   * release but you are not the owner of the resource
   *
   * @see ResourceTransfer interface
   */

  async command error_t release();
}

--- NEW FILE: TimeCalc.nc ---
/* 
 * Copyright (c) 2008, Technische Universitaet Berlin All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.  - Redistributions in
 * binary form must reproduce the above copyright notice, this list of
 * conditions and the following disclaimer in the documentation and/or other
 * materials provided with the distribution.  - Neither the name of the
 * Technische Universitaet Berlin nor the names of its contributors may be used
 * to endorse or promote products derived from this software without specific
 * prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:34 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */
interface TimeCalc
{
  /**
   * Returns the interval between time t1 and time t0 assuming
   * that t0 happened before t1.
   * @return interval between t1 and t0
   */
  async command uint32_t timeElapsed(uint32_t t0, uint32_t t1);

  /**
   * Assuming that t0 lies in the past, this command returns TRUE
   * iff t0+dt lies also in the past.
   * @return TRUE if t0+dt is later than "now"
   */
  async command bool hasExpired(uint32_t t0, uint32_t dt);
}

--- NEW FILE: WriteBeaconField.nc ---
/* 
 * Copyright (c) 2008, Technische Universitaet Berlin All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.  - Redistributions in
 * binary form must reproduce the above copyright notice, this list of
 * conditions and the following disclaimer in the documentation and/or other
 * materials provided with the distribution.  - Neither the name of the
 * Technische Universitaet Berlin nor the names of its contributors may be used
 * to endorse or promote products derived from this software without specific
 * prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * - Revision -------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2008/06/16 18:00:34 $
 * @author Jan Hauer <hauer at tkn.tu-berlin.de>
 * ========================================================================
 */
interface WriteBeaconField
{
  // returns length of bytes written
  command uint8_t write(uint8_t *dest, uint8_t maxlen);
  // *current* length in byte
  command uint8_t getLength();
}



More information about the Tinyos-2-commits mailing list