Relacs  0.9.8
Public Member Functions | Protected Member Functions | List of all members
AnalogInput Class Referenceabstract

#include <analoginput.h>

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

Public Member Functions

 AnalogInput (void)
 
 AnalogInput (int aitype)
 
 AnalogInput (const string &deviceclass, int aitype=0)
 
virtual ~AnalogInput (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 channels (void) const =0
 
virtual int bits (void) const =0
 
virtual double maxRate (void) const =0
 
virtual int maxRanges (void) const =0
 
virtual double unipolarRange (int index) const =0
 
virtual double bipolarRange (int index) const =0
 
int minGainIndex (bool unipolar) const
 
int maxGainIndex (bool unipolar) const
 
int gainIndex (bool unipolar, double maxvoltage) const
 
virtual int testRead (InList &traces)
 
virtual int prepareRead (InList &traces)=0
 
virtual int startRead (QSemaphore *sp=0, QReadWriteLock *datamutex=0, QWaitCondition *datawait=0, QSemaphore *aosp=0)=0
 
virtual int readData (void)=0
 
virtual int convertData (void)=0
 
virtual void model (InList &data, const vector< int > &aochannels, vector< float > &aovalues)
 
virtual int stop (void)=0
 
virtual int reset (void)=0
 
virtual bool running (void) const
 
virtual void take (const vector< AnalogInput * > &ais, const vector< AnalogOutput * > &aos, vector< int > &aiinx, vector< int > &aoinx, vector< bool > &airate, vector< bool > &aorate)
 
virtual void addTraces (vector< TraceSpec > &traces, int deviceid) const
 
virtual int matchTraces (InList &traces) const
 
int analogInputType (void) const
 
- Public Member Functions inherited from Device
 Device (int type=MiscellaneousType)
 
 Device (const string &deviceclass, int type=MiscellaneousType)
 
virtual ~Device (void)
 
virtual const Optionsinfo (void) const
 
virtual const Optionssettings (void) const
 
int deviceType (void) const
 
string deviceTypeStr (void) const
 
string deviceClass (void) const
 
string deviceFile (void) const
 
string deviceName (void) const
 
string deviceVendor (void) const
 
string deviceIdent (void) const
 
virtual void setDeviceIdent (const string &ident)
 
virtual void clearError (void)
 
virtual string errorStr (void) const
 
void setErrorStr (const string &strg)
 
void addErrorStr (const string &strg)
 
void setErrorStr (int errnum)
 
void addErrorStr (int errnum)
 
virtual bool success (void) const
 
virtual bool failed (void) const
 
- Public Member Functions inherited from Options
 Options (void)
 
 Options (const Options &o)
 
 Options (const Options &o, int flags)
 
 Options (const string &name, const string &type, int flags, int style)
 
 Options (const Str &opttxt, const string &assignment=":=", const string &separator=",;")
 
 Options (const StrQueue &sq, const string &assignment=":=")
 
 Options (istream &str, const string &assignment=":=", const string &comment="#", const string &stop="", string *line=0)
 
virtual ~Options (void)
 
Optionsoperator= (const Options &o)
 
Optionsassign (const Options &o)
 
Optionsappend (const Options &o)
 
Optionsadd (const Options &o)
 
Optionsinsert (const Options &o, const string &atname="")
 
Optionsassign (const Options &o, int flags)
 
Optionscopy (Options &o, int flags)
 
Optionsappend (const Options &o, int flags)
 
Optionsadd (const Options &o, int flags)
 
Optionsinsert (const Options &o, int flags, const string &atname="")
 
Parameterassign (const string &name, const string &value)
 
OptionsparentSection (void)
 
const OptionsparentSection (void) const
 
void setParentSection (Options *parentsection)
 
void resetParents (void)
 
OptionsrootSection (void)
 
const OptionsrootSection (void) const
 
string name (void) const
 
virtual void setName (const string &name)
 
virtual void setName (const string &name, const string &type)
 
string type (void) const
 
void setType (const string &type)
 
string include (void) const
 
void setInclude (const string &include)
 
void setInclude (const string &url, const string &name)
 
int flag (void) const
 
bool flag (int selectflag) const
 
OptionssetFlag (int flag)
 
OptionsaddFlag (int flag)
 
OptionsdelFlag (int flag)
 
OptionsclearFlag (void)
 
int style (void) const
 
OptionssetStyle (int style)
 
OptionsaddStyle (int style)
 
OptionsdelStyle (int style)
 
OptionsclearStyle (void)
 
bool checkType (int mask) const
 
Str warning (void) const
 
iterator begin (void)
 
iterator end (void)
 
const_iterator begin (void) const
 
const_iterator end (void) const
 
section_iterator sectionsBegin (void)
 
section_iterator sectionsEnd (void)
 
const_section_iterator sectionsBegin (void) const
 
const_section_iterator sectionsEnd (void) const
 
const_iterator find (const string &pattern, int level=-1) const
 
iterator find (const string &pattern, int level=-1)
 
const_iterator rfind (const string &pattern, int level=-1) const
 
iterator rfind (const string &pattern, int level=-1)
 
const_section_iterator findSection (const string &pattern, int level=-1) const
 
section_iterator findSection (const string &pattern, int level=-1)
 
const_section_iterator rfindSection (const string &pattern, int level=-1) const
 
section_iterator rfindSection (const string &pattern, int level=-1)
 
const Parameteroperator[] (int i) const
 
Parameteroperator[] (int i)
 
const Parameteroperator[] (const string &name) const
 
Parameteroperator[] (const string &name)
 
const Optionssection (int i) const
 
Optionssection (int i)
 
const Optionssection (const string &name) const
 
Optionssection (const string &name)
 
Str request (const string &name) const
 
ParametersetRequest (const string &name, const string &request)
 
Parameter::ValueType valueType (const string &name) const
 
ParametersetValueType (const string &name, Parameter::ValueType type)
 
int flags (const string &name) const
 
bool flags (const string &name, int flag) const
 
ParametersetFlags (const string &name, int flags)
 
ParameteraddFlags (const string &name, int flags)
 
ParameterdelFlags (const string &name, int flags)
 
ParameterclearFlags (const string &name)
 
bool changed (const string &name)
 
int style (const string &name) const
 
ParametersetStyle (const string &name, int style)
 
ParameteraddStyle (const string &name, int style)
 
ParameterdelStyle (const string &name, int style)
 
Str format (const string &name) const
 
ParametersetFormat (const string &name, int width=0, int prec=-1, char fmt='g')
 
ParametersetFormat (const string &name, const string &format)
 
int formatWidth (const string &name) const
 
int size (const string &name) const
 
Parameteradd (const Parameter &np)
 
Parameterinsert (const Parameter &np, const string &atname="")
 
ParameteraddText (const string &name, const string &request, const string &dflt, int flags=0, int style=0)
 
ParameteraddText (const string &name, const string &dflt="", int flags=0, int style=0)
 
ParameterinsertText (const string &name, const string &atname, const string &request, const string &dflt, int flags=0, int style=0)
 
ParameterinsertText (const string &name, const string &atname="", const string &dflt="", int flags=0, int style=0)
 
Str text (const string &name, int index, const string &dflt="", const string &format="", const string &unit="") const
 
Str text (const string &name, const string &dflt="", const string &format="", const string &unit="") const
 
void texts (const string &name, vector< string > &s, const string &format="", const string &unit="") const
 
Str allText (const string &name, const string &dflt="", const string &format="", const string &unit="", const string &separator=", ") const
 
ParametersetText (const string &name, const string &strg)
 
ParametersetText (const string &name, const Parameter &p)
 
ParameterpushText (const string &name, const string &strg)
 
Str defaultText (const string &name, const string &format="", const string &unit="") const
 
ParametersetDefaultText (const string &name, const string &dflt)
 
ParameteraddSelection (const string &name, const string &request, const string &selection, int flags=0, int style=0)
 
ParameteraddSelection (const string &name, const string &selection="", int flags=0, int style=0)
 
ParameterinsertSelection (const string &name, const string &atname, const string &request, const string &selection, int flags=0, int style=0)
 
ParameterinsertSelection (const string &name, const string &atname="", const string &selection="", int flags=0, int style=0)
 
ParameterselectText (const string &name, const string &strg, int add=0)
 
ParameterselectText (const string &name, int index)
 
int index (const string &name) const
 
int index (const string &name, const string &strg) const
 
ParameteraddNumber (const string &name, const string &request, double dflt, double minimum, double maximum=MAXDOUBLE, double step=1.0, const string &unit="", const string &outputunit="", const string &format="", int flags=0, int style=0)
 
ParameteraddNumber (const string &name, const string &request, double dflt, const string &unit="", const string &format="", int flags=0, int style=0)
 
ParameteraddNumber (const string &name, double dflt, const string &unit="", const string &format="", int flags=0, int style=0)
 
ParameteraddNumber (const string &name, double dflt, const string &unit, int flags, int style=0)
 
ParameteraddNumber (const string &name, double dflt, double error, const string &unit="", const string &format="", int flags=0, int style=0)
 
ParameteraddNumber (const string &name, const string &unit="", const string &format="", int flags=0, int style=0)
 
ParameterinsertNumber (const string &name, const string &atname, const string &request, double dflt, double minimum, double maximum=MAXDOUBLE, double step=1.0, const string &unit="", const string &outputunit="", const string &format="", int flags=0, int style=0)
 
ParameterinsertNumber (const string &name, const string &atname, const string &request, double dflt, const string &unit="", const string &format="", int flags=0, int style=0)
 
ParameterinsertNumber (const string &name, const string &atname, double dflt, const string &unit="", const string &format="", int flags=0, int style=0)
 
ParameterinsertNumber (const string &name, const string &atname, const string &unit="", const string &format="", int flags=0, int style=0)
 
double number (const string &name, double dflt=0.0, const string &unit="", int index=0) const
 
double number (const string &name, const string &unit, double dflt=0.0, int index=0) const
 
double number (const string &name, int index, double dflt=0.0, const string &unit="") const
 
double number (const string &name, int index, const string &unit, double dflt=0.0) const
 
void numbers (const string &name, vector< double > &n, const string &unit="") const
 
double error (const string &name, const string &unit="", int index=0) const
 
double error (const string &name, int index, const string &unit="") const
 
void errors (const string &name, vector< double > &n, const string &unit="") const
 
ParametersetNumber (const string &name, double number, double error, const string &unit="")
 
ParametersetNumber (const string &name, double number, const string &unit="")
 
ParameterpushNumber (const string &name, double number, double error=-1.0, const string &unit="")
 
ParameterpushNumber (const string &name, double number, const string &unit)
 
ParametersetNumber (const string &name, const Parameter &p)
 
double defaultNumber (const string &name, const string &unit="") const
 
ParametersetDefaultNumber (const string &name, double dflt, const string &unit="")
 
double minimum (const string &name, const string &unit="") const
 
double maximum (const string &name, const string &unit="") const
 
double step (const string &name, const string &unit="") const
 
ParametersetStep (const string &name, double step, const string &unit="")
 
ParametersetMinMax (const string &name, double minimum=-MAXDOUBLE, double maximum=MAXDOUBLE, double step=1.0, const string &unit="")
 
Str unit (const string &name) const
 
Str outUnit (const string &name) const
 
ParametersetUnit (const string &name, const string &internunit, const string &outunit="")
 
ParametersetOutUnit (const string &name, const string &outputunit)
 
ParameterchangeUnit (const string &name, const string &internunit)
 
ParameteraddInteger (const string &name, const string &request, long dflt, long minimum=LONG_MIN, long maximum=LONG_MAX, long step=1, const string &unit="", const string &outputunit="", int width=0, int flags=0, int style=0)
 
ParameteraddInteger (const string &name, long dflt, const string &unit="", int width=0, int flags=0, int style=0)
 
ParameteraddInteger (const string &name, const string &unit="")
 
ParameterinsertInteger (const string &name, const string &atname, const string &request, long dflt, long minimum=LONG_MIN, long maximum=LONG_MAX, long step=1, const string &unit="", const string &outputunit="", int width=0, int flags=0, int style=0)
 
ParameterinsertInteger (const string &name, const string &atname, long dflt, const string &unit="", int width=0, int flags=0, int style=0)
 
ParameterinsertInteger (const string &name, const string &atname, const string &unit="", int width=0, int flags=0, int style=0)
 
long integer (const string &name, const string &unit="", long dflt=0, int index=0) const
 
long integer (const string &name, int index, long dflt=0, const string &unit="") const
 
long integer (const string &name, int index, const string &unit, long dflt=0) const
 
void integers (const string &name, vector< long > &n, const string &unit="") const
 
void integers (const string &name, vector< int > &n, const string &unit="") const
 
ParametersetInteger (const string &name, long number, long error, const string &unit="")
 
ParametersetInteger (const string &name, long number, const string &unit="")
 
ParameterpushInteger (const string &name, long number, long error, const string &unit="")
 
ParameterpushInteger (const string &name, long number, const string &unit="")
 
ParametersetInteger (const string &name, const Parameter &p)
 
long defaultInteger (const string &name, const string &unit="") const
 
ParametersetDefaultInteger (const string &name, long dflt, const string &unit="")
 
ParametersetMinMax (const string &name, long minimum=LONG_MIN, long maximum=LONG_MAX, long step=1, const string &unit="")
 
ParametersetMinMax (const string &name, int minimum, int maximum, int step=1, const string &unit="")
 
ParameteraddBoolean (const string &name, const string &request, bool dflt, int flags=0, int style=0)
 
ParameteraddBoolean (const char *name, const char *request, bool dflt, int flags=0, int style=0)
 
ParameteraddBoolean (const string &name, bool dflt, int flags=0, int style=0)
 
ParameteraddBoolean (const char *name, bool dflt, int flags=0, int style=0)
 
ParameterinsertBoolean (const string &name, const string &atname="", const string &request="", bool dflt=false, int flags=0, int style=0)
 
ParameterinsertBoolean (const string &name, const string &atname, int flags=0, int style=0)
 
bool boolean (const string &name, bool dflt=false, int index=0) const
 
bool boolean (const string &name, int index, bool dflt=false) const
 
void booleans (const string &name, vector< bool > &n) const
 
ParametersetBoolean (const string &name, bool b)
 
ParametersetBoolean (const string &name, const Parameter &p)
 
bool defaultBoolean (const string &name) const
 
ParametersetDefaultBoolean (const string &name, bool dflt)
 
ParameteraddDate (const string &name, const string &request, int year=0, int month=0, int day=0, int flags=0, int style=0)
 
ParameteraddDate (const string &name, int year, int month, int day, int flags=0, int style=0)
 
ParameteraddDate (const string &name, int flags=0, int style=0)
 
ParameterinsertDate (const string &name, const string &atname="", const string &request="", int year=0, int month=0, int day=0, int flags=0, int style=0)
 
ParameterinsertDate (const string &name, const string &atname, int year=0, int month=0, int day=0, int flags=0, int style=0)
 
ParameterinsertDate (const string &name, const string &atname, int flags=0, int style=0)
 
const Parameterdate (const string &name, int index, int &year, int &month, int &day) const
 
ParametersetDate (const string &name, int year, int month, int day)
 
ParametersetDate (const string &name, const string &date)
 
ParametersetDate (const string &name, const struct tm &date)
 
ParametersetDate (const string &name, const time_t &time)
 
ParametersetCurrentDate (const string &name)
 
ParametersetDate (const string &name, const Parameter &p)
 
const ParameterdefaultDate (const string &name, int index, int &year, int &month, int &day) const
 
ParametersetDefaultDate (const string &name, int year, int month, int day)
 
ParameteraddTime (const string &name, const string &request, int hour=0, int minutes=0, int seconds=0, int milliseconds=0, int flags=0, int style=0)
 
ParameteraddTime (const string &name, int hour, int minutes, int seconds, int milliseconds=0, int flags=0, int style=0)
 
ParameteraddTime (const string &name, int flags=0, int style=0)
 
ParameterinsertTime (const string &name, const string &atname="", const string &request="", int hour=0, int minutes=0, int seconds=0, int milliseconds=0, int flags=0, int style=0)
 
ParameterinsertTime (const string &name, const string &atname, int hour=0, int minutes=0, int seconds=0, int milliseconds=0, int flags=0, int style=0)
 
ParameterinsertTime (const string &name, const string &atname, int flags=0, int style=0)
 
const Parametertime (const string &name, int index, int &hour, int &minutes, int &seconds, int &milliseconds) const
 
ParametersetTime (const string &name, int hour, int minutes, int seconds, int milliseconds=0)
 
ParametersetTime (const string &name, const string &time)
 
ParametersetTime (const string &name, const struct tm &time)
 
ParametersetTime (const string &name, const time_t &time)
 
ParametersetCurrentTime (const string &name)
 
ParametersetTime (const string &name, const Parameter &p)
 
const ParameterdefaultTime (const string &name, int index, int &hour, int &minutes, int &seconds, int &milliseconds) const
 
ParametersetDefaultTime (const string &name, int hour, int minutes, int seconds, int milliseconds=0)
 
OptionsnewSection (int level, const string &name, const string &type="", int flag=0, int style=0)
 
OptionsnewSection (int level, const string &name, int flag, int style=0)
 
OptionsnewSection (const string &name, const string &type="", int flag=0, int style=0)
 
OptionsnewSection (const string &name, int flag, int style=0)
 
OptionsnewSubSection (const string &name, const string &type="", int flag=0, int style=0)
 
OptionsnewSubSection (const string &name, int flag, int style=0)
 
OptionsnewSubSubSection (const string &name, const string &type="", int flag=0, int style=0)
 
OptionsnewSubSubSection (const string &name, int flag, int style=0)
 
OptionsaddSection (const string &name, const string &type="", int flag=0, int style=0)
 
OptionsaddSection (const string &name, int flag, int style=0)
 
OptionsinsertSection (const string &name, const string &atpattern, const string &type="", int flag=0, int style=0)
 
OptionsinsertSection (const string &name, const string &atpattern, int flag, int style=0)
 
OptionsnewSection (int level, const Options &opt, int selectmask, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsnewSection (int level, const Options &opt, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsnewSection (int level, const Options &opt, const string &name, int flag, int style=0)
 
OptionsnewSection (const Options &opt, int selectmask, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsnewSection (const Options &opt, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsnewSection (const Options &opt, const string &name, int flag, int style=0)
 
OptionsnewSubSection (const Options &opt, int selectmask, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsnewSubSection (const Options &opt, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsnewSubSection (const Options &opt, const string &name, int flag, int style=0)
 
OptionsnewSubSubSection (const Options &opt, int selectmask, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsnewSubSubSection (const Options &opt, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsnewSubSubSection (const Options &opt, const string &name, int flag, int style=0)
 
OptionsaddSection (const Options &opt, int selectmask, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsaddSection (const Options &opt, const string &name="", const string &type="", int flag=0, int style=0)
 
OptionsaddSection (const Options &opt, const string &name, int flag, int style=0)
 
OptionsinsertSection (const Options &opt, int selectmask, const string &name, const string &atpattern, const string &type="", int flag=0, int style=0)
 
OptionsinsertSection (const Options &opt, const string &name, const string &atpattern, const string &type="", int flag=0, int style=0)
 
OptionsinsertSection (const Options &opt, const string &name, const string &atpattern, int flag, int style=0)
 
OptionsnewSection (Options *opt, bool newparent=false)
 
OptionsaddSection (Options *opt, bool newparent=false)
 
OptionsinsertSection (Options *opt, const string &atpattern, bool newparent=false)
 
OptionsnewSections (Options *opt, bool newparent=false)
 
void endSection (void)
 
void clearSections (void)
 
void setSection (Options &opt)
 
void lastSection (void)
 
int up (void)
 
int down (void)
 
ParametersetDefault (const string &name)
 
OptionssetDefaults (int flags=0)
 
ParametersetToDefault (const string &name)
 
OptionssetToDefaults (int flags=0)
 
Optionserase (iterator p)
 
Optionserase (section_iterator p)
 
Optionserase (Options *s)
 
Optionserase (const string &pattern)
 
Optionserase (int selectflag)
 
Optionspop (void)
 
OptionspopSection (void)
 
Optionsflatten (Options *root=0)
 
Optionsclear (bool revert=true)
 
int size (void) const
 
int size (int selectflag) const
 
bool empty (void) const
 
int parameterSize (void) const
 
int parameterSize (int flags) const
 
int sectionsSize (void) const
 
int sectionsSize (int flags) const
 
bool exist (const string &pattern) const
 
bool existSection (const string &pattern) const
 
OptionssetFlags (int flags, int selectflag=0)
 
OptionsaddFlags (int flags, int selectflag=0)
 
OptionsdelFlags (int flags, int selectflag=0)
 
OptionssetValueTypeFlags (int flags, int typemask)
 
OptionsaddValueTypeFlags (int flags, int typemask)
 
OptionsdelValueTypeFlags (int flags, int typemask)
 
OptionssetStyles (int style, int selectflag=0)
 
OptionsaddStyles (int style, int selectflag=0)
 
OptionsdelStyles (int style, int selectflag=0)
 
int styleSize (int style) const
 
OptionssetValueTypeStyles (int style, int typemask)
 
OptionsaddValueTypeStyles (int style, int typemask)
 
OptionsdelValueTypeStyles (int style, int typemask)
 
int nameWidth (int selectmask=0, bool detailed=false, bool escape=false) const
 
string save (int selectmask=0, int flags=0) const
 
ostream & save (ostream &str, const string &start="", int selectmask=0, int flags=0, int width=-1) const
 
ostream & save (ostream &str, const string &textformat, const string &numberformat, const string &boolformat="%i=%b", const string &dateformat="%i=%04Y-%02m-%02d", const string &timeformat="%i=%02H:%02M:%02S", const string &sectionformat="%i", int selectmask=0, const string &start="") const
 
ostream & saveXML (ostream &str, int selectmask=0, int flags=0, int level=0, int indent=4) const
 
Optionsread (const string &opttxt, int flag, const string &assignment=":=", const string &separator=",;", int *indent=0)
 
Optionsread (const string &opttxt, const string &assignment=":=", const string &separator=",;")
 
istream & read (istream &str, int flag, const string &assignment=":=", const string &comment="#", const string &stop="", Str *line=0)
 
istream & read (istream &str, const string &assignment=":=", const string &comment="#", const string &stop="", Str *line=0)
 
Optionsread (const StrQueue &sq, int flag=0, const string &assignment=":=")
 
bool read (const Parameter &p, int flag=0)
 
Optionsread (const Options &o, int flags=0, int flag=0)
 
bool readAppend (const Parameter &p)
 
OptionsreadAppend (const Options &o, int flags=0)
 
Optionsload (const Str &opttxt, const string &assignment=":=", const string &separator=",;", int *indent=0, int *indentspacing=0, int *level=0)
 
istream & load (istream &str, const string &assignment=":=", const string &comment="#", const string &stop="", string *line=0)
 
Optionsload (const StrQueue &sq, const string &assignment=":=")
 
virtual void notify (void)
 
void callNotifies (void)
 
bool setNotify (bool notify=true)
 
bool unsetNotify (void)
 
bool notifying (void) const
 

Protected Member Functions

virtual int testReadData (InList &traces)
 
virtual int testReadDevice (InList &traces)=0
 
void setAnalogInputType (int aitype)
 
void setReadSleep (unsigned long ms)
 
void setInfo (void)
 
void setSettings (const InList &traces, int readbuffer=0, int updatebuffer=0)
 
virtual void startThread (QSemaphore *sp=0, QReadWriteLock *datamutex=0, QWaitCondition *datawait=0, bool error=false)
 
virtual void run (void)
 
virtual void stopRead (void)
 
- Protected Member Functions inherited from Device
void setDeviceType (int type)
 
void setDeviceClass (const string &deviceclass)
 
void setDeviceFile (const string &devicefile)
 
void setDeviceName (const string &devicename)
 
void setDeviceVendor (const string &devicevendor)
 
void addInfo (void)
 
void lock (void) const
 
void unlock (void) const
 
QMutex * mutex (void) const
 
virtual void initOptions (void)
 

Additional Inherited Members

- Public Types inherited from Device
enum  DeviceTypes {
  MiscellaneousType = 0, AnalogInputType = 1, AnalogOutputType = 2, DigitalIOType = 3,
  TriggerType = 4, AttenuatorType = 5, AttenuateType = 6, ManipulatorType = 7,
  TemperatureType = 8, CameraType = 9
}
 
- Public Types inherited from Options
enum  SaveFlags {
  NoName = 1, NoType = 2, NoInclude = 4, SwitchNameType = 8,
  Embrace = 16, PrintRequest = 32, FirstOnly = 64, PrintType = 128,
  PrintStyle = 256, DontCloseSection = 512, AlwaysQuote = 1024, EscapeQuotes = 2048
}
 
typedef deque< Parameter >
::iterator 
iterator
 
typedef deque< Parameter >
::const_iterator 
const_iterator
 
typedef deque< Options * >
::iterator 
section_iterator
 
typedef deque< Options * >
::const_iterator 
const_section_iterator
 
- Static Public Member Functions inherited from Device
static int deviceTypes (void)
 
static string deviceTypeStr (int type)
 
static string getErrorStr (int ern)
 
- Static Public Member Functions inherited from Options
static double floorLog10 (double v)
 
static double floor10 (double v, double scale=1.0)
 
static double ceil10 (double v, double scale=1.0)
 
- Static Public Attributes inherited from Device
static const int NotOpen = -1
 
static const int InvalidDevice = -2
 
static const int ReadError = -3
 
static const int WriteError = -4
 
static const int InvalidParam = -5
 
- Static Public Attributes inherited from Options
static const int NonDefault = Parameter::NonDefault
 
static const long TabSection = 0x04000000
 
- Protected Attributes inherited from Device
Options Info
 
Options Settings
 

Detailed Description

Interface for accessing analog input of a data-aquisition board.

Author
Marco Hackenberg
Jan Benda
Todo:

add probe function that returns a string of possible supported devices.

add directread function for single point acquisition

add a flag for indicating whether device is capable of streaming input

In case you want to use a analog input device within RELACS, your AnalogInput implementation needs to provide a void default constructor (i.e. with no parameters) that does not open the device. Also, include the header file <relacs/relacsplugin.h> and make the AnalogInput device known to RELACS with the addAnalogInput( ClassNameOfYourAnalogInputImplementation, PluginSetName ) macro.

Constructor & Destructor Documentation

AnalogInput ( void  )

Create a new AnalogInput without opening a device. Reimplement this constructor.

AnalogInput ( int  aitype)

Constructs an AnalogInput with type id aitype.

See Also
setAnalogInputType()
AnalogInput ( const string &  deviceclass,
int  aitype = 0 
)

Constructs an AnalogInput with device class deviceclass and type id aitype.

See Also
setDeviceClass(), setAnalogInputType()
~AnalogInput ( void  )
virtual

Stop analog input and close the daq driver.

Member Function Documentation

int open ( const string &  device)
overridevirtual

Open the analog input device specified by device. Returns zero on success, or InvalidDevice (or any other negative number indicating the error).

See Also
isOpen(), close(), reset()

Reimplemented from Device.

Reimplemented in AISim.

References Options::clear(), Device::Info, Device::InvalidDevice, and Device::setDeviceFile().

int open ( Device device)
overridevirtual

Open the analog input device specified by device. Returns zero on success, or InvalidDevice (or any other negative number indicating the error).

See Also
isOpen(), close(), reset()

Reimplemented from Device.

Reimplemented in AISim.

References Options::clear(), Device::deviceIdent(), Device::Info, Device::InvalidDevice, and Device::setDeviceFile().

virtual bool isOpen ( void  ) const
pure virtual
virtual void close ( void  )
pure virtual

Stop all activity and close the device.

See Also
open(), isOpen(), reset()

Implements Device.

Implemented in AISim.

virtual int channels ( void  ) const
pure virtual

Number of analog input channels.

Implemented in AISim.

Referenced by AnalogInput::setInfo(), and AnalogInput::testReadData().

virtual int bits ( void  ) const
pure virtual

Resolution in bits of analog input.

Implemented in AISim.

Referenced by AnalogInput::setInfo().

virtual double maxRate ( void  ) const
pure virtual

Maximum sampling rate in Hz of analog input.

Implemented in AISim.

Referenced by AnalogInput::setInfo(), and AnalogInput::testReadData().

virtual int maxRanges ( void  ) const
pure virtual
virtual double unipolarRange ( int  index) const
pure virtual
virtual double bipolarRange ( int  index) const
pure virtual
int minGainIndex ( bool  unipolar) const
Returns
the gain index for the minimum gain (largest range) available for inputs of polarity unipolar.
See Also
maxGainIndex(), gainIndex()

References AnalogInput::bipolarRange(), Options::index(), AnalogInput::isOpen(), AnalogInput::maxRanges(), and AnalogInput::unipolarRange().

Referenced by Acquire::adjustGain().

int maxGainIndex ( bool  unipolar) const
Returns
the gain index for the maximum gain (smallest range) available for inputs of polarity unipolar.
See Also
minGainIndex(), gainIndex()

References AnalogInput::bipolarRange(), Options::index(), AnalogInput::isOpen(), AnalogInput::maxRanges(), and AnalogInput::unipolarRange().

int gainIndex ( bool  unipolar,
double  maxvoltage 
) const
Returns
the gain index for the largest gain (smallest range) available for inputs of polarity unipolar that just fits maxvoltage.
See Also
minGainIndex(), maxGainIndex()

References AnalogInput::bipolarRange(), AnalogInput::isOpen(), AnalogInput::maxRanges(), and AnalogInput::unipolarRange().

Referenced by Acquire::adjustGain(), AnalogInput::setSettings(), and AnalogInput::testReadData().

int testRead ( InList traces)
virtual

Test settings for analog input on the device for each input channel in traces. First, all error flags in traces are cleared (DaqError::clearError()). If an error ocurred in any trace, the corresponding errorflags in the InData are set and a negative value is returned. The channels in traces are not sorted. Simply calls testReadData() and testReadDevice(). This function can be called any time independently of prepareRead() and startRead() with different traces.

References InList::clearError(), AnalogInput::testReadData(), and AnalogInput::testReadDevice().

virtual int prepareRead ( InList traces)
pure virtual

Prepare analog input of the input traces traces on the device as much as possible. If an error ocurred in any channel, the corresponding errorflags in the InData structure are filled and a negative value is returned. In addition, according to the InData::gainIndex() of each trace the gain and the minimum and maximum possible output voltages for each of the traces should be set (see InData::setGain(), InData::setMaxVoltage(), InData::setMinVoltage() ). This function assumes that traces successfully passed testRead(). The channels in traces are not sorted.

Implemented in AISim.

virtual int startRead ( QSemaphore *  sp = 0,
QReadWriteLock *  datamutex = 0,
QWaitCondition *  datawait = 0,
QSemaphore *  aosp = 0 
)
pure virtual

Start non-blocking analog input for the input traces that were passed to the previous call of prepareRead(). If an error ocurred in any channel, the corresponding errorflags in the InData structure are filled and a negative value is returned. Also start possible pending acquisition on other devices that are known from take().

Parameters
[in]spif not null, a thread is started reading out the running analog input. When the thread and analog input is finished, releases the semaphore by one. On error, the semaphore is released by 1000 so that the process waiting on the semaphore is waking up immediately.
[in]datamutexthe mutex for locking the input traces that were passed to the previous call of prepareRead().
[in]datawaita waitcondition that is waken up whnever the thread put new data into the input traces.
[in]aospis the semaphore that guards analog outputs. if null, then do not start analog outputs.
Returns
-1 on failure, 0 on success and 1 on succes and if for an analog output further calls to writeData() are necessary. This function is called after a successfull prepareRead() or after stop(). This function should be as quick as possible.

Implemented in AISim.

virtual int readData ( void  )
pure virtual

Read data from a running data acquisition and store them in an internal buffer. Returns the total number of read data values. If an error ocurred in any channel, the corresponding errorflags in the InData structure are filled and a -2 is returned. If no acquisition is running and therefore no more data are to be expected, -1 is returned. This function is called periodically after reading has been successfully started by startRead(). This function does not modify the traces passed to prepareRead()!

Implemented in AISim.

Referenced by AnalogInput::run().

virtual int convertData ( void  )
pure virtual

Convert the acquired data from the internal buffer to numbers in the secondary unit and store the data in the traces that were passed to the previous call of prepareRead(). Returns the number of data values that were added to the traces (sum over all traces). If an error ocurred in any channel, the corresponding errorflags in the InData structure are filled and a negative value is returned. This function is called periodically after one or several calls to readData().

Implemented in AISim.

Referenced by AnalogInput::run().

void model ( InList data,
const vector< int > &  aochannels,
vector< float > &  aovalues 
)
virtual

Compute a dynamic clamp model. An implementation is only needed for an analog input simulation.

Referenced by Model::next().

virtual int stop ( void  )
pure virtual

Stop any running ananlog input activity, but preserve all so far read in data. The next call to readData() will return the data. Should call stopRead() to stop the thread. Returns zero on success, otherwise one of the flags NotOpen, InvalidDevice, ReadError.

See Also
reset(), startRead()

Implemented in AISim.

virtual int reset ( void  )
pure virtual

Clear any internal data buffers and reset the device. Assumes that analog input is already stopped. Returns zero on success, otherwise one of the flags NotOpen, InvalidDevice, ReadError.

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

Reimplemented from Device.

Implemented in AISim.

Referenced by AnalogInput::run().

bool running ( void  ) const
virtual
Returns
true if analog input is running. The default implementation checks whether the thread is still running. In your implementation you should use this information as well.

Reimplemented in AISim.

void take ( const vector< AnalogInput * > &  ais,
const vector< AnalogOutput * > &  aos,
vector< int > &  aiinx,
vector< int > &  aoinx,
vector< bool > &  airate,
vector< bool > &  aorate 
)
virtual

Check for every analog input and analog output device in ais and aos, respectively, whether it can be simultaneously started by startRead() from this device. Add the indices of those devices to aiinx and aoinx, respectively. The corresponding entries in airate and aorate should be set to true if these devices should use the same sampling rate as this.

void addTraces ( vector< TraceSpec > &  traces,
int  deviceid 
) const
virtual

If the analog input device supports inputs that are not physical input lines but rather readable internal variables, like model outputs of a dynamic clamp modul, then reimplement this function. Add for each such variable a TraceSpec to traces. deviceid is the id of this analog input device that you should pass as the device to TraceSpec.

int matchTraces ( InList traces) const
virtual

May match trace names with driver internal trace names, for example trace names of a dynamic clamp model.

Returns
0: no traces needed to be matched.
n: n traces have been successfully matched.
-1: Failed to match a trace.
int analogInputType ( void  ) const

The id of the analog input implementation.

See Also
setAnalogInputType(), deviceType(), deviceName(), ident()
int testReadData ( InList traces)
protectedvirtual

Test each input channel in traces for valid settings. If an error ocurred in any trace, the corresponding errorflags in the InData are set and a negative value is returned. The following error conditions are checked: DeviceNotOpen, NoData (InData::capacity() <= 0), MultipleDevices, MultipleStartSources, MultipleDelays, MultipleSampleRates, MultipleContinuous, MultipleBuffersizes (InData::capacity()), MultipleBufferTimes, MultipleUpdateTimes, InvalidStartSource (InData::startSource() < 0), InvalidDelay (InData::delay() < 0), InvalidSampleRate (InData::sampleRate() > maxRate() or < 1.0), InvalidChannel (InData::channel() >= channels() or < 0), MultipleChannels, InvalidReference (InData::reference() != InData::Differential, InData::Referenced, InData::NonReferenced), InvalidGain (InData::gainIndex() not valid, i.e. < 0 or >= maxRanges() or the corresponding range in unipolarRange() or bipolarRange does not exist). This function is called by testRead().

References InList::addError(), AnalogInput::bipolarRange(), AnalogInput::channels(), DaqError::DeviceNotOpen, InList::failed(), AnalogInput::gainIndex(), DaqError::InvalidChannel, DaqError::InvalidDelay, DaqError::InvalidGain, DaqError::InvalidReference, DaqError::InvalidSampleRate, DaqError::InvalidStartSource, AnalogInput::isOpen(), AnalogInput::maxRanges(), AnalogInput::maxRate(), DaqError::MultipleBuffersizes, DaqError::MultipleBufferTimes, DaqError::MultipleChannels, DaqError::MultipleContinuous, DaqError::MultipleDelays, DaqError::MultipleDevices, DaqError::MultipleSampleRates, DaqError::MultipleStartSources, DaqError::MultipleUpdateTimes, DaqError::NoData, InData::ParamChannel, InData::RefCommon, InData::RefDifferential, InData::RefGround, InData::RefOther, InList::setContinuous(), InList::setDelay(), InList::setDevice(), InList::setReadTime(), InList::setReference(), InList::setSampleRate(), InList::setStartSource(), InList::setUpdateTime(), InList::size(), and AnalogInput::unipolarRange().

Referenced by AnalogInput::testRead().

virtual int testReadDevice ( InList traces)
protectedpure virtual

Device driver specific tests on the settings in traces for each input channel. Before this function is called, the validity of the settings in traces was already tested by testReadData(). testWriteDevice() is called even if an error was detected by testWriteData(). 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 InData are set and a negative value is returned. In addition, according to the gainIndex() of each trace the gain and the minimum and maximum possible output voltages for each of the traces should be set (see InData::setGain(), InData::setMaxVoltage(), InData::setMinVoltage() ). The channels in traces are not sorted. This function is called by testRead().

Referenced by AnalogInput::testRead().

void setAnalogInputType ( int  aitype)
protected

Set id of the analog input implementation to aitype. This function should be called in the constructor of an implementation of AnalogInput.

See Also
analogInputType(), setDeviceType(), setDeviceName(), setDeviceFile(), setIdent()
void setReadSleep ( unsigned long  ms)
protected

Set the time for sleeping between calls of readData() to ms milliseconds.

void setInfo ( void  )
protected
void setSettings ( const InList traces,
int  readbuffer = 0,
int  updatebuffer = 0 
)
protected

Set the settings() for traces. Call this function from within a successful prepareRead().

Parameters
[in]tracesthe input traces for which the settings string should be constructed.
[in]readbufferis the size of the driver's buffer in bytes.
[in]updatebufferis the size of the internal buffer in bytes.
See Also
settings()

References Options::addBoolean(), Options::addInteger(), Options::addNumber(), Options::addText(), Options::clear(), AnalogInput::gainIndex(), and InList::size().

Referenced by AISim::prepareRead().

void startThread ( QSemaphore *  sp = 0,
QReadWriteLock *  datamutex = 0,
QWaitCondition *  datawait = 0,
bool  error = false 
)
protectedvirtual

Start the thread if sp is not null. If error do not start the thread and release the semaphore sp.

void run ( void  )
protectedvirtual
void stopRead ( void  )
protectedvirtual

Stop the running thread.

References Device::lock(), and Device::unlock().


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