and Send.cancel improvements
event void Timer.fired()
{
event void Timer.fired()
{
- ASSERT( state == LISTEN || state == SLEEP || state == SEND_SUBSEND|| state == SEND_SUBSEND_DONE );
+ ASSERT( state == LISTEN || state == SLEEP || state == SEND_SUBSEND || state == SEND_SUBSEND_DONE );
if( state == LISTEN )
state = SLEEP_SUBSTOP;
if( state == LISTEN )
state = SLEEP_SUBSTOP;
state = SEND_SUBSTART;
else if( state == LISTEN_SUBSTART_DONE )
state = SEND_SUBSTART_DONE;
state = SEND_SUBSTART;
else if( state == LISTEN_SUBSTART_DONE )
state = SEND_SUBSTART_DONE;
- else if( state == LISTEN_TIMER || state == SLEEP_SUBSTOP|| state == LISTEN )
+ else if( state == LISTEN_TIMER || state == SLEEP_SUBSTOP || state == LISTEN )
state = SEND_TIMER;
else
return EBUSY;
state = SEND_TIMER;
else
return EBUSY;
if( state == SEND_SUBSEND )
{
call Timer.stop();
if( state == SEND_SUBSEND )
{
call Timer.stop();
+ state = SEND_DONE;
+ txError = ECANCEL;
- // TODO: ask if sendDone should be called after a succesfull cancel
+ 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);
+ }
command uint16_t LowPowerListening.getRxSleepInterval(message_t *msg)
{
if( ! call PacketSleepInterval.isSet(msg) )
command uint16_t LowPowerListening.getRxSleepInterval(message_t *msg)
{
if( ! call PacketSleepInterval.isSet(msg) )
return call PacketSleepInterval.get(msg);
}
command void LowPowerListening.setRxDutyCycle(message_t *msg, uint16_t dutyCycle)
{
return call PacketSleepInterval.get(msg);
}
command void LowPowerListening.setRxDutyCycle(message_t *msg, uint16_t dutyCycle)
{
- call PacketSleepInterval.set(msg,
+ call LowPowerListening.setRxSleepInterval(msg,
call LowPowerListening.dutyCycleToSleepInterval(dutyCycle));
}
command uint16_t LowPowerListening.getRxDutyCycle(message_t *msg)
{
call LowPowerListening.dutyCycleToSleepInterval(dutyCycle));
}
command uint16_t LowPowerListening.getRxDutyCycle(message_t *msg)
{
- if( ! call PacketSleepInterval.isSet(msg) )
- return 10000;
-
return call LowPowerListening.sleepIntervalToDutyCycle(
return call LowPowerListening.sleepIntervalToDutyCycle(
- call PacketSleepInterval.get(msg));
+ call LowPowerListening.getRxSleepInterval(msg));