diff --git a/platform/cooja/dev/cooja-radio.c b/platform/cooja/dev/cooja-radio.c index 3d6225049..1f2bd36d7 100644 --- a/platform/cooja/dev/cooja-radio.c +++ b/platform/cooja/dev/cooja-radio.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cooja-radio.c,v 1.1 2007/05/18 13:48:16 fros4943 Exp $ + * $Id: cooja-radio.c,v 1.2 2007/05/18 15:20:21 fros4943 Exp $ */ #include @@ -54,6 +54,7 @@ int simOutSize; char simRadioHWOn = 1; int simSignalStrength = -200; +int simLastSignalStrength = -200; char simPower = 100; int simRadioChannel = 1; int inSendFunction = 0; @@ -98,6 +99,12 @@ radio_set_channel(int channel) /*-----------------------------------------------------------------------------------*/ int radio_sstrength(void) +{ + return simLastSignalStrength; +} +/*-----------------------------------------------------------------------------------*/ +int +radio_current_sstrength(void) { return simSignalStrength; } @@ -121,6 +128,7 @@ doInterfaceActionsBeforeTick(void) // Don't fall asleep while receiving (in main file) if (simReceiving) { + simLastSignalStrength = simSignalStrength; simDontFallAsleep = 1; return; } diff --git a/platform/cooja/dev/cooja-radio.h b/platform/cooja/dev/cooja-radio.h index 7e9d2268e..9ad2c6f07 100644 --- a/platform/cooja/dev/cooja-radio.h +++ b/platform/cooja/dev/cooja-radio.h @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: cooja-radio.h,v 1.1 2007/05/18 13:48:30 fros4943 Exp $ + * $Id: cooja-radio.h,v 1.2 2007/05/18 15:20:20 fros4943 Exp $ */ #ifndef __COOJA_RADIO_H__ @@ -102,10 +102,15 @@ u16_t radio_read(u8_t *buf, u16_t bufsize); /** - * This function returns the recevied signal strength of the last + * This function returns the signal strength of the last * received packet. This function typically is called when a packet * has been received. */ int radio_sstrength(void); +/** + * This function measures and returns the signal strength. + */ +int radio_current_sstrength(void); + #endif /* __COOJA_RADIO_H__ */