Compare commits
13 Commits
94b51b5794
...
master
Author | SHA1 | Date | |
---|---|---|---|
4b38e2e46e | |||
9fa37d125d | |||
00dbf4485a | |||
88670c1079 | |||
2efdbe2d68 | |||
38994ac192 | |||
f6238e5a36 | |||
f0762e272f | |||
46ab0ec80f | |||
1d8eb2a808 | |||
22fb039172 | |||
cf8dd83a48 | |||
1a08f8ee3a |
@@ -5,21 +5,66 @@
|
||||
* a simple class with only one method for plugin info
|
||||
*/
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
class ATBAPPplugin
|
||||
{
|
||||
class UnifiedDCVMCInterface;
|
||||
|
||||
public:
|
||||
explicit ATBAPPplugin() = default;
|
||||
virtual ~ATBAPPplugin() = default;
|
||||
template <typename T>
|
||||
struct ATBAPPplugin {
|
||||
enum class PLUGIN_STATE : quint8 {
|
||||
NOT_INITIALIZED = 0,
|
||||
INITIALIZED = 1
|
||||
};
|
||||
enum class RESULT_STATE : quint8 {
|
||||
SUCCESS = 1, // operation was successfull
|
||||
ERROR_BACKEND, // error from backend (e.g. backend replies with error)
|
||||
ERROR_NETWORK,
|
||||
ERROR_TIMEOUT, // the operation timed out
|
||||
ERROR_PROCESS, // internal plugin error, should not occur (this is a bug in implementation)
|
||||
ERROR_BUSY,
|
||||
ERROR_STATE,
|
||||
ERROR_RETRY, // retry operation
|
||||
INFO // informational (e.g. display a message, log something etc.)
|
||||
};
|
||||
enum class CASH_STATE : quint8 {
|
||||
CACHE_EMPTY, // Cache still empty, default state
|
||||
CACHE_INPUT, // Coins are in Cache
|
||||
OVERPAYED,
|
||||
/* t.b.d. */
|
||||
};
|
||||
enum class TICKET_VARIANT : quint8 {
|
||||
PARKING_TICKET,
|
||||
RECEIPT,
|
||||
ERROR_RECEIPT,
|
||||
START_RECEIPT, // e.g. Szeged Start
|
||||
STOP_RECEIPT, // e.g. Szeged Stop
|
||||
};
|
||||
enum class STEP : quint8 {
|
||||
UP = 1,
|
||||
DOWN = 2
|
||||
};
|
||||
enum class TERMINAL_STATE : quint8 {
|
||||
NOT_AVAILABLE = 1,
|
||||
AVAILABLE,
|
||||
PREPARED_FOR_VENDING,
|
||||
BUSY,
|
||||
NEEDS_MAINTENANCE
|
||||
};
|
||||
|
||||
virtual const QString & getPluginInfo() = 0;
|
||||
virtual const QString &getPluginInfo() = 0;
|
||||
virtual QStringList getPluginInfoList() {
|
||||
return QStringList(QString());
|
||||
}
|
||||
};
|
||||
|
||||
Q_DECLARE_INTERFACE(ATBAPPplugin,
|
||||
"eu.atb.ptu.plugin.ATBAPPplugin/0.9")
|
||||
|
||||
using PLUGIN_STATE = ATBAPPplugin<UnifiedDCVMCInterface>::PLUGIN_STATE;
|
||||
using RESULT_STATE = ATBAPPplugin<UnifiedDCVMCInterface>::RESULT_STATE;
|
||||
using CASH_STATE = ATBAPPplugin<UnifiedDCVMCInterface>::CASH_STATE;
|
||||
using TICKET_VARIANT = ATBAPPplugin<UnifiedDCVMCInterface>::TICKET_VARIANT;
|
||||
using STEP = ATBAPPplugin<UnifiedDCVMCInterface>::STEP;
|
||||
using TERMINAL_STATE = ATBAPPplugin<UnifiedDCVMCInterface>::TERMINAL_STATE;
|
||||
|
||||
//Q_DECLARE_INTERFACE(ATBAPPplugin,
|
||||
// "eu.atb.ptu.plugin.ATBAPPplugin/0.9")
|
||||
|
||||
#endif // ATBAPPPLUGIN_H
|
||||
|
@@ -17,21 +17,20 @@ ATBVMCPlugin::ATBVMCPlugin(QObject *parent)
|
||||
: VMCInterface(parent)
|
||||
, m_errorCode("")
|
||||
, m_errorDescription("")
|
||||
, m_pluginInfo("")
|
||||
, m_serialPortName("")
|
||||
, m_useDebug(false)
|
||||
, m_pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
||||
, m_vmc(nullptr) {
|
||||
|
||||
QStringList lst;
|
||||
lst << QString(" Interface: ") + INTERFACE;
|
||||
lst << QString("Interface Version: ") + INTERFACE_VERSION;
|
||||
lst << QString(" PluginName: ") + PLUGIN_NAME;
|
||||
lst << QString(" Version: ") + PLUGIN_VERSION;
|
||||
lst << QString(" git-describe: ") + PLUGIN_GIT_DESCRIBE;
|
||||
lst << QString(" Extended version: ") + PLUGIN_EXTENDED_VERSION;
|
||||
m_pluginInfoList.clear();
|
||||
m_pluginInfoList << QString(" Interface: ") + INTERFACE;
|
||||
m_pluginInfoList << QString("Interface Version: ") + INTERFACE_VERSION;
|
||||
m_pluginInfoList << QString(" PluginName: ") + PLUGIN_NAME;
|
||||
m_pluginInfoList << QString(" Version: ") + PLUGIN_VERSION;
|
||||
m_pluginInfoList << QString(" git-describe: ") + PLUGIN_GIT_DESCRIBE;
|
||||
m_pluginInfoList << QString(" Extended version: ") + PLUGIN_EXTENDED_VERSION;
|
||||
|
||||
m_pluginInfo = lst.join('\n');
|
||||
m_pluginInfo = m_pluginInfoList.join('\n');
|
||||
}
|
||||
|
||||
ATBVMCPlugin::~ATBVMCPlugin() {
|
||||
@@ -41,12 +40,34 @@ ATBVMCPlugin::~ATBVMCPlugin() {
|
||||
}
|
||||
}
|
||||
|
||||
QStringList ATBVMCPlugin::getPluginInfoList() {
|
||||
return m_pluginInfoList;
|
||||
}
|
||||
|
||||
QString const &ATBVMCPlugin::getPluginInfo() {
|
||||
return m_pluginInfo;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// interface:
|
||||
PLUGIN_STATE ATBVMCPlugin::initDCPlugin(QObject *eventReceiver, const QSettings & settings) {
|
||||
Q_UNUSED(eventReceiver);
|
||||
Q_UNUSED(settings);
|
||||
|
||||
return PLUGIN_STATE::NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
PLUGIN_STATE ATBVMCPlugin::initPlugin(QObject *eventReceiver, QObject *atbSystem, QObject *hmiConfig, QSettings const &settings) {
|
||||
return initVMCPlugin(eventReceiver, atbSystem, hmiConfig, settings);
|
||||
}
|
||||
|
||||
PLUGIN_STATE ATBVMCPlugin::initPlugin(QObject *eventReceiver, QSettings const &settings) {
|
||||
Q_UNUSED(eventReceiver);
|
||||
Q_UNUSED(settings);
|
||||
|
||||
return PLUGIN_STATE::NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
PLUGIN_STATE ATBVMCPlugin::initVMCPlugin(QObject *appControl,
|
||||
QObject *atbSystem,
|
||||
QObject *hmiConfig,
|
||||
@@ -70,6 +91,8 @@ PLUGIN_STATE ATBVMCPlugin::initVMCPlugin(QObject *appControl,
|
||||
connect(m_vmc, SIGNAL(setMachineNr(QString)), hmiConfig, SLOT(setMachineNr(QString)), Qt::QueuedConnection);
|
||||
connect(m_vmc, SIGNAL(setDefaultLanguage(quint8)), hmiConfig, SLOT(setDefaultLanguage(quint8)), Qt::QueuedConnection);
|
||||
|
||||
connect(m_vmc, SIGNAL(wakeVMC()), m_vmc, SLOT(onWakeVMC()), Qt::QueuedConnection);
|
||||
|
||||
return PLUGIN_STATE::INITIALIZED;
|
||||
}
|
||||
|
||||
@@ -81,22 +104,51 @@ PLUGIN_STATE ATBVMCPlugin::getState() {
|
||||
return m_pluginState;
|
||||
}
|
||||
|
||||
QString ATBVMCPlugin::getLastError() {
|
||||
QString const &ATBVMCPlugin::getLastError() {
|
||||
return m_errorCode;
|
||||
}
|
||||
|
||||
QString ATBVMCPlugin::getLastErrorDescription() {
|
||||
QString const &ATBVMCPlugin::getLastErrorDescription() {
|
||||
return m_errorDescription;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
// helpers e.g. for debug / log
|
||||
QString ATBVMCPlugin::getString(RESULT_STATE /*resultState*/) {
|
||||
return "";
|
||||
QString const &ATBVMCPlugin::getString(RESULT_STATE resultState) {
|
||||
static QString str;
|
||||
|
||||
switch (resultState) {
|
||||
case RESULT_STATE::SUCCESS:
|
||||
str = QString("RESULT_STATE::SUCCESS");
|
||||
break;
|
||||
case RESULT_STATE::ERROR_BACKEND:
|
||||
str = QString("RESULT_STATE::ERROR_BACKEND");
|
||||
break;
|
||||
case RESULT_STATE::ERROR_TIMEOUT:
|
||||
str = QString("RESULT_STATE::ERROR_TIMEOUT");
|
||||
break;
|
||||
case RESULT_STATE::ERROR_PROCESS:
|
||||
str = QString("RESULT_STATE::ERROR_PROCESS");
|
||||
break;
|
||||
case RESULT_STATE::ERROR_RETRY:
|
||||
str = QString("RESULT_STATE::ERROR_RETRY");
|
||||
break;
|
||||
case RESULT_STATE::INFO:
|
||||
str = QString("RESULT_STATE::INFO");
|
||||
break;
|
||||
case RESULT_STATE::ERROR_NETWORK:
|
||||
str = QString("RESULT_STATE::ERROR_NETWORK");
|
||||
break;
|
||||
case RESULT_STATE::ERROR_BUSY:
|
||||
str = QString("RESULT_STATE::ERROR_BUSY");
|
||||
break;
|
||||
case RESULT_STATE::ERROR_STATE:
|
||||
str = QString("RESULT_STATE::ERROR_STATE");
|
||||
break;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
void ATBVMCPlugin::onChangedProgramModeToSELL() {
|
||||
|
||||
}
|
||||
@@ -129,7 +181,18 @@ void ATBVMCPlugin::reset() {
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
QStringList ATBVMCPlugin::interfaces() const {
|
||||
QStringList result;
|
||||
int const count = this->metaObject()->classInfoCount();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
QString const name(QString::fromLatin1(this->metaObject()->classInfo(i).name()));
|
||||
QString const value(QString::fromLatin1(this->metaObject()->classInfo(i).value()));
|
||||
if (name == "Interface") {
|
||||
result << value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
Q_EXPORT_PLUGIN2(ATBVMCPlugin, ATBVMCPlugin)
|
||||
|
@@ -15,6 +15,7 @@ class ATBVMCPlugin : public VMCInterface {
|
||||
Q_OBJECT
|
||||
|
||||
Q_INTERFACES(VMCInterface)
|
||||
Q_CLASSINFO("Interface", "VMCInterface")
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
Q_PLUGIN_METADATA(IID "eu.atb.ptu.plugin.ATBVMCPlugin")
|
||||
@@ -24,24 +25,25 @@ public:
|
||||
explicit ATBVMCPlugin(QObject *parent = nullptr);
|
||||
virtual ~ATBVMCPlugin();
|
||||
|
||||
virtual const QString & getPluginInfo() override;
|
||||
virtual QStringList getPluginInfoList() override;
|
||||
virtual const QString &getPluginInfo() override;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// interface:
|
||||
virtual PLUGIN_STATE initVMCPlugin(QObject *eventReceiver,
|
||||
QObject *atbSystem,
|
||||
QObject *hmiConfig,
|
||||
QSettings const &settings) override;
|
||||
virtual PLUGIN_STATE initPlugin(QObject *eventReceiver, QObject *atbSystem, QObject *hmiConfig, QSettings const &settings) override;
|
||||
virtual PLUGIN_STATE initPlugin(QObject *eventReceiver, QSettings const &settings) override;
|
||||
virtual PLUGIN_STATE initDCPlugin(QObject *eventReceiver, const QSettings & settings) override;
|
||||
virtual PLUGIN_STATE initVMCPlugin(QObject *eventReceiver, QObject *atbSystem, QObject *hmiConfig, QSettings const &settings) override;
|
||||
|
||||
// mandantory ATBAPP plugin methods: ------------------------------------------
|
||||
PLUGIN_STATE getState() override;
|
||||
QString getLastError() override;
|
||||
QString getLastErrorDescription() override;
|
||||
|
||||
#if 0
|
||||
QString const &getLastError() override;
|
||||
QString const &getLastErrorDescription() override;
|
||||
|
||||
// helpers e.g. for debug / log
|
||||
virtual QString getString(RESULT_STATE resultState) override;
|
||||
virtual QString const &getString(RESULT_STATE resultState) override;
|
||||
|
||||
QStringList interfaces() const;
|
||||
|
||||
public slots:
|
||||
virtual void onChangedProgramModeToSELL() override;
|
||||
@@ -54,11 +56,10 @@ public slots:
|
||||
virtual void reboot() override;
|
||||
virtual void reset() override;
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
QString m_errorCode;
|
||||
QString m_errorDescription;
|
||||
QStringList m_pluginInfoList;
|
||||
QString m_pluginInfo;
|
||||
QString m_serialPortName;
|
||||
bool m_useDebug;
|
||||
|
@@ -12,60 +12,40 @@
|
||||
#include "ATBAPPplugin.h"
|
||||
|
||||
|
||||
class UnifiedDCVMCInterface : public ATBAPPplugin {
|
||||
Q_INTERFACES(ATBAPPplugin)
|
||||
class UnifiedDCVMCInterface : public ATBAPPplugin<UnifiedDCVMCInterface> {
|
||||
//Q_INTERFACES(ATBAPPplugin)
|
||||
//Q_CLASSINFO("Interface", "ATBAPPplugin")
|
||||
|
||||
public:
|
||||
enum class PLUGIN_STATE : quint8 {
|
||||
NOT_INITIALIZED = 0,
|
||||
INITIALIZED = 1
|
||||
};
|
||||
enum class RESULT_STATE : quint8 {
|
||||
SUCCESS = 1, // operation was successfull
|
||||
ERROR_BACKEND, // error from backend (e.g. backend replies with error)
|
||||
ERROR_TIMEOUT, // the operation timed out
|
||||
ERROR_PROCESS, // internal plugin error, should not occur (this is a bug in implementation)
|
||||
ERROR_RETRY, // retry operation
|
||||
INFO // informational (e.g. display a message, log something etc.)
|
||||
};
|
||||
enum class CASH_STATE : quint8 {
|
||||
CACHE_EMPTY, // Cache still empty, default state
|
||||
CACHE_INPUT, // Coins are in Cache
|
||||
OVERPAYED,
|
||||
/* t.b.d. */
|
||||
};
|
||||
enum class TICKET_VARIANT : quint8 {
|
||||
PARKING_TICKET,
|
||||
RECEIPT,
|
||||
ERROR_RECEIPT,
|
||||
START_RECEIPT, // e.g. Szeged Start
|
||||
STOP_RECEIPT, // e.g. Szeged Stop
|
||||
};
|
||||
|
||||
explicit UnifiedDCVMCInterface() = default;
|
||||
virtual ~UnifiedDCVMCInterface() = default;
|
||||
|
||||
virtual const QString & getPluginInfo() = 0;
|
||||
virtual QStringList getPluginInfoList() = 0;
|
||||
virtual const QString &getPluginInfo() = 0;
|
||||
|
||||
// mandantory ATBAPP plugin methods:
|
||||
virtual PLUGIN_STATE getState() = 0;
|
||||
virtual QString getLastError() = 0;
|
||||
virtual QString getLastErrorDescription() = 0;
|
||||
virtual QString const &getLastError() = 0;
|
||||
virtual QString const &getLastErrorDescription() = 0;
|
||||
|
||||
virtual PLUGIN_STATE initPlugin(QObject *eventReceiver,
|
||||
QObject *atbSystem,
|
||||
QObject *hmiConfig,
|
||||
QSettings const &settings) = 0;
|
||||
|
||||
virtual PLUGIN_STATE initPlugin(QObject *eventReceiver, QSettings const &settings) = 0;
|
||||
|
||||
virtual PLUGIN_STATE initDCPlugin(QObject *eventReceiver,
|
||||
const QSettings & settings) = 0;
|
||||
|
||||
virtual PLUGIN_STATE initVMCPlugin(QObject *eventReceiver,
|
||||
QObject *atbSystem, QObject *hmiConfig,
|
||||
QObject *atbSystem, QObject *hmiConfig,
|
||||
const QSettings & settings) = 0;
|
||||
|
||||
#if 0
|
||||
|
||||
virtual QString getString(RESULT_STATE resultState) = 0;
|
||||
virtual QString const &getString(RESULT_STATE resultState) = 0;
|
||||
|
||||
public slots:
|
||||
//public slots:
|
||||
virtual void onChangedProgramModeToSELL() = 0;
|
||||
virtual void onChangedProgramModeToSERVICE() = 0;
|
||||
virtual void onChangedProgramModeToIDLE() = 0;
|
||||
@@ -75,79 +55,9 @@ public slots:
|
||||
virtual void stopPhysicalLayer() = 0;
|
||||
virtual void reboot() = 0;
|
||||
virtual void reset() = 0;
|
||||
|
||||
signals:
|
||||
void printTicketFinished(RESULT_STATE resultState,
|
||||
const QString & errorCode,
|
||||
const QString & errorDescription);
|
||||
void printReceiptFinished(RESULT_STATE resultState,
|
||||
const QString & errorCode,
|
||||
const QString & errorDescription);
|
||||
|
||||
/**
|
||||
* emitted on e.g. a coin input
|
||||
*/
|
||||
void cashInputEvent(RESULT_STATE resultState,
|
||||
CASH_STATE cashState,
|
||||
const QString & newCashValue,
|
||||
/* additional variables? */
|
||||
const QString & errorCode,
|
||||
const QString & errorDescription);
|
||||
|
||||
/**
|
||||
* emitted if cashInput has been stopped, e.g. in result to task requestStopCashInput():
|
||||
* -> shutter is blocked
|
||||
* -> no cash input is possible
|
||||
* -> coins are in cache
|
||||
*/
|
||||
void cashInputFinished(RESULT_STATE resultState,
|
||||
const QString & newCashValue,
|
||||
/* additional variables? */
|
||||
const QString & errorCode,
|
||||
const QString & errorDescription);
|
||||
|
||||
|
||||
/**
|
||||
* emitted e.g. if service door is opened
|
||||
*/
|
||||
void requestModeSERVICE();
|
||||
|
||||
/**
|
||||
* emitted e.g. if doors are closed
|
||||
*/
|
||||
void requestModeIDLE();
|
||||
|
||||
/**
|
||||
* emitted e.g. on severe errors
|
||||
*/
|
||||
void requestModeOOO();
|
||||
|
||||
/**
|
||||
* emitted e.g. if service door is opened
|
||||
*/
|
||||
void requestAccountResponse(const QHash<QString, QVariant> & accountData);
|
||||
|
||||
/**
|
||||
* emitted on error
|
||||
* depending on errorCode:
|
||||
* -> interrupt selling process
|
||||
* -> machine can go to state OOO
|
||||
* -> send error event to ISMAS
|
||||
* -> ...
|
||||
*/
|
||||
void Error(
|
||||
/* additional variables? */
|
||||
const QString & errorCode,
|
||||
const QString & errorDescription);
|
||||
#endif
|
||||
};
|
||||
|
||||
Q_DECLARE_INTERFACE(UnifiedDCVMCInterface,
|
||||
"eu.atb.ptu.plugin.UnifiedDCVMCInterface/1.0")
|
||||
|
||||
using PLUGIN_STATE = UnifiedDCVMCInterface::PLUGIN_STATE;
|
||||
using RESULT_STATE = UnifiedDCVMCInterface::RESULT_STATE;
|
||||
using CASH_STATE = UnifiedDCVMCInterface::CASH_STATE;
|
||||
using TICKET_VARIANT = UnifiedDCVMCInterface::TICKET_VARIANT;
|
||||
//Q_DECLARE_INTERFACE(UnifiedDCVMCInterface,
|
||||
// "eu.atb.ptu.plugin.UnifiedDCVMCInterface/1.0")
|
||||
|
||||
#endif // UNIFIED_DCVMC_INTERFACE_H_INCLUDED
|
||||
|
@@ -20,14 +20,18 @@ namespace nsVMCInterface {
|
||||
class VMCInterface : public QObject, public UnifiedDCVMCInterface {
|
||||
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(ATBAPPplugin UnifiedDCVMCInterface)
|
||||
|
||||
//Q_INTERFACES(ATBAPPplugin UnifiedDCVMCInterface)
|
||||
//Q_INTERFACES(UnifiedDCVMCInterface)
|
||||
//Q_CLASSINFO("Interface", "ATBAPPplugin")
|
||||
//Q_CLASSINFO("Interface", "UnifiedDCVMCInterface")
|
||||
public:
|
||||
|
||||
explicit VMCInterface(QObject *parent = nullptr) : QObject(parent) {}
|
||||
virtual ~VMCInterface() = default;
|
||||
|
||||
virtual const QString & getPluginInfo() = 0;
|
||||
virtual QStringList getPluginInfoList() = 0;
|
||||
virtual const QString &getPluginInfo() = 0;
|
||||
virtual QString const &getString(RESULT_STATE resultState) = 0;
|
||||
|
||||
virtual PLUGIN_STATE initPlugin(QObject *eventReceiver, QObject *atbSystem,
|
||||
QObject *hmiConfig, QSettings const &settings) override {
|
||||
@@ -43,86 +47,6 @@ public:
|
||||
virtual PLUGIN_STATE initVMCPlugin(QObject *eventReceiver,
|
||||
QObject *atbSystem, QObject *hmiConfig,
|
||||
const QSettings & settings) = 0;
|
||||
|
||||
#if 0
|
||||
|
||||
virtual QString getString(RESULT_STATE resultState) = 0;
|
||||
|
||||
public slots:
|
||||
virtual void onChangedProgramModeToSELL() = 0;
|
||||
virtual void onChangedProgramModeToSERVICE() = 0;
|
||||
virtual void onChangedProgramModeToIDLE() = 0;
|
||||
virtual void onChangedProgramModeToOOO() = 0;
|
||||
|
||||
virtual void startPhysicalLayer() = 0;
|
||||
virtual void stopPhysicalLayer() = 0;
|
||||
virtual void reboot() = 0;
|
||||
virtual void reset() = 0;
|
||||
|
||||
signals:
|
||||
void printTicketFinished(RESULT_STATE resultState,
|
||||
const QString & errorCode,
|
||||
const QString & errorDescription);
|
||||
void printReceiptFinished(RESULT_STATE resultState,
|
||||
const QString & errorCode,
|
||||
const QString & errorDescription);
|
||||
|
||||
/**
|
||||
* emitted on e.g. a coin input
|
||||
*/
|
||||
void cashInputEvent(RESULT_STATE resultState,
|
||||
CASH_STATE cashState,
|
||||
const QString & newCashValue,
|
||||
/* additional variables? */
|
||||
const QString & errorCode,
|
||||
const QString & errorDescription);
|
||||
|
||||
/**
|
||||
* emitted if cashInput has been stopped, e.g. in result to task requestStopCashInput():
|
||||
* -> shutter is blocked
|
||||
* -> no cash input is possible
|
||||
* -> coins are in cache
|
||||
*/
|
||||
void cashInputFinished(RESULT_STATE resultState,
|
||||
const QString & newCashValue,
|
||||
/* additional variables? */
|
||||
const QString & errorCode,
|
||||
const QString & errorDescription);
|
||||
|
||||
|
||||
/**
|
||||
* emitted e.g. if service door is opened
|
||||
*/
|
||||
void requestModeSERVICE();
|
||||
|
||||
/**
|
||||
* emitted e.g. if doors are closed
|
||||
*/
|
||||
void requestModeIDLE();
|
||||
|
||||
/**
|
||||
* emitted e.g. on severe errors
|
||||
*/
|
||||
void requestModeOOO();
|
||||
|
||||
/**
|
||||
* emitted e.g. if service door is opened
|
||||
*/
|
||||
void requestAccountResponse(const QHash<QString, QVariant> & accountData);
|
||||
|
||||
/**
|
||||
* emitted on error
|
||||
* depending on errorCode:
|
||||
* -> interrupt selling process
|
||||
* -> machine can go to state OOO
|
||||
* -> send error event to ISMAS
|
||||
* -> ...
|
||||
*/
|
||||
void Error(
|
||||
/* additional variables? */
|
||||
const QString & errorCode,
|
||||
const QString & errorDescription);
|
||||
#endif
|
||||
};
|
||||
|
||||
Q_DECLARE_INTERFACE(VMCInterface,
|
||||
|
@@ -13,6 +13,13 @@
|
||||
VMC::VMC(QObject *appControl, QSettings const *settings,
|
||||
QObject *parent)
|
||||
: QObject(parent) {
|
||||
|
||||
this->REMOTE_OUT_gpio_outstream = nullptr;
|
||||
this->REMOTE_OUT_gpio = nullptr;
|
||||
this->sendBuffer = nullptr;
|
||||
this->receiveBuffer = nullptr;
|
||||
this->com_interface = nullptr;
|
||||
|
||||
this->flag_blockVMCScreen = 0;
|
||||
this->currentCachedScreen = VMC_CMD_SCREEN_START;
|
||||
|
||||
@@ -23,6 +30,8 @@ VMC::VMC(QObject *appControl, QSettings const *settings,
|
||||
this->receiveBuffer = new ReceiveBuffer(com_interface, this);
|
||||
this->sendBuffer = new SendBuffer(com_interface, this);
|
||||
|
||||
this->privateInit_REMOTE_OUT();
|
||||
|
||||
connect(receiveBuffer, SIGNAL(ReceiveResponse(quint8)), sendBuffer, SLOT(onReceiveResponse(quint8)));
|
||||
|
||||
com_interface->open(settings->value("VMC/serialPort", "ttymxc2").toString(),
|
||||
@@ -41,11 +50,59 @@ VMC::VMC(QObject *appControl, QSettings const *settings,
|
||||
|
||||
|
||||
VMC::~VMC() {
|
||||
delete(this->sendBuffer);
|
||||
delete(this->receiveBuffer);
|
||||
delete(this->com_interface);
|
||||
if (this->REMOTE_OUT_gpio_outstream) {
|
||||
delete(this->REMOTE_OUT_gpio_outstream);
|
||||
}
|
||||
if (this->REMOTE_OUT_gpio) {
|
||||
delete(this->REMOTE_OUT_gpio);
|
||||
}
|
||||
if (this->sendBuffer) {
|
||||
delete(this->sendBuffer);
|
||||
}
|
||||
if (this->receiveBuffer) {
|
||||
delete(this->receiveBuffer);
|
||||
}
|
||||
if (this->com_interface) {
|
||||
delete(this->com_interface);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* functions for wake vmc
|
||||
*/
|
||||
|
||||
void VMC::onWakeVMC() {
|
||||
this->privateWakeVMC();
|
||||
}
|
||||
|
||||
void VMC::privateWakeVMC() {
|
||||
QTimer::singleShot (100, this, SLOT(privateSuspendVMC()));
|
||||
this->privateSet_REMOTE_OUT(true);
|
||||
}
|
||||
|
||||
void VMC::privateSuspendVMC() {
|
||||
this->privateSet_REMOTE_OUT(false);
|
||||
}
|
||||
|
||||
void VMC::privateSet_REMOTE_OUT(bool state) {
|
||||
if (state) { *(this->REMOTE_OUT_gpio_outstream) << "1"; }
|
||||
else { *(this->REMOTE_OUT_gpio_outstream) << "0"; }
|
||||
|
||||
this->REMOTE_OUT_gpio_outstream->flush();
|
||||
}
|
||||
|
||||
void VMC::privateInit_REMOTE_OUT() {
|
||||
QString sysfs_remout_out("/sys/class/leds/REMOTE_OUT/brightness");
|
||||
|
||||
this->REMOTE_OUT_gpio = new QFile(sysfs_remout_out);
|
||||
if (!REMOTE_OUT_gpio->open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
qDebug() << "ATB_system::privateInit_REMOTE_OUT() cannot open file: " << sysfs_remout_out;
|
||||
qDebug() << " file.errorString() = " << REMOTE_OUT_gpio->errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
this->REMOTE_OUT_gpio_outstream = new QTextStream(this->REMOTE_OUT_gpio);
|
||||
}
|
||||
|
||||
/********************************************************************************
|
||||
* S E N D M E S S A G E S t o V M C
|
||||
|
@@ -11,6 +11,8 @@
|
||||
#include <QTimer>
|
||||
#include <QList>
|
||||
#include <QSettings>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
|
||||
#define VMC_RECEIVE_TIMEOUT 1000
|
||||
@@ -147,11 +149,8 @@ class SendBuffer;
|
||||
using FormatedStringList = QList<QByteArray>;
|
||||
|
||||
|
||||
class VMC : public QObject
|
||||
{
|
||||
class VMC : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
private:
|
||||
QObject *m_appControl;
|
||||
COM_interface *com_interface;
|
||||
@@ -159,6 +158,9 @@ private:
|
||||
SendBuffer *sendBuffer;
|
||||
QSettings const *m_settings;
|
||||
|
||||
QFile *REMOTE_OUT_gpio;
|
||||
QTextStream *REMOTE_OUT_gpio_outstream;
|
||||
|
||||
// internal: write a ByteArray to com-port:
|
||||
int SendMessage(QByteArray ba, bool enqueue = false);
|
||||
|
||||
@@ -185,10 +187,14 @@ private:
|
||||
quint8 flag_blockVMCScreen;
|
||||
quint16 currentCachedScreen;
|
||||
|
||||
void privateInit_REMOTE_OUT();
|
||||
|
||||
private slots:
|
||||
void onDelayedMessageTimerTimeout();
|
||||
|
||||
void skipDiscount();
|
||||
void privateSet_REMOTE_OUT(bool state);
|
||||
void privateWakeVMC();
|
||||
void privateSuspendVMC();
|
||||
|
||||
public:
|
||||
explicit VMC(QObject *eventReceiver, QSettings const *settings,
|
||||
@@ -387,6 +393,8 @@ public slots:
|
||||
void ccStartTransactionRequest(); // called to start/restart a CC transaction
|
||||
void ccStartConfirmTransaction(); // called to start confirmation
|
||||
void ccPrintReceipt(QString receipt); // called to send receipt to vmc
|
||||
|
||||
void onWakeVMC();
|
||||
};
|
||||
|
||||
#endif // VMC_H
|
||||
|
Reference in New Issue
Block a user