Gauge interface. More...
#include <bpsgauge.h>
Public Types | |
| enum | { StatusStable = 0, StatusDynamic = 1 } |
| Read status. | |
| enum | Unit { UnitCelsius = 0, UnitPH = 1 } |
| Value unit. | |
Signals | |
| void | error (const QString &aMessage) |
| Combined failure signal from readValueTimeout() and readValueError(). | |
| void | readValueError (const QString &aMessage) |
| Signal emitted as failure result of a requestReadValue() for all other reasons except timeout. | |
| void | readValueOk (int aStatus, double aValue) |
| Signal emitted as success result of a requestReadValue() call. | |
| void | readValueTimeout (const QString &aMessage) |
| Signal emitted as failure result of a requestReadValue() call when nothing was received withing the specified timeout. | |
Public Member Functions | |
| BpsGauge (QObject *aParent=0) | |
| QMap< QString, QString > | config () const |
| virtual void | requestReadValue (int aTimeout=0)=0 |
| Request the reading of status and value. | |
| virtual int | resolution () const =0 |
| Resolution of the values returned. | |
| void | setConfig (const QMap< QString, QString > &aConfig) |
| Set the configuration. | |
| virtual Unit | unit () const =0 |
| Unit of the values returned. | |
| virtual | ~BpsGauge () |
| Virtual default destructor. | |
Gauge interface.
Gauge interfaces operate similar as a thread, where commands are given by request calls, and results are returned as signals. Background operations are however implemented with QTimer, so the requesting thread must have an event queue. Overlapped requests are not supported, subsequent requests should be made only after the previous has been answered by a signal.
| BpsGauge::BpsGauge | ( | QObject * | aParent = 0 | ) |
| [in] | aParent | The parent object. |
| QMap<QString,QString> BpsGauge::config | ( | ) | const |
| void BpsGauge::error | ( | const QString & | aMessage | ) | [signal] |
Combined failure signal from readValueTimeout() and readValueError().
| [in] | aMessage | Information about the failure reason (for example "Timeout", "Device not open" etc.) |
| void BpsGauge::readValueError | ( | const QString & | aMessage | ) | [signal] |
Signal emitted as failure result of a requestReadValue() for all other reasons except timeout.
| [in] | aMessage | Information about the failure reason (for example "Device can not be opened", "Checksum error" etc.) |
| void BpsGauge::readValueOk | ( | int | aStatus, |
| double | aValue | ||
| ) | [signal] |
Signal emitted as success result of a requestReadValue() call.
| [in] | aStatus | The value status. |
| [in] | aValue | The current value. |
| void BpsGauge::readValueTimeout | ( | const QString & | aMessage | ) | [signal] |
Signal emitted as failure result of a requestReadValue() call when nothing was received withing the specified timeout.
| [in] | aMessage | Information about the failure reason ("Timeout") |
| virtual void BpsGauge::requestReadValue | ( | int | aTimeout = 0 | ) | [pure virtual] |
Request the reading of status and value.
| [in] | aTimeout | Time out in seconds. Special values: 0 = no wait, -1 = wait endless |
| virtual int BpsGauge::resolution | ( | ) | const [pure virtual] |
Resolution of the values returned.
Positive values denote fractional digits. For example 3 stands for steps of 0.001, 0 are steps of 1, and -2 are steps of 100.
| void BpsGauge::setConfig | ( | const QMap< QString, QString > & | aConfig | ) |
Set the configuration.
This should be done before making requests.
| [in] | aConfig | The gauge configuration, usually the values in Central System Settings/Terminals/TERMINAL/Devices/Gauges/{device no}. |
| virtual Unit BpsGauge::unit | ( | ) | const [pure virtual] |
Unit of the values returned.