e32142c Implement cash input interface f611e07 Implement printing ticket 6478eda TS: pr_printTemplate(): send 'longFDcmd_set()' 1663d09 Merge with TS 21.04.23 080c00e Set serialPort name from config bbce2b0 Test printing ticket 8ff17a2 DeviceControllerInterface: erroCode is a string c657428 Project: including DCPlugin.pri globally f0f0493 hwapi: remove unused dependency to QWidget 9bf99c5 Fix: make plugin compile 8ff8faf Fix: warning 09a8049 Merge branch 'master' into pu/integration 21fb07b Merge branch 'master' of git.mimbach49.de:GerhardHoffmann/DCPlugin 01f8c1e First compiling version for high level vending interface 3029b8d Rename TARGET name 2143801 Configure project for PTU5-YOCTO 6f6d3b7 Add atb/qt gitignore 4cfb8f1 Add auto version generation script git-subtree-dir: DCPlugin git-subtree-split: e32142cd6277cf647d27a9c0a2e9e4d7c6ca4269
126 lines
3.1 KiB
C++
126 lines
3.1 KiB
C++
#ifndef ATBDEVICECONTROLLERPLUGIN_H
|
|
#define ATBDEVICECONTROLLERPLUGIN_H
|
|
|
|
#include <QObject>
|
|
|
|
#include "src/ATBAPP/DeviceControllerInterface.h"
|
|
#include "src/ATBAPP/ATBAPPplugin.h"
|
|
#include "version.h"
|
|
|
|
|
|
|
|
#include "hwapi.h"
|
|
|
|
#include <unistd.h>
|
|
#include <thread>
|
|
#include <memory>
|
|
#include <QSharedMemory>
|
|
|
|
|
|
class QTextCodec;
|
|
|
|
|
|
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);
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
void Error(
|
|
const QString & errorCode,
|
|
const QString & errorDescription);
|
|
|
|
|
|
|
|
|
|
private:
|
|
QString errorCode;
|
|
QString errorDescription;
|
|
QString pluginInfo;
|
|
|
|
int currentTemplate;
|
|
|
|
|
|
bool useDebug;
|
|
|
|
PLUGIN_STATE pluginState;
|
|
|
|
QObject* healthEventReceiver;
|
|
|
|
hwinf* hw;
|
|
|
|
QTextCodec *codec;
|
|
|
|
private slots:
|
|
// printer
|
|
|
|
void onPrinterDataPrepared();
|
|
void onPrinterPrintNextTemplate();
|
|
|
|
void onPrintFinishedOK();
|
|
void onPrintFinishedERR();
|
|
|
|
// cash payment
|
|
void onCashGotCoin();
|
|
void onCashVendStopByMax();
|
|
};
|
|
|
|
#endif // ATBDEVICECONTROLLERPLUGIN_H
|