Documents > BPS V2 C++ API

Labeler interface. More...

#include <bpslabeler.h>

List of all members.

Signals

void error (const QString &aMessage)
 Error signal.
void hideProgress ()
 Emitted after the operation is completed (or failed or was aborted).
void showProgress (int aMaximum, const QString &aLabel)
 Emitted at start of operation to begin showing the progress indicator.
void updateProgressLabel (const QString &aLabel)
 Emitted to update the progress label text.
void updateProgressMaximum (int aMaximum)
 Emitted to change the highest tick value.
void updateProgressValue (int aValue)
 Emitted when progress reaches next value to update the progress indicator.

Public Member Functions

 BpsLabeler (BpsDatastore *aDatastore, const QString &aLabelerId, QObject *aParent=0)
virtual bool canSave ()
 Information if save() and clear() is supported.
virtual bool canStartStop ()
 Information if start() and stop() is supported.
virtual void clear (const QVariant &aCollection, volatile bool *aCancelFlag=0)
 Delete all articles of a collection from the labelers internal database.
void clearCache ()
 Clear the cached global and settings data.
virtual void close (volatile bool *aCancelFlag=0)=0
 Close the device and release it for manual operation.
BpsDatastoredatastore () const
QString labelerId () const
virtual void load (const QVariant &aArticle, const QVariant &aCollection, const QVariantMap &aParams, volatile bool *aCancelFlag=0)=0
 Load an article into the working memory so it is ready to start labeling.
virtual void open (int aLineNo, const QString &aLineName, const QMap< QString, QString > &aConfig, volatile bool *aCancelFlag=0)=0
 Open the device and do general initializations (setting the current date for example).
virtual void processEvents ()
 Process pending events from labeler.
virtual void save (const QVariant &aArticle, const QVariant &aCollection, const QVariantMap &aParams, volatile bool *aCancelFlag=0)
 Save an article to the labelers internal database for emergency or offline operation.
virtual void saveLoad (const QVariant &aArticle, const QVariant &aCollection, const QVariantMap &aParams, volatile bool *aCancelFlag=0)
 Save an article to the labelers internal database, and load it into the working memory so it is ready to start labeling.
void setCustomData (const QString &aSettingsData, const QString &aGlobalData)
 Makes the labeler use custom data instead of the regular data.
virtual void start (volatile bool *aCancelFlag=0)
 Start labeling, if supported by the device.
virtual void stop (volatile bool *aCancelFlag=0)
 Stop labeling, if supported by the device.
virtual ~BpsLabeler ()
 Virtual default destructor.

Protected Member Functions

QString globalData () const
 The global data is independent of the distinct setting.
bool init (const QVariant &aArticle, const QVariant &aCollection, const QVariantMap &aParams)
 Initialize the internal data for processing placeholders.
QString processPlaceholders (const QString &aText)
 Replace the placeholders in the given text.
virtual QString processReplacement (const QString &aText)
 After the substitute content for a placeholder has been created, this method gets called to post-process it.
QString settingsData () const
 The settings data belonging to the latest article init() was called for.

Detailed Description

Labeler interface.


Constructor & Destructor Documentation

BpsLabeler::BpsLabeler ( BpsDatastore aDatastore,
const QString &  aLabelerId,
QObject *  aParent = 0 
)
Parameters:
[in]aDatastoreThe datastore to use.
[in]aLabelerIdThe labeler ID, for example "generic" or "lm2000".
[in]aParentThe parent object.

Member Function Documentation

virtual bool BpsLabeler::canSave ( ) [virtual]

Information if save() and clear() is supported.

The default implementation returns false. Overload this method to return true in case.

Returns:
True if save() and clear() are supported.
virtual bool BpsLabeler::canStartStop ( ) [virtual]

Information if start() and stop() is supported.

The default implementation returns false. Overload this method to return true in case.

