BPS C++ API  2.24.4
bpsscales.h
Go to the documentation of this file.
1 
4 #ifndef BPSSCALES_H
5 #define BPSSCALES_H
6 
7 #include "bpsdecimal.h"
8 #include <QMap>
9 #include <QObject>
10 
19 {
20  Q_OBJECT
22 
23 public:
27  enum {
28  StatusStable = 0, // The weight was successfully read and is stable.
29  StatusDynamic = 1, // The weight was successfully read but is dynamic (moving).
30  StatusOverload = 2, // The scales is overloaded (above valid maximum weight).
31  StatusUnderload = 3, // The scales is underloaded (below valid minimum weight).
32  StatusError = 4 // The scales is in error state (but still can communicate with host obviously).
33  };
34 
38  BpsScales(QObject* aParent=0);
39 
43  virtual ~BpsScales();
44 
50  void setConfig(const QMap<QString,QString>& aConfig);
51 
57 
64  virtual bool canTare() const;
65 
69  virtual void requestReadWeight() = 0;
70 
74  virtual void requestReadTare();
75 
79  virtual void requestTakeTare();
80 
84  virtual void requestClearTare();
85 
86 signals:
87 
94  void readWeightOk(int aStatus, const BpsDecimal& aWeight, bool aTared);
95 
100  void readWeightError(const QString& aMessage);
101 
106  void readTareOk(const BpsDecimal& aTare);
107 
112  void readTareError(const QString& aMessage);
113 
117  void takeTareOk();
118 
123  void takeTareError(const QString& aMessage);
124 
128  void clearTareOk();
129 
134  void clearTareError(const QString& aMessage);
135 
139  void ok();
140 
145  void error(const QString& aMessage);
146 
147 };
148 
149 #endif // BPSSCALES_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
Scales interface.
Definition: bpsscales.h:19
void clearTareOk()
Signal emitted as success result of a requestClearTare() call.
void readTareOk(const BpsDecimal &aTare)
Signal emitted as success result of a requestReadWeight() call.
void readWeightError(const QString &aMessage)
Signal emitted as failure result of a requestReadWeight() call.
virtual ~BpsScales()
Virtual default destructor.
void setConfig(const QMap< QString, QString > &aConfig)
Set the scales configuration.
QMap< QString, QString > config() const
void readWeightOk(int aStatus, const BpsDecimal &aWeight, bool aTared)
Signal emitted as success result of a requestReadWeight() call.
virtual void requestClearTare()
Request clearing of the tare, going back to gross weight.
void takeTareError(const QString &aMessage)
Signal emitted as failure result of a requestTakeTare() call.
BpsScales(QObject *aParent=0)
void readTareError(const QString &aMessage)
Signal emitted as failure result of a requestReadTare() call.
void error(const QString &aMessage)
Combined failure signal from readWeightError(), readTareError(), takeTareError() and clearTareError()...
virtual void requestReadTare()
Request reading of the current tare status and weight.
virtual void requestReadWeight()=0
Request the reading of a scales status and weight.
virtual bool canTare() const
Information if requestReadTare(), requestTakeTare() and requestClearTare() are supported.
void clearTareError(const QString &aMessage)
Signal emitted as failure result of a requestClearTare() call.
void ok()
Combined success signal from readWeightOk(), readTareOk(), takeTareOk() and clearTareOk().
virtual void requestTakeTare()
Request taring of the current stable weight, going to net weight.
void takeTareOk()
Signal emitted as success result of a requestTakeTare() call.