コード例 #1
0
  /**
   * Analyzes the data file identified by the given resource name.
   *
   * @param aResourceName the name of the resource (= data file) to analyse, cannot be <code>null
   *     </code>.
   * @return the analysis results, never <code>null</code>.
   * @throws Exception in case of exceptions.
   */
  private I2CDataSet analyseDataFile(
      final String aResourceName, final int aSclIndex, final int aSdaIndex) throws Exception {
    URL resource = ResourceUtils.getResource(getClass(), aResourceName);
    AcquisitionResult container = DataTestUtils.getCapturedData(resource);
    ToolContext toolContext = DataTestUtils.createToolContext(container);

    ToolProgressListener progressListener = Mockito.mock(ToolProgressListener.class);
    AnnotationListener annotationListener = Mockito.mock(AnnotationListener.class);

    I2CAnalyserTask worker = new I2CAnalyserTask(toolContext, progressListener, annotationListener);
    worker.setLineAIndex(aSclIndex);
    worker.setLineBIndex(aSdaIndex);
    worker.setDetectSDA_SCL(false);
    worker.setReportACK(false);
    worker.setReportNACK(false);
    worker.setReportStart(false);
    worker.setReportStop(false);

    // Simulate we're running in a separate thread by directly calling the main
    // working routine...
    I2CDataSet result = worker.call();
    assertNotNull(result);

    return result;
  }
コード例 #2
0
  /**
   * Analyzes the data file identified by the given resource name.
   *
   * @param aResourceName the name of the resource (= data file) to analyse, cannot be <code>null
   *     </code>.
   * @return the analysis results, never <code>null</code>.
   * @throws Exception in case of exceptions.
   */
  private I2CDataSet analyseDataFile(
      final String aResourceName, final int aSclIndex, final int aSdaIndex) throws Exception {
    URL resource = ResourceUtils.getResource(getClass(), aResourceName);
    DataContainer container = DataTestUtils.getCapturedData(resource);
    ToolContext toolContext = DataTestUtils.createToolContext(0, container.getValues().length);

    I2CAnalyserWorker worker = new I2CAnalyserWorker(container, toolContext);
    worker.setLineAIndex(aSclIndex);
    worker.setLineBIndex(aSdaIndex);
    worker.setDetectSDA_SCL(false);
    worker.setReportACK(false);
    worker.setReportNACK(false);
    worker.setReportStart(false);
    worker.setReportStop(false);

    // Simulate we're running in a separate thread by directly calling the main
    // working routine...
    I2CDataSet result = worker.doInBackground();
    assertNotNull(result);

    return result;
  }