From 8116da5c4ecae3bf8791e80d8af3b32d02e562ef Mon Sep 17 00:00:00 2001 From: fros4943 Date: Thu, 17 Sep 2009 11:06:35 +0000 Subject: [PATCH] removed mote state references --- .../contikimote/interfaces/ContikiClock.java | 3 +- .../contikimote/interfaces/ContikiRadio.java | 12 +----- .../se/sics/cooja/interfaces/Battery.java | 13 +----- .../sics/cooja/plugins/MoteInformation.java | 40 +------------------ 4 files changed, 6 insertions(+), 62 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiClock.java b/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiClock.java index 0705a1820..e9f939cf9 100644 --- a/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiClock.java +++ b/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiClock.java @@ -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; diff --git a/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiRadio.java b/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiRadio.java index 24a211419..35ee6728a 100644 --- a/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiRadio.java +++ b/tools/cooja/java/se/sics/cooja/contikimote/interfaces/ContikiRadio.java @@ -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); diff --git a/tools/cooja/java/se/sics/cooja/interfaces/Battery.java b/tools/cooja/java/se/sics/cooja/interfaces/Battery.java index 89d46667e..1d9698b9d 100644 --- a/tools/cooja/java/se/sics/cooja/interfaces/Battery.java +++ b/tools/cooja/java/se/sics/cooja/interfaces/Battery.java @@ -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()) { diff --git a/tools/cooja/java/se/sics/cooja/plugins/MoteInformation.java b/tools/cooja/java/se/sics/cooja/plugins/MoteInformation.java index cde6ea2e2..34a095b6e 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/MoteInformation.java +++ b/tools/cooja/java/se/sics/cooja/plugins/MoteInformation.java @@ -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 visibleMoteInterfaces = new Vector(); 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");