DAQFlex Plugins  0.9.8
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
DAQFlexCore Class Reference

#include <daqflexcore.h>

Inheritance diagram for DAQFlexCore:
Inheritance graph
[legend]
Collaboration diagram for DAQFlexCore:
Collaboration graph
[legend]

Public Types

enum  DAQFlexError {
  Success, ErrorNoDevice, ErrorInvalidID, ErrorUSBInit,
  ErrorPipe, ErrorTransferFailed, ErrorInvalidBufferSize, ErrorCantOpenFPGAFile,
  ErrorFPGAUploadFailed, ErrorLibUSBIO, ErrorLibUSBInvalidParam, ErrorLibUSBAccess,
  ErrorLibUSBNoDevice, ErrorLibUSBNotFound, ErrorLibUSBBusy, ErrorLibUSBTimeout,
  ErrorLibUSBOverflow, ErrorLibUSBPipe, ErrorLibUSBInterrupted, ErrorLibUSBNoMem,
  ErrorLibUSBNotSupported, ErrorLibUSBOther, ErrorLibUSBUnknown
}
 

Public Member Functions

 DAQFlexCore (void)
 
 DAQFlexCore (const string &device, const Options &opts)
 
 ~DAQFlexCore (void)
 
virtual int open (const string &device) override
 
virtual bool isOpen (void) const
 
virtual void close (void)
 
virtual int reset (void)
 
string sendMessage (const string &message)
 
int sendCommand (const string &command)
 
int sendCommands (const string &command1, const string &command2)
 
unsigned int maxAIData (void) const
 
double maxAIRate (void) const
 
int maxAIChannels (void) const
 
int aiFIFOSize (void) const
 
void setAISampleRate (double samplerate)
 
double aiSampleRate (void) const
 
unsigned int maxAOData (void) const
 
double maxAORate (void) const
 
int maxAOChannels (void) const
 
int aoFIFOSize (void) const
 
int dioLines (void) const
 
int inPacketSize (void) const
 
int outPacketSize (void) const
 
DAQFlexError readBulkTransfer (unsigned char *data, int length, int *transferred, unsigned int timeout)
 
DAQFlexError writeBulkTransfer (unsigned char *data, int length, int *transferred, unsigned int timeout)
 
void clearRead (void)
 
void clearWrite (void)
 
virtual void clearError (void)
 
int error (void) const
 
virtual string errorStr (void) const
 
virtual bool success (void) const
 
virtual bool failed (void) const
 
string daqflexErrorStr (void) const
 
string daqflexErrorStr (DAQFlexError error) const
 

Static Public Attributes

static const int DAQFlexErrorMax = 23
 
static const string DAQFlexErrorText [DAQFlexErrorMax]
 
static const int MCCVendorID = 0x09db
 
static const int USB_2001_TC = 0x00F9
 
static const int USB_7202 = 0x00F2
 
static const int USB_7204 = 0x00F0
 
static const int USB_1608_G = 0x0110
 
static const int USB_1608_GX = 0x0111
 
static const int USB_1608_GX_2AO = 0x0112
 
static const int USB_201 = 0x0113
 
static const int USB_204 = 0x0114
 
static const int USB_202 = 0x012B
 
static const int USB_205 = 0x012C
 
static const int USB_2408 = 0x00FD
 
static const int USB_2408_2AO = 0x00FE
 
static const int USB_1208_FS_Plus = 0x00E8
 
static const int USB_1408_FS_Plus = 0x00E9
 
static const int USB_1608_FS_Plus = 0x00EA
 

Protected Member Functions

void initOptions () override
 

Detailed Description

[Device] The DAQFlex interface over libusb

Author
Jan Benda
Version
1.2
Options
  • firmwarepath=/usr/lib/daqflex/: Path to the *.rbf firmware files
Supported devices:
In principle all DAQFlex Devices are supported. However, it might be necessary to adjust some properties for some of the devices.

Currently tested and working are the following devices:

Therefore, the following devices should work as well:

