fixed interference in app radio
This commit is contained in:
parent
c0e7eb21bc
commit
940a2903f2
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: ApplicationRadio.java,v 1.10 2009/10/28 14:38:02 fros4943 Exp $
|
* $Id: ApplicationRadio.java,v 1.11 2010/01/24 23:16:17 joxe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.interfaces;
|
package se.sics.cooja.interfaces;
|
||||||
|
@ -83,6 +83,8 @@ public class ApplicationRadio extends Radio {
|
||||||
private double outputPower = 0;
|
private double outputPower = 0;
|
||||||
private int outputPowerIndicator = 100;
|
private int outputPowerIndicator = 100;
|
||||||
|
|
||||||
|
private int interfered;
|
||||||
|
|
||||||
public ApplicationRadio(Mote mote) {
|
public ApplicationRadio(Mote mote) {
|
||||||
this.mote = mote;
|
this.mote = mote;
|
||||||
this.simulation = mote.getSimulation();
|
this.simulation = mote.getSimulation();
|
||||||
|
@ -117,10 +119,17 @@ public class ApplicationRadio extends Radio {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void signalReceptionEnd() {
|
public void signalReceptionEnd() {
|
||||||
|
//System.out.println("SignalReceptionEnded for node: " + mote.getID() + " intf:" + interfered);
|
||||||
if (isInterfered() || packetToMote == null) {
|
if (isInterfered() || packetToMote == null) {
|
||||||
|
interfered--;
|
||||||
|
if (interfered == 0) isInterfered = false;
|
||||||
|
if (interfered < 0) {
|
||||||
isInterfered = false;
|
isInterfered = false;
|
||||||
|
//logger.warn("Interfered got lower than 0!!!");
|
||||||
|
interfered = 0;
|
||||||
|
}
|
||||||
packetToMote = null;
|
packetToMote = null;
|
||||||
return;
|
if (interfered > 0) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
isReceiving = false;
|
isReceiving = false;
|
||||||
|
@ -154,7 +163,9 @@ public class ApplicationRadio extends Radio {
|
||||||
return lastEvent;
|
return lastEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Note: this must be called exactly as many times as the reception ended */
|
||||||
public void interfereAnyReception() {
|
public void interfereAnyReception() {
|
||||||
|
interfered++;
|
||||||
if (!isInterfered()) {
|
if (!isInterfered()) {
|
||||||
isInterfered = true;
|
isInterfered = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue