Relacs Core Library  0.9.8
Public Member Functions | Protected Member Functions | Static Protected Attributes | List of all members
DIOSim Class Referenceabstract

#include <diosim.h>

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

Public Member Functions

 DynClampDigitalIO (void)
 
 DynClampDigitalIO (const string &device, const Options &opts)
 
virtual ~DynClampDigitalIO (void)
 
virtual int open (const string &device) override
 
virtual int open (Device &device) override
 
virtual bool isOpen (void) const =0
 
virtual void close (void)=0
 
virtual int lines (void) const =0
 
virtual const Optionssettings (void) const
 
int allocateLines (int lines)
 
int allocateLine (int line)
 
int allocateLine (int line, int id)
 
void freeLines (int id)
 
bool allocatedLines (int lines, int id)
 
bool allocatedLines (int lines)
 
bool allocatedLine (int line, int id)
 
bool allocatedLine (int line)
 
virtual int configureLine (int line, bool output)
 
virtual int configureLines (int lines, int output)
 
bool lineConfiguration (int line) const
 
virtual int write (int line, bool val)=0
 
virtual int read (int line, bool &val) const =0
 
virtual int writeLines (int lines, int val)=0
 
virtual int readLines (int lines, int &val) const =0
 
virtual int setSyncPulse (double duration)
 
virtual int clearSyncPulse (void)
 
- Public Member Functions inherited from DigitalIO
 DigitalIO (const string &deviceclass)
 
virtual ~DigitalIO (void)
 
int allocateLines (unsigned int lines)
 
int allocateLine (unsigned int line)
 
int allocateLine (unsigned int line, int id)
 
void freeLines (int id)
 
bool allocatedLines (unsigned int lines, int id)
 
bool allocatedLines (unsigned int lines)
 
bool allocatedLine (unsigned int line, int id)
 
bool allocatedLine (unsigned int line)
 
virtual int configureLine (unsigned int line, bool output)
 
virtual int configureLines (unsigned int lines, unsigned int output)
 
bool lineConfiguration (unsigned int line) const
 
virtual int write (unsigned int line, bool val)=0
 
virtual int read (unsigned int line, bool &val)=0
 
virtual int writeLines (unsigned int lines, unsigned int val)=0
 
virtual int readLines (unsigned int lines, unsigned int &val)=0
 
virtual int setSyncPulse (int modemask, int modebits, unsigned int line, double duration, int mode=0)
 
virtual int clearSyncPulse (int modemask, int modebits)
 

Protected Member Functions

void freeLines (void)
 
void setInfo (void)
 
- Protected Member Functions inherited from DigitalIO
void freeLines (void)
 
void setInfo (void)
 

Static Protected Attributes

static const int MaxDIOLines = 32
 
- Static Protected Attributes inherited from DigitalIO
static const unsigned int MaxDIOLines
 

Detailed Description

Implementation of DigitialIO simulating an digital I/O device.

Author
Jan Benda
Version
1.0

Constructor & Destructor Documentation

virtual ~DynClampDigitalIO ( void  )
virtual

Close the daq driver.

Member Function Documentation

DynClampDigitalIO ( void  )

Create a new DynClampDigitalIO without opening a device.

DynClampDigitalIO ( const string &  device,
const Options opts 
)

Open the digital I/O driver specified by its device file device.

virtual int open ( const string &  device)
overridevirtual

Open the digital I/O device specified by device.

Returns
zero on success, or InvalidDevice (or any other negative number indicating the error). You should call freeLines() somewhere at the beginning and setInfo() somewhere at the end of the reimplmentation of this function.
See Also
isOpen(), close()

Reimplemented from DigitalIO.

virtual int open ( Device device)
overridevirtual

Open the digital I/O device specified by device.

Returns
zero on success, or InvalidDevice (or any other negative number indicating the error). You should call freeLines() somewhere at the beginning and setInfo() somewhere at the end of the reimplementation of this function.
See Also
isOpen(), close()

Reimplemented from DigitalIO.

virtual bool isOpen ( void  ) const
pure virtual
Returns
true if the device is open.
See Also
open(), close()

Implements DigitalIO.

virtual void close ( void  )
pure virtual

Close the device.

See Also
open(), isOpen()

Implements DigitalIO.

virtual int lines ( void  ) const
pure virtual
Returns
the number of digital I/O lines the device supports

Implements DigitalIO.

virtual const Options& settings ( void  ) const
virtual

Returns the ids for each digital I/O line.

Reimplemented from DigitalIO.

int allocateLines ( int  lines)

Allocate the lines lines of the digital I/O device.

Parameters
[in]linesa bit mask of the digital lines to be allocated.
Returns
the id, a positive number, of the allocated lines
WriteError if some of the lines have been already allocated
See Also
freeLines(), allocatedLines()
int allocateLine ( int  line)

Allocate the single digital I/O line line of the digital I/O device. Further lines can be allocated by calling allocateLine( int, int ).

