[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/cc1000 ByteRadio.nc, 1.1.2.7, 1.1.2.8 CC1000Const.h, 1.1.2.8, 1.1.2.9 CC1000CsmaP.nc, 1.1.2.14, 1.1.2.15 CC1000Msg.h, 1.1.2.3, 1.1.2.4 CC1000SendReceiveP.nc, 1.1.2.18, 1.1.2.19 LowPowerListening.nc, 1.1.2.2, 1.1.2.3

David Gay idgay at users.sourceforge.net
Thu Oct 26 10:41:57 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/cc1000
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv23229

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	ByteRadio.nc CC1000Const.h CC1000CsmaP.nc CC1000Msg.h 
	CC1000SendReceiveP.nc LowPowerListening.nc 
Log Message:
switch to new LPL interfaces


Index: ByteRadio.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/cc1000/ByteRadio.nc,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -d -r1.1.2.7 -r1.1.2.8
*** ByteRadio.nc	22 Sep 2006 18:54:29 -0000	1.1.2.7
--- ByteRadio.nc	26 Oct 2006 17:41:54 -0000	1.1.2.8
***************
*** 21,26 ****
    /**
     * SendReceive wants to send a packet.
     */
!   event void rts();
  
    /**
--- 21,27 ----
    /**
     * SendReceive wants to send a packet.
+    * @param msg Message to be sent.
     */
!   event void rts(message_t *msg);
  
    /**

Index: CC1000Const.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/cc1000/CC1000Const.h,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -C2 -d -r1.1.2.8 -r1.1.2.9
*** CC1000Const.h	22 Sep 2006 18:54:30 -0000	1.1.2.8
--- CC1000Const.h	26 Oct 2006 17:41:55 -0000	1.1.2.9
***************
*** 219,223 ****
    CC1K_LPL_STATES =         9,
  
!   CC1K_LPL_PACKET_TIME =    16
  };
  
--- 219,236 ----
    CC1K_LPL_STATES =         9,
  
!   CC1K_LPL_PACKET_TIME =    16,
! 
!   CC1K_LPL_CHECK_TIME =     16, /* In tenth's of milliseconds, this should
! 				  be an approximation of the on-time for
! 			          a LPL check rather than the total check
! 			          time. */
!   CC1K_LPL_MIN_INTERVAL =    5, /* In milliseconds, the minimum interval
! 				   between low-power-listening checks */
!   CC1K_LPL_MAX_INTERVAL =    10000  /* In milliseconds, the maximum interval
! 				       between low-power-listening checks.
! 				       Arbitrary value, but must be at
! 				       most 32767 because of the way
! 				       sleep interval is stored in outgoing
! 				       messages */
  };
  
***************
*** 233,272 ****
  #endif 
  
