Add first version which at least complies.
This commit is contained in:
147
plugins/CC/CCDummy.cpp
Normal file
147
plugins/CC/CCDummy.cpp
Normal file
@@ -0,0 +1,147 @@
|
||||
#include "CCDummy.h"
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
using namespace nsCCInterface;
|
||||
|
||||
|
||||
const std::string CCInterfacePluginInfoString = R"(
|
||||
{
|
||||
"PluginName": "CCDummy",
|
||||
"Version": "1.0",
|
||||
"git-describe": "",
|
||||
}
|
||||
)";
|
||||
|
||||
|
||||
|
||||
CCDummy::CCDummy(QObject *parent) :
|
||||
QObject(parent),
|
||||
errorCode(1),
|
||||
errorDescription(""),
|
||||
pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
||||
{
|
||||
this->pluginInfo = QString::fromUtf8(CCInterfacePluginInfoString.c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
CCDummy::~CCDummy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
PLUGIN_STATE CCDummy::initCCInterfacePlugin(QObject *healthEventReceiver, const QSettings & settings)
|
||||
{
|
||||
Q_UNUSED(healthEventReceiver)
|
||||
|
||||
qDebug() << "called CCDummy::initCalculatePricePlugin()";
|
||||
qDebug() << " pluginName from setting is: " << settings.value("PLUGINS/CCPlugin", "").toString();
|
||||
|
||||
this->pluginState = PLUGIN_STATE::INITIALIZED;
|
||||
|
||||
return this->pluginState;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CCDummy::requestReset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CCDummy::requestStartTransaction(quint32 amount)
|
||||
{
|
||||
Q_UNUSED(amount)
|
||||
}
|
||||
|
||||
|
||||
void CCDummy::requestCancelTransaction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CCDummy::requestRevertTransaction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CCDummy::requestConfirmTransaction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CCDummy::requestDayClose()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CCDummy::requestCardInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CCDummy::requestPreAuthTransaction(quint32 amount)
|
||||
{
|
||||
Q_UNUSED(amount);
|
||||
}
|
||||
|
||||
void CCDummy::requestCancelPreAuthTransaction(QString & receiptNumber)
|
||||
{
|
||||
Q_UNUSED(receiptNumber);
|
||||
}
|
||||
|
||||
void CCDummy::requestBookTotalTransaction(quint32 amount, QString & receiptNumber)
|
||||
{
|
||||
Q_UNUSED(amount)
|
||||
Q_UNUSED(receiptNumber)
|
||||
}
|
||||
|
||||
void CCDummy::wakeupCC()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CCDummy::sleepCC()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************************************
|
||||
* Mandatory plugin methods
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
PLUGIN_STATE CCDummy::getState()
|
||||
{
|
||||
return this->pluginState;
|
||||
}
|
||||
|
||||
quint32 CCDummy::getLastError()
|
||||
{
|
||||
return this->errorCode;
|
||||
}
|
||||
|
||||
const QString & CCDummy::getLastErrorDescription()
|
||||
{
|
||||
return this->errorDescription;
|
||||
}
|
||||
|
||||
|
||||
const QString & CCDummy::getPluginInfo()
|
||||
{
|
||||
return pluginInfo;
|
||||
}
|
||||
|
||||
|
||||
|
68
plugins/CC/CCDummy.h
Normal file
68
plugins/CC/CCDummy.h
Normal file
@@ -0,0 +1,68 @@
|
||||
#ifndef CCDUMMY_H
|
||||
#define CCDUMMY_H
|
||||
|
||||
|
||||
#include <QObject>
|
||||
#include "CCInterface.h"
|
||||
#include "ATBAPPplugin.h"
|
||||
|
||||
|
||||
class CCDummy : public QObject,
|
||||
public CCInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(ATBAPPplugin)
|
||||
Q_INTERFACES(CCInterface)
|
||||
|
||||
public:
|
||||
CCDummy(QObject *parent = 0);
|
||||
~CCDummy();
|
||||
|
||||
// interface:
|
||||
nsCCInterface::PLUGIN_STATE initCCInterfacePlugin(QObject *healthEventReceiver, const QSettings & settings);
|
||||
|
||||
nsCCInterface::PLUGIN_STATE getState();
|
||||
quint32 getLastError();
|
||||
const QString & getLastErrorDescription();
|
||||
|
||||
// return a plugin description in JSON or XML
|
||||
const QString & getPluginInfo();
|
||||
|
||||
|
||||
public slots:
|
||||
void requestReset();
|
||||
void requestStartTransaction(quint32 amount);
|
||||
void requestCancelTransaction();
|
||||
void requestRevertTransaction();
|
||||
void requestConfirmTransaction();
|
||||
void requestDayClose();
|
||||
void requestCardInfo();
|
||||
void requestPreAuthTransaction(quint32 amount);
|
||||
void requestCancelPreAuthTransaction(QString & receiptNumber);
|
||||
void requestBookTotalTransaction(quint32 amount, QString & receiptNumber);
|
||||
|
||||
void wakeupCC();
|
||||
void sleepCC();
|
||||
|
||||
signals:
|
||||
void sendStartTransactionResult(nsCCInterface::RESULT_STATE resultState, QString & result);
|
||||
void sendCancelTransactionResult(nsCCInterface::RESULT_STATE resultState, QString & result);
|
||||
void sendRevertTransactionResult(nsCCInterface::RESULT_STATE resultState, QString & result);
|
||||
void sendConfirmTransactionResult(nsCCInterface::RESULT_STATE resultState, QString & result);
|
||||
void sendDayCloseResult(nsCCInterface::RESULT_STATE resultState, QString & result);
|
||||
void sendCardInfoResult(nsCCInterface::RESULT_STATE resultState, QString & result);
|
||||
void sendPreAuthTransactionResult(nsCCInterface::RESULT_STATE resultState, QString & result);
|
||||
void sendCancelPreAuthTransactionResult(nsCCInterface::RESULT_STATE resultState, QString & result);
|
||||
void sendBookTotalTransactionResult(nsCCInterface::RESULT_STATE resultState, QString & result);
|
||||
|
||||
private:
|
||||
quint32 errorCode;
|
||||
QString errorCodeString;
|
||||
QString errorDescription;
|
||||
QString pluginInfo;
|
||||
|
||||
nsCCInterface::PLUGIN_STATE pluginState;
|
||||
|
||||
};
|
||||
|
||||
#endif // CCDUMMY_H
|
86
plugins/CC/CCInterface.h
Normal file
86
plugins/CC/CCInterface.h
Normal file
@@ -0,0 +1,86 @@
|
||||
#ifndef CCINTERFACE_H
|
||||
#define CCINTERFACE_H
|
||||
|
||||
#include <QtPlugin>
|
||||
|
||||
#include <QSettings>
|
||||
#include <QString>
|
||||
|
||||
#include "ATBAPPplugin.h"
|
||||
|
||||
|
||||
namespace nsCCInterface {
|
||||
enum class PLUGIN_STATE : quint8;
|
||||
enum class RESULT_STATE : quint8;
|
||||
}
|
||||
|
||||
|
||||
class CCInterface : public ATBAPPplugin
|
||||
{
|
||||
Q_INTERFACES(ATBAPPplugin)
|
||||
|
||||
public:
|
||||
virtual ~CCInterface() {}
|
||||
|
||||
virtual nsCCInterface::PLUGIN_STATE initCCInterfacePlugin(QObject *healthEventReceiver, const QSettings & settings) = 0;
|
||||
|
||||
|
||||
virtual nsCCInterface::PLUGIN_STATE getState() = 0;
|
||||
virtual quint32 getLastError() = 0;
|
||||
virtual const QString & getLastErrorDescription() = 0;
|
||||
|
||||
// return a plugin description in JSON or XML
|
||||
// -> ATBAPPplugin::getPluginInfo()
|
||||
|
||||
public slots:
|
||||
virtual void requestReset() = 0;
|
||||
virtual void requestStartTransaction(quint32 amount) = 0;
|
||||
virtual void requestCancelTransaction() = 0;
|
||||
virtual void requestRevertTransaction() = 0;
|
||||
virtual void requestConfirmTransaction() = 0;
|
||||
virtual void requestDayClose() = 0;
|
||||
virtual void requestCardInfo() = 0;
|
||||
virtual void requestPreAuthTransaction(quint32 amount) = 0;
|
||||
virtual void requestCancelPreAuthTransaction(QString & receiptNumber) = 0;
|
||||
virtual void requestBookTotalTransaction(quint32 amount, QString & receiptNumber) = 0;
|
||||
virtual void wakeupCC() = 0;
|
||||
virtual void sleepCC() = 0;
|
||||
|
||||
signals:
|
||||
virtual void sendStartTransactionResult(nsCCInterface::RESULT_STATE resultState, QString & result) = 0;
|
||||
virtual void sendCancelTransactionResult(nsCCInterface::RESULT_STATE resultState, QString & result) = 0;
|
||||
virtual void sendRevertTransactionResult(nsCCInterface::RESULT_STATE resultState, QString & result) = 0;
|
||||
virtual void sendConfirmTransactionResult(nsCCInterface::RESULT_STATE resultState, QString & result) = 0;
|
||||
virtual void sendDayCloseResult(nsCCInterface::RESULT_STATE resultState, QString & result) = 0;
|
||||
virtual void sendCardInfoResult(nsCCInterface::RESULT_STATE resultState, QString & result) = 0;
|
||||
virtual void sendPreAuthTransactionResult(nsCCInterface::RESULT_STATE resultState, QString & result) = 0;
|
||||
virtual void sendCancelPreAuthTransactionResult(nsCCInterface::RESULT_STATE resultState, QString & result) = 0;
|
||||
virtual void sendBookTotalTransactionResult(nsCCInterface::RESULT_STATE resultState, QString & result) = 0;
|
||||
|
||||
};
|
||||
|
||||
Q_DECLARE_INTERFACE(CCInterface,
|
||||
"eu.atb.ptu.plugin.CCInterface/2.9.1")
|
||||
|
||||
|
||||
namespace nsCCInterface {
|
||||
|
||||
enum class PLUGIN_STATE : quint8 {
|
||||
NOT_INITIALIZED = 0,
|
||||
INITIALIZED = 1
|
||||
};
|
||||
|
||||
enum class RESULT_STATE : quint8 {
|
||||
SUCCESS = 1,
|
||||
ERROR_BACKEND = 2,
|
||||
ERROR_NETWORK = 3,
|
||||
ERROR_TIMEOUT = 4,
|
||||
ERROR_PROCESS = 5,
|
||||
ERROR_BUSY = 6,
|
||||
ERROR_STATE = 7,
|
||||
INFO = 8
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // CCINTERFACE_H
|
Reference in New Issue
Block a user