Derive from QObject so we can load the VMCInterface.

Add pure virtual functions initPlugin() and initVMCPlugin().
Minor: comment out some code.
This commit is contained in:
Gerhard Hoffmann 2023-11-14 13:39:06 +01:00
parent 028792143a
commit f96ac85a18

View File

@ -17,33 +17,113 @@ namespace nsVMCInterface {
} }
class VMCInterface : public UnifiedDCVMCInterface { class VMCInterface : public QObject, public UnifiedDCVMCInterface {
Q_OBJECT Q_OBJECT
Q_INTERFACES(ATBAPPplugin) Q_INTERFACES(ATBAPPplugin UnifiedDCVMCInterface)
Q_INTERFACES(UnifiedDCVMCInterface)
public: public:
explicit VMCInterface(QObject *parent = nullptr) explicit VMCInterface(QObject *parent = nullptr) : QObject(parent) {}
: UnifiedDCVMCInterface(parent) {} virtual ~VMCInterface() = default;
virtual PLUGIN_STATE initPlugin(QObject *eventReceiver, QObject *atbSystem, virtual PLUGIN_STATE initPlugin(QObject *eventReceiver, QObject *atbSystem,
QObject *hmiConfig, QSettings const &settings) override { QObject *hmiConfig, QSettings const &settings) override {
return initVMCPlugin(eventReceiver, atbSystem, hmiConfig, settings); return initVMCPlugin(eventReceiver, atbSystem, hmiConfig, settings);
} }
virtual ~VMCInterface() {}
/** /**
* @brief initDCPlugin * @brief initVMCPlugin
* @param eventReceiver - QObject to receive ATBMachineEvents or HealthEvents * @param eventReceiver - QObject to receive ATBMachineEvents or HealthEvents
* @param settings * @param settings
* @return * @return
*/ */
virtual PLUGIN_STATE initVMCPlugin(QObject *eventReceiver, virtual PLUGIN_STATE initVMCPlugin(QObject *eventReceiver,
QObject *atbSystem, QObject *hmiConfig, QObject *atbSystem, QObject *hmiConfig,
const QSettings & settings) = 0; 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,
"eu.atb.ptu.plugin.VMCInterface/1.0")
#endif // VMCINTERFACE_H #endif // VMCINTERFACE_H