added method for turning off radio receiver of application motes

This commit is contained in:
fros4943 2010-02-08 16:00:46 +00:00
parent f4d19560fc
commit 8ec88e2fcb

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ApplicationRadio.java,v 1.12 2010/02/05 09:07:58 fros4943 Exp $
* $Id: ApplicationRadio.java,v 1.13 2010/02/08 16:00:46 fros4943 Exp $
*/
package se.sics.cooja.interfaces;
@ -83,7 +83,7 @@ public class ApplicationRadio extends Radio {
private double outputPower = 0;
private int outputPowerIndicator = 100;
private int interfered;
private int interfered;
public ApplicationRadio(Mote mote) {
this.mote = mote;
@ -346,7 +346,19 @@ private int interfered;
return mote;
}
private boolean radioOn = true;
public void setReceiverOn(boolean radioOn) {
if (this.radioOn == radioOn) {
return;
}
this.radioOn = radioOn;
lastEvent = radioOn?RadioEvent.HW_ON:RadioEvent.HW_OFF;
lastEventTime = simulation.getSimulationTime();
this.setChanged();
this.notifyObservers();
}
public boolean isReceiverOn() {
return true;
return radioOn;
}
}