Labeler interface. More...
#include <bpslabeler.h>
Public Types | |
enum | { DataPackage , DataSum1 , DataSum2 , DataSumJob } |
Data type identifiers. More... | |
enum | Entity { Collection , All } |
Clearing entities. More... | |
enum | Feature { CanPrint , CanSave , CanStartStop , CanClearCollection , CanClearAll , CanEmitDataPackage , CanEmitDataSum1 , CanEmitDataSum2 , CanEmitDataSumJob } |
Feature identifiers. More... | |
Signals | |
void | dataReceived (int aDataType, const QVariant &aCount, const QVariant &aWeight, const QVariant &aPrice) |
Emitted when data is received from labeler. More... | |
void | error (const QString &aMessage) |
Emitted for fatal messages, for example failed operations. More... | |
void | hideProgress () |
Emitted after the operation is completed (or failed or was aborted). More... | |
void | info (const QString &aMessage) |
Emitted for informational messages. More... | |
void | showProgress (int aMaximum, const QString &aLabel) |
Emitted at start of operation to begin showing the progress indicator. More... | |
void | updateProgressLabel (const QString &aLabel) |
Emitted to update the progress label text. More... | |
void | updateProgressMaximum (int aMaximum) |
Emitted to change the highest tick value. More... | |
void | updateProgressValue (int aValue) |
Emitted when progress reaches next value to update the progress indicator. More... | |
void | warning (const QString &aMessage) |
Emitted for non-fatal messages, for example reception of unexpected records. More... | |
Public Member Functions | |
BpsLabeler (BpsDatastore *aDatastore, const QString &aLabelerId, QObject *aParent=0) | |
virtual void | clear (Entity aEntity, const QVariant &aKey, volatile bool *aCancelFlag=nullptr) |
Delete articles from the labelers internal database. More... | |
void | clearCache () |
Clear the cached global and settings data. More... | |
virtual void | close (volatile bool *aCancelFlag=nullptr)=0 |
Close the device and release it for manual operation. More... | |
virtual void | control (int aOp, const QVariantMap &aInput, QVariantMap &aOutput, volatile bool *aCancelFlag=nullptr) |
Execute labeler specific operations. More... | |
BpsDatastore * | datastore () const |
virtual bool | hasFeature (Feature aFeature) |
Query information about available features. More... | |
virtual bool | isOpen () const =0 |
virtual bool | isStarted () const |
Get the start/stop status. More... | |
QString | labelerId () const |
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. More... | |
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). More... | |
virtual void | print (volatile bool *aCancelFlag=nullptr) |
Print a single label with the article previously loaded into the working memory. More... | |
virtual void | processEvents () |
Process pending events from labeler. More... | |
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. More... | |
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 database. More... | |
void | setCustomData (const QString &aSettingsData, const QString &aGlobalData) |
Makes the labeler use custom data instead of the regular data. More... | |
virtual void | start (volatile bool *aCancelFlag=nullptr) |
Start labeling, if supported by the device. More... | |
virtual void | stop (volatile bool *aCancelFlag=nullptr) |
Stop labeling, if supported by the device. More... | |
virtual | ~BpsLabeler () |
Virtual default destructor. | |
![]() | |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () |
void | dumpObjectInfo () const const |
void | dumpObjectTree () |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_DISABLE_COPY (Class) | |
Q_DISABLE_COPY_MOVE (Class) | |
Q_DISABLE_MOVE (Class) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
QObject (QObject *parent) | |
T | qobject_cast (const QObject *object) |
T | qobject_cast (QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
QThread * | thread () const const |
Protected Member Functions | |
virtual int | checkReplacement (const QString &aText, const QVariant &aCheckInfo) |
Function called by processPlaceholdes() before any character is added to the produced text. More... | |
bool | init (const QVariant &aArticle, const QVariantMap &aParams, const QString &aType=QString()) |
Initialize the internal data for processing placeholders. More... | |
QString | labelData () const |
The label data belonging to the latest article init() was called for. More... | |
QString | labelerData () const |
The labeler data is independent of the distinct setting and taken from table t_labelers. More... | |
QVariant | labelerKey () const |
The labeler key from t_labelers. More... | |
QVariant | labelKey () const |
The label key from t_labels belonging to the latest article init() was called for. More... | |
QString | processPlaceholders (const QString &aText, const QVariant &aCheckInfo=QVariant()) |
Replace the placeholders in the given text. More... | |
virtual QString | processReplacement (const QString &aText) |
After the substitute content for a single placeholder has been created, this method gets called to post-process it. More... | |
![]() | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Additional Inherited Members | |
![]() | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
![]() | |
typedef | QObjectList |
![]() | |
objectName | |
Labeler interface.
anonymous enum |
enum BpsLabeler::Entity |
enum BpsLabeler::Feature |
Feature identifiers.
Enumerator | |
---|---|
CanPrint | Supports print(). |
CanSave | Supports save(). |
CanStartStop | |
CanClearCollection | Supports clearing the articles of a collection. |
CanClearAll | Supports clearing all stored articles. |
CanEmitDataPackage | Can emit single package records. |
CanEmitDataSum1 | Can emit sum 1 records. |
CanEmitDataSum2 | Can emit sum 2 records. |
CanEmitDataSumJob | Can emit job sum records. |
BpsLabeler::BpsLabeler | ( | BpsDatastore * | aDatastore, |
const QString & | aLabelerId, | ||
QObject * | aParent = 0 |
||
) |
aDatastore | The datastore to use. |
aLabelerId | The labeler ID, for example "generic" or "lm2000". |
aParent | The parent object. |
|
protectedvirtual |
Function called by processPlaceholdes() before any character is added to the produced text.
A typical use is to limit line lengths when proportional fonts are used. The default implementation always returns 0.
aText | The text how it would be after adding the character. Lines breaks are represented by a newline character. |
aCheckInfo | The check info passed into processPlaceholders(). |
|
virtual |
Delete articles from the labelers internal database.
The default implementation does nothing.
aEntity | The entity to clear. |
aKey | The collection key when aEntity is BpsLabeler::Collection. Unused when aEntity is BpsLabeler::All. |
aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
BpsException | on errors or when operation is canceled. |
void BpsLabeler::clearCache | ( | ) |
Clear the cached global and settings data.
Any previous setCustomData() action is reverted and regular data gets used again.
|
pure virtual |
Close the device and release it for manual operation.
aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
BpsException | on errors or when operation is canceled. |
|
virtual |
Execute labeler specific operations.
See documentation of the respective labeler interfaces for details. The default implementation does noting.
aOp | Operation command. |
aInput | Input data. |
aOutput | Output data. |
aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
BpsException | on errors or when operation is canceled. |
|
signal |
Emitted when data is received from labeler.
aDataType | Type of the received data. |
aCount | Number of packages (BpsDecimal when known, invalid when unknown). |
aWeight | Weight in kilo (BpsDecimal when known, invalid when unknown). |
aPrice | Price (BpsDecimal when known, invalid when unknown). |
BpsDatastore* BpsLabeler::datastore | ( | ) | const |
|
signal |
Emitted for fatal messages, for example failed operations.
aMessage | The message. |
|
virtual |
Query information about available features.
The default implementation returns false for any feature. Overload this method to return true in case.
aFeature | The feature to check. |
|
signal |
Emitted after the operation is completed (or failed or was aborted).
The progress indicator should get hidden.
|
signal |
Emitted for informational messages.
aMessage | The message. |
|
protected |
Initialize the internal data for processing placeholders.
Usually this will get called by implementations of load() and save() before replacing the placeholders.
aArticle | Key of the article to load. |
aParams | Override values for the placeholders as key/value pairs. All placeholders except a_barcode may be overridden. |
aType | Sub-type name for generic labelers. |
BpsException | on errors. |
|
pure virtual |
|
virtual |
Get the start/stop status.
The default implementation returns true if labeler is open and false if not open.
|
protected |
The label data belonging to the latest article init() was called for.
For performance reasons the settings data of formerly loaded articles are cached, however it is possible to force reloading by calling clearCache() in advance.
BpsException | on errors. |
|
protected |
The labeler data is independent of the distinct setting and taken from table t_labelers.
For performance reasons the labeler data is cached, however it is possible to force reloading by calling clearCache() in advance.
BpsException | on errors. |
QString BpsLabeler::labelerId | ( | ) | const |
|
protected |
|
protected |
The label key from t_labels belonging to the latest article init() was called for.
|
pure virtual |
Load an article into the working memory so it is ready to start labeling.
If the device does not support start/stop labeling, this may also start the labeling process.
aArticle | Key of the article to load. |
aParams | Override values for the placeholders as key/value pairs. All placeholders except a_barcode may be overridden. |
aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
BpsException | on errors or when operation is canceled. |
|
pure virtual |
Open the device and do general initializations (setting the current date for example).
aLineNo | The packing line number, usually the folder Central System Settings/Terminals/TERMINAL/Packlines/LINENO. |
aLineName | The packing line name, usually the value Central System Settings/Terminals/TERMINAL/Packlines/LINENO/Name. |
aConfig | The labeler configuration, usually the values in Central System Settings/Terminals/TERMINAL/Packlines/LINENO/Labeler. |
aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
BpsException | on errors or when operation is canceled. |
|
virtual |
Print a single label with the article previously loaded into the working memory.
Overload this method for non-automatic labelers such as plain printers, where the label print is triggered by an external signal. The default implementation does nothing.
aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
BpsException | on errors or when operation is canceled. |
|
virtual |
Process pending events from labeler.
This might be called by the labeling process by timer in intervals, or at idle times. In case of errors, the signal error() will be emitted.
|
protected |
Replace the placeholders in the given text.
aText | The source text with placeholders to be processed. |
aCheckInfo | When a valid value is given, checkReplacement() is called while processing. |
BpsException | on errors. |
After the substitute content for a single placeholder has been created, this method gets called to post-process it.
The default implementation returns the text unmodified. Re-implement this method to escape certain characters for example. If you need to post-process the whole text, instead of single placeholder substitutes, operate on the text returned by processPlaceholders() instead.
aText | The substitute text that will be used instead of the placeholder. |
|
virtual |
Save an article to the labelers internal database for emergency or offline operation.
The default implementation does nothing.
aArticle | Key of the article to load. |
aParams | Override values for the placeholders as key/value pairs. All placeholders except a_barcode may be overridden. |
aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
BpsException | on errors or when operation is canceled. |
|
virtual |
Load an article into the working memory and conditionally also save it to the labelers internal database.
Saving to the database happens conditionally depending on the labeler setting "Savemode". If the device does not support start/stop labeling, this may also start the labeling process. The default implementation calls load().
aArticle | Key of the article to load. |
aParams | Override values for the placeholders as key/value pairs. All placeholders except a_barcode may be overridden. |
aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
BpsException | on errors or when operation is canceled. |
Makes the labeler use custom data instead of the regular data.
This method is used to test unsaved data in labeler settings application.
aSettingsData | Settings data to be used in place of c_label.c_data. |
aGlobalData | Global data to be used in place of c_labeler.c_data. |
|
signal |
Emitted at start of operation to begin showing the progress indicator.
The indicator should have value ticks from 0 to aMaximum, and be set initially to 0.
aMaximum | Highest tick value, usually the number of processed items. |
aLabel | Label to display in the progress indicator. Use QString() to display no label. |
|
virtual |
Start labeling, if supported by the device.
The default implementation does nothing.
aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
BpsException | on errors or when operation is canceled. |
|
virtual |
Stop labeling, if supported by the device.
The default implementation does nothing.
aCancelFlag | If the cancel flag becomes false during operation, the method will throw a BpsException. |
BpsException | on errors or when operation is canceled. |
|
signal |
Emitted to update the progress label text.
aLabel | New label text to display in the progress indicator. |
|
signal |
Emitted to change the highest tick value.
aMaximum | Highest tick value, usually the number of processed items. |
|
signal |
Emitted when progress reaches next value to update the progress indicator.
aValue | The value tick reached in the range 1...aMaximum, see showProgress(). |
|
signal |
Emitted for non-fatal messages, for example reception of unexpected records.
aMessage | The message. |