BPS C++ API  2.24.4
bpslabeler.h
Go to the documentation of this file.
1 
4 #ifndef BPSLABELER_H
5 #define BPSLABELER_H
6 
7 #include "bpscore_global.h"
8 #include <QObject>
9 #include <QVariantMap>
10 
11 class BpsDatastore;
12 
17 {
18  Q_OBJECT
20 
21 public:
25  enum {
29  DataSumJob
30  };
31 
35  enum Feature {
44  CanEmitDataSumJob
45  };
46 
50  enum Entity {
52  All
53  };
54 
60  BpsLabeler(BpsDatastore* aDatastore, const QString& aLabelerId, QObject* aParent=0);
61 
65  virtual ~BpsLabeler();
66 
74  virtual bool hasFeature(Feature aFeature);
75 
80 
84  QString labelerId() const;
85 
92  void setCustomData(const QString& aSettingsData, const QString& aGlobalData);
93 
98  void clearCache();
99 
103  virtual bool isOpen() const = 0;
104 
110  virtual bool isStarted() const;
111 
120  virtual void open(int aLineNo, const QString& aLineName, const QMap<QString,QString>& aConfig, volatile bool* aCancelFlag = nullptr) = 0;
121 
127  virtual void close(volatile bool* aCancelFlag = nullptr) = 0;
128 
137  virtual void load(const QVariant& aArticle, const QVariantMap& aParams, volatile bool* aCancelFlag = nullptr) = 0;
138 
147  virtual void save(const QVariant& aArticle, const QVariantMap& aParams, volatile bool* aCancelFlag = nullptr);
148 
159  virtual void saveLoad(const QVariant& aArticle, const QVariantMap& aParams, volatile bool* aCancelFlag = nullptr);
160 
168  virtual void print(volatile bool* aCancelFlag = nullptr);
169 
178  virtual void clear(Entity aEntity, const QVariant& aKey, volatile bool* aCancelFlag = nullptr);
179 
186  virtual void start(volatile bool* aCancelFlag = nullptr);
187 
194  virtual void stop(volatile bool* aCancelFlag = nullptr);
195 
206  virtual void control(int aOp, const QVariantMap& aInput, QVariantMap& aOutput, volatile bool* aCancelFlag = nullptr);
207 
213  virtual void processEvents();
214 
215 signals:
216 
223  void showProgress(int aMaximum, const QString& aLabel);
224 
229  void updateProgressMaximum(int aMaximum);
230 
235  void updateProgressValue(int aValue);
236 
241  void updateProgressLabel(const QString& aLabel);
242 
247  void hideProgress();
248 
253  void error(const QString& aMessage);
254 
259  void warning(const QString& aMessage);
260 
265  void info(const QString& aMessage);
266 
274  void dataReceived(int aDataType, const QVariant& aCount, const QVariant& aWeight, const QVariant& aPrice);
275 
276 
277 protected:
278 
288  bool init(const QVariant& aArticle, const QVariantMap& aParams, const QString& aType = QString());
289 
300 
307 
318 
325 
333  QString processPlaceholders(const QString& aText, const QVariant& aCheckInfo = QVariant());
334 
343  virtual int checkReplacement(const QString& aText, const QVariant& aCheckInfo);
344 
353  virtual QString processReplacement(const QString& aText);
354 };
355 
356 #endif // BPSLABELER_H
Public include file for BPS CORE library macros.
#define BPSCORE_EXPORT
Declare class to be an import from the shared library.
Definition: bpscore_global.h:22
#define BPS_PRIVATE(Class)
Declare pointer to private object in a public class.
Definition: bpsglobals.h:102
BPS datastore class.
Definition: bpsdatastore.h:61
Labeler interface.
Definition: bpslabeler.h:17
void dataReceived(int aDataType, const QVariant &aCount, const QVariant &aWeight, const QVariant &aPrice)
Emitted when data is received from labeler.
void updateProgressLabel(const QString &aLabel)
Emitted to update the progress label text.
QString processPlaceholders(const QString &aText, const QVariant &aCheckInfo=QVariant())
Replace the placeholders in the given text.
virtual void print(volatile bool *aCancelFlag=nullptr)
Print a single label with the article previously loaded into the working memory.
BpsLabeler(BpsDatastore *aDatastore, const QString &aLabelerId, QObject *aParent=0)
virtual void saveLoad(const QVariant &aArticle, const QVariantMap &aParams, volatile bool *aCancelFlag=nullptr)
Load an article into the working memory and conditionally also save it to the labelers internal datab...
virtual QString processReplacement(const QString &aText)
After the substitute content for a single placeholder has been created, this method gets called to po...
void clearCache()
Clear the cached global and settings data.
Entity
Clearing entities.
Definition: bpslabeler.h:50
@ Collection
Clear articles of a collection (by given collection).
Definition: bpslabeler.h:51
virtual ~BpsLabeler()
Virtual default destructor.
virtual bool isOpen() const =0
void error(const QString &aMessage)
Emitted for fatal messages, for example failed operations.
QString labelData() const
The label data belonging to the latest article init() was called for.
virtual void control(int aOp, const QVariantMap &aInput, QVariantMap &aOutput, volatile bool *aCancelFlag=nullptr)
Execute labeler specific operations.
BpsDatastore * datastore() const
virtual void open(int aLineNo, const QString &aLineName, const QMap< QString, QString > &aConfig, volatile bool *aCancelFlag=nullptr)=0
Open the device and do general initializations (setting the current date for example).
virtual void save(const QVariant &aArticle, const QVariantMap &aParams, volatile bool *aCancelFlag=nullptr)
Save an article to the labelers internal database for emergency or offline operation.
void updateProgressValue(int aValue)
Emitted when progress reaches next value to update the progress indicator.
virtual void load(const QVariant &aArticle, const QVariantMap &aParams, volatile bool *aCancelFlag=nullptr)=0
Load an article into the working memory so it is ready to start labeling.
void showProgress(int aMaximum, const QString &aLabel)
Emitted at start of operation to begin showing the progress indicator.
virtual bool hasFeature(Feature aFeature)
Query information about available features.
Feature
Feature identifiers.
Definition: bpslabeler.h:35
@ CanPrint
Supports print().
Definition: bpslabeler.h:36
@ CanStartStop
Supports start() and stop().
Definition: bpslabeler.h:38
@ CanEmitDataSum1
Can emit sum 1 records.
Definition: bpslabeler.h:42
@ CanClearCollection
Supports clearing the articles of a collection.
Definition: bpslabeler.h:39
@ CanClearAll
Supports clearing all stored articles.
Definition: bpslabeler.h:40
@ CanEmitDataPackage
Can emit single package records.
Definition: bpslabeler.h:41
@ CanEmitDataSum2
Can emit sum 2 records.
Definition: bpslabeler.h:43
@ CanSave
Supports save().
Definition: bpslabeler.h:37
QString labelerId() const
QString labelerData() const
The labeler data is independent of the distinct setting and taken from table t_labelers.
QVariant labelerKey() const
The labeler key from t_labelers.
@ DataSum1
Sum 1 (TU)
Definition: bpslabeler.h:27
@ DataSum2
Sum 2 (LU)
Definition: bpslabeler.h:28
@ DataPackage
Single package.
Definition: bpslabeler.h:26
bool init(const QVariant &aArticle, const QVariantMap &aParams, const QString &aType=QString())
Initialize the internal data for processing placeholders.
virtual void stop(volatile bool *aCancelFlag=nullptr)
Stop labeling, if supported by the device.
virtual void close(volatile bool *aCancelFlag=nullptr)=0
Close the device and release it for manual operation.
void hideProgress()
Emitted after the operation is completed (or failed or was aborted).
virtual void start(volatile bool *aCancelFlag=nullptr)
Start labeling, if supported by the device.
void warning(const QString &aMessage)
Emitted for non-fatal messages, for example reception of unexpected records.
virtual int checkReplacement(const QString &aText, const QVariant &aCheckInfo)
Function called by processPlaceholdes() before any character is added to the produced text.
void setCustomData(const QString &aSettingsData, const QString &aGlobalData)
Makes the labeler use custom data instead of the regular data.
void updateProgressMaximum(int aMaximum)
Emitted to change the highest tick value.
virtual bool isStarted() const
Get the start/stop status.
QVariant labelKey() const
The label key from t_labels belonging to the latest article init() was called for.
virtual void processEvents()
Process pending events from labeler.
virtual void clear(Entity aEntity, const QVariant &aKey, volatile bool *aCancelFlag=nullptr)
Delete articles from the labelers internal database.
void info(const QString &aMessage)
Emitted for informational messages.