Cooja: Add LQI-Support to DGRM

This commit is contained in:
Moritz 'Morty' Strübe 2012-10-30 11:42:04 +01:00
parent 610f6cba14
commit 80e7a6fd8c
3 changed files with 40 additions and 1 deletions

View file

@ -382,6 +382,20 @@ public class Msp802154Radio extends Radio implements CustomDataRadio {
rssiLastCounter = 8;
}
/* This will set the CORR-value of the CC2420
*
* @see se.sics.cooja.interfaces.Radio#setLQI(int)
*/
public void setLQI(int lqi){
radio.setLQI(lqi);
}
public int getLQI(){
return radio.getLQI();
}
public Mote getMote() {
return mote;
}

View file

@ -170,6 +170,25 @@ public abstract class Radio extends MoteInterface {
*/
public abstract int getOutputPowerIndicatorMax();
/**
* Returns the current LQI-value. This might differ from platform to platform
* @return Current LQI value.
*
*
*/
public int getLQI() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
/**
* Sets the LQI. This in not supported by all platforms. Also results may differ
* from platform to platform.
*
* @param lqi The current LQI
*/
public void setLQI(int lqi){
}
/**
* @return Current surrounding signal strength
*/

View file

@ -173,13 +173,19 @@ public class DirectedGraphMedium extends AbstractRadioMedium {
conn.getSource().setCurrentSignalStrength(SS_STRONG);
}
//Maximum reception signal of all possible radios received
DGRMDestinationRadio dstRadios[] = edgesTable.get(conn.getSource());
DGRMDestinationRadio dstRadios[] = getPotentialDestinations(conn.getSource());
if (dstRadios == null) continue;
for (DGRMDestinationRadio dstRadio : dstRadios) {
if (dstRadio.radio.getCurrentSignalStrength() < dstRadio.signal) {
dstRadio.radio.setCurrentSignalStrength(dstRadio.signal);
}
/* We can set this without further checks, as it will only be read
* if a packet is actually received. In that case it is set to the
* correct value */
dstRadio.radio.setLQI(dstRadio.lqi);
}
}
}