Ejemplo n.º 1
0
  public boolean connectViaGeneric(
      int portId, long baudRate, String dataBits, String stopBits, String parity) {
    if (!serialPorts.connectPort(portId)) {
      return false;
    } else {
      serialPorts.setParameters(baudRate, dataBits, stopBits, parity);

      OpenSIMKit.serialPorts = serialPorts;

      connectionMode = deviceConnectionMode.serial_port;
      deviceConnected = true;

      OpenSIMKit.mainFrame.setConnectedInterface();

      return true;
    }
  }
 @Override
 protected void okPressed() {
   // I need to save these values in local variables as the GUI stuff is
   // deleted after he close
   SelectedRate = Integer.parseInt(BaudRates.getCombo().getText());
   SelectedPort = SerialPorts.getCombo().getText();
   ArduinoInstancePreferences.setGlobalValue(
       ArduinoConst.KEY_SERIAlRATE, BaudRates.getCombo().getText());
   ArduinoInstancePreferences.setGlobalValue(ArduinoConst.KEY_SERIAlPORT, SelectedPort);
   super.okPressed();
 }