Member Enumeration Documentation

Enumerator
Success 
ErrorNoDevice 
ErrorInvalidID 
ErrorUSBInit 
ErrorPipe 
ErrorTransferFailed 
ErrorInvalidBufferSize 
ErrorCantOpenFPGAFile 
ErrorFPGAUploadFailed 
ErrorLibUSBIO 
ErrorLibUSBInvalidParam 
ErrorLibUSBAccess 
ErrorLibUSBNoDevice 
ErrorLibUSBNotFound 
ErrorLibUSBBusy 
ErrorLibUSBTimeout 
ErrorLibUSBOverflow 
ErrorLibUSBPipe 
ErrorLibUSBInterrupted 
ErrorLibUSBNoMem 
ErrorLibUSBNotSupported 
ErrorLibUSBOther 
ErrorLibUSBUnknown 

Constructor & Destructor Documentation

DAQFlexCore ( void  )
DAQFlexCore ( const string &  device,
const Options opts 
)

References DAQFlexCore::open().

~DAQFlexCore ( void  )

References DAQFlexCore::close().

Member Function Documentation

int open ( const string &  device)
overridevirtual
bool isOpen ( void  ) const
virtual
void close ( void  )
virtual
int reset ( void  )
virtual
string sendMessage ( const string &  message)
int sendCommand ( const string &  command)
int sendCommands ( const string &  command1,
const string &  command2 
)

Send commands to the device.

Returns
error code

References DAQFlexCore::Success.

Referenced by DAQFlexAnalogInput::startRead().

unsigned int maxAIData ( void  ) const
Returns
the resolution of the A/D converter.

Referenced by DAQFlexAnalogInput::bits(), and DAQFlexAnalogInput::prepareRead().

double maxAIRate ( void  ) const
Returns
the maximum scan rate of the A/D converter.

Referenced by DAQFlexAnalogInput::maxRate().

int maxAIChannels ( void  ) const
Returns
the number of analog input channels.

Referenced by DAQFlexAnalogInput::channels().

int aiFIFOSize ( void  ) const
Returns
the number of samples the AI FIFO can hold. 0: no FIFO present but hardware paced AI supported. -1: no FIFO and no hardware paced AI.

Referenced by DAQFlexAnalogInput::open().

void setAISampleRate ( double  samplerate)

Set the currently used sampling rate of analog input to samplerate.

Referenced by DAQFlexAnalogInput::prepareRead().

double aiSampleRate ( void  ) const

Return the currently used sampling rate of analog input.

Referenced by DAQFlexAnalogOutput::prepareWrite().

unsigned int maxAOData ( void  ) const
Returns
the resolution of the D/A converter.

Referenced by DAQFlexAnalogOutput::bits(), DAQFlexAnalogOutput::directWrite(), and DAQFlexAnalogOutput::writeZeros().

double maxAORate ( void  ) const
Returns
the maximum scan rate of the D/A converter.

Referenced by DAQFlexAnalogOutput::maxRate().

int maxAOChannels ( void  ) const
Returns
the number of analog output channels.

Referenced by DAQFlexAnalogOutput::channels(), and DAQFlexAnalogOutput::open().

int aoFIFOSize ( void  ) const
Returns
the number of samples the AI FIFO can hold. 0: no FIFO present but hardware paced AO supported. -1: no FIFO and no hardware paced AO.

Referenced by DAQFlexAnalogOutput::prepareWrite(), DAQFlexAnalogOutput::startWrite(), DAQFlexAnalogInput::take(), and DAQFlexAnalogOutput::writeData().

int dioLines ( void  ) const
Returns
the number of digital I/O lines.

Referenced by DAQFlexDigitalIO::lines().

int inPacketSize ( void  ) const

The size of a single incoming packet in bytes.

Referenced by DAQFlexAnalogInput::prepareRead(), DAQFlexAnalogInput::readData(), and DAQFlexAnalogInput::reset().

int outPacketSize ( void  ) const

The size of a single outgoing packet in bytes.

