Documents > BPS V2 C++ API
BpsGauge Class Reference

Gauge interface. More...

#include <bpsgauge.h>

List of all members.

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.

Detailed Description

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.


Constructor & Destructor Documentation

BpsGauge::BpsGauge ( QObject *  aParent = 0)
Parameters:
[in]aParentThe parent object.

Member Function Documentation

QMap<QString,QString> BpsGauge::config ( ) const
Returns:
The configuration with lowercase keys, and trimmed keys and values.
See also:
Bps::lowerKeyStringMap().
void BpsGauge::error ( const QString &  aMessage) [signal]

Combined failure signal from readValueTimeout() and readValueError().

Parameters:
[in]aMessageInformation 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.

Parameters:
[in]aMessageInformation 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.

Parameters:
[in]aStatusThe value status.
[in]aValueThe 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.

Parameters:
[in]aMessageInformation about the failure reason ("Timeout")
virtual void BpsGauge::requestReadValue ( int  aTimeout = 0) [pure virtual]

Request the reading of status and value.

Parameters:
[in]aTimeoutTime 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.

Returns:
Resolution in digits.
void BpsGauge::setConfig ( const QMap< QString, QString > &  aConfig)

Set the configuration.

This should be done before making requests.

Parameters:
[in]aConfigThe 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.

Returns:
Value type.

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