X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Fchips%2Frf2xx%2Flayers%2FLowPowerListeningLayerP.nc;h=eae77f1b9baf3baa16a6a40630a12faa880e2fe1;hb=97e9cb5f12a8fcdd7537ddd0eec19ffe364af663;hp=4bdd79ee301312431ddc65de466b030170d147c7;hpb=51b365b6cb1df293dac98e285ae4856c2dccba2b;p=tinyos-2.x.git diff --git a/tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc b/tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc index 4bdd79ee..eae77f1b 100644 --- a/tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc +++ b/tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc @@ -31,6 +31,7 @@ module LowPowerListeningLayerP interface SplitControl; interface Send; interface Receive; + interface RadioPacket; interface LowPowerListening; } @@ -40,6 +41,7 @@ module LowPowerListeningLayerP interface SplitControl as SubControl; interface Send as SubSend; interface Receive as SubReceive; + interface RadioPacket as SubPacket; interface PacketAcknowledgements; interface LowPowerListeningConfig as Config; @@ -358,6 +360,11 @@ implementation /*----------------- LowPowerListening -----------------*/ + lpl_metadata_t* getMeta(message_t* msg) + { + return ((void*)msg) + sizeof(message_t) - call RadioPacket.metadataLength(msg); + } + command uint16_t LowPowerListening.dutyCycleToSleepInterval(uint16_t dutyCycle) { if( dutyCycle >= 10000 ) @@ -418,12 +425,12 @@ implementation else if( interval > MAX_SLEEP ) interval = MAX_SLEEP; - (call Config.metadata(msg))->sleepint = interval; + getMeta(msg)->sleepint = interval; } command uint16_t LowPowerListening.getRxSleepInterval(message_t *msg) { - uint16_t sleepint = (call Config.metadata(msg))->sleepint; + uint16_t sleepint = getMeta(msg)->sleepint; return sleepint != 0 ? sleepint : sleepInterval; } @@ -440,8 +447,36 @@ implementation call LowPowerListening.getRxSleepInterval(msg)); } - async event void Config.clear(message_t* msg) +/*----------------- RadioPacket -----------------*/ + + async command uint8_t RadioPacket.headerLength(message_t* msg) + { + return call SubPacket.headerLength(msg); + } + + async command uint8_t RadioPacket.payloadLength(message_t* msg) + { + return call SubPacket.payloadLength(msg); + } + + async command void RadioPacket.setPayloadLength(message_t* msg, uint8_t length) + { + call SubPacket.setPayloadLength(msg, length); + } + + async command uint8_t RadioPacket.maxPayloadLength() + { + return call SubPacket.maxPayloadLength(); + } + + async command uint8_t RadioPacket.metadataLength(message_t* msg) + { + return call SubPacket.metadataLength(msg) + sizeof(lpl_metadata_t); + } + + async command void RadioPacket.clear(message_t* msg) { - (call Config.metadata(msg))->sleepint = 0; + getMeta(msg)->sleepint = 0; + call SubPacket.clear(msg); } }