DCPlugin/src/ATBAPP/ATBDeviceControllerPlugin.h
Siegfried Siegert a4d74ed0f7
Update printing ticket (version 2.1)
Use hwapi::prn_getPrintResult() to detect print result.
2023-06-22 12:14:55 +02:00

144 lines
3.2 KiB
C++

#ifndef ATBDEVICECONTROLLERPLUGIN_H
#define ATBDEVICECONTROLLERPLUGIN_H
#include <QObject>
#include "src/ATBAPP/DeviceControllerInterface.h"
#include "src/ATBAPP/ATBAPPplugin.h"
#include "src/ATBAPP/DeviceControllerDiag.h"
#include "version.h"
#include "interfaces.h"
#include <unistd.h>
class QTextCodec;
using namespace nsDeviceControllerInterface;
class QSettings;
class ATBDeviceControllerPlugin :
public DeviceControllerInterface
{
Q_OBJECT
Q_INTERFACES(ATBAPPplugin)
Q_INTERFACES(DeviceControllerInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA( IID "ATBDeviceControllerPlugin" )
#endif
public:
explicit ATBDeviceControllerPlugin(QObject *parent = nullptr);
~ATBDeviceControllerPlugin();
// ----------------------------------------------------------------------------
// interface:
PLUGIN_STATE initDCPlugin(QObject *eventReceiver, const QSettings & settings);
// TASKS: Cash handling -------------------------------------------------------
void requestStartCashInput(const QString & amount);
void requestStopCashInput();
void cashCollect();
void cashAbort();
// TASKS: printing ------------------------------------------------------------
void requestPrintTicket(const QHash<QString, QVariant> & printingData);
// TASKS: Account -------------------------------------------------------------
void requestAccount();
// mandantory ATBAPP plugin methods: ------------------------------------------
nsDeviceControllerInterface::PLUGIN_STATE getState();
QString & getLastError();
const QString & getLastErrorDescription();
const QString & getPluginInfo();
// helpers e.g. for debug / log
const QString getString(nsDeviceControllerInterface::RESULT_STATE resultState);;
public slots:
void onChangedProgramModeToSELL();
void onChangedProgramModeToSERVICE();
void onChangedProgramModeToIDLE();
void onChangedProgramModeToOOO();
signals:
private:
QString errorCode;
QString errorDescription;
QString pluginInfo;
int currentTemplate;
bool useDebug;
PLUGIN_STATE pluginState;
QObject* eventReceiver;
hwinf* hw;
DeviceControllerDiag* diag;
QTextCodec *codec;
bool private_loadCashAgentLib(QString pluginName);
quint8 currentSelectedTicketType;
nsDeviceControllerInterface::CASH_STATE currentCashState;
// counts failed hw->log_chkIfVaultRecordAvailable()
int accountCheckCounter;
private slots:
// printer
void onPrinterDataPrepared();
void onPrinterPrintNextTemplate();
void onPrinterWaitForPrinting();
void onPrintFinishedOK();
void onPrintFinishedERR();
// cash payment
void onCashGotCoin();
void onCashPayStopedSuccess();
void onCashPayStopByMax();
void onCashPayStopByEscrow();
void onCashPayStopByError();
void onCashPayStopByTimeout();
// doors and hardware contacts
void onServiceDoorOpened();
void onVaultDoorOpened();
void onCoinBoxRemoved();
void onCoinBoxInserted();
void onAllDoorsClosed();
void onCBinAndAllDoorsClosed();
// account handling
void private_startAccount();
void private_checkAccountData();
void private_getAccountData();
};
#endif // ATBDEVICECONTROLLERPLUGIN_H