Returns:
True if start() and stop() are supported.
virtual void BpsLabeler::clear ( const QVariant &  aCollection,
volatile bool *  aCancelFlag = 0 
) [virtual]

Delete all articles of a collection from the labelers internal database.

The default implementation does nothing.

Parameters:
[in]aCollectionKey of the collection. The collection is used as folder/group/customer in the labelers internal database.
[in]aCancelFlagIf the cancel flag becomes false during operation, the method will throw a BpsException.
Exceptions:
BpsExceptionon 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.

virtual void BpsLabeler::close ( volatile bool *  aCancelFlag = 0) [pure virtual]

Close the device and release it for manual operation.

Parameters:
[in]aCancelFlagIf the cancel flag becomes false during operation, the method will throw a BpsException.
Exceptions:
BpsExceptionon errors or when operation is canceled.
BpsDatastore* BpsLabeler::datastore ( ) const
Returns:
The datastore object.
void BpsLabeler::error ( const QString &  aMessage) [signal]

Error signal.

Parameters:
[in]aMessageThe error message.
QString BpsLabeler::globalData ( ) const [protected]

The global data is independent of the distinct setting.

For performance reasons the global data is cached, however it is possible to force reloading by calling clearCache() in advance.

Returns:
The global data.
Exceptions:
BpsExceptionon errors.
void BpsLabeler::hideProgress ( ) [signal]

Emitted after the operation is completed (or failed or was aborted).

The progress indicator should get hidden.

bool BpsLabeler::init ( const QVariant &  aArticle,
const QVariant &  aCollection,
const QVariantMap &  aParams 
) [protected]

Initialize the internal data for processing placeholders.

Usually this will get called by implementations of load() and save() before replacing the placeholders.

