BPS C++ API  2.24.4
bpsgauge.h
Go to the documentation of this file.
1 
4 #ifndef BPSGAUGE_H
5 #define BPSGAUGE_H
6 
7 #include "bpsdecimal.h"
8 #include <QObject>
9 #include <QMap>
10 
19 {
20  Q_OBJECT
22 
23 public:
27  enum Unit {
28  UnitCelsius = 0, // The value is degrees celsius.
29  UnitPH = 1 // The value is pH.
30  };
31 
35  enum {
36  StatusStable = 0, // The value was successfully read and is stable.
37  StatusDynamic = 1 // The value was successfully read but is dynamic (moving).
38  };
39 
43  BpsGauge(QObject* aParent=0);
44 
48  virtual ~BpsGauge();
49 
55  void setConfig(const QMap<QString,QString>& aConfig);
56 
62 
67  virtual Unit unit() const = 0;
68 
75  virtual int resolution() const = 0;
76 
81  virtual void requestReadValue(int aTimeout = 0) = 0;
82 
83 signals:
84 
90  void readValueOk(int aStatus, const BpsDecimal& aValue);
91 
96  void readValueTimeout(const QString& aMessage);
97 
102  void readValueError(const QString& aMessage);
103 
108  void error(const QString& aMessage);
109 
110 };
111 
112 #endif // BPSGAUGE_H
#define BPSCORE_EXPORT
Declare class to be an import from the shared library.
Definition: bpscore_global.h:22
Public include file for BpsDecimal class.
#define BPS_PRIVATE(Class)
Declare pointer to private object in a public class.
Definition: bpsglobals.h:102
A class for decimal arithmetics.
Definition: bpsdecimal.h:87
Gauge interface.
Definition: bpsgauge.h:19
Unit
Value unit.
Definition: bpsgauge.h:27
QMap< QString, QString > config() const
void readValueError(const QString &aMessage)
Signal emitted as failure result of a requestReadValue() for all other reasons except timeout.
virtual void requestReadValue(int aTimeout=0)=0
Request the reading of status and value.
void readValueOk(int aStatus, const BpsDecimal &aValue)
Signal emitted as success result of a requestReadValue() call.
virtual Unit unit() const =0
Unit of the values returned.
void setConfig(const QMap< QString, QString > &aConfig)
Set the configuration.
void error(const QString &aMessage)
Combined failure signal from readValueTimeout() and readValueError().
virtual int resolution() const =0
Resolution of the values returned.
BpsGauge(QObject *aParent=0)
virtual ~BpsGauge()
Virtual default destructor.
void readValueTimeout(const QString &aMessage)
Signal emitted as failure result of a requestReadValue() call when nothing was received withing the s...