DAQFlex Plugins  0.9.8
Classes | Public Member Functions | Protected Member Functions | Friends | List of all members
DAQFlexAnalogOutput Class Reference

#include <daqflexanalogoutput.h>

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

Public Member Functions

 DAQFlexAnalogOutput (void)
 
 DAQFlexAnalogOutput (DAQFlexCore &device, const Options &opts)
 
virtual ~DAQFlexAnalogOutput (void)
 
virtual int open (DAQFlexCore &daqflexdevice)
 
virtual int open (Device &device) override
 
virtual bool isOpen (void) const
 
virtual void close (void)
 
virtual int channels (void) const
 
virtual int bits (void) const
 
virtual double maxRate (void) const
 
virtual int maxRanges (void) const
 
virtual double unipolarRange (int index) const
 
virtual double bipolarRange (int index) const
 
virtual int directWrite (OutList &sigs)
 
virtual int prepareWrite (OutList &sigs)
 
virtual int startWrite (QSemaphore *sp=0)
 
virtual int writeData (void)
 
virtual int stop (void)
 
virtual int reset (void)
 
virtual Status status (void) const
 
virtual bool useAIRate (void) const
 
bool prepared (void) const
 
bool noMoreData (void) const
 
- Public Member Functions inherited from AnalogOutput
 AnalogOutput (void)
 
 AnalogOutput (int aotype)
 
 AnalogOutput (const string &deviceclass, int aotype=0)
 
virtual ~AnalogOutput (void)
 
virtual int open (const string &device) override
 
double delay (int channel) const
 
void setDelays (const vector< double > &delays)
 
void setDelay (double delay)
 
double externalReference (void) const
 
void setExternalReference (double extr)
 
virtual int testWrite (OutList &sigs)
 
bool running (void) const
 
virtual long index (void) const
 
virtual int getAISyncDevice (const vector< AnalogInput * > &ais) const
 
virtual void take (const vector< AnalogOutput * > &aos, vector< int > &aoinx, vector< bool > &aorate)
 
virtual void addTraces (vector< TraceSpec > &traces, int deviceid) const
 
virtual int matchTraces (vector< TraceSpec > &traces) const
 
int analogOutputType (void) const
 

Protected Member Functions

virtual int testWriteDevice (OutList &sigs)
 
void writeZeros (void)
 
void initOptions () override
 
- Protected Member Functions inherited from AnalogOutput
virtual int testWriteData (OutList &sigs)
 
void setAnalogOutputType (int aotype)
 
void setWriteSleep (unsigned long ms)
 
void setErrorStr (const string &strg)
 
void addErrorStr (const string &strg)
 
void setErrorStr (int errnum)
 
void addErrorStr (int errnum)
 
void setErrorStr (const OutList &sigs)
 
void addErrorStr (const OutList &sigs)
 
void setInfo (void)
 
void setSettings (const OutList &sigs, int writebuffer=0)
 
virtual void startThread (QSemaphore *sp=0, bool error=false)
 
virtual void run (void)
 
virtual void stopWrite (void)
 

Friends

class DAQFlexAnalogInput
 

Additional Inherited Members

- Public Types inherited from AnalogOutput
enum  Status
 

Detailed Description

[AnalogOutput] Interface for accessing analog output of a DAQFlex board from Measurement Computing.

Author
Jan Benda
Bug:

reset() blocks for a long time at high analog input sampling rates!!!

Calibration is not yet implemented.

Analog output timing is not yet implemented for no-FIFO boards

Options
useaiclock: Use AI clock for starting AO.

For this you need to connect AICKO with AOCKI .

Constructor & Destructor Documentation

DAQFlexAnalogOutput ( void  )

Create a new DAQFlexAnalogOutput without opening a device.

References DAQFlexAnalogOutput::initOptions().

DAQFlexAnalogOutput ( DAQFlexCore device,
const Options opts 
)

Open the analog input driver specified by its device file device.

References DAQFlexAnalogOutput::open().

~DAQFlexAnalogOutput ( void  )
virtual

Stop analog input and close the daq driver.

References DAQFlexAnalogOutput::close().

Member Function Documentation

int open ( DAQFlexCore daqflexdevice)
virtual
int open ( Device device)
overridevirtual

Open analog input on DAQFlexCore device device.

Reimplemented from AnalogOutput.

References DAQFlexAnalogOutput::open().

bool isOpen ( void  ) const
virtual
void close ( void  )
virtual
int channels ( void  ) const
virtual
int bits ( void  ) const
virtual

Resolution in bits of analog input.

Implements AnalogOutput.

References DAQFlexAnalogOutput::isOpen(), log(), and DAQFlexCore::maxAOData().

double maxRate ( void  ) const
virtual

Maximum sampling rate in Hz of analog input.

Implements AnalogOutput.

References DAQFlexCore::maxAORate().

int maxRanges ( void  ) const
virtual

Maximum number of analog input ranges.

double unipolarRange ( int  index) const
virtual

