removed mote state references

This commit is contained in:
fros4943 2009-09-17 11:06:35 +00:00
parent 62287dcb03
commit 8116da5c4e
4 changed files with 6 additions and 62 deletions

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ContikiClock.java,v 1.11 2009/06/09 19:12:30 fros4943 Exp $
* $Id: ContikiClock.java,v 1.12 2009/09/17 11:06:35 fros4943 Exp $
*/
package se.sics.cooja.contikimote.interfaces;
@ -38,7 +38,6 @@ import org.apache.log4j.Logger;
import org.jdom.Element;
import se.sics.cooja.*;
import se.sics.cooja.Mote.State;
import se.sics.cooja.contikimote.ContikiMote;
import se.sics.cooja.contikimote.ContikiMoteInterface;
import se.sics.cooja.interfaces.Clock;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ContikiRadio.java,v 1.28 2009/05/26 14:24:20 fros4943 Exp $
* $Id: ContikiRadio.java,v 1.29 2009/09/17 11:06:35 fros4943 Exp $
*/
package se.sics.cooja.contikimote.interfaces;
@ -308,15 +308,7 @@ public class ContikiRadio extends Radio implements ContikiMoteInterface, PolledA
* data to the mote.
*/
private void lockInReceivingMode() {
// If mote is inactive, try to wake it up
if (mote.getState() != Mote.State.ACTIVE) {
if (RAISES_EXTERNAL_INTERRUPT) {
mote.scheduleImmediateWakeup();
}
if (mote.getState() != Mote.State.ACTIVE) {
return;
}
}
mote.scheduleImmediateWakeup();
// Lock core radio in receiving loop
myMoteMemory.setByteValueOf("simReceiving", (byte) 1);

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: Battery.java,v 1.8 2009/05/26 14:24:20 fros4943 Exp $
* $Id: Battery.java,v 1.9 2009/09/17 11:08:07 fros4943 Exp $
*/
package se.sics.cooja.interfaces;
@ -118,16 +118,7 @@ public class Battery extends MoteInterface implements PolledAfterAllTicks {
return;
}
// If mote is dead, do nothing
if (mote.getState() == Mote.State.DEAD) {
return;
}
if (mote.getState() == Mote.State.ACTIVE) {
cpuEnergyConsumption += cpuEnergyConsumptionLPMPerMs;
} else {
cpuEnergyConsumption += cpuEnergyConsumptionAwakePerMs;
}
cpuEnergyConsumption += cpuEnergyConsumptionAwakePerMs;
totalEnergyConsumption = cpuEnergyConsumption;
for (MoteInterface intf : mote.getInterfaces().getInterfaces()) {

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: MoteInformation.java,v 1.6 2008/10/28 13:59:35 fros4943 Exp $
* $Id: MoteInformation.java,v 1.7 2009/09/17 11:09:23 fros4943 Exp $
*/
package se.sics.cooja.plugins;
@ -38,7 +38,6 @@ import javax.swing.*;
import org.apache.log4j.Logger;
import se.sics.cooja.*;
import se.sics.cooja.Mote.State;
/**
* Mote information displays information about a given mote.
@ -57,9 +56,6 @@ public class MoteInformation extends VisPlugin {
private final static int LABEL_WIDTH = 170;
private final static int LABEL_HEIGHT = 15;
private final JLabel stateLabel;
private Observer stateObserver;
private Vector<JPanel> visibleMoteInterfaces = new Vector<JPanel>();
private Simulation mySimulation;
@ -100,24 +96,6 @@ public class MoteInformation extends VisPlugin {
mainPane.add(smallPane);
mainPane.add(Box.createRigidArea(new Dimension(0,25)));
/* State */
smallPane = new JPanel(new BorderLayout());
label = new JLabel("-- STATE --");
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
smallPane.add(BorderLayout.WEST, label);
if (mote.getState() == Mote.State.ACTIVE) {
label = new JLabel("active");
} else if (mote.getState() == State.LPM) {
label = new JLabel("low power mode");
} else {
label = new JLabel("dead");
}
label.setPreferredSize(new Dimension(LABEL_WIDTH,LABEL_HEIGHT));
stateLabel = label;
smallPane.add(BorderLayout.EAST, label);
mainPane.add(smallPane);
mainPane.add(Box.createRigidArea(new Dimension(0,25)));
@ -179,25 +157,9 @@ public class MoteInformation extends VisPlugin {
} catch (java.beans.PropertyVetoException e) {
// Could not select
}
/* Listen to mote state changes */
mote.addStateObserver(stateObserver = new Observer() {
public void update(Observable obs, Object obj) {
if (mote.getState() == State.ACTIVE) {
stateLabel.setText("active");
} else if (mote.getState() == Mote.State.LPM) {
stateLabel.setText("low power mode");
} else {
stateLabel.setText("dead");
}
}
});
}
public void closePlugin() {
// Remove state observer
mote.deleteStateObserver(stateObserver);
// Release all interface visualizations
for (JPanel interfaceVisualization: visibleMoteInterfaces) {
MoteInterface moteInterface = (MoteInterface) interfaceVisualization.getClientProperty("my_interface");