AIOUSB::USBDevice Class Reference

#include <USBDevice.hpp>

Inheritance diagram for AIOUSB::USBDevice:

Inheritance graph
[legend]
Collaboration diagram for AIOUSB::USBDevice:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual std::ostream & print (std::ostream &out)
int getDeviceIndex () const
int getProductID () const
const std::string & getName () const
__uint64_t getSerialNumber () const
int getCommTimeout () const
USBDevicesetCommTimeout (int timeout)
USBDevicereset ()
USBDevicecustomEEPROMWrite (int address, const UCharArray &data)
UCharArray customEEPROMRead (int address, int numBytes)

Static Public Attributes

static const int CUSTOM_EEPROM_SIZE = 0x200
static const int CLEAR_FIFO_METHOD_IMMEDIATE = 0
static const int CLEAR_FIFO_METHOD_AUTO = 1
static const int CLEAR_FIFO_METHOD_IMMEDIATE_AND_ABORT = 5
static const int CLEAR_FIFO_METHOD_WAIT = 86

Protected Member Functions

 USBDevice (int productID, int deviceIndex)
virtual ~USBDevice ()
USBDeviceclearFIFO (int method)
double getMiscClock ()
USBDevicesetMiscClock (double clockHz)
int getStreamingBlockSize ()
USBDevicesetStreamingBlockSize (int blockSize)

Protected Attributes

int deviceIndex
int productID
std::string name
__uint64_t serialNumber

Friends

class USBDeviceManager
class DIOStreamSubsystem
class AnalogInputSubsystem


Detailed Description

Class USBDevice is the abstract super class of all USB device families.

Constructor & Destructor Documentation

AIOUSB::USBDevice::USBDevice ( int  productID,
int  deviceIndex 
) [protected]

AIOUSB::USBDevice::~USBDevice (  )  [protected, virtual]


Member Function Documentation

USBDevice & AIOUSB::USBDevice::clearFIFO ( int  method  )  [protected]

UCharArray AIOUSB::USBDevice::customEEPROMRead ( int  address,
int  numBytes 
)

Reads data from the custom programming area of the device EEPROM.

Parameters:
address starting address from 0x000 to 0x1FF within the EEPROM.
numBytes the number of bytes to read from the EEPROM, beginning at the starting address. The starting address plus the number of bytes to read may not exceed the maximum address of 0x1FF.
Returns:
An array of bytes containing the data read from the EEPROM. The length of the array will be equal to numBytes.
Exceptions:
IllegalArgumentException 
OperationFailedException 

USBDevice & AIOUSB::USBDevice::customEEPROMWrite ( int  address,
const UCharArray data 
)

Writes data to the custom programming area of the device EEPROM. Beware that writing to the EEPROM is particularly slow. Writing the entire EEPROM may take several seconds. Before initiating a lengthy EEPROM write procedure, it is recommended that the communication timeout be increased to at least five seconds, if not ten (see setCommTimeout( int timeout )). Otherwise, a timeout error will occur before the write procedure finishes. Once the write procedure is finished, you can restore the timeout to a more reasonable value. If you are writing a smaller amount of data to the EEPROM, you may reduce the timeout proportionately.

Parameters:
address starting address from 0x000 to 0x1FF within the EEPROM.
data an array of bytes containing the data to write to the EEPROM, beginning at the starting address. The starting address plus the data size may not exceed the maximum address of 0x1FF.
Returns:
This device, useful for chaining together multiple operations.
Exceptions:
IllegalArgumentException 
OperationFailedException 

int AIOUSB::USBDevice::getCommTimeout (  )  const

Gets the current timeout setting for USB communications.

Returns:
Current timeout setting (in milliseconds).
See also:
setCommTimeout( int timeout )

int AIOUSB::USBDevice::getDeviceIndex (  )  const [inline]

Gets the device's index on the USB bus. The device index isn't used within this Java class library, but is used in the underlying AIOUSB library. The device index is somewhat useful within this Java class library to differentiate between multiple devices of the same type.

Returns:
The index of the device on the USB bus.

double AIOUSB::USBDevice::getMiscClock (  )  [inline, protected]

const std::string& AIOUSB::USBDevice::getName (  )  const [inline]

Gets the device's name.

Returns:
The device name.

int AIOUSB::USBDevice::getProductID (  )  const [inline]

Gets the device's product ID.

Returns:
The device product ID.

__uint64_t AIOUSB::USBDevice::getSerialNumber (  )  const [inline]

Gets the device's serial number.

Returns:
The device serial number (a 64-bit integer).
Exceptions:
OperationFailedException 

int AIOUSB::USBDevice::getStreamingBlockSize (  )  [protected]

ostream & AIOUSB::USBDevice::print ( std::ostream &  out  )  [virtual]

Prints the properties of this device and all of its subsystems. Mainly useful for diagnostic purposes.

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

Reimplemented in AIOUSB::USB_AI16_Family, AIOUSB::USB_AO16_Family, AIOUSB::USB_CTR_15_Family, AIOUSB::USB_DA12_8A_Family, AIOUSB::USB_DA12_8E_Family, AIOUSB::USB_DIO_16_Family, AIOUSB::USB_DIO_32_Family, and AIOUSB::USB_DIO_Family.

USBDevice & AIOUSB::USBDevice::reset (  ) 

Perform a USB port reset to reinitialize the device.

Returns:
This device, useful for chaining together multiple operations.
Exceptions:
OperationFailedException 

USBDevice & AIOUSB::USBDevice::setCommTimeout ( int  timeout  ) 

Sets the timeout for USB communications.

Parameters:
timeout the new timeout setting (in milliseconds; default is 5,000).
Returns:
This device, useful for chaining together multiple operations.
Exceptions:
IllegalArgumentException 
OperationFailedException 

USBDevice & AIOUSB::USBDevice::setMiscClock ( double  clockHz  )  [protected]

USBDevice & AIOUSB::USBDevice::setStreamingBlockSize ( int  blockSize  )  [protected]


Friends And Related Function Documentation

friend class AnalogInputSubsystem [friend]

friend class DIOStreamSubsystem [friend]

friend class USBDeviceManager [friend]


Member Data Documentation

Enable auto-clear FIFO every falling edge of DIO port D bit 1 (on digital boards, analog boards treat as 0).

Clear FIFO as soon as command received (and disable auto-clear).

Clear FIFO as soon as command received (and disable auto-clear), and abort stream.

Clear FIFO and wait for it to be emptied.

const int AIOUSB::USBDevice::CUSTOM_EEPROM_SIZE = 0x200 [static]

Size of custom EEPROM area (bytes).

std::string AIOUSB::USBDevice::name [protected]

__uint64_t AIOUSB::USBDevice::serialNumber [protected]


doxygen