Implement cash input interface
This commit is contained in:
		@@ -14,7 +14,8 @@ ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent) : QObject(
 | 
			
		||||
 | 
			
		||||
    connect(dynamic_cast<QObject*>(hw), SIGNAL(hwapi_templatePrintFinished_OK()),  this, SLOT(onPrintFinishedOK()));
 | 
			
		||||
    connect(dynamic_cast<QObject*>(hw), SIGNAL(hwapi_templatePrintFinished_Err()), this, SLOT(onPrintFinishedERR()));
 | 
			
		||||
    connect(dynamic_cast<QObject*>(hw), SIGNAL(hwapi_gotNewCoin()), this, SLOT(onGotCoin()));
 | 
			
		||||
    connect(dynamic_cast<QObject*>(hw), SIGNAL(hwapi_gotNewCoin()),    this, SLOT(onCashGotCoin()));
 | 
			
		||||
    connect(dynamic_cast<QObject*>(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<uint32_t>(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
 | 
			
		||||
 
 | 
			
		||||
@@ -118,8 +118,8 @@ private slots:
 | 
			
		||||
   void onPrintFinishedERR();
 | 
			
		||||
 | 
			
		||||
   // cash payment
 | 
			
		||||
   void onGotCoin();
 | 
			
		||||
 | 
			
		||||
   void onCashGotCoin();
 | 
			
		||||
   void onCashVendStopByMax();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // ATBDEVICECONTROLLERPLUGIN_H
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user