Relacs DAQ Library
0.9.8
|
#include <attenuator.h>
Public Member Functions | |
Attenuator (void) | |
Attenuator (const string &deviceclass) | |
virtual | ~Attenuator (void) |
virtual int | lines (void) const =0 |
virtual double | minLevel (void) const =0 |
virtual double | maxLevel (void) const =0 |
virtual void | levels (vector< double > &l) const =0 |
virtual int | attenuate (int di, double &decibel)=0 |
virtual int | testAttenuate (int di, double &decibel)=0 |
virtual int | mute (int di) |
virtual int | testMute (int di) |
Public Member Functions inherited from Device | |
Device (int type=MiscellaneousType) | |
Device (const string &deviceclass, int type=MiscellaneousType) | |
virtual | ~Device (void) |
virtual int | open (const string &device) |
virtual int | open (Device &device) |
virtual bool | isOpen (void) const =0 |
virtual void | close (void)=0 |
virtual int | reset (void) |
virtual const Options & | info (void) const |
virtual const Options & | settings (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 |
Static Public Attributes | |
static const double | MuteAttenuationLevel = -1.0e37 |
static const int | Underflow = -5 |
static const int | Overflow = -6 |
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 |
Protected Member Functions | |
void | setInfo (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 } |
Static Public Member Functions inherited from Device | |
static int | deviceTypes (void) |
static string | deviceTypeStr (int type) |
static string | getErrorStr (int ern) |
Protected Attributes inherited from Device | |
Options | Info |
Options | Settings |
Interface for programming an attenuator.
Via a constructor or the open()-function a specific attenuator device is assigned to the Attenuator-class and opened. The isOpen()-function checks whether the device driver for the attenuator is valid and opened. With close() the device driver for the attenuator is closed.
The number of output lines that can be attenuated by the attenuator is returned by lines(). The minimum and maximum possible attenuation level is returned by minLevel() and maxLevel(), respectively. levels() returns all possible attenuation levels.
The attenuation level of an output line can be set by the attenuate()-function. Attenuators usually can be set to discrete attenuation levels only. If you request a specific attenuation level by attenuate(), than it is very likely that the actually set attenuation level differs slightly from the requested one. To make this attenuation level known to the user, attenuate() sets the decibel variable to the actually set attenuation level.
To check whether a requested attenuation level is possible and what level would be set without actually setting it, you can use the testAttenuate()-function.
The mute()-function can be used to mute an output line and testMute() checks whether the output line can be muted. Alternatively, you can call attenuate() with decibel set to MuteAttenuationLevel.
Possible return values of attenuate(), test() and mute() are:
0
: successNotOpen:
The device driver for the attenuator is not open.InvalidDevice:
An invalid device index is requested, i.e. the requested output line is not supported by the attenuator device.ReadError:
Failed in reading the attenuation level.WriteError:
Failed in setting the attenuation level.Underflow:
The requested attenuation level is too high, i.e. the requested signal amplitude is too small.Overflow:
The requested attenuation level is too low, i.e. the requested signal amplitude is too large.In case you want to use a attenuator device within RELACS, your Attenuator 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 Attenuator device known to RELACS with the addAttenuator
( ClassNameOfYourAttenuatorImplementation, PluginSetName ) macro.
Attenuator | ( | void | ) |
Constructs an Attenuator.
Attenuator | ( | const string & | deviceclass | ) |
Constructs an Attenuator with device class deviceclass.
|
virtual |
Destructor. Closes the attenuator device driver.
|
pure virtual |
Returns the number of output lines the attenuator device supports. Reimplement this function for a specific attenuator. The default implementation returns 1.
Referenced by Attenuate::isOpen(), and Attenuator::setInfo().
|
pure virtual |
Returns the minimum possible attenuation level in decibel. This number can be negative, indicating amplification.
Referenced by Attenuate::maxIntensity(), Attenuate::minIntensity(), and Attenuator::setInfo().
|
pure virtual |
Returns the maximum possible attenuation level in decibel.
Referenced by Attenuate::maxIntensity(), Attenuate::minIntensity(), and Attenuator::setInfo().
|
pure virtual |
Returns in l all possible attenuation levels sorted by increasing attenuation levels (highest last).
Referenced by Attenuate::intensities().
|
pure virtual |
Set the attenuation level of the output line specified by its index di to decibel decibel. decibel can also be set to MuteAttenuationLevel for requesting to mute the attenuator. Returns the actually set level in decibel. In case the attenuator was muted, MuteAttenuationLevel is returned in decibel. If the requested attenuation level is too high or too low (Underflow or Overflow), then the maximum or minimum possible attenuation level is set and returned in decibel. You have to reimplement this function for a specific attenuator.
NotOpen:
The device driver for the attenuator is not open.InvalidDevice:
An invalid device index is requested, i.e. the requested output line is not supported by the attenuator device.WriteError:
Failed in setting the attenuation level.Underflow:
The requested attenuation level is too high, i.e. the requested signal amplitude is too small.Overflow:
The requested attenuation level is too low, i.e. the requested signal amplitude is too large. Referenced by Attenuate::attenuate(), Attenuator::mute(), and Attenuate::write().
|
pure virtual |
Tests setting the attenuation level of the output line specified by its index di to decibel decibel. decibel can also be set to MuteAttenuationLevel for requesting to mute the attenuator. Returns the level that would be set in decibel. In case the attenuator would be muted, MuteAttenuationLevel is returned in decibel. If the requested attenuation level is too high or too low (Underflow or Overflow), then the maximum or minimum possible attenuation level is returned in decibel. You have to reimplement this function for a specific attenuator.
NotOpen:
The device driver for the attenuator is not open.InvalidDevice:
An invalid device index is requested, i.e. the requested output line is not supported by the attenuator device.Underflow:
The requested attenuation level is too high, i.e. the requested signal amplitude is too small.Overflow:
The requested attenuation level is too low, i.e. the requested signal amplitude is too large. Referenced by Attenuate::testAttenuate(), Attenuator::testMute(), and Attenuate::testWrite().
|
virtual |
Mutes the output line specified by its index di. The default implementation simply calls attenuate( di, MuteAttenuationLevel ).
NotOpen:
The device driver for the attenuator is not open.InvalidDevice:
An invalid device index is requested, i.e. the requested output line is not supported by the attenuator device.WriteError:
Failed in setting the attenuation level. References Attenuator::attenuate(), and Attenuator::MuteAttenuationLevel.
Referenced by Attenuate::mute().
|
virtual |
Tests muting the output line specified by its index di. The default implementation simply calls testAttenuate( di, MuteAttenuationLevel ).
NotOpen:
The device driver for the attenuator is not open.InvalidDevice:
An invalid device index is requested, i.e. the requested output line is not supported by the attenuator device.WriteError:
Failed in setting the attenuation level. References Attenuator::MuteAttenuationLevel, and Attenuator::testAttenuate().
Referenced by Attenuate::testMute().
|
protected |
Set the device info(). Call this function from open().
References Device::addInfo(), Device::Info, Attenuator::lines(), Attenuator::maxLevel(), and Attenuator::minLevel().
|
static |
The attenuation level for which the outputline is muted.
Referenced by Attenuator::mute(), and Attenuator::testMute().
|
static |
Return code indicating a too high requested attenuation level, i.e. the requested signal amplitude is too small.
|
static |
Return code indicating a too low requested attenuation level, i.e. the requested signal amplitude is too large.