public boolean setConfigXML(
      Simulation simulation, Collection<Element> configXML, boolean visAvailable) {
    setSimulation(simulation);
    myMoteInterfaceHandler = createMoteInterfaceHandler();

    /* Create watchpoint container */
    try {
      breakpointsContainer =
          new MspBreakpointContainer(this, ((MspMoteType) getType()).getFirmwareDebugInfo());
    } catch (IOException e) {
      throw (RuntimeException) new RuntimeException("Error: " + e.getMessage()).initCause(e);
    }

    for (Element element : configXML) {
      String name = element.getName();

      if (name.equals("motetype_identifier")) {
        /* Ignored: handled by simulation */
      } else if ("breakpoints".equals(element.getName())) {
        breakpointsContainer.setConfigXML(element.getChildren(), visAvailable);
      } else if (name.equals("interface_config")) {
        String intfClass = element.getText().trim();
        if (intfClass.equals("se.sics.cooja.mspmote.interfaces.MspIPAddress")) {
          intfClass = IPAddress.class.getName();
        }
        if (intfClass.equals("se.sics.cooja.mspmote.interfaces.ESBLog")) {
          intfClass = MspSerial.class.getName();
        }
        if (intfClass.equals("se.sics.cooja.mspmote.interfaces.SkySerial")) {
          intfClass = MspSerial.class.getName();
        }
        Class<? extends MoteInterface> moteInterfaceClass =
            simulation.getGUI().tryLoadClass(this, MoteInterface.class, intfClass);

        if (moteInterfaceClass == null) {
          logger.fatal("Could not load mote interface class: " + intfClass);
          return false;
        }

        MoteInterface moteInterface = getInterfaces().getInterfaceOfType(moteInterfaceClass);
        moteInterface.setConfigXML(element.getChildren(), visAvailable);
      }
    }

    /* Schedule us immediately */
    requestImmediateWakeup();
    return true;
  }
  public Collection<Element> getConfigXML() {
    ArrayList<Element> config = new ArrayList<Element>();
    Element element;

    /* Breakpoints */
    element = new Element("breakpoints");
    element.addContent(breakpointsContainer.getConfigXML());
    config.add(element);

    // Mote interfaces
    for (MoteInterface moteInterface : getInterfaces().getInterfaces()) {
      element = new Element("interface_config");
      element.setText(moteInterface.getClass().getName());

      Collection<Element> interfaceXML = moteInterface.getConfigXML();
      if (interfaceXML != null) {
        element.addContent(interfaceXML);
        config.add(element);
      }
    }

    return config;
  }
 public void removeWatchpointListener(ActionListener listener) {
   breakpointsContainer.removeWatchpointListener(listener);
 }
 public ActionListener[] getWatchpointListeners() {
   return breakpointsContainer.getWatchpointListeners();
 }
 public Mote getMote() {
   return breakpointsContainer.getMote();
 }
 public Watchpoint getLastWatchpoint() {
   return breakpointsContainer.getLastWatchpoint();
 }
 /* Watchpoints: Forward to breakpoint container */
 public void addWatchpointListener(ActionListener listener) {
   breakpointsContainer.addWatchpointListener(listener);
 }