nl.lxtreme.ols.api.data
Class CapturedData

java.lang.Object
  extended by nl.lxtreme.ols.api.data.CapturedData
All Implemented Interfaces:
AcquisitionResult

public class CapturedData
extends Object
implements AcquisitionResult

CapturedData encapsulates the data obtained by the analyzer during a single run.

In the java code each transition is represented by an integer together with a timestamp represented by a long value.

Author:
Michael "Mr. Sump" Poppitz, J.W. Janssen

Constructor Summary
CapturedData(int[] values, long[] timestamps, long triggerPosition, int rate, int channels, int enabledChannels, long absLen)
          Constructs CapturedData based on the given compressed sampling data.
CapturedData(int[] values, long triggerPosition, int rate, int channels, int enabledChannels)
          Constructs CapturedData based on the given absolute sampling data.
CapturedData(List<Integer> aValues, List<Long> aTimestamps, long aTriggerPosition, int aRate, int aChannels, int aEnabledChannels, long aAbsoluteLength)
          Constructs CapturedData based on the given compressed sampling data.
 
Method Summary
 long getAbsoluteLength()
          Returns the absolute length of the captured data, or, in other words, the largest available timestamp plus some padding to make the last sample visible.
 int getChannels()
          Returns the number of channels in the sample data.
 int getEnabledChannels()
          Returns a bitmask of enabled channels in the sample data.
 int getSampleIndex(long abs)
          Returns the sample index from the given absolute time value.
 int getSampleRate()
          Returns the sample rate in which this data was captured.
 long[] getTimestamps()
          Returns the time stamps of the individual samples.
 long getTriggerPosition()
          Returns the trigger position, as (absolute) time-value.
 int[] getValues()
          Returns the actual sample values.
 boolean hasTimingData()
          Returns wether or not the object contains timing data
 boolean hasTriggerData()
          Returns whether or not the object contains trigger data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CapturedData

public CapturedData(int[] values,
                    long triggerPosition,
                    int rate,
                    int channels,
                    int enabledChannels)
Constructs CapturedData based on the given absolute sampling data.

Parameters:
values - 32bit values as read from device
triggerPosition - position of trigger as time value
rate - sampling rate (may be set to NOT_AVAILABLE)
channels - number of used channels
enabledChannels - bit mask identifying used channels

CapturedData

public CapturedData(int[] values,
                    long[] timestamps,
                    long triggerPosition,
                    int rate,
                    int channels,
                    int enabledChannels,
                    long absLen)
Constructs CapturedData based on the given compressed sampling data.

Parameters:
values - 32bit values as read from device
timestamps - timstamps in number of samples since sample start
triggerPosition - position of trigger as time value
rate - sampling rate (may be set to NOT_AVAILABLE)
channels - number of used channels
enabledChannels - bit mask identifying used channels
absLen - absolute number of samples

CapturedData

public CapturedData(List<Integer> aValues,
                    List<Long> aTimestamps,
                    long aTriggerPosition,
                    int aRate,
                    int aChannels,
                    int aEnabledChannels,
                    long aAbsoluteLength)
Constructs CapturedData based on the given compressed sampling data.

Parameters:
aValues - 32bit values as read from device
aTimestamps - timstamps in number of samples since sample start
aTriggerPosition - position of trigger as time value
aRate - sampling rate (may be set to NOT_AVAILABLE)
aChannels - number of used channels
aEnabledChannels - bit mask identifying used channels
aAbsoluteLength - absolute number of samples
Method Detail

getAbsoluteLength

public final long getAbsoluteLength()
Description copied from interface: AcquisitionResult
Returns the absolute length of the captured data, or, in other words, the largest available timestamp plus some padding to make the last sample visible.

Specified by:
getAbsoluteLength in interface AcquisitionResult
Returns:
the absolute length, >= 0.
See Also:
getAbsoluteLength()

getChannels

public final int getChannels()
Description copied from interface: AcquisitionResult
Returns the number of channels in the sample data.

Specified by:
getChannels in interface AcquisitionResult
Returns:
the channel count, >= 0.
See Also:
getChannels()

getEnabledChannels

public final int getEnabledChannels()
Description copied from interface: AcquisitionResult
Returns a bitmask of enabled channels in the sample data.

Specified by:
getEnabledChannels in interface AcquisitionResult
Returns:
a bitmask of enabled channels, for example, 0xFF for the first 8 channels.
See Also:
getEnabledChannels()

getSampleIndex

public final int getSampleIndex(long abs)
Description copied from interface: AcquisitionResult
Returns the sample index from the given absolute time value.

Specified by:
getSampleIndex in interface AcquisitionResult
Parameters:
abs - the (absolute) time value to convert to a sample index.
Returns:
the sample number before the selected absolute time.
See Also:
getSampleIndex(long)

getSampleRate

public final int getSampleRate()
Description copied from interface: AcquisitionResult
Returns the sample rate in which this data was captured.

Specified by:
getSampleRate in interface AcquisitionResult
Returns:
a sample rate in hertz (Hz).
See Also:
getSampleRate()

getTimestamps

public final long[] getTimestamps()
Description copied from interface: AcquisitionResult
Returns the time stamps of the individual samples.

The time values returned should represent an ever increasing time line. So, timestamp[n-1] < timestamp[n] < timestamp[n+1] for all elements of the returned array.

NOTE: the length of this array must be equal to the length of the array returned by AcquisitionResult.getValues()!

Specified by:
getTimestamps in interface AcquisitionResult
Returns:
the time stamps, as array of long values.
See Also:
getTimestamps()

getTriggerPosition

public final long getTriggerPosition()
Description copied from interface: AcquisitionResult
Returns the trigger position, as (absolute) time-value.

Specified by:
getTriggerPosition in interface AcquisitionResult
Returns:
a value representing the trigger position in time.
See Also:
getTriggerPosition()

getValues

public final int[] getValues()
Description copied from interface: AcquisitionResult
Returns the actual sample values.

NOTE: the length of this array must be equal to the length of the array returned by AcquisitionResult.getTimestamps()!

Specified by:
getValues in interface AcquisitionResult
Returns:
the sample values, as array of integers.
See Also:
getValues()

hasTimingData

public final boolean hasTimingData()
Description copied from interface: AcquisitionResult
Returns wether or not the object contains timing data

Specified by:
hasTimingData in interface AcquisitionResult
Returns:
true when timing data is available
See Also:
hasTimingData()

hasTriggerData

public final boolean hasTriggerData()
Description copied from interface: AcquisitionResult
Returns whether or not the object contains trigger data

Specified by:
hasTriggerData in interface AcquisitionResult
Returns:
true when trigger data is available
See Also:
hasTriggerData()


Copyright © 2012 L'Xtreme IT consultancy. All Rights Reserved.