Ejemplo n.º 1
0
  /** {@inheritDoc} */
  @Override
  protected void prepareToolTask(final ToolTask<UARTDataSet> aToolTask) {
    final UARTAnalyserTask toolTask = (UARTAnalyserTask) aToolTask;

    // The value at index zero is "Unused", so extracting one of all items
    // causes all "unused" values to be equivalent to -1, which is interpreted
    // as not used...
    toolTask.setRxdIndex(this.rxd.getSelectedIndex() - 1);
    toolTask.setTxdIndex(this.txd.getSelectedIndex() - 1);
    toolTask.setCtsIndex(this.cts.getSelectedIndex() - 1);
    toolTask.setRtsIndex(this.rts.getSelectedIndex() - 1);
    toolTask.setDcdIndex(this.dcd.getSelectedIndex() - 1);
    toolTask.setRiIndex(this.ri.getSelectedIndex() - 1);
    toolTask.setDsrIndex(this.dsr.getSelectedIndex() - 1);
    toolTask.setDtrIndex(this.dtr.getSelectedIndex() - 1);
    // Handle the auto detect option for baudrates...
    if (this.autoDetectBaudRate.isSelected()) {
      toolTask.setBaudRate(UARTAnalyserTask.AUTO_DETECT_BAUDRATE);
    } else {
      toolTask.setBaudRate(((Integer) this.baudrate.getSelectedItem()).intValue());
    }

    // Other properties...
    toolTask.setIdleLevel((BitLevel) this.idleLevel.getSelectedItem());
    toolTask.setBitEncoding((BitEncoding) this.bitEncoding.getSelectedItem());
    toolTask.setBitOrder((BitOrder) this.bitOrder.getSelectedItem());
    toolTask.setParity((Parity) this.parity.getSelectedItem());
    toolTask.setStopBits((StopBits) this.stop.getSelectedItem());
    toolTask.setBitCount(NumberUtils.smartParseInt((String) this.bits.getSelectedItem(), 8));
  }
Ejemplo n.º 2
0
  /**
   * @see
   *     nl.lxtreme.ols.tool.base.BaseAsyncToolDialog#setupToolWorker(nl.lxtreme.ols.tool.base.BaseAsyncToolWorker)
   */
  @Override
  protected void setupToolWorker(final UARTAnalyserWorker aToolWorker) {
    // The value at index zero is "Unused", so extracting one of all items
    // causes all "unused" values to be equivalent to -1, which is interpreted
    // as not used...
    aToolWorker.setRxdIndex(this.rxd.getSelectedIndex() - 1);
    aToolWorker.setTxdIndex(this.txd.getSelectedIndex() - 1);
    aToolWorker.setCtsIndex(this.cts.getSelectedIndex() - 1);
    aToolWorker.setRtsIndex(this.rts.getSelectedIndex() - 1);
    aToolWorker.setDcdIndex(this.dcd.getSelectedIndex() - 1);
    aToolWorker.setRiIndex(this.ri.getSelectedIndex() - 1);
    aToolWorker.setDsrIndex(this.dsr.getSelectedIndex() - 1);
    aToolWorker.setDtrIndex(this.dtr.getSelectedIndex() - 1);

    // Other properties...
    aToolWorker.setInverted(this.inv.isSelected());
    aToolWorker.setParity((UARTParity) this.parity.getSelectedItem());
    aToolWorker.setStopBits((UARTStopBits) this.stop.getSelectedItem());
    aToolWorker.setBitCount(NumberUtils.smartParseInt((String) this.bits.getSelectedItem(), 8));
  }