Voltage range index in Volt for unipolar mode. If -1 is returned this range is not supported.

References AnalogOutput::index().

double bipolarRange ( int  index) const
virtual

Voltage range index in Volt for bipolar mode. If -1 is returned this range is not supported.

References AnalogOutput::index().

int directWrite ( OutList sigs)
virtual

Directly writes from each signal in sigs the first data value to the data acquisition board.

Implements AnalogOutput.

References OutList::addError(), gain(), DAQFlexCore::maxAOData(), DAQFlexCore::sendMessage(), OutList::size(), and OutList::success().

int prepareWrite ( OutList sigs)
virtual

Prepare analog output of the output signals sigs on the device. If an error ocurred in any signal, the corresponding errorflags in OutData are set and a negative value is returned. This function assumes that sigs successfully passed testWrite(). The channels in sigs are not sorted.

Implements AnalogOutput.

References OutList::add(), OutList::addError(), OutList::addErrorStr(), DAQFlexCore::aiSampleRate(), DAQFlexCore::aoFIFOSize(), OutList::back(), OutData::channel(), AnalogOutput::delay(), OutList::deviceBufferSize(), OutList::deviceReset(), DAQFlexAnalogOutput::isOpen(), max(), min(), minMax(), DAQFlexCore::outPacketSize(), DAQFlexCore::sendMessage(), AnalogOutput::setSettings(), OutList::size(), OutList::sortByChannel(), OutList::success(), and DAQFlexAnalogOutput::writeData().

int startWrite ( QSemaphore *  sp = 0)
virtual

Start analog output of the output signals after they were prepared by prepareWrite(). If an error ocurred in any signal, the corresponding errorflags in OutData are set and a negative value is returned. Also start possible pending acquisition on other devices that are known from take().

Implements AnalogOutput.

References DAQFlexCore::aoFIFOSize(), DAQFlexCore::sendCommand(), and AnalogOutput::startThread().

int writeData ( void  )
virtual

Write data to a running data acquisition. Returns the number of data values that were popped from the signal device-buffers (sum over all signals). If an error ocurred in any channel, the corresponding errorflags in the OutList structure are filled and a negative value is returned.

Implements AnalogOutput.

References DAQFlexCore::aoFIFOSize(), ceil(), DAQFlexCore::daqflexErrorStr(), DAQFlexCore::ErrorLibUSBBusy, DAQFlexCore::ErrorLibUSBNoDevice, DAQFlexCore::ErrorLibUSBPipe, DAQFlexCore::ErrorLibUSBTimeout, DAQFlexCore::outPacketSize(), DAQFlexCore::sendMessage(), AnalogOutput::setErrorStr(), DAQFlexCore::Success, and DAQFlexCore::writeBulkTransfer().

Referenced by DAQFlexAnalogOutput::prepareWrite().

int stop ( void  )
virtual

Stop any running ananlog output activity. Returns zero on success, otherwise NotOpen.

See Also
reset(), startWrite()

Implements AnalogOutput.

References DAQFlexCore::sendCommand(), and AnalogOutput::stopWrite().

int reset ( void  )
virtual

Clear any internal data buffers and reset the device. Assumes that analog output is already stopped. Returns zero on success, otherwise NotOpen.

See Also
stop(), close(), open(), isOpen()

Implements AnalogOutput.

References DAQFlexCore::clearWrite(), DAQFlexCore::sendCommand(), and DAQFlexCore::sendMessage().

Referenced by DAQFlexAnalogOutput::close().

AnalogOutput::Status status ( void  ) const
virtual
Returns
the status of the analog output.

Implements AnalogOutput.

References AnalogOutput::Idle, AnalogOutput::Running, DAQFlexCore::sendMessage(), and AnalogOutput::Underrun.

bool useAIRate ( void  ) const
virtual

Return true if the analog output is required to have the same sampling rate as the analog input as determined by UseAIClock.

Reimplemented from AnalogOutput.

Referenced by DAQFlexAnalogInput::startRead(), and DAQFlexAnalogInput::take().

bool prepared ( void  ) const

True if analog output was prepared using testWriteDevice() and prepareWrite()

Referenced by DAQFlexAnalogInput::startRead().

bool noMoreData ( void  ) const
Returns
true if writeData() does not need to be called any more.

Referenced by DAQFlexAnalogInput::startRead().

int testWriteDevice ( OutList sigs)
protectedvirtual

Device driver specific tests on the settings in sigs for each output signal. Before this function is called, the validity of the settings in sigs was already tested by testReadData(). This function should test whether the settings are really supported by the hardware. If an error ocurred in any trace, the corresponding errorflags in the OutData are set and a negative value is returned. The channels in sigs are not sorted. This function is called by testWrite().

Implements AnalogOutput.

References OutList::addError(), DAQFlexAnalogOutput::channels(), and OutList::size().

void writeZeros ( void  )
protected
void initOptions ( void  )
overrideprotected

Friends And Related Function Documentation

friend class DAQFlexAnalogInput
friend

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