Committed on the Free edition of March Hare Software CVSNT Server.
Upgrade to CVS Suite for more features and support:
http://march-hare.com/cvsnt/
* this message via the PacketAcknowledgements interface.
*/
command bool ackRequested(message_t* msg);
+
+ /**
+ * Returns the number of milliseconds the mote should turn on
+ * its radio to check for incoming messages. This check is
+ * performed at every localWakeInterval.
+ */
+ command uint16_t getListenLength();
}
LowPowerListeningLayerP.Timer -> TimerMilliC;
LowPowerListeningLayerP.SystemLowPowerListening -> SystemLowPowerListeningC;
+
+ components NoLedsC as LedsC;
+ LowPowerListeningLayerP.Leds -> LedsC;
}
interface LowPowerListeningConfig as Config;
interface Timer<TMilli>;
interface SystemLowPowerListening;
+
+ interface Leds;
}
}
{
enum
{
- // minimum wakeup time to catch a transmission in milliseconds
- LISTEN_WAKEUP = 6U, // use xxxL if LISTEN_WAKEUP * 10000 > 65535
-
MIN_SLEEP = 2, // the minimum sleep interval in milliseconds
};
ASSERT( error == SUCCESS || error == EBUSY );
if( error == SUCCESS )
+ {
+ call Leds.led2On();
++state;
+ }
else
post transition();
}
ASSERT( error == SUCCESS || error == EBUSY );
if( error == SUCCESS )
+ {
++state;
+ call Leds.led2Off();
+ }
else
post transition();
}
{
state = LISTEN;
if( sleepInterval > 0 )
- call Timer.startOneShot(LISTEN_WAKEUP);
+ call Timer.startOneShot(call Config.getListenLength());
}
else if( state == SLEEP_TIMER )
{
transmitInterval = call LowPowerListening.getRemoteWakeupInterval(txMsg);
if( transmitInterval > 0 )
- call Timer.startOneShot(transmitInterval);
+ call Timer.startOneShot(transmitInterval
+ + 2 * call Config.getListenLength());
state = SEND_SUBSEND;
post transition();
event message_t* SubReceive.receive(message_t* msg)
{
+ call Leds.led0Toggle();
+
if( state == SLEEP_SUBSTOP )
state = LISTEN;
state = SEND_SUBSEND;
post transition();
+
+ if( error == SUCCESS )
+ call Leds.led1Toggle();
}
/*----------------- LowPowerListening -----------------*/
* congestion backoff = 0x7 * CC2420_BACKOFF_PERIOD = 70 jiffies = 2240 microsec
*/
+#ifndef LOW_POWER_LISTENING
+
async command uint16_t RandomCollisionConfig.getMinimumBackoff()
{
return (uint16_t)(320 * RADIO_ALARM_MICROSEC);
return (uint16_t)(2240 * RADIO_ALARM_MICROSEC);
}
+#endif
+
async command uint16_t RandomCollisionConfig.getTransmitBarrier(message_t* msg)
{
uint16_t time;
return call Ieee154PacketLayer.getAckRequired(msg);
}
+ command uint16_t LowPowerListeningConfig.getListenLength()
+ {
+ return 5;
+ }
+
+ async command uint16_t RandomCollisionConfig.getMinimumBackoff()
+ {
+ return (uint16_t)(320 * RADIO_ALARM_MICROSEC);
+ }
+
+ async command uint16_t RandomCollisionConfig.getInitialBackoff(message_t* msg)
+ {
+ return (uint16_t)(1600 * RADIO_ALARM_MICROSEC);
+ }
+
+ async command uint16_t RandomCollisionConfig.getCongestionBackoff(message_t* msg)
+ {
+ return (uint16_t)(3200 * RADIO_ALARM_MICROSEC);
+ }
+
#endif
}
* congestion backoff = 0x7 * CC2420_BACKOFF_PERIOD = 70 jiffies = 2240 microsec
*/
+#ifndef LOW_POWER_LISTENING
+
async command uint16_t RandomCollisionConfig.getMinimumBackoff()
{
return (uint16_t)(320 * RADIO_ALARM_MICROSEC);
return (uint16_t)(2240 * RADIO_ALARM_MICROSEC);
}
+#endif
+
async command uint16_t RandomCollisionConfig.getTransmitBarrier(message_t* msg)
{
uint16_t time;
return call Ieee154PacketLayer.getAckRequired(msg);
}
+ command uint16_t LowPowerListeningConfig.getListenLength()
+ {
+ return 5;
+ }
+
+ async command uint16_t RandomCollisionConfig.getMinimumBackoff()
+ {
+ return (uint16_t)(320 * RADIO_ALARM_MICROSEC);
+ }
+
+ async command uint16_t RandomCollisionConfig.getInitialBackoff(message_t* msg)
+ {
+ return (uint16_t)(1600 * RADIO_ALARM_MICROSEC);
+ }
+
+ async command uint16_t RandomCollisionConfig.getCongestionBackoff(message_t* msg)
+ {
+ return (uint16_t)(3200 * RADIO_ALARM_MICROSEC);
+ }
+
#endif
}