- 
- static const_uint8_t CC1K_LPL_PreambleLength[CC1K_LPL_STATES*2] = {
-     0, 6,       // Always on, 6 byte preamble
-     0x0, 48,    // 10ms check interval
-     0x0, 60,    // 25ms 
-     0x0, 144,   // 50ms 
-     0x1, 0x0f,  // 100ms
-     0x1, 0xf8,  // 200ms
-     0x3, 0xd9,  // 400ms
-     0x7, 0x9b,  // 800ms
-     0xf, 0x06,  // 1600ms
- };
- 
- static const_uint8_t CC1K_LPL_SleepTime[CC1K_LPL_STATES*2] = {
-     0, 0,       //0
-     0x0, 10,    // 10ms
-     0x0, 25,    // 25ms
-     0x0, 50,    // 50ms
-     0x0, 100,   // 100ms
-     0x0, 200,   // 200ms
-     0x1, 0x90,  // 400ms
-     0x3, 0x20,  // 800ms
-     0x6, 0x40,  // 1600ms
- };
- 
- static const_uint8_t CC1K_LPL_SleepPreamble[CC1K_LPL_STATES] = {
-     0, 
-     8,
-     8,
-     8, 
-     8,
-     8,
-     8,
-     8
- };
- 
  static const_uint8_t CC1K_Params[6][20] = {
    // (0) 433.002 MHz channel, 19.2 Kbps data, Manchester Encoding, High Side LO
--- 246,249 ----

Index: CC1000CsmaP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/cc1000/CC1000CsmaP.nc,v
retrieving revision 1.1.2.14
retrieving revision 1.1.2.15
diff -C2 -d -r1.1.2.14 -r1.1.2.15
*** CC1000CsmaP.nc	22 Sep 2006 18:54:30 -0000	1.1.2.14
--- CC1000CsmaP.nc	26 Oct 2006 17:41:55 -0000	1.1.2.15
***************
*** 102,106 ****
    int16_t macDelay;
  
-   uint8_t lplTxPower, lplRxPower;
    uint16_t sleepTime;
  
--- 102,105 ----
***************
*** 109,112 ****
--- 108,115 ----
    task void setWakeupTask();
  
+   cc1000_metadata_t *getMetadata(message_t *amsg) {
+     return (cc1000_metadata_t *)((uint8_t *)amsg->footer + sizeof(cc1000_footer_t));
+   }
+   
    void enterIdleState() {
      call cancelRssi();
***************
*** 158,175 ****
    }
  
!   /* LPL preamble length and sleep time computation */
! 
!   void setPreambleLength() {
!     uint16_t len =
!       (uint16_t)read_uint8_t(&CC1K_LPL_PreambleLength[lplTxPower * 2]) << 8
!       | read_uint8_t(&CC1K_LPL_PreambleLength[lplTxPower * 2 + 1]);
!     call ByteRadio.setPreambleLength(len);
!   }
! 
!   void setSleepTime() {
!     sleepTime =
!       (uint16_t)read_uint8_t(&CC1K_LPL_SleepTime[lplRxPower *2 ]) << 8 |
!       read_uint8_t(&CC1K_LPL_SleepTime[lplRxPower * 2 + 1]);
!   }
  
    /* Initialisation, startup and stopping */
--- 161,165 ----
    }
  
!   void setPreambleLength(message_t *msg);
  
    /* Initialisation, startup and stopping */
***************
*** 201,206 ****
  	  enterIdleStateSetWakeup();
  	  f.txPending = FALSE;
- 	  setPreambleLength();
- 	  setSleepTime();
  	}
        else
--- 191,194 ----
***************
*** 241,245 ****
  	  if (call CC1000Squelch.settled())
  	    {
! 	      if (lplRxPower == 0)
  		call WakeupTimer.startOneShot(CC1K_SquelchIntervalSlow);
  	      else
--- 229,233 ----
  	  if (call CC1000Squelch.settled())
  	    {
! 	      if (sleepTime == 0)
  		call WakeupTimer.startOneShot(CC1K_SquelchIntervalSlow);
  	      else
***************
*** 307,311 ****
  
      atomic
!       if (f.txPending)
  	{
  	  if (radioState == PULSECHECK_STATE || radioState == POWERDOWN_STATE)
--- 295,299 ----
  
      atomic
!       if (f.txPending || !sleepTime)
  	{
  	  if (radioState == PULSECHECK_STATE || radioState == POWERDOWN_STATE)
***************
*** 315,320 ****
  	    }
  	}
!       else if (lplRxPower > 0 && call CC1000Squelch.settled() &&
! 	       !call ByteRadio.syncing())
  	{
  	  radioOff();
--- 303,307 ----
  	    }
  	}
!       else if (call CC1000Squelch.settled() && !call ByteRadio.syncing())
  	{
  	  radioOff();
***************
*** 369,373 ****
    /*------*/
  
!   event void ByteRadio.rts() {
      atomic
        {
--- 356,360 ----
    /*------*/
  
!   event void ByteRadio.rts(message_t *msg) {
      atomic
        {
***************
*** 380,383 ****
--- 367,372 ----
  	else
  	  macDelay = 1;
+ 
+ 	setPreambleLength(msg);
        }
    }
***************
*** 480,551 ****
    }
  
!   async command error_t LowPowerListening.setListeningMode(uint8_t power) {
!     if (power >= CC1K_LPL_STATES)
!       return FAIL;
  
!     atomic
!       {
! 	if (radioState != DISABLED_STATE)
! 	  return FAIL;
! 	lplTxPower = power;
! 	lplRxPower = power;
!       }
!     return SUCCESS;
    }
  
!   async command uint8_t LowPowerListening.getListeningMode() {
!     atomic return lplRxPower;
    }
  
!   async command error_t LowPowerListening.setTransmitMode(uint8_t power) {
!     if (power >= CC1K_LPL_STATES)
!       return FAIL;
  
!     atomic
!       {
! 	lplTxPower = power;
! 	setPreambleLength();
!       }
!     return SUCCESS;
    }
  
!   async command uint8_t LowPowerListening.getTransmitMode() {
!     atomic return lplTxPower;
    }
  
!   async command error_t LowPowerListening.setPreambleLength(uint16_t bytes) {
!     call ByteRadio.setPreambleLength(bytes);
!     return SUCCESS;
    }
  
!   async command uint16_t LowPowerListening.getPreambleLength() {
!     return call ByteRadio.getPreambleLength();
    }
  
!   async command error_t LowPowerListening.setCheckInterval(uint16_t ms) {
!     atomic 
!       {
! 	if (lplRxPower == 0)
! 	  return FAIL;
  
! 	sleepTime = ms;
!       }
!     return SUCCESS;
    }
  
!   async command uint16_t LowPowerListening.getCheckInterval() {
!     atomic return sleepTime;
    }
  
!   /* Default MAC backoff parameters */
!   /*--------------------------------*/
  
!   default async event uint16_t CsmaBackoff.initial(message_t *m) { 
!     // initially back off [1,32] bytes (approx 2/3 packet)
!     return (call Random.rand16() & 0x1F) + 1;
    }
  
!   default async event uint16_t CsmaBackoff.congestion(message_t *m) { 
!     return (call Random.rand16() & 0xF) + 1;
    }
  }
--- 469,574 ----
    }
  
!   /* Default MAC backoff parameters */
!   /*--------------------------------*/
  
!   default async event uint16_t CsmaBackoff.initial(message_t *m) { 
!     // initially back off [1,32] bytes (approx 2/3 packet)
!     return (call Random.rand16() & 0x1F) + 1;
    }
  
!   default async event uint16_t CsmaBackoff.congestion(message_t *m) { 
!     return (call Random.rand16() & 0xF) + 1;
    }
  
!   /* LowPowerListening setup */
!   /* ----------------------- */
  
!   uint16_t validateSleepInterval(uint16_t sleepIntervalMs) {
!     if (sleepIntervalMs < CC1K_LPL_MIN_INTERVAL)
!       return 0;
!     else if (sleepIntervalMs > CC1K_LPL_MAX_INTERVAL)
!       return CC1K_LPL_MAX_INTERVAL;
!     else
!       return sleepIntervalMs;
    }
  
!   uint16_t dutyToSleep(uint16_t dutyCycle) {
!     /* Scaling factors on CC1K_LPL_CHECK_TIME and dutyCycle are identical */
!     uint16_t interval = (1000 * CC1K_LPL_CHECK_TIME) / dutyCycle;
! 
!     return interval < CC1K_LPL_MIN_INTERVAL ? 0 : interval;
    }
  
!   uint16_t sleepToDuty(uint16_t sleepInterval) {
!     if (sleepInterval < CC1K_LPL_MIN_INTERVAL)
!       return 10000;
! 
!     /* Scaling factors on CC1K_LPL_CHECK_TIME and dutyCycle are identical */
!     return (1000 * CC1K_LPL_CHECK_TIME) / sleepInterval;
    }
  
!   command void LowPowerListening.setLocalSleepInterval(uint16_t s) {
!     sleepTime = validateSleepInterval(s);
    }
  
!   command uint16_t LowPowerListening.getLocalSleepInterval() {
!     return sleepTime;
!   }
  
!   command void LowPowerListening.setLocalDutyCycle(uint16_t d) {
!     return call LowPowerListening.setLocalSleepInterval(dutyToSleep(d));
    }
  
!   command uint16_t LowPowerListening.getLocalDutyCycle() {
!     return sleepToDuty(call LowPowerListening.getLocalSleepInterval());
    }
  
!   command void LowPowerListening.setRxSleepInterval(message_t *msg, uint16_t sleepIntervalMs) {
!     cc1000_metadata_t *meta = getMetadata(msg);
  
!     meta->strength_or_preamble = -(int16_t)validateSleepInterval(sleepIntervalMs) - 1;
    }
  
!   command uint16_t LowPowerListening.getRxSleepInterval(message_t *msg) {
!     cc1000_metadata_t *meta = getMetadata(msg);
! 
!     if (meta->strength_or_preamble >= 0)
!       return sleepTime;
!     else
!       return -(meta->strength_or_preamble + 1);
!   }
! 
!   command void LowPowerListening.setRxDutyCycle(message_t *msg, uint16_t d) {
!     return call LowPowerListening.setRxSleepInterval(msg, dutyToSleep(d));
!   }
! 
!   command uint16_t LowPowerListening.getRxDutyCycle(message_t *msg) {
!     return sleepToDuty(call LowPowerListening.getRxSleepInterval(msg));
!   }
! 
!   command uint16_t LowPowerListening.dutyCycleToSleepInterval(uint16_t d) {
!     return dutyToSleep(d);
!   }
! 
!   command uint16_t LowPowerListening.sleepIntervalToDutyCycle(uint16_t s) {
!     return sleepToDuty(s);
!   }
! 
!   void setPreambleLength(message_t *msg) {
!     cc1000_metadata_t *meta = getMetadata(msg);
!     uint16_t s;
!     uint32_t plen;
! 
!     if (meta->strength_or_preamble >= 0)
!       s = sleepTime;
!     else
!       s = -(meta->strength_or_preamble + 1);
!     meta->strength_or_preamble = 0; /* Destroy setting */
! 
!     if (s == 0)
!       plen = 6;
!     else
!       plen = ((s * 614UL) >> 8) + 22; /* ~ s * 2.4 + 22 */
!     call ByteRadio.setPreambleLength(plen);
    }
  }

Index: CC1000Msg.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/cc1000/CC1000Msg.h,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** CC1000Msg.h	4 Aug 2006 00:34:18 -0000	1.1.2.3
--- CC1000Msg.h	26 Oct 2006 17:41:55 -0000	1.1.2.4
***************
*** 17,21 ****
  
  typedef nx_struct CC1KMetadata {
!   nx_uint16_t strength;
    nx_uint8_t ack;
    nx_uint16_t time;
--- 17,21 ----
  
  typedef nx_struct CC1KMetadata {
!   nx_int16_t strength_or_preamble; /* negative when used for preamble length */
    nx_uint8_t ack;
    nx_uint16_t time;

Index: CC1000SendReceiveP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/cc1000/CC1000SendReceiveP.nc,v
retrieving revision 1.1.2.18
retrieving revision 1.1.2.19
diff -C2 -d -r1.1.2.18 -r1.1.2.19
*** CC1000SendReceiveP.nc	22 Sep 2006 18:54:30 -0000	1.1.2.18
--- CC1000SendReceiveP.nc	26 Oct 2006 17:41:55 -0000	1.1.2.19
***************
*** 263,267 ****
  	}
        }
!     signal ByteRadio.rts();
  
      return SUCCESS;
--- 263,267 ----
  	}
        }
!     signal ByteRadio.rts(msg);
  
      return SUCCESS;
***************
*** 477,483 ****
  
      if (result != SUCCESS)
!       rxMetadata->strength = 0;
      else
!       rxMetadata->strength = data;
    }
  
--- 477,483 ----
  
      if (result != SUCCESS)
!       rxMetadata->strength_or_preamble = 0;
      else
!       rxMetadata->strength_or_preamble = data;
    }
  

Index: LowPowerListening.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/cc1000/LowPowerListening.nc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** LowPowerListening.nc	26 Jan 2006 21:11:40 -0000	1.1.2.2
--- LowPowerListening.nc	26 Oct 2006 17:41:55 -0000	1.1.2.3
***************
*** 1,109 ****
! /*									tab:4
!  *
!  *
!  * "Copyright (c) 2000-2002 The Regents of the University  of California.  
   * 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 UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF
!  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!  * 
!  * THE UNIVERSITY OF CALIFORNIA 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 UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
!  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
   *
   */
  /**
!  * Low Power Listening control interface
   *
!  * @author Joe Polastre
   */
! interface LowPowerListening
! {
    /**
!    * Set the current Low Power Listening mode.
!    * Setting the LPL mode sets both the check interval and preamble length.
!    * The listening mode can only be set while the radio is stopped.
     *
!    * Modes include:
!    *  0 = Radio fully on
!    *  1 = 10ms check interval
!    *  2 = 25ms check interval
!    *  3 = 50ms check interval
!    *  4 = 100ms check interval (recommended)
!    *  5 = 200ms check interval
!    *  6 = 400ms check interval
!    *  7 = 800ms check interval
!    *  8 = 1600ms check interval
     *
!    * @param mode the mode number
!    * @return SUCCESS if the mode was successfully changed, FAIL otherwise
     */
!   async command error_t setListeningMode(uint8_t mode);
! 
    /**
!    * Get the current Low Power Listening mode
!    * @return mode number (see SetListeningMode)
     */
!   async command uint8_t getListeningMode();
! 
    /**
!    * Set the transmit mode.  This allows for hybrid schemes where
!    * the transmit mode is different than the receive mode.
!    * Use SetListeningMode first, then change the mode with SetTransmitMode.
     *
!    * @param mode mode number (see SetListeningMode)
!    * @return SUCCESS if the mode was successfully changed, FAIL otherwise
     */
!   async command error_t setTransmitMode(uint8_t mode);
! 
    /**
!    * Get the current Low Power Listening transmit mode
!    * @return mode number (see SetListeningMode)
     */
!   async command uint8_t getTransmitMode();
! 
    /**
!    * Set the preamble length of outgoing packets. Note that this overrides
!    * the value set by setListeningMode or setTransmitMode.
!    *
!    * @param bytes length of the preamble in bytes
!    * @return SUCCESS if the preamble length was successfully changed, FAIL
!    *   otherwise
     */
!   async command error_t setPreambleLength(uint16_t bytes);
! 
    /**
!    * Get the preamble length of outgoing packets
!    *
!    * @return length of the preamble in bytes
     */
!   async command uint16_t getPreambleLength();
! 
    /**
!    * Set the check interval (time between waking up and sampling
!    * the radio for activity in low power listening). The sleep time
!    * can only be changed if low-power-listening is enabled 
!    * (setListeningMode called with a non-zero value).
!    *
!    * @param ms check interval in milliseconds
!    * @return SUCCESS if the check interval was successfully changed,
!    *   FAIL otherwise.
     */
!   async command error_t setCheckInterval(uint16_t ms);
! 
    /**
!    * Get the check interval currently used by low power listening
!    *
!    * @return length of the check interval in milliseconds
     */
!   async command uint16_t getCheckInterval();
  }
--- 1,129 ----
! /*
!  * Copyright (c) 2005-2006 Rincon Research Corporation
   * 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 Arch Rock Corporation 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
+  * ARCHED ROCK OR ITS 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
   */
+  
  /**
!  * Low Power Listening interface
   *
!  * @author David Moss
!  * @author Jonathan Hui
   */
!  
! interface LowPowerListening {
! 
    /**
!    * Set this this node's radio sleep interval, in milliseconds.
!    * Once every interval, the node will sleep and perform an Rx check 
!    * on the radio.  Setting the sleep interval to 0 will keep the radio
!    * always on.
     *
!    * This is the equivalent of setting the local duty cycle rate.
     *
!    * @param sleepIntervalMs the length of this node's Rx check interval, in [ms]
     */
!   command void setLocalSleepInterval(uint16_t sleepIntervalMs);
!   
    /**
!    * @return the local node's sleep interval, in [ms]
     */
!   command uint16_t getLocalSleepInterval();
!   
    /**
!    * Set this node's radio duty cycle rate, in units of [percentage*100].
!    * For example, to get a 0.05% duty cycle,
!    * <code>
!    *   call LowPowerListening.setDutyCycle(5);  // or equivalently...
!    *   call LowPowerListening.setDutyCycle(00005);  // for better readability?
!    * </code>
     *
!    * For a 100% duty cycle (always on),
!    * <code>
!    *   call LowPowerListening.setDutyCycle(10000);
!    * </code>
!    *
!    * This is the equivalent of setting the local sleep interval explicitly.
!    * 
!    * @param dutyCycle The duty cycle percentage, in units of [percentage*100]
     */
!   command void setLocalDutyCycle(uint16_t dutyCycle);
!   
    /**
!    * @return this node's radio duty cycle rate, in units of [percentage*100]
     */
!   command uint16_t getLocalDutyCycle();
!   
!   
    /**
!    * Configure this outgoing message so it can be transmitted to a neighbor mote
!    * with the specified Rx sleep interval.
!    * @param msg Pointer to the message that will be sent
!    * @param sleepInterval The receiving node's sleep interval, in [ms]
     */
!   command void setRxSleepInterval(message_t *msg, uint16_t sleepIntervalMs);
!   
    /**
!    * @return the destination node's sleep interval configured in this message
     */
!   command uint16_t getRxSleepInterval(message_t *msg);
!   
    /**
!    * Configure this outgoing message so it can be transmitted to a neighbor mote
!    * with the specified Rx duty cycle rate.
!    * Duty cycle is in units of [percentage*100], i.e. 0.25% duty cycle = 25.
!    * 
!    * @param msg Pointer to the message that will be sent
!    * @param dutyCycle The duty cycle of the receiving mote, in units of 
!    *     [percentage*100]
     */
!   command void setRxDutyCycle(message_t *msg, uint16_t dutyCycle);
!   
    /**
!    * @return the destination node's duty cycle configured in this message
!    *     in units of [percentage*100]
     */
!   command uint16_t getRxDutyCycle(message_t *msg);
!   
!   /**
!    * Convert a duty cycle, in units of [percentage*100], to
!    * the sleep interval of the mote in milliseconds
!    * @param dutyCycle The duty cycle in units of [percentage*100]
!    * @return The equivalent sleep interval, in units of [ms]
!    */
!   command uint16_t dutyCycleToSleepInterval(uint16_t dutyCycle);
!   
!   /**
!    * Convert a sleep interval, in units of [ms], to a duty cycle
!    * in units of [percentage*100]
!    * @param sleepInterval The sleep interval in units of [ms]
!    * @return The duty cycle in units of [percentage*100]
!    */
!   command uint16_t sleepIntervalToDutyCycle(uint16_t sleepInterval);
!   
  }



More information about the Tinyos-2-commits mailing list