using new MotePlugin interface

This commit is contained in:
fros4943 2010-01-15 10:54:42 +00:00
parent a2b6c39ac2
commit 760818260c
8 changed files with 60 additions and 19 deletions

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: MspCLI.java,v 1.4 2009/12/14 13:23:18 fros4943 Exp $
* $Id: MspCLI.java,v 1.5 2010/01/15 10:55:03 fros4943 Exp $
*/
package se.sics.cooja.mspmote.plugins;
@ -46,6 +46,7 @@ import javax.swing.SwingUtilities;
import se.sics.cooja.ClassDescription;
import se.sics.cooja.GUI;
import se.sics.cooja.Mote;
import se.sics.cooja.MotePlugin;
import se.sics.cooja.PluginType;
import se.sics.cooja.Simulation;
import se.sics.cooja.VisPlugin;
@ -54,7 +55,7 @@ import se.sics.mspsim.cli.LineListener;
@ClassDescription("Msp CLI")
@PluginType(PluginType.MOTE_PLUGIN)
public class MspCLI extends VisPlugin {
public class MspCLI extends VisPlugin implements MotePlugin {
private static final long serialVersionUID = 2833218439838209672L;
@ -198,5 +199,9 @@ public class MspCLI extends VisPlugin {
private String trim(String text) {
return (text != null) && ((text = text.trim()).length() > 0) ? text : null;
}
public Mote getMote() {
return mspMote;
}
}

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: MspCodeWatcher.java,v 1.21 2009/10/27 08:52:49 fros4943 Exp $
* $Id: MspCodeWatcher.java,v 1.22 2010/01/15 10:55:03 fros4943 Exp $
*/
package se.sics.cooja.mspmote.plugins;
@ -74,6 +74,7 @@ import org.jdom.Element;
import se.sics.cooja.ClassDescription;
import se.sics.cooja.GUI;
import se.sics.cooja.Mote;
import se.sics.cooja.MotePlugin;
import se.sics.cooja.PluginType;
import se.sics.cooja.Simulation;
import se.sics.cooja.VisPlugin;
@ -88,7 +89,7 @@ import se.sics.mspsim.util.DebugInfo;
@ClassDescription("Msp Code Watcher")
@PluginType(PluginType.MOTE_PLUGIN)
public class MspCodeWatcher extends VisPlugin {
public class MspCodeWatcher extends VisPlugin implements MotePlugin {
private static Logger logger = Logger.getLogger(MspCodeWatcher.class);
private Simulation simulation;
private Observer simObserver;
@ -608,4 +609,8 @@ public class MspCodeWatcher extends VisPlugin {
}
};
public Mote getMote() {
return mspMote;
}
}

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: MspCycleWatcher.java,v 1.2 2008/02/11 11:50:44 fros4943 Exp $
* $Id: MspCycleWatcher.java,v 1.3 2010/01/15 10:55:03 fros4943 Exp $
*/
package se.sics.cooja.mspmote.plugins;
@ -46,7 +46,7 @@ import se.sics.mspsim.core.MSP430;
@ClassDescription("Msp Cycle Watcher")
@PluginType(PluginType.MOTE_PLUGIN)
public class MspCycleWatcher extends VisPlugin {
public class MspCycleWatcher extends VisPlugin implements MotePlugin {
private static Logger logger = Logger.getLogger(MspStackWatcher.class);
private MspMote mspMote;
private MSP430 cpu;
@ -120,5 +120,8 @@ public class MspCycleWatcher extends VisPlugin {
simulation.deleteObserver(simObserver);
}
public Mote getMote() {
return mspMote;
}
}

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: MspStackWatcher.java,v 1.6 2009/10/27 10:13:34 fros4943 Exp $
* $Id: MspStackWatcher.java,v 1.7 2010/01/15 10:55:03 fros4943 Exp $
*/
package se.sics.cooja.mspmote.plugins;
@ -47,6 +47,7 @@ import org.apache.log4j.Logger;
import se.sics.cooja.ClassDescription;
import se.sics.cooja.GUI;
import se.sics.cooja.Mote;
import se.sics.cooja.MotePlugin;
import se.sics.cooja.PluginType;
import se.sics.cooja.Simulation;
import se.sics.cooja.VisPlugin;
@ -58,7 +59,7 @@ import se.sics.mspsim.util.Utils;
@ClassDescription("Msp Stack Watcher")
@PluginType(PluginType.MOTE_PLUGIN)
public class MspStackWatcher extends VisPlugin {
public class MspStackWatcher extends VisPlugin implements MotePlugin {
private static Logger logger = Logger.getLogger(MspStackWatcher.class);
private MspMote mspMote;
@ -152,4 +153,8 @@ public class MspStackWatcher extends VisPlugin {
stackUI.stop();
}
public Mote getMote() {
return mspMote;
}
}

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: NativeIPGateway.java,v 1.11 2009/10/21 16:43:24 fros4943 Exp $
* $Id: NativeIPGateway.java,v 1.12 2010/01/15 10:55:21 fros4943 Exp $
*/
package se.sics.cooja.plugins;
@ -70,6 +70,7 @@ import org.jdom.Element;
import se.sics.cooja.ClassDescription;
import se.sics.cooja.GUI;
import se.sics.cooja.Mote;
import se.sics.cooja.MotePlugin;
import se.sics.cooja.PluginType;
import se.sics.cooja.Simulation;
import se.sics.cooja.VisPlugin;
@ -80,7 +81,7 @@ import se.sics.cooja.interfaces.SerialPort;
@ClassDescription("Open Native IP Gateway")
@PluginType(PluginType.MOTE_PLUGIN)
public class NativeIPGateway extends VisPlugin {
public class NativeIPGateway extends VisPlugin implements MotePlugin {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(NativeIPGateway.class);
@ -1013,4 +1014,8 @@ public class NativeIPGateway extends VisPlugin {
}
}
public Mote getMote() {
return mote;
}
}

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.7 2009/09/17 11:09:23 fros4943 Exp $
* $Id: MoteInformation.java,v 1.8 2010/01/15 10:54:42 fros4943 Exp $
*/
package se.sics.cooja.plugins;
@ -46,7 +46,7 @@ import se.sics.cooja.*;
*/
@ClassDescription("Mote Information")
@PluginType(PluginType.MOTE_PLUGIN)
public class MoteInformation extends VisPlugin {
public class MoteInformation extends VisPlugin implements MotePlugin {
private static Logger logger = Logger.getLogger(MoteInformation.class);
private static final long serialVersionUID = 1L;
@ -171,4 +171,8 @@ public class MoteInformation extends VisPlugin {
}
}
public Mote getMote() {
return mote;
}
}

View file

@ -26,10 +26,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: MoteInterfaceViewer.java,v 1.7 2009/06/30 12:46:26 fros4943 Exp $
* $Id: MoteInterfaceViewer.java,v 1.8 2010/01/15 10:54:42 fros4943 Exp $
*/
package se.sics.cooja.plugins;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.EventQueue;
@ -38,17 +39,21 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Collection;
import java.util.Vector;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import org.jdom.Element;
import se.sics.cooja.ClassDescription;
import se.sics.cooja.GUI;
import se.sics.cooja.Mote;
import se.sics.cooja.MoteInterface;
import se.sics.cooja.MotePlugin;
import se.sics.cooja.PluginType;
import se.sics.cooja.Simulation;
import se.sics.cooja.VisPlugin;
@ -61,7 +66,7 @@ import se.sics.cooja.GUI.HasQuickHelp;
*/
@ClassDescription("Mote Interface Viewer")
@PluginType(PluginType.MOTE_PLUGIN)
public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp {
public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp, MotePlugin {
private static final long serialVersionUID = 1L;
private Mote mote;
@ -70,7 +75,6 @@ public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp {
private JComboBox selectInterfaceComboBox = null;
private JScrollPane mainScrollPane;
/**
* Create a new mote interface viewer.
*
@ -94,7 +98,7 @@ public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp {
selectInterfaceComboBox = new JComboBox();
final JPanel interfacePanel = new JPanel();
Vector<MoteInterface> intfs = mote.getInterfaces().getInterfaces();
Collection<MoteInterface> intfs = mote.getInterfaces().getInterfaces();
for (MoteInterface intf : intfs) {
selectInterfaceComboBox.addItem(GUI.getDescriptionOf(intf));
}
@ -235,4 +239,8 @@ public class MoteInterfaceViewer extends VisPlugin implements HasQuickHelp {
return help;
}
public Mote getMote() {
return mote;
}
}

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: VariableWatcher.java,v 1.9 2009/08/27 14:38:57 fros4943 Exp $
* $Id: VariableWatcher.java,v 1.10 2010/01/15 10:54:42 fros4943 Exp $
*/
package se.sics.cooja.plugins;
@ -69,6 +69,7 @@ import se.sics.cooja.AddressMemory;
import se.sics.cooja.ClassDescription;
import se.sics.cooja.GUI;
import se.sics.cooja.Mote;
import se.sics.cooja.MotePlugin;
import se.sics.cooja.PluginType;
import se.sics.cooja.Simulation;
import se.sics.cooja.VisPlugin;
@ -84,7 +85,7 @@ import se.sics.cooja.AddressMemory.UnknownVariableException;
*/
@ClassDescription("Variable Watcher")
@PluginType(PluginType.MOTE_PLUGIN)
public class VariableWatcher extends VisPlugin {
public class VariableWatcher extends VisPlugin implements MotePlugin {
private static final long serialVersionUID = 1L;
private AddressMemory moteMemory;
@ -114,6 +115,8 @@ public class VariableWatcher extends VisPlugin {
private NumberFormat integerFormat;
private Mote mote;
/**
* @param moteToView Mote
* @param simulation Simulation
@ -121,7 +124,7 @@ public class VariableWatcher extends VisPlugin {
*/
public VariableWatcher(Mote moteToView, Simulation simulation, GUI gui) {
super("Variable Watcher (" + moteToView + ")", gui);
this.mote = moteToView;
moteMemory = (AddressMemory) moteToView.getMemory();
JLabel label;
@ -588,6 +591,9 @@ public class VariableWatcher extends VisPlugin {
return true;
}
public Mote getMote() {
return mote;
}
}
/* Limit JTextField input class */