/** {@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));
  }
Beispiel #2
0
 /**
  * Returns all supported capture sizes.
  *
  * @return an array of capture sizes, in bytes, never <code>null</code>.
  */
 public Integer[] getCaptureSizes() {
   final String rawValue = this.properties.get(DEVICE_CAPTURESIZES);
   final String[] values = rawValue.split(",\\s*");
   final List<Integer> result = new ArrayList<Integer>();
   for (String value : values) {
     result.add(Integer.valueOf(value.trim()));
   }
   Collections.sort(
       result, NumberUtils.<Integer>createNumberComparator(false /* aSortAscending */));
   return result.toArray(new Integer[result.size()]);
 }
Beispiel #3
0
  /**
   * Returns all supported sample rates.
   *
   * @return an array of sample rates, in Hertz, never <code>null</code>.
   */
  public Integer[] getSampleRates() {
    final String rawValue = this.properties.get(DEVICE_SAMPLERATES);
    final String[] values = rawValue.split(",\\s*");
    final SortedSet<Integer> result =
        new TreeSet<Integer>(
            NumberUtils.<Integer>createNumberComparator(false /* aSortAscending */));
    for (String value : values) {
      result.add(Integer.valueOf(value.trim()));
    }

    return result.toArray(new Integer[result.size()]);
  }
  /**
   * @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));
  }