2023-04-19 16:26:12 +02:00
|
|
|
#ifndef ATBDEVICECONTROLLERPLUGIN_H
|
|
|
|
#define ATBDEVICECONTROLLERPLUGIN_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
#include "src/ATBAPP/DeviceControllerInterface.h"
|
|
|
|
#include "src/ATBAPP/ATBAPPplugin.h"
|
|
|
|
#include "version.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-05 12:49:20 +02:00
|
|
|
#include "interfaces.h"
|
2023-04-19 16:26:12 +02:00
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <thread>
|
|
|
|
#include <memory>
|
|
|
|
#include <QSharedMemory>
|
|
|
|
|
|
|
|
|
2023-05-04 13:21:14 +02:00
|
|
|
class QTextCodec;
|
|
|
|
|
2023-04-19 16:26:12 +02:00
|
|
|
|
|
|
|
using namespace nsDeviceControllerInterface;
|
|
|
|
|
|
|
|
class QSettings;
|
|
|
|
|
|
|
|
class ATBDeviceControllerPlugin : public QObject,
|
|
|
|
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 *healthEventReceiver, 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);
|
|
|
|
|
2023-06-01 16:30:50 +02:00
|
|
|
// TASKS: Account -------------------------------------------------------------
|
|
|
|
void requestAccount();
|
|
|
|
|
2023-04-19 16:26:12 +02:00
|
|
|
// mandantory ATBAPP plugin methods: ------------------------------------------
|
|
|
|
nsDeviceControllerInterface::PLUGIN_STATE getState();
|
2023-05-02 17:07:48 +02:00
|
|
|
QString & getLastError();
|
2023-04-19 16:26:12 +02:00
|
|
|
const QString & getLastErrorDescription();
|
|
|
|
|
|
|
|
const QString & getPluginInfo();
|
|
|
|
|
|
|
|
// helpers e.g. for debug / log
|
|
|
|
const QString getString(nsDeviceControllerInterface::RESULT_STATE resultState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void printTicketFinished(nsDeviceControllerInterface::RESULT_STATE resultState,
|
|
|
|
const QString & errorCode,
|
|
|
|
const QString & errorDescription);
|
|
|
|
|
|
|
|
void cashInputEvent(nsDeviceControllerInterface::RESULT_STATE resultState,
|
|
|
|
nsDeviceControllerInterface::CASH_STATE cashState,
|
|
|
|
const QString & newCashValue,
|
|
|
|
const QString & errorCode,
|
|
|
|
const QString & errorDescription);
|
|
|
|
|
|
|
|
void cashInputFinished(nsDeviceControllerInterface::RESULT_STATE resultState,
|
|
|
|
const QString & newCashValue,
|
|
|
|
const QString & errorCode,
|
|
|
|
const QString & errorDescription);
|
|
|
|
|
|
|
|
void requestServiceMode();
|
|
|
|
|
2023-06-01 16:30:50 +02:00
|
|
|
void requestAccountResponse(const QHash<QString, QVariant> & accountData);
|
|
|
|
|
|
|
|
|
2023-04-19 16:26:12 +02:00
|
|
|
void Error(
|
|
|
|
const QString & errorCode,
|
|
|
|
const QString & errorDescription);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
2023-05-02 17:07:48 +02:00
|
|
|
QString errorCode;
|
2023-04-19 16:26:12 +02:00
|
|
|
QString errorDescription;
|
|
|
|
QString pluginInfo;
|
|
|
|
|
2023-05-04 13:21:14 +02:00
|
|
|
int currentTemplate;
|
|
|
|
|
|
|
|
|
2023-04-19 16:26:12 +02:00
|
|
|
bool useDebug;
|
|
|
|
|
|
|
|
PLUGIN_STATE pluginState;
|
|
|
|
|
|
|
|
QObject* healthEventReceiver;
|
|
|
|
|
|
|
|
hwinf* hw;
|
|
|
|
|
2023-05-04 13:21:14 +02:00
|
|
|
QTextCodec *codec;
|
2023-05-02 17:10:17 +02:00
|
|
|
|
2023-06-05 12:49:20 +02:00
|
|
|
bool private_loadCashAgentLib(QString pluginName);
|
|
|
|
|
2023-05-02 17:10:17 +02:00
|
|
|
private slots:
|
2023-05-04 13:21:14 +02:00
|
|
|
// printer
|
|
|
|
|
2023-05-03 11:56:36 +02:00
|
|
|
void onPrinterDataPrepared();
|
2023-05-04 13:21:14 +02:00
|
|
|
void onPrinterPrintNextTemplate();
|
|
|
|
|
2023-05-02 17:10:17 +02:00
|
|
|
void onPrintFinishedOK();
|
|
|
|
void onPrintFinishedERR();
|
2023-05-04 13:21:14 +02:00
|
|
|
|
|
|
|
// cash payment
|
2023-05-04 14:28:38 +02:00
|
|
|
void onCashGotCoin();
|
2023-05-22 11:20:28 +02:00
|
|
|
void onCashPayStopByMax();
|
|
|
|
void onCashPayStopByEscrow();
|
|
|
|
void onCashPayStopByError();
|
|
|
|
void onCashPayStopByTimeout();
|
2023-04-19 16:26:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ATBDEVICECONTROLLERPLUGIN_H
|