diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.cpp b/src/ATBAPP/ATBDeviceControllerPlugin.cpp index 0a9784d..d0520b2 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.cpp +++ b/src/ATBAPP/ATBDeviceControllerPlugin.cpp @@ -14,7 +14,8 @@ ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent) : QObject( connect(dynamic_cast(hw), SIGNAL(hwapi_templatePrintFinished_OK()), this, SLOT(onPrintFinishedOK())); connect(dynamic_cast(hw), SIGNAL(hwapi_templatePrintFinished_Err()), this, SLOT(onPrintFinishedERR())); - connect(dynamic_cast(hw), SIGNAL(hwapi_gotNewCoin()), this, SLOT(onGotCoin())); + connect(dynamic_cast(hw), SIGNAL(hwapi_gotNewCoin()), this, SLOT(onCashGotCoin())); + connect(dynamic_cast(hw), SIGNAL(hwapi_vendStopByMax()), this, SLOT(onCashVendStopByMax())); } ATBDeviceControllerPlugin::~ATBDeviceControllerPlugin() {} @@ -47,22 +48,25 @@ PLUGIN_STATE ATBDeviceControllerPlugin::initDCPlugin(QObject *healthEventReceive // TASKS: Cash handling ------------------------------------------------------- void ATBDeviceControllerPlugin::requestStartCashInput(const QString & amount) { + qCritical() << "Start Cash vending with amount = " << amount; + uint32_t amountInt = static_cast(amount.toUInt()); + hw->cash_startPayment(amountInt); } void ATBDeviceControllerPlugin::requestStopCashInput() { - + hw->cash_stopPayment(); } void ATBDeviceControllerPlugin::cashCollect() { - + hw->vend_success(); } void ATBDeviceControllerPlugin::cashAbort() { - + hw->vend_failed(); } @@ -185,12 +189,44 @@ void ATBDeviceControllerPlugin::onPrintFinishedERR() this->errorDescription); } -void ATBDeviceControllerPlugin::onGotCoin() -{ + +/************************************************************************************************ + * cash payment + */ +void ATBDeviceControllerPlugin::onCashGotCoin() +{ + // DEBUG + qCritical() << "ATBDeviceControllerPlugin::onGotCoin()"; + + uint32_t amountInt = this->hw->getInsertedAmount(); + + QString amountString = QString::number(amountInt); + + + emit this->cashInputEvent(nsDeviceControllerInterface::RESULT_STATE::SUCCESS, + nsDeviceControllerInterface::CASH_STATE::CACHE_INPUT, + amountString, + "", + ""); } +void ATBDeviceControllerPlugin::onCashVendStopByMax() +{ + // DEBUG + qCritical() << "ATBDeviceControllerPlugin::onCashVendStopByMax()"; + + uint32_t amountInt = this->hw->getInsertedAmount(); + + QString amountString = QString::number(amountInt); + + emit this->cashInputFinished(nsDeviceControllerInterface::RESULT_STATE::SUCCESS, + amountString, + "", + ""); + +} /************************************************************************************************ * Mandatory plugin methods diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.h b/src/ATBAPP/ATBDeviceControllerPlugin.h index 3dc6e18..6e8285b 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.h +++ b/src/ATBAPP/ATBDeviceControllerPlugin.h @@ -118,8 +118,8 @@ private slots: void onPrintFinishedERR(); // cash payment - void onGotCoin(); - + void onCashGotCoin(); + void onCashVendStopByMax(); }; #endif // ATBDEVICECONTROLLERPLUGIN_H