Parameters
[in]linethe digital line (not its bitmask!) to be allocated.
Returns
the id, a positive number, of the allocated line
WriteError if the line has been already allocated
See Also
freeLines(), allocatedLine()
int allocateLine ( int  line,
int  id 
)

Allocate one more digital I/O line line of the digital I/O device for id id. The id should be the returned value of a previous call to allocateLine( int ).

Parameters
[in]linethe digital line (not its bitmask!) to be allocated.
[in]idthe id under which this line should be allocated.
Returns
the id, a positive number, of the allocated line (same as id)
WriteError if the line has been already allocated
See Also
freeLines(), allocatedLine()
void freeLines ( int  id)

Free the previously allocated digital I/O lines with id id.

See Also
allocateLines()
bool allocatedLines ( int  lines,
int  id 
)
Returns
true if all the digitial I/O lines lines have been allocated under id id.
Parameters
[in]linesthe bit mask of the digital lines.
[in]idthe id under which this line was previously allocated.
See Also
allocateLines()
bool allocatedLines ( int  lines)
Returns
true if all the digitial I/O lines lines have been allocated, independent of the ids.
Parameters
[in]linesthe bit mask of the digital lines.
See Also
allocateLines()
bool allocatedLine ( int  line,
int  id 
)
Returns
true if digitial I/O line line was allocated under id id.
Parameters
[in]linethe digital line (not its bitmask!)
[in]idthe id under which this line was previously allocated.
See Also
allocateLine()
bool allocatedLine ( int  line)
Returns
true if digitial I/O line line is allocated, independent of the id.
Parameters
[in]linethe digital line (not its bitmask!)
See Also
allocateLine()
virtual int configureLine ( int  line,
bool  output 
)
virtual

Configure digital I/O line line for input (output = false) or output (output = true). When reimplementing this function, call this function on success.

Parameters
[in]linethe digital line (not its bitmask!)
[in]outputtrue if this line should be configured for output.
Returns
0 on success, otherwise a negative number indicating the error.
See Also
configureLines(), lineConfiguration()
virtual int configureLines ( int  lines,
int  output 
)
virtual

Configure digital I/O lines specified by lines for input (0) or output (1) according to output. When reimplementing this function, call this function on success.

Parameters
[in]linesa bit mask of the digital lines to be configured.
[in]outputa bitmask for tha digital I/O lines that should be configured for output.
Returns
0 on success, otherwise a negative number indicating the error.
See Also
configureLine(), lineConfiguration()
bool lineConfiguration ( int  line) const

Returns the configuation of an digital I/O line.

Parameters
[in]linethe digital line (channel)
Returns
true, if the line has been configured for output.
See Also
configureLine(), configureLines()
virtual int write ( int  line,
bool  val 
)
pure virtual

Write val to the digital I/O line line.

Parameters
[in]linethe digital line (not its bitmask!)
[in]valthe value that should be written to the digital output line (true: high, false: low).
Returns
0 on success, otherwise a negative number indicating the error
See Also
read()
virtual int read ( int  line,
bool &  val 
) const
pure virtual

Read from digital I/O line line and return value in val.

Parameters
[in]linethe digital line (not its bitmask!)
[out]valthe value that was read from to the digital input line (true: high, false: low).
Returns
0 on success, otherwise a negative number indicating the error
See Also
write()
virtual int writeLines ( int  lines,
int  val 
)
pure virtual

Write val to the digital I/O lines defined in lines.

Parameters
[in]linesa bit mask selecting the digital lines to be written.
[in]vala bit mask indicating what should be written to the digital output lines (1: high, 0: low).
Returns
0 on success, otherwise a negative number indicating the error
See Also
read()
virtual int readLines ( int  lines,
int &  val 
) const
pure virtual

Read digital I/O lines and return them in val.

Parameters
[in]linesa bit mask selecting the digital lines from which to read.
[out]vala bit field returning the values read from to the digital input lines (1: high, 0: low).
Returns
0 on success, otherwise a negative number indicating the error
See Also
write()
virtual int setSyncPulse ( double  duration)
virtual

Enables generation of TTL Pulses on a previously defined DIO line and the scaling of the current for analog output according to the measured period divided by the curent injection time of duration microseconds. This is used for synchronizing a discontinous current-clamp amplifier with an dynamic-clamp loop.

Parameters
[in]durationthe duration of the current injection of the amplifier in seconds.
Returns
0 on success, a Device error code on failure.
See Also
clearSyncPulse()
virtual int clearSyncPulse ( void  )
virtual

Disable TTL Pulse generation and current scaling.

Returns
0 on success, a Device error code on failure.
See Also
setSyncPulse()
void freeLines ( void  )
protected

Free all allocated digital I/O lines.

See Also
freeLines()
void setInfo ( void  )
protected

Set the device info(). Call this function from open().

See Also
info()

Member Data Documentation

const int MaxDIOLines = 32
staticprotected

The maximum number of digital I/O lines.


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