com.acces.aiousb
Class DIOStreamSubsystem

java.lang.Object
  extended by com.acces.aiousb.DIOStreamSubsystem

public class DIOStreamSubsystem
extends java.lang.Object

Class DIOStreamSubsystem represents the digital I/O streaming subsystem of a device. One accesses this counter/timer subsystem through its parent object, typically through a method such as diostream() (see USB_DIO_16_Family.diostream()).


Constructor Summary
DIOStreamSubsystem(USBDevice parent)
          Constructor for digital I/O streaming subsystem.
 
Method Summary
 DIOStreamSubsystem clearFIFO(int method)
          Clears the streaming FIFO, using one of several different methods.
 DIOStreamSubsystem close()
          Closes a digital I/O stream opened by a call to open().
 DIOStreamSubsystem open(boolean directionRead)
          Opens a digital I/O stream.
 java.io.PrintStream print(java.io.PrintStream stream)
          Prints the properties of this subsystem.
 char[] read(int numSamples)
          Reads a frame from a digital I/O stream opened by a call to open( true ).
 double setClock(boolean directionRead, double clockHz)
          Sets the internal read/write clock speed of a digital I/O stream.
 DIOStreamSubsystem setStreamingBlockSize(int blockSize)
          Sets the streaming block size.
 int write(char[] values)
          Writes a frame to a digital I/O stream opened by a call to open( false ).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DIOStreamSubsystem

public DIOStreamSubsystem(USBDevice parent)
Constructor for digital I/O streaming subsystem.

Parameters:
parent - the parent USB device object that this subsystem is a part of.
Throws:
OperationFailedException
Method Detail

print

public java.io.PrintStream print(java.io.PrintStream stream)
Prints the properties of this subsystem. Mainly useful for diagnostic purposes.

Parameters:
stream - the print stream where properties will be printed.
Returns:
The print stream.

setStreamingBlockSize

public DIOStreamSubsystem setStreamingBlockSize(int blockSize)
Sets the streaming block size.

Parameters:
blockSize - the streaming block size you wish to set. This will be rounded up to the next multiple of 256.
Returns:
This subsystem, useful for chaining together multiple operations.
Throws:
java.lang.IllegalArgumentException
OperationFailedException

setClock

public double setClock(boolean directionRead,
                       double clockHz)
Sets the internal read/write clock speed of a digital I/O stream.

Parameters:
directionRead - true sets read clock; false sets write clock.
clockHz - the frequency at which to stream the samples (in Hertz).
Returns:
The actual frequency that will be generated, limited by the device's capabilities.
Throws:
OperationFailedException

open

public DIOStreamSubsystem open(boolean directionRead)
Opens a digital I/O stream. When you are done using the stream, you must close it by calling close().

Parameters:
directionRead - true open the stream for reading; false open the stream for writing.
Returns:
This subsystem, useful for chaining together multiple operations.
Throws:
OperationFailedException

close

public DIOStreamSubsystem close()
Closes a digital I/O stream opened by a call to open().

Returns:
This subsystem, useful for chaining together multiple operations.
Throws:
OperationFailedException

read

public char[] read(int numSamples)
Reads a frame from a digital I/O stream opened by a call to open( true ). You cannot read from, and write to a stream. A stream may be read-only or write-only.

Parameters:
numSamples - the number of samples to read.
Returns:
An array containing the samples read. The array may be smaller than the number of samples requested if fewer samples were received than were requested.
Throws:
java.lang.IllegalArgumentException
OperationFailedException

write

public int write(char[] values)
Writes a frame to a digital I/O stream opened by a call to open( false ). You cannot read from, and write to a stream. A stream may be read-only or write-only.

Parameters:
values - an array containing the samples to write.
Returns:
The number of samples actually written.
Throws:
java.lang.IllegalArgumentException
OperationFailedException

clearFIFO

public DIOStreamSubsystem clearFIFO(int method)
Clears the streaming FIFO, using one of several different methods.

Parameters:
method - the method to use when clearing the FIFO. May be one of:
USBDevice.CLEAR_FIFO_METHOD_IMMEDIATE
USBDevice.CLEAR_FIFO_METHOD_AUTO
USBDevice.CLEAR_FIFO_METHOD_IMMEDIATE_AND_ABORT
USBDevice.CLEAR_FIFO_METHOD_WAIT
Returns:
This subsystem, useful for chaining together multiple operations.