/** * Returns whether any captured data is available. * * @return <code>true</code> if there is captured data, <code>false</code> * otherwise. */ public boolean hasCapturedData() { return getAcquisitionData() != null; }
/** * @see nl.lxtreme.ols.api.data.CapturedData#getValues() */ @Override public int[] getValues() { return hasCapturedData() ? getAcquisitionData().getValues() : new int[0]; }
/** * @see nl.lxtreme.ols.api.data.CapturedData#getSampleIndex(long) */ @Override public int getSampleIndex( final long aAbs ) { return hasCapturedData() ? getAcquisitionData().getSampleIndex( aAbs ) : Ols.NOT_AVAILABLE; }
/** * @see nl.lxtreme.ols.api.data.CapturedData#getSampleRate() */ @Override public int getSampleRate() { return hasCapturedData() ? getAcquisitionData().getSampleRate() : Ols.NOT_AVAILABLE; }
/** * @see nl.lxtreme.ols.api.data.CapturedData#getTimestamps() */ @Override public long[] getTimestamps() { return hasCapturedData() ? getAcquisitionData().getTimestamps() : new long[0]; }
/** * @see nl.lxtreme.ols.api.data.CapturedData#hasTimingData() */ @Override public boolean hasTimingData() { return hasCapturedData() ? getAcquisitionData().hasTimingData() : false; }
/** * @see nl.lxtreme.ols.api.data.CapturedData#getAbsoluteLength() */ @Override public long getAbsoluteLength() { return hasCapturedData() ? getAcquisitionData().getAbsoluteLength() : Ols.NOT_AVAILABLE; }
/** * @see nl.lxtreme.ols.api.data.CapturedData#getChannels() */ @Override public int getChannels() { return hasCapturedData() ? getAcquisitionData().getChannels() : Ols.NOT_AVAILABLE; }
/** * @see nl.lxtreme.ols.api.data.CapturedData#getEnabledChannels() */ @Override public int getEnabledChannels() { return hasCapturedData() ? getAcquisitionData().getEnabledChannels() : Ols.NOT_AVAILABLE; }
/** * @see nl.lxtreme.ols.api.data.CapturedData#hasTriggerData() */ @Override public boolean hasTriggerData() { return hasCapturedData() ? getAcquisitionData().hasTriggerData() : false; }
/** * Calculates the time offset * * @param aTime * the absolute sample number, >= 0. * @return time relative to data */ protected long calculateTimeOffset( final long aTime ) { final AcquisitionResult capturedData = getAcquisitionData(); if ( capturedData.hasTriggerData() ) { return aTime - capturedData.getTriggerPosition(); } return aTime; }
/** * @see nl.lxtreme.ols.api.data.CapturedData#getTriggerPosition() */ @Override public long getTriggerPosition() { return hasCapturedData() && hasTriggerData() ? getAcquisitionData().getTriggerPosition() : Ols.NOT_AVAILABLE; }
/** * Returns the (absolute) time value for the cursor indicated by the given * index. * * @param aCursorIdx * the index of the cursor to return as time, should be >= 0 and < * 10. * @return the time value (in seconds), or -1.0 if the cursor is not * available. */ public Double getCursorTimeValue( final int aCursorIdx ) { if ( !isCursorPositionSet( aCursorIdx ) ) { return null; } Long cursorPos = getCursorPosition( aCursorIdx ); return Double.valueOf( calculateTimeOffset( cursorPos.longValue() ) / ( double )getAcquisitionData().getSampleRate() ); }