2023-04-19 16:26:12 +02:00
|
|
|
#ifndef ATBDEVICECONTROLLERPLUGIN_H
|
|
|
|
#define ATBDEVICECONTROLLERPLUGIN_H
|
|
|
|
|
|
|
|
#include <QObject>
|
2023-12-01 15:07:29 +01:00
|
|
|
#include <QLocale>
|
2023-04-19 16:26:12 +02:00
|
|
|
|
|
|
|
#include "src/ATBAPP/DeviceControllerInterface.h"
|
|
|
|
#include "src/ATBAPP/ATBAPPplugin.h"
|
2023-06-22 08:44:16 +02:00
|
|
|
#include "src/ATBAPP/DeviceControllerDiag.h"
|
|
|
|
|
2023-04-19 16:26:12 +02:00
|
|
|
#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>
|
|
|
|
|
|
|
|
|
2023-07-20 08:15:03 +02:00
|
|
|
class DBusControllerInterface;
|
2023-05-04 13:21:14 +02:00
|
|
|
class QTextCodec;
|
|
|
|
|
2023-04-19 16:26:12 +02:00
|
|
|
|
|
|
|
using namespace nsDeviceControllerInterface;
|
|
|
|
|
|
|
|
class QSettings;
|
|
|
|
|
2023-06-20 13:11:40 +02:00
|
|
|
class ATBDeviceControllerPlugin :
|
2023-04-19 16:26:12 +02:00
|
|
|
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:
|
2023-06-22 08:50:10 +02:00
|
|
|
PLUGIN_STATE initDCPlugin(QObject *eventReceiver, const QSettings & settings);
|
2023-04-19 16:26:12 +02:00
|
|
|
|
|
|
|
// TASKS: Cash handling -------------------------------------------------------
|
|
|
|
void requestStartCashInput(const QString & amount);
|
|
|
|
void requestStopCashInput();
|
|
|
|
void cashCollect();
|
|
|
|
void cashAbort();
|
|
|
|
|
2023-11-23 17:58:36 +01:00
|
|
|
// read coin/cash processing variants -----------------------------------------
|
|
|
|
nsDeviceControllerInterface::COIN_PROCESSOR coinProcessor();
|
|
|
|
nsDeviceControllerInterface::BILL_ACCEPTOR billAcceptor();
|
|
|
|
|
2023-04-19 16:26:12 +02:00
|
|
|
// TASKS: printing ------------------------------------------------------------
|
|
|
|
void requestPrintTicket(const QHash<QString, QVariant> & printingData);
|
2023-06-26 19:47:01 +02:00
|
|
|
void requestPrintTicket(nsDeviceControllerInterface::TICKET_VARIANT ticketVariant, const QHash<QString, QVariant> & printingData);
|
|
|
|
void requestPrintReceipt(const QHash<QString, QVariant> & printingData);
|
2023-08-07 17:38:29 +02:00
|
|
|
void requestPrintReceipt(const QString & printingString);
|
2023-04-19 16:26:12 +02:00
|
|
|
|
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
|
2023-06-12 08:31:17 +02:00
|
|
|
const QString getString(nsDeviceControllerInterface::RESULT_STATE resultState);;
|
|
|
|
|
|
|
|
public slots:
|
2023-06-13 17:00:17 +02:00
|
|
|
void onChangedProgramModeToSELL();
|
|
|
|
void onChangedProgramModeToSERVICE();
|
|
|
|
void onChangedProgramModeToIDLE();
|
|
|
|
void onChangedProgramModeToOOO();
|
2023-04-19 16:26:12 +02:00
|
|
|
|
2023-06-30 10:40:14 +02:00
|
|
|
void startPhysicalLayer();
|
|
|
|
void stopPhysicalLayer();
|
2023-07-05 12:44:45 +02:00
|
|
|
void reboot();
|
2023-07-05 10:22:41 +02:00
|
|
|
void reset();
|
2023-04-19 16:26:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
signals:
|
2023-07-05 18:47:45 +02:00
|
|
|
// public Signals are defined in interface
|
2023-04-19 16:26:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
private:
|
2023-05-02 17:07:48 +02:00
|
|
|
QString errorCode;
|
2023-04-19 16:26:12 +02:00
|
|
|
QString errorDescription;
|
|
|
|
QString pluginInfo;
|
|
|
|
|
2023-06-26 19:47:01 +02:00
|
|
|
QList<int> templateList;
|
2023-05-04 13:21:14 +02:00
|
|
|
|
2023-06-30 10:39:24 +02:00
|
|
|
QString serialPortName;
|
2023-05-04 13:21:14 +02:00
|
|
|
|
2023-04-19 16:26:12 +02:00
|
|
|
bool useDebug;
|
|
|
|
|
2023-11-21 11:21:28 +01:00
|
|
|
bool isMaster;
|
|
|
|
|
2023-04-19 16:26:12 +02:00
|
|
|
PLUGIN_STATE pluginState;
|
|
|
|
|
2023-06-21 10:55:12 +02:00
|
|
|
QObject* eventReceiver;
|
2023-04-19 16:26:12 +02:00
|
|
|
|
2023-07-20 08:15:03 +02:00
|
|
|
DBusControllerInterface* dbus;
|
|
|
|
|
2023-04-19 16:26:12 +02:00
|
|
|
hwinf* hw;
|
|
|
|
|
2023-06-22 08:44:16 +02:00
|
|
|
DeviceControllerDiag* diag;
|
|
|
|
|
2023-11-30 18:16:45 +01:00
|
|
|
uint32_t cashStartAmountInt;
|
|
|
|
|
2023-06-22 08:44:16 +02:00
|
|
|
|
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-06-09 11:18:39 +02:00
|
|
|
quint8 currentSelectedTicketType;
|
|
|
|
|
2023-06-16 15:50:25 +02:00
|
|
|
nsDeviceControllerInterface::CASH_STATE currentCashState;
|
|
|
|
|
2023-06-19 16:26:33 +02:00
|
|
|
// counts failed hw->log_chkIfVaultRecordAvailable()
|
|
|
|
int accountCheckCounter;
|
|
|
|
|
2023-07-20 08:15:03 +02:00
|
|
|
// dbus
|
|
|
|
int init_sc_dbus();
|
2023-06-19 16:26:33 +02:00
|
|
|
|
2023-12-01 15:07:29 +01:00
|
|
|
QLocale printerLocale;
|
|
|
|
|
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-06-26 19:47:01 +02:00
|
|
|
void onPrinterDataPreparedForTemplates();
|
2023-05-04 13:21:14 +02:00
|
|
|
void onPrinterPrintNextTemplate();
|
2023-08-07 17:38:29 +02:00
|
|
|
void onPrinterWaitForPrintingTicket();
|
|
|
|
void onPrinterWaitForPrintingReceipt();
|
2023-05-04 13:21:14 +02:00
|
|
|
|
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-06-15 18:49:13 +02:00
|
|
|
void onCashPayStopedSuccess();
|
2023-05-22 11:20:28 +02:00
|
|
|
void onCashPayStopByMax();
|
2023-11-23 17:59:49 +01:00
|
|
|
void onCashPayStopByPushbutton();
|
2023-05-22 11:20:28 +02:00
|
|
|
void onCashPayStopByEscrow();
|
|
|
|
void onCashPayStopByError();
|
|
|
|
void onCashPayStopByTimeout();
|
2023-06-13 17:00:17 +02:00
|
|
|
|
|
|
|
// doors and hardware contacts
|
|
|
|
void onServiceDoorOpened();
|
|
|
|
void onVaultDoorOpened();
|
|
|
|
void onCoinBoxRemoved();
|
|
|
|
void onCoinBoxInserted();
|
|
|
|
void onAllDoorsClosed();
|
2023-06-20 13:23:36 +02:00
|
|
|
void onCBinAndAllDoorsClosed();
|
2023-06-19 16:26:33 +02:00
|
|
|
|
|
|
|
// account handling
|
|
|
|
void private_startAccount();
|
|
|
|
void private_checkAccountData();
|
|
|
|
void private_getAccountData();
|
2023-07-05 18:47:45 +02:00
|
|
|
|
|
|
|
// measurement values
|
|
|
|
void onNewVoltage(uint32_t voltage);
|
2023-07-25 12:56:15 +02:00
|
|
|
|
|
|
|
void onWokeUp(uchar source);
|
2023-04-19 16:26:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ATBDEVICECONTROLLERPLUGIN_H
|