Referenced by DAQFlexAnalogOutput::prepareWrite(), and DAQFlexAnalogOutput::writeData().

DAQFlexCore::DAQFlexError readBulkTransfer ( unsigned char *  data,
int  length,
int *  transferred,
unsigned int  timeout 
)

Transfer data from the device to a buffer.

Parameters
[in]dataa buffer for the received data
[in]lengthnumber of bytes data can receive
[in]transferrednumber of bytes actually transferred
[in]timeoutin milliseconds
Returns
an eror code.

Referenced by DAQFlexAnalogInput::readData(), and DAQFlexAnalogInput::reset().

DAQFlexCore::DAQFlexError writeBulkTransfer ( unsigned char *  data,
int  length,
int *  transferred,
unsigned int  timeout 
)

Transfer data from a buffer to the device.

Parameters
[in]datato be sent
[in]lengthnumber of bytes in data to be sent
[in]transferrednumber of bytes actually transferred
[in]timeoutin milliseconds
Returns
an eror code.

Referenced by DAQFlexAnalogOutput::writeData().

void clearRead ( void  )

Clear the reading endpoint.

Referenced by DAQFlexAnalogInput::reset().

void clearWrite ( void  )

Clear the writing endpoint.

Referenced by DAQFlexAnalogOutput::reset().

void clearError ( void  )
virtual

Clear the error state and the error string.

References DAQFlexCore::Success.

Referenced by DAQFlexCore::open().

int error ( void  ) const
Returns
the current error state.

Referenced by DAQFlexCore::daqflexErrorStr(), and DAQFlexAnalogInput::open().

string errorStr ( void  ) const
virtual

Return the translated error state and the error string.

References DAQFlexCore::daqflexErrorStr(), and DAQFlexCore::Success.

bool success ( void  ) const
virtual
Returns
true if there is no error.

References DAQFlexCore::Success.

Referenced by DAQFlexAnalogInput::open(), and DAQFlexAnalogOutput::open().

bool failed ( void  ) const
virtual
Returns
true if there is an error.

References DAQFlexCore::Success.

Referenced by DAQFlexAnalogInput::prepareRead().

string daqflexErrorStr ( void  ) const
string daqflexErrorStr ( DAQFlexError  error) const
Returns
a descriptive string for error.

References DAQFlexCore::DAQFlexErrorText, and DAQFlexCore::error().

void initOptions ( void  )
overrideprotected

Member Data Documentation

const int DAQFlexErrorMax = 23
static
const string DAQFlexErrorText
static
Initial value:
=
{ "success",
"no device",
"invalid ID",
"USB init failed",
"pipe",
"transfer failed",
"invalid buffer size",
"failed to open FPGA file",
"FPGA upload failed",
"libusb IO",
"libusb invalid parameter",
"libusb access",
"libusb no device",
"libusb not found",
"libusb busy",
"libusb timeout",
"libusb overflow",
"libusb pipe",
"libusb interrupted",
"libusb no memory",
"libusb not supported",
"libusb other",
"libusb unknown" }

Referenced by DAQFlexCore::daqflexErrorStr().

const int MCCVendorID = 0x09db
static

vendor ID of MCC USB DAQ boards.

Referenced by DAQFlexCore::open().

const int USB_2001_TC = 0x00F9
static
const int USB_7202 = 0x00F2
static
const int USB_7204 = 0x00F0
static
const int USB_1608_G = 0x0110
static
const int USB_1608_GX = 0x0111
static
const int USB_1608_GX_2AO = 0x0112
static
const int USB_201 = 0x0113
static
const int USB_204 = 0x0114
static
const int USB_202 = 0x012B
static
const int USB_205 = 0x012C
static
const int USB_2408 = 0x00FD
static
const int USB_2408_2AO = 0x00FE
static
const int USB_1208_FS_Plus = 0x00E8
static
const int USB_1408_FS_Plus = 0x00E9
static
const int USB_1608_FS_Plus = 0x00EA
static

The documentation for this class was generated from the following files: