108 lines
2.9 KiB
C
108 lines
2.9 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>
|
||
|
|
||
|
|
||
|
|
||
|
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();
|
||
|
quint32 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:
|
||
|
quint32 errorCode;
|
||
|
QString errorCodeString;
|
||
|
QString errorDescription;
|
||
|
QString pluginInfo;
|
||
|
|
||
|
bool useDebug;
|
||
|
|
||
|
PLUGIN_STATE pluginState;
|
||
|
|
||
|
QObject* healthEventReceiver;
|
||
|
|
||
|
hwinf* hw;
|
||
|
|
||
|
};
|
||
|
|
||
|
#endif // ATBDEVICECONTROLLERPLUGIN_H
|