Parameters:
[in]aArticleKey of the article to load.
[in]aCollectionKey of the collection.
[in]aParamsOverride values for the placeholders as key/value pairs. All placeholders except a_barcode may be overridden.
Returns:
True when successfully loaded, false if not labeler settings found.
Exceptions:
BpsExceptionon errors.
QString BpsLabeler::labelerId ( ) const
Returns:
The labeler ID.
virtual void BpsLabeler::load ( const QVariant &  aArticle,
const QVariant &  aCollection,
const QVariantMap &  aParams,
volatile bool *  aCancelFlag = 0 
) [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 will also start the labeling process.

Parameters:
[in]aArticleKey of the article to load.
[in]aCollectionKey of the collection. The collection is used as folder/group/customer in the labelers internal database.
[in]aParamsOverride values for the placeholders as key/value pairs. All placeholders except a_barcode may be overridden.
[in]aCancelFlagIf the cancel flag becomes false during operation, the method will throw a BpsException.
Exceptions:
BpsExceptionon errors or when operation is canceled.
virtual void BpsLabeler::open ( int  aLineNo,
const QString &  aLineName,
const QMap< QString, QString > &  aConfig,
volatile bool *  aCancelFlag = 0 
) [pure virtual]

Open the device and do general initializations (setting the current date for example).

Parameters:
[in]aLineNoThe packing line number, usually the folder Central System Settings/Terminals/TERMINAL/Packlines/LINENO.
[in]aLineNameThe packing line name, usually the value Central System Settings/Terminals/TERMINAL/Packlines/LINENO/Name.
[in]aConfigThe labeler configuration, usually the values in Central System Settings/Terminals/TERMINAL/Packlines/LINENO/Labeler.
[in]aCancelFlagIf the cancel flag becomes false during operation, the method will throw a BpsException.
Exceptions:
BpsExceptionon errors or when operation is canceled.
virtual void BpsLabeler::processEvents ( ) [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.

QString BpsLabeler::processPlaceholders ( const QString &  aText) [protected]

Replace the placeholders in the given text.

Parameters:
[in]aTextThe source text with placeholders to be processed.
Returns:
The text with the placeholders replaced by the final content.
Exceptions:
BpsExceptionon errors.
virtual QString BpsLabeler::processReplacement ( const QString &  aText) [protected, virtual]

After the substitute content for a 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.

Parameters:
[in]aTextThe substitute text that will be used instead of the placeholder.
Returns:
The processed text as it shall be inserted.
virtual void BpsLabeler::save ( const QVariant &  aArticle,
const QVariant &  aCollection,
const QVariantMap &  aParams,
volatile bool *  aCancelFlag = 0 
) [virtual]

Save an article to the labelers internal database for emergency or offline operation.

The default implementation does nothing.

Parameters:
[in]aArticleKey of the article to load.
[in]aCollectionKey of the collection. The collection is used as folder/group/customer in the labelers internal database.
[in]aParamsOverride values for the placeholders as key/value pairs. All placeholders except a_barcode may be overridden.
[in]aCancelFlagIf the cancel flag becomes false during operation, the method will throw a BpsException.
Exceptions:
BpsExceptionon errors or when operation is canceled.
virtual void BpsLabeler::saveLoad ( const QVariant &  aArticle,
const QVariant &  aCollection,
const QVariantMap &  aParams,
volatile bool *  aCancelFlag = 0 
) [virtual]

Save an article to the labelers internal database, and load it into the working memory so it is ready to start labeling.

If the device does not support start/stop labeling, this will also start the labeling process. The default implementation calls load().

Parameters:
[in]aArticleKey of the article to load.
[in]aCollectionKey of the collection. The collection is used as folder/group/customer in the labelers internal database.
[in]aParamsOverride values for the placeholders as key/value pairs. All placeholders except a_barcode may be overridden.
[in]aCancelFlagIf the cancel flag becomes false during operation, the method will throw a BpsException.
Exceptions:
BpsExceptionon errors or when operation is canceled.
void BpsLabeler::setCustomData ( const QString &  aSettingsData,
const QString &  aGlobalData 
)

Makes the labeler use custom data instead of the regular data.

This method is used to test unsaved data in labeler settings application.

Parameters:
[in]aSettingsDataSettings data to be used in place of c_label.c_data.
[in]aGlobalDataGlobal data to be used in place of c_labeler.c_data.
QString BpsLabeler::settingsData ( ) const [protected]

The settings 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.

Returns:
The settings data.
Exceptions:
BpsExceptionon errors.
void BpsLabeler::showProgress ( int  aMaximum,
const QString &  aLabel 
) [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.

Parameters:
[in]aMaximumHighest tick value, usually the number of processed items.
[in]aLabelLabel to display in the progress indicator. Use QString() to display no label.
virtual void BpsLabeler::start ( volatile bool *  aCancelFlag = 0) [virtual]

Start labeling, if supported by the device.

The default implementation does nothing.

Parameters:
[in]aCancelFlagIf the cancel flag becomes false during operation, the method will throw a BpsException.
Exceptions:
BpsExceptionon errors or when operation is canceled.
virtual void BpsLabeler::stop ( volatile bool *  aCancelFlag = 0) [virtual]

Stop labeling, if supported by the device.

The default implementation does nothing.

Parameters:
[in]aCancelFlagIf the cancel flag becomes false during operation, the method will throw a BpsException.
Exceptions:
BpsExceptionon errors or when operation is canceled.
void BpsLabeler::updateProgressLabel ( const QString &  aLabel) [signal]

Emitted to update the progress label text.

Parameters:
[in]aLabelNew label text to display in the progress indicator.
void BpsLabeler::updateProgressMaximum ( int  aMaximum) [signal]

Emitted to change the highest tick value.

Parameters:
[in]aMaximumHighest tick value, usually the number of processed items.
void BpsLabeler::updateProgressValue ( int  aValue) [signal]

Emitted when progress reaches next value to update the progress indicator.

Parameters:
[in]aValueThe value tick reached in the range 1...aMaximum, see showProgress().

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