Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
d720c7190f
|
|||
3fff6a0ebe
|
|||
bacee366b8
|
|||
acf3e143c1
|
|||
c84050091b
|
|||
9be2841187
|
@@ -311,6 +311,73 @@ void ATBDeviceControllerPlugin::cashCollect()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ATBDeviceControllerPlugin::cashCollect(const QString & amount)
|
||||||
|
{
|
||||||
|
if (this->coinProcessor() != nsDeviceControllerInterface::COIN_PROCESSOR::CHANGER) {
|
||||||
|
this->cashCollect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if we must change coins:
|
||||||
|
|
||||||
|
// inserted amount
|
||||||
|
uint32_t amountInsertedInt = this->hw->getInsertedAmount();
|
||||||
|
|
||||||
|
bool ok;
|
||||||
|
uint32_t amountToPayInt = amount.toInt(&ok);
|
||||||
|
|
||||||
|
// check if we must change coins:
|
||||||
|
if (amountInsertedInt > amountToPayInt) {
|
||||||
|
|
||||||
|
uint32_t amountToChangeInt = amountInsertedInt - amountToPayInt;
|
||||||
|
|
||||||
|
qCritical() << "cashCollect(" << amount << ")";
|
||||||
|
qCritical() << " amount to change: " << QString::number(amountToChangeInt);
|
||||||
|
|
||||||
|
|
||||||
|
// trigger changer:
|
||||||
|
emit this->cashPaymentChanging(nsDeviceControllerInterface::RESULT_STATE::SUCCESS,
|
||||||
|
QString::number(amountToChangeInt),
|
||||||
|
"", // ErrorCode
|
||||||
|
""); // ErrorDescription
|
||||||
|
|
||||||
|
// change
|
||||||
|
hw->changer_returnCoins(amountToChangeInt);
|
||||||
|
|
||||||
|
QTimer::singleShot(1000, this, &ATBDeviceControllerPlugin::onCashChangerState);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// nothing to change:
|
||||||
|
|
||||||
|
qCritical() << "cashCollect(" << amount << ")";
|
||||||
|
qCritical() << " nothing to change. ";
|
||||||
|
|
||||||
|
|
||||||
|
hw->vend_success();
|
||||||
|
|
||||||
|
QString amountString = QString::number(amountInsertedInt);
|
||||||
|
|
||||||
|
// inserted coins
|
||||||
|
uint32_t amountCoinsInt = CashUtils::getAmountOfInsertedCoins(this->hw);
|
||||||
|
QString amountCoinsString = QString::number(amountCoinsInt);
|
||||||
|
|
||||||
|
// inserted notes
|
||||||
|
uint32_t amountNotesInt = CashUtils::getAmountOfInsertedNotes(this->hw);
|
||||||
|
QString amountNotesString = QString::number(amountNotesInt);
|
||||||
|
|
||||||
|
emit this->cashPaymentFinished(nsDeviceControllerInterface::RESULT_STATE::SUCCESS,
|
||||||
|
amountString,
|
||||||
|
amountCoinsString, // coins
|
||||||
|
amountNotesString, // notes
|
||||||
|
0, // proposed change
|
||||||
|
"",
|
||||||
|
"");
|
||||||
|
this->currentCashState = CASH_STATE::CACHE_EMPTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::cashAbort()
|
void ATBDeviceControllerPlugin::cashAbort()
|
||||||
{
|
{
|
||||||
hw->vend_failed();
|
hw->vend_failed();
|
||||||
@@ -1167,7 +1234,7 @@ void ATBDeviceControllerPlugin::private_setupDynTemplatData_FINE_PAYMENT(struct
|
|||||||
memcpy((char*)dynTicketData->currentDate, ba_currentDate.data(), std::min(ba_currentDate.size(),8));
|
memcpy((char*)dynTicketData->currentDate, ba_currentDate.data(), std::min(ba_currentDate.size(),8));
|
||||||
|
|
||||||
QByteArray ba_ticketId = codec->fromUnicode(ticket->getPrintingData()["ticketId"].toString());
|
QByteArray ba_ticketId = codec->fromUnicode(ticket->getPrintingData()["ticketId"].toString());
|
||||||
memcpy((char*)dynTicketData->dynDat7, ba_amount.data(), std::min(ba_ticketId.size(),8));
|
memcpy((char*)dynTicketData->dynDat7, ba_ticketId.data(), std::min(ba_ticketId.size(),8));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1444,6 +1511,10 @@ void ATBDeviceControllerPlugin::onCashChangerState()
|
|||||||
"");
|
"");
|
||||||
changerStateRequestCounter = 0;
|
changerStateRequestCounter = 0;
|
||||||
lastChangerResult = 0;
|
lastChangerResult = 0;
|
||||||
|
|
||||||
|
// finalize vending:
|
||||||
|
hw->vend_success();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1498,6 +1569,10 @@ void ATBDeviceControllerPlugin::onCashChangerState()
|
|||||||
errorDescription);
|
errorDescription);
|
||||||
changerStateRequestCounter = 0;
|
changerStateRequestCounter = 0;
|
||||||
lastChangerResult = 0;
|
lastChangerResult = 0;
|
||||||
|
|
||||||
|
// finalize vending:
|
||||||
|
hw->vend_success();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,6 +50,7 @@ public:
|
|||||||
void requestStartCashInput(const QString & amount);
|
void requestStartCashInput(const QString & amount);
|
||||||
void requestStopCashInput();
|
void requestStopCashInput();
|
||||||
void cashCollect();
|
void cashCollect();
|
||||||
|
void cashCollect(const QString & amount);
|
||||||
void cashAbort();
|
void cashAbort();
|
||||||
|
|
||||||
// read coin/cash processing variants -----------------------------------------
|
// read coin/cash processing variants -----------------------------------------
|
||||||
|
@@ -142,8 +142,8 @@ void DeviceControllerDiag::private_startDiag()
|
|||||||
void DeviceControllerDiag::sys_superviseSystem()
|
void DeviceControllerDiag::sys_superviseSystem()
|
||||||
{ // this function proofs if vending is possible depending of doors state
|
{ // this function proofs if vending is possible depending of doors state
|
||||||
|
|
||||||
struct T_dynamicCondition dynMaCond;
|
struct T_dynamicCondition dynMaCond = {};
|
||||||
struct T_moduleCondition modCond;
|
struct T_moduleCondition modCond = {};
|
||||||
|
|
||||||
|
|
||||||
qCritical() << " sys_superviseSystem()";
|
qCritical() << " sys_superviseSystem()";
|
||||||
@@ -202,13 +202,13 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
{
|
{
|
||||||
bool flag_sendOperate = true;
|
bool flag_sendOperate = true;
|
||||||
|
|
||||||
struct T_moduleCondition modCond;
|
struct T_moduleCondition modCond = {};
|
||||||
hw->sys_getDeviceConditions(&modCond);
|
hw->sys_getDeviceConditions(&modCond);
|
||||||
|
|
||||||
struct T_dynamicCondition dynMaCond;
|
struct T_dynamicCondition dynMaCond = {};
|
||||||
hw->sys_getDynMachineConditions(&dynMaCond);
|
hw->sys_getDynMachineConditions(&dynMaCond);
|
||||||
|
|
||||||
struct T_devices devPara;
|
struct T_devices devPara = {};
|
||||||
hw->sys_restoreDeviceParameter(&devPara);
|
hw->sys_restoreDeviceParameter(&devPara);
|
||||||
|
|
||||||
// store some interesting results:
|
// store some interesting results:
|
||||||
@@ -606,7 +606,7 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
|||||||
"DC",
|
"DC",
|
||||||
eventClass,
|
eventClass,
|
||||||
eventName,
|
eventName,
|
||||||
1,
|
1, // eventState
|
||||||
parameter,
|
parameter,
|
||||||
"" // second level info
|
"" // second level info
|
||||||
);
|
);
|
||||||
|
@@ -60,9 +60,10 @@ public:
|
|||||||
virtual void requestStopCashInput() = 0;
|
virtual void requestStopCashInput() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called e.g. on Button "NEXT" in pay-up (direct coin input)
|
* called e.g. after printing
|
||||||
*/
|
*/
|
||||||
virtual void cashCollect() = 0;
|
virtual void cashCollect() = 0;
|
||||||
|
virtual void cashCollect(const QString & amount) = 0;
|
||||||
virtual void cashAbort() = 0;
|
virtual void cashAbort() = 0;
|
||||||
|
|
||||||
// TASKS: Account -------------------------------------------------------------
|
// TASKS: Account -------------------------------------------------------------
|
||||||
@@ -138,6 +139,14 @@ signals:
|
|||||||
const QString & errorCode,
|
const QString & errorCode,
|
||||||
const QString & errorDescription);
|
const QString & errorDescription);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* emitted if cashPayment has been finished, e.g. in result to task cashCollect():
|
||||||
|
* if coins in changer must be given back to user.
|
||||||
|
*/
|
||||||
|
void cashPaymentChanging(nsDeviceControllerInterface::RESULT_STATE resultState,
|
||||||
|
const QString & changeValue, // amount changed by changer/escrow
|
||||||
|
const QString & errorCode,
|
||||||
|
const QString & errorDescription);
|
||||||
/**
|
/**
|
||||||
* emitted if cashPayment has been finished, e.g. in result to task cashCollect():
|
* emitted if cashPayment has been finished, e.g. in result to task cashCollect():
|
||||||
* -> ticket should be printed sucessfully
|
* -> ticket should be printed sucessfully
|
||||||
@@ -145,7 +154,7 @@ signals:
|
|||||||
* Provides data for logging, especially changed value
|
* Provides data for logging, especially changed value
|
||||||
*/
|
*/
|
||||||
void cashPaymentFinished(nsDeviceControllerInterface::RESULT_STATE resultState,
|
void cashPaymentFinished(nsDeviceControllerInterface::RESULT_STATE resultState,
|
||||||
const QString & newCashValue, // total inserted amount amount
|
const QString & newCashValue, // total inserted amount
|
||||||
const QString & coinValue, // inserted amount, paid with coins
|
const QString & coinValue, // inserted amount, paid with coins
|
||||||
const QString & noteValue, // inserted amount, paid with notes
|
const QString & noteValue, // inserted amount, paid with notes
|
||||||
const QString & changeValue, // amount changed by changer/escrow
|
const QString & changeValue, // amount changed by changer/escrow
|
||||||
@@ -203,7 +212,7 @@ signals:
|
|||||||
|
|
||||||
|
|
||||||
Q_DECLARE_INTERFACE(DeviceControllerInterface,
|
Q_DECLARE_INTERFACE(DeviceControllerInterface,
|
||||||
"eu.atb.ptu.plugin.DeviceControllerInterface/1.1.6")
|
"eu.atb.ptu.plugin.DeviceControllerInterface/1.2.0")
|
||||||
|
|
||||||
|
|
||||||
namespace nsDeviceControllerInterface {
|
namespace nsDeviceControllerInterface {
|
||||||
|
@@ -172,6 +172,9 @@ QDebug operator<<(QDebug debug, TICKET_VARIANT ticketVariant)
|
|||||||
case TICKET_VARIANT::FOOD_STAMP:
|
case TICKET_VARIANT::FOOD_STAMP:
|
||||||
debug << "TICKET_VARIANT::FOOD_STAMP";
|
debug << "TICKET_VARIANT::FOOD_STAMP";
|
||||||
break;
|
break;
|
||||||
|
case TICKET_VARIANT::FREE_TICKET:
|
||||||
|
debug << "TICKET_VARIANT::FREE_TICKET";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return debug;
|
return debug;
|
||||||
|
Reference in New Issue
Block a user