@Override
  public boolean motorAttach(
      String motorName, String type, Integer pwrPin, Integer dirPin, Integer encoderPin) {
    ServiceInterface sw = Runtime.getService(motorName);
    if (!sw.isLocal()) {
      error("motor needs to be in same instance of mrl as controller");
      return false;
    }

    Motor m = (Motor) sw;
    m.setController(this);
    m.broadcastState();
    return true;
  }
示例#2
0
  @Override
  public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    // parent.getSelectedComponent()
    if (boundServiceName.equals(getText())) {
      // Service Frame
      ServiceInterface sw = Runtime.getService(getText());
      if ("info".equals(cmd)) {
        BareBonesBrowserLaunch.openURL("http://myrobotlab.org/service/" + sw.getSimpleName());

      } else if ("detach".equals(cmd)) {
        undockPanel();
      } else if ("release".equals(cmd)) {
        myService.send(Runtime.getInstance().getName(), "releaseService", boundServiceName);
      } else if ("prevent export".equals(cmd)) {
        myService.send(boundServiceName, "allowExport", false);
        allowExportMenuItem.setIcon(Util.getImageIcon("allowExport.png"));
        allowExportMenuItem.setActionCommand("allow export");
        allowExportMenuItem.setText("allow export");
      } else if ("allow export".equals(cmd)) {
        myService.send(boundServiceName, "allowExport", true);
        allowExportMenuItem.setIcon(Util.getImageIcon("preventExport.png"));
        allowExportMenuItem.setActionCommand("prevent export");
        allowExportMenuItem.setText("prevent export");
      }
    } else {
      // Sub Tabbed sub pane
      ServiceInterface sw = Runtime.getService(boundServiceName);
      if ("info".equals(cmd)) {
        BareBonesBrowserLaunch.openURL(
            "http://myrobotlab.org/service/" + sw.getSimpleName() + "#" + getText());

      } else if ("detach".equals(cmd)) {
        undockPanel();
      }
    }
  }