DCPlugin/src/ATBAPP/ATBDeviceControllerPlugin.h

193 lines
5.1 KiB
C
Raw Normal View History

#ifndef ATBDEVICECONTROLLERPLUGIN_H
#define ATBDEVICECONTROLLERPLUGIN_H
#include <QObject>
2023-12-01 15:07:29 +01:00
#include <QLocale>
#include "src/ATBAPP/DeviceControllerInterface.h"
#include "src/ATBAPP/ATBAPPplugin.h"
#include "src/ATBAPP/DeviceControllerDiag.h"
#include "src/ATBAPP/support/Ticket.h"
#include "version.h"
#include "support/PersistentData.h"
2024-01-31 13:42:51 +01:00
#include <DeviceController/interfaces.h>
#include <unistd.h>
class DBusControllerInterface;
2023-05-04 13:21:14 +02:00
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:
2023-06-22 08:50:10 +02:00
PLUGIN_STATE initDCPlugin(QObject *eventReceiver, const QSettings & settings);
void sendDeviceParameter(const QJsonObject & jsonObject);
// TASKS: Cash handling -------------------------------------------------------
void requestStartCashInput(const QString & amount);
void requestStopCashInput();
void cashCollect();
void cashAbort();
// read coin/cash processing variants -----------------------------------------
nsDeviceControllerInterface::COIN_PROCESSOR coinProcessor();
nsDeviceControllerInterface::BILL_ACCEPTOR billAcceptor();
// TASKS: printing ------------------------------------------------------------
void requestPrintTicket(const QHash<QString, QVariant> & printingData);
void requestPrintTicket(nsDeviceControllerInterface::TICKET_VARIANT ticketVariant, const QHash<QString, QVariant> & printingData);
void requestPrintReceipt(const QHash<QString, QVariant> & printingData);
void requestPrintReceipt(const QString & printingString);
2023-06-01 16:30:50 +02:00
// 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
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();
void startPhysicalLayer();
void stopPhysicalLayer();
2023-07-05 12:44:45 +02:00
void reboot();
2023-07-05 10:22:41 +02:00
void reset();
signals:
2023-07-05 18:47:45 +02:00
// public Signals are defined in interface
private:
QString errorCode;
QString errorDescription;
QString pluginInfo;
2023-06-30 10:39:24 +02:00
QString serialPortName;
2023-05-04 13:21:14 +02:00
bool useDebug;
2023-11-21 11:21:28 +01:00
bool isMaster;
PLUGIN_STATE pluginState;
2023-06-21 10:55:12 +02:00
QObject* eventReceiver;
DBusControllerInterface* dbus;
hwinf* hw;
DeviceControllerDiag* diag;
PersistentData *persistentData;
uint32_t cashStartAmountInt;
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);
quint8 currentSelectedTicketType;
nsDeviceControllerInterface::CASH_STATE currentCashState;
// counts failed hw->log_chkIfVaultRecordAvailable()
int accountCheckCounter;
// counts faild hw->prn-getPrintResult()
int printResultCheckCounter;
// dbus
int init_sc_dbus();
// printer privates ----------------------------------------------------------------------------
Ticket * currentTicket;
2023-12-01 15:07:29 +01:00
QLocale printerLocale;
void prepareDynTemplateData();
void private_setupDynTemplateData_START_RECEIPT(struct T_dynDat *dynTicketData, Ticket *ticket);
void private_setupDynTemplatData_STOP_RECEIPT(struct T_dynDat *dynTicketData, Ticket *ticket);
void private_setupDynTemplatData_FOOD_STAMP(struct T_dynDat *dynTicketData, Ticket *ticket);
// ---------------------------------------------------------------------------------------------
2023-12-01 15:07:29 +01:00
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();
void onPrinterDataPreparedForTemplates();
2023-05-04 13:21:14 +02:00
void onPrinterPrintNextTemplate();
void onPrinterWaitForPrintingTicket();
void onPrinterWaitForPrintingReceipt();
2023-05-04 13:21:14 +02:00
void onPrinterPrepareDynTemplateData();
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();
void onCashPayStopByPushbutton();
2023-05-22 11:20:28 +02:00
void onCashPayStopByEscrow();
void onCashPayStopByError();
void onCashPayStopByTimeout();
void onCashChangerState();
2023-06-13 17:00:17 +02:00
// 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();
2023-07-05 18:47:45 +02:00
// measurement values
void onNewVoltage(uint32_t voltage);
void onWokeUp(uchar source);
};
#endif // ATBDEVICECONTROLLERPLUGIN_H