Documents > BPS V2 C++ API
BpsRobots Class Reference

BpsRobots class. More...

#include <bpsrobots.h>

List of all members.

Signals

void hideProgress ()
 Emitted after the operation is completed (or failed or was aborted).
void itemRejected (const QVariant &aKey)
 Emitted when a item was rejected by robot or because of data constraints.
void itemSynced (const QVariant &aKey)
 Emitted when a item was successfully synced, e.g.
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

void addRobotsToTrip (const QVariant &aOrdertrip)
 Add robot status records for all zones having a robot to a trip.
bool anyRobots () const
 BpsRobots (BpsDatastore *aDatastore, const QString &aProgram, QObject *aParent=0)
BpsDatastoredatastore () const
void lockRobot (const QVariant &aZone, volatile bool *aCancelFlag=0)
 Lock the zone for exclusive robot access.
void revokeOrders (const QVariant &aZone, BpsRobot::OrderType aOrderType, const QVariantList &aKeys, volatile bool *aCancelFlag=0)
 Revoke orders from the robot.
void syncOrders (const QVariant &aZone, BpsRobot::OrderType aOrderType, const QVariantList &aKeys, BpsRobot::OrderSyncMode aSyncMode, volatile bool *aCancelFlag=0)
 Synchronize orders to the robot.
void syncStock (const QVariant &aZone, volatile bool *aCancelFlag=0)
 Import all robot stocks into the BPS stock.
void unlockRobot (const QVariant &aZone)
 Unlock the zone, in case it was locked by the current actor.
QVariantList zones () const
QList< qlonglong > zonesAsLongLong () const
QList< qulonglong > zonesAsULongLong () const

Detailed Description

BpsRobots class.


Constructor & Destructor Documentation

BpsRobots::BpsRobots ( BpsDatastore aDatastore,
const QString &  aProgram,
QObject *  aParent = 0 
)
Parameters:
[in]aDatastoreThe datastore object to use
[in]aProgramName of the program, to be used in license tokens.
[in]aParentThe parent object

Member Function Documentation

void BpsRobots::addRobotsToTrip ( const QVariant &  aOrdertrip)

Add robot status records for all zones having a robot to a trip.

Parameters:
[in]aOrdertripThe key of the order trip to send.
Exceptions:
BpsExceptionthrown on database errors.
bool BpsRobots::anyRobots ( ) const
Returns:
True if there are any robots.
BpsDatastore* BpsRobots::datastore ( ) const
Returns:
The datastore object.
void BpsRobots::hideProgress ( ) [signal]

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

The progress indicator should get hidden.

void BpsRobots::itemRejected ( const QVariant &  aKey) [signal]

Emitted when a item was rejected by robot or because of data constraints.

Parameters:
[in]aKeyKey of the order item.
void BpsRobots::itemSynced ( const QVariant &  aKey) [signal]

Emitted when a item was successfully synced, e.g.

accepted by robot.

Parameters:
[in]aKeyKey of the order item.
void BpsRobots::lockRobot ( const QVariant &  aZone,
volatile bool *  aCancelFlag = 0 
)

Lock the zone for exclusive robot access.

Parameters:
[in]aZoneKey of the zone.
[in]aCancelFlagIt the cancel flag becomes false during operation, lockRobot will stop and throw a BpsException.
Exceptions:
BpsExceptionthrown on SQL errors.
void BpsRobots::revokeOrders ( const QVariant &  aZone,
BpsRobot::OrderType  aOrderType,
const QVariantList &  aKeys,
volatile bool *  aCancelFlag = 0 
)

Revoke orders from the robot.

The method tries to revoke as many items as possible as long as no fatal error or cancel happens, and only throws an exception about the robot unable to revoke certain items at the end.

  • When revoking of an item succeeds, the robot status of the item is deleted.
  • When revoking of any items is rejected or aborted, the robot status of the affected items remain unchanged.

In case of aborting (cancel or fatal error) in a critical communication phase, the status BPS knows about the robot may be inaccurate and have to be cleared manually by the user. The message of the thrown exception will in such a case include information about that fact.

Parameters:
[in]aZoneKey of the zone.
[in]aOrderTypeType of the records addressed by aKeys.
[in]aKeysList of keys to process.
[in]aCancelFlagIt the cancel flag becomes false during operation, revokeOrders will stop and throw a BpsException.
Exceptions:
BpsExceptionthrown when revoking the trip failed or was aborted.
void BpsRobots::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.
void BpsRobots::syncOrders ( const QVariant &  aZone,
BpsRobot::OrderType  aOrderType,
const QVariantList &  aKeys,
BpsRobot::OrderSyncMode  aSyncMode,
volatile bool *  aCancelFlag = 0 
)

Synchronize orders to the robot.

The method tries to synchronize as many items as possible as long as no fatal error or abort happens, and only throws an exception about rejects at the end.

  • When sending of a yet unsent order item is rejected, the order item remains unchanged.
  • When sending updates for a item is rejected, the item is reverted to the known robot status.
  • When sending is aborted, fails fatal or items are locked, the order items remain unchanged.

In case of aborting (cancel or fatal error) in a critical communication phase, the status BPS knows about the robot may be inaccurate and have to be cleared manually by the user. The message of the thrown exception will in such a case include information about that fact.

Parameters:
[in]aZoneKey of the zone.
[in]aOrderTypeType of the records addressed by aKeys.
[in]aKeysList of keys to process.
[in]aSyncModeSynchronizing mode.
[in]aCancelFlagIf the cancel flag becomes false during operation, syncOrders will stop and throw a BpsException.
Exceptions:
BpsExceptionthrown when sending the trip failed or was aborted.
void BpsRobots::syncStock ( const QVariant &  aZone,
volatile bool *  aCancelFlag = 0 
)

Import all robot stocks into the BPS stock.

Parameters:
[in]aZoneKey of the zone.
[in]aCancelFlagIt the cancel flag becomes false during operation, syncStock will stop and throw a BpsException.
Exceptions:
BpsExceptionthrown when querying the stock levels failed or was aborted.
void BpsRobots::unlockRobot ( const QVariant &  aZone)

Unlock the zone, in case it was locked by the current actor.

Parameters:
[in]aZoneKey of the zone.
Exceptions:
BpsExceptionthrown on SQL errors.
void BpsRobots::updateProgressLabel ( const QString &  aLabel) [signal]

Emitted to update the progress label text.

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

Emitted to change the highest tick value.

Parameters:
[in]aMaximumHighest tick value, usually the number of processed items.
void BpsRobots::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().
QVariantList BpsRobots::zones ( ) const
Returns:
List of zones with active robots.
QList<qlonglong> BpsRobots::zonesAsLongLong ( ) const
Returns:
Zones with active robots, as list of qlonglong.
QList<qulonglong> BpsRobots::zonesAsULongLong ( ) const
Returns:
Zones with active robots, as list of qulonglong.

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