#ifndef DEVICECONTROLLERINTERFACE_H #define DEVICECONTROLLERINTERFACE_H #include #include #include #include "ATBAPPplugin.h" namespace nsDeviceControllerInterface { enum class PLUGIN_STATE : quint8; enum class RESULT_STATE : quint8; enum class CASH_STATE : quint8; enum class TICKET_VARIANT : quint8; enum class COIN_PROCESSOR : quint8; enum class BILL_ACCEPTOR : quint8; } class DeviceControllerInterface : public QObject , public ATBAPPplugin { Q_OBJECT Q_INTERFACES(ATBAPPplugin) public: virtual ~DeviceControllerInterface() {} /** * @brief initDCPlugin * @param eventReceiver - QObject to receive ATBMachineEvents or HealthEvents * @param settings * @return */ virtual nsDeviceControllerInterface::PLUGIN_STATE initDCPlugin(QObject *eventReceiver, const QSettings & settings) = 0; // TASKS: Cash handling ------------------------------------------------------- /** * enables coin input * amount = "0": pay-up * amount > "0": pay-down */ virtual void requestStartCashInput(const QString & amount) = 0; /** * called e.g. on Button "NEXT" in pay-up (direct coin input) */ virtual void requestStopCashInput() = 0; /** * called e.g. on Button "NEXT" in pay-up (direct coin input) */ virtual void cashCollect() = 0; virtual void cashAbort() = 0; // TASKS: Account ------------------------------------------------------------- virtual void requestAccount() = 0; // TASKS: printing ------------------------------------------------------------ virtual void requestPrintTicket(const QHash & printingData) = 0; virtual void requestPrintTicket(nsDeviceControllerInterface::TICKET_VARIANT ticketVariant, const QHash & printingData) = 0; virtual void requestPrintReceipt(const QHash & printingData) = 0; virtual void requestPrintReceipt(const QString & printingString) = 0; // read coin/cash processing variants virtual nsDeviceControllerInterface::COIN_PROCESSOR coinProcessor() = 0; virtual nsDeviceControllerInterface::BILL_ACCEPTOR billAcceptor() = 0; // mandantory ATBAPP plugin methods: virtual nsDeviceControllerInterface::PLUGIN_STATE getState() = 0; virtual const QString & getLastError() = 0; virtual const QString & getLastErrorDescription() = 0; // return a plugin description in JSON or XML // -> ATBAPPplugin::getPluginInfo() // helpers e.g. for debug / log virtual const QString getString(nsDeviceControllerInterface::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(nsDeviceControllerInterface::RESULT_STATE resultState, const QString & errorCode, const QString & errorDescription); void printReceiptFinished(nsDeviceControllerInterface::RESULT_STATE resultState, const QString & errorCode, const QString & errorDescription); /** * emitted on e.g. a coin input */ void cashInputEvent(nsDeviceControllerInterface::RESULT_STATE resultState, nsDeviceControllerInterface::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(nsDeviceControllerInterface::RESULT_STATE resultState, const QString & newCashValue, const QString & coinValue, const QString & noteValue, const QString & changeValue, const QString & errorCode, const QString & errorDescription); /** * emitted if cashPayment has been finished, e.g. in result to task cashCollect(): * -> ticket should be printed sucessfully * -> coins in excrow or changer are given back to user * Provides data for logging, especially changed value */ void cashPaymentFinished(nsDeviceControllerInterface::RESULT_STATE resultState, const QString & newCashValue, // total inserted amount amount const QString & coinValue, // inserted amount, paid with coins const QString & noteValue, // inserted amount, paid with notes const QString & changeValue, // amount changed by changer/escrow const QString & errorCode, const QString & errorDescription); /** * emitted e.g. if service door is opened */ void requestModeSERVICE(); /** * emitted e.g. if vault door is opened */ void requestModeACCOUNT(); /** * 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 & accountData); /** * show text messaged in service mode */ void showServiceText(const QString & text); void showServiceText(quint16 textNumber); /** * 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); }; Q_DECLARE_INTERFACE(DeviceControllerInterface, "eu.atb.ptu.plugin.DeviceControllerInterface/1.1.0") namespace nsDeviceControllerInterface { 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 }; enum class COIN_PROCESSOR : quint8 { CHANGER, ESCROW }; enum class BILL_ACCEPTOR : quint8 { YES, NO }; } #endif // DEVICECONTROLLERINTERFACE_H