Add enums for describing plugin status:

PLUGIN_STATE
RESULT_STATE
CASH_STATE
TICKET_VARIANT
STEP
TERMINAL_STATE.
Add default implementation for getPluginInfo().
This commit is contained in:
Gerhard Hoffmann 2023-11-16 08:23:07 +01:00
parent 1a08f8ee3a
commit cf8dd83a48

View File

@ -7,19 +7,61 @@
#include <QObject> #include <QObject>
#include <QStringList> #include <QStringList>
class ATBAPPplugin struct ATBAPPplugin {
{ enum class PLUGIN_STATE : quint8 {
NOT_INITIALIZED = 0,
public: INITIALIZED = 1
explicit ATBAPPplugin() = default;
virtual ~ATBAPPplugin() = default;
virtual QStringList getPluginInfo() = 0;
}; };
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 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, Q_DECLARE_INTERFACE(ATBAPPplugin,
"eu.atb.ptu.plugin.ATBAPPplugin/0.9") "eu.atb.ptu.plugin.ATBAPPplugin/0.9")
#endif // ATBAPPPLUGIN_H #endif // ATBAPPPLUGIN_H