Compare commits
6 Commits
94b51b5794
...
f0762e272f
Author | SHA1 | Date | |
---|---|---|---|
f0762e272f | |||
46ab0ec80f | |||
1d8eb2a808 | |||
22fb039172 | |||
cf8dd83a48 | |||
1a08f8ee3a |
@ -5,21 +5,63 @@
|
||||
* a simple class with only one method for plugin info
|
||||
*/
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
class ATBAPPplugin
|
||||
{
|
||||
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
|
||||
};
|
||||
|
||||
public:
|
||||
explicit ATBAPPplugin() = default;
|
||||
virtual ~ATBAPPplugin() = default;
|
||||
|
||||
virtual const QString & getPluginInfo() = 0;
|
||||
virtual const QString &getPluginInfo() = 0;
|
||||
virtual QStringList getPluginInfoList() {
|
||||
return QStringList(QString());
|
||||
}
|
||||
};
|
||||
|
||||
using PLUGIN_STATE = ATBAPPplugin::PLUGIN_STATE;
|
||||
using RESULT_STATE = ATBAPPplugin::RESULT_STATE;
|
||||
using CASH_STATE = ATBAPPplugin::CASH_STATE;
|
||||
using TICKET_VARIANT = ATBAPPplugin::TICKET_VARIANT;
|
||||
using STEP = ATBAPPplugin::STEP;
|
||||
using TERMINAL_STATE = ATBAPPplugin::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,
|
||||
@ -81,22 +102,44 @@ 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;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
void ATBVMCPlugin::onChangedProgramModeToSELL() {
|
||||
|
||||
}
|
||||
@ -129,7 +172,6 @@ void ATBVMCPlugin::reset() {
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
Q_EXPORT_PLUGIN2(ATBVMCPlugin, ATBVMCPlugin)
|
||||
|
@ -24,24 +24,23 @@ 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;
|
||||
|
||||
public slots:
|
||||
virtual void onChangedProgramModeToSELL() override;
|
||||
@ -54,11 +53,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;
|
||||
|
@ -16,54 +16,33 @@ class UnifiedDCVMCInterface : public ATBAPPplugin {
|
||||
Q_INTERFACES(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:
|
||||
virtual void onChangedProgramModeToSELL() = 0;
|
||||
@ -75,79 +54,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;
|
||||
|
||||
#endif // UNIFIED_DCVMC_INTERFACE_H_INCLUDED
|
||||
|
@ -27,7 +27,9 @@ 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 +45,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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user