[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/rf230 LowPowerListeningLayerP.nc, 1.5, 1.6

Miklos Maroti mmaroti at users.sourceforge.net
Tue May 13 02:12:06 PDT 2008


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

Modified Files:
	LowPowerListeningLayerP.nc 
Log Message:
make the default rxSleepinterval(msg) to be the localSleepInterval
and Send.cancel improvements

Index: LowPowerListeningLayerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf230/LowPowerListeningLayerP.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** LowPowerListeningLayerP.nc	7 May 2008 21:33:13 -0000	1.5
--- LowPowerListeningLayerP.nc	13 May 2008 09:12:04 -0000	1.6
***************
*** 254,258 ****
  	event void Timer.fired()
  	{
! 		ASSERT( state == LISTEN || state == SLEEP || state == SEND_SUBSEND|| state == SEND_SUBSEND_DONE );
  
  		if( state == LISTEN )
--- 254,258 ----
  	event void Timer.fired()
  	{
! 		ASSERT( state == LISTEN || state == SLEEP || state == SEND_SUBSEND || state == SEND_SUBSEND_DONE );
  
  		if( state == LISTEN )
***************
*** 291,295 ****
  		else if( state == LISTEN_SUBSTART_DONE )
  			state = SEND_SUBSTART_DONE;
! 		else if( state == LISTEN_TIMER || state == SLEEP_SUBSTOP|| state == LISTEN )
  			state = SEND_TIMER;
  		else
--- 291,295 ----
  		else if( state == LISTEN_SUBSTART_DONE )
  			state = SEND_SUBSTART_DONE;
! 		else if( state == LISTEN_TIMER || state == SLEEP_SUBSTOP || state == LISTEN )
  			state = SEND_TIMER;
  		else
***************
*** 308,317 ****
  		{
  			call Timer.stop();
! 			state = LISTEN_TIMER;
  			post transition();
  
- 			// TODO: ask if sendDone should be called after a succesfull cancel
  			return SUCCESS;
  		}
  		else
  			return FAIL;
--- 308,324 ----
  		{
  			call Timer.stop();
! 			state = SEND_DONE;
! 			txError = ECANCEL;
  			post transition();
  
  			return SUCCESS;
  		}
+ 		else if( state == SEND_SUBSEND_DONE )
+ 		{
+ 			// we stop sending the message even if SubSend.cancel was not succesfull
+ 			state = SEND_SUBSEND_DONE_LAST;
+ 
+ 			return call SubSend.cancel(txMsg);
+ 		}
  		else
  			return FAIL;
***************
*** 418,422 ****
      {
  		if( ! call PacketSleepInterval.isSet(msg) )
! 			return 0;
  
  		return call PacketSleepInterval.get(msg);
--- 425,429 ----
      {
  		if( ! call PacketSleepInterval.isSet(msg) )
! 			return sleepInterval;
  
  		return call PacketSleepInterval.get(msg);
***************
*** 425,429 ****
  	command void LowPowerListening.setRxDutyCycle(message_t *msg, uint16_t dutyCycle)
      {
! 		call PacketSleepInterval.set(msg, 
  			call LowPowerListening.dutyCycleToSleepInterval(dutyCycle));
  	}
--- 432,436 ----
  	command void LowPowerListening.setRxDutyCycle(message_t *msg, uint16_t dutyCycle)
      {
! 		call LowPowerListening.setRxSleepInterval(msg, 
  			call LowPowerListening.dutyCycleToSleepInterval(dutyCycle));
  	}
***************
*** 431,439 ****
  	command uint16_t LowPowerListening.getRxDutyCycle(message_t *msg)
      {
- 		if( ! call PacketSleepInterval.isSet(msg) )
- 			return 10000;
- 
  		return call LowPowerListening.sleepIntervalToDutyCycle(
! 			call PacketSleepInterval.get(msg));
  	}
  }
--- 438,443 ----
  	command uint16_t LowPowerListening.getRxDutyCycle(message_t *msg)
      {
  		return call LowPowerListening.sleepIntervalToDutyCycle(
! 			call LowPowerListening.getRxSleepInterval(msg));
  	}
  }



More information about the Tinyos-2-commits mailing list