Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
8fe705f49b
|
|||
bf1bdc34bb
|
|||
73ae01573d
|
|||
bc595e1c7e
|
|||
18104b7271
|
|||
d720c7190f
|
|||
3fff6a0ebe
|
|||
bacee366b8
|
|||
acf3e143c1
|
@@ -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();
|
||||||
@@ -580,7 +647,7 @@ void ATBDeviceControllerPlugin::onNewVoltage(uint32_t voltage)
|
|||||||
json = JSON::objectBuilder()
|
json = JSON::objectBuilder()
|
||||||
->set("Name", "batt")
|
->set("Name", "batt")
|
||||||
->set("Value", voltageString)
|
->set("Value", voltageString)
|
||||||
->set("Unit", "V")
|
->set("Unit", "mV")
|
||||||
->create();
|
->create();
|
||||||
|
|
||||||
|
|
||||||
@@ -725,6 +792,7 @@ void ATBDeviceControllerPlugin::requestPrintTicket(const QHash<QString, QVariant
|
|||||||
|
|
||||||
qCritical() << "ATBDeviceControllerPlugin::requestPrintTicket( " << endl
|
qCritical() << "ATBDeviceControllerPlugin::requestPrintTicket( " << endl
|
||||||
<< " licenseplate = " << printingData["licenseplate"] << endl
|
<< " licenseplate = " << printingData["licenseplate"] << endl
|
||||||
|
<< " productText = " << printingData["productText"] << endl
|
||||||
<< " amount = " << printingData["amount"] << endl
|
<< " amount = " << printingData["amount"] << endl
|
||||||
<< " parkingEnd = " << printingData["parkingEnd"] << endl
|
<< " parkingEnd = " << printingData["parkingEnd"] << endl
|
||||||
<< " currentDateTime = " << printingData["currentDateTime"] << endl
|
<< " currentDateTime = " << printingData["currentDateTime"] << endl
|
||||||
@@ -774,11 +842,14 @@ void ATBDeviceControllerPlugin::requestPrintTicket(const QHash<QString, QVariant
|
|||||||
QByteArray ba_currentDate = codec->fromUnicode(currentDateString);
|
QByteArray ba_currentDate = codec->fromUnicode(currentDateString);
|
||||||
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));
|
||||||
|
|
||||||
|
// Product-Text
|
||||||
|
QByteArray ba_productText = codec->fromUnicode(printingData["productText"].toString());
|
||||||
|
memcpy((char*)dynTicketData->dynDat5, ba_productText.data(), std::min(ba_productText.size(),8));
|
||||||
|
|
||||||
// Ticket-Number
|
// Ticket-Number
|
||||||
QByteArray ba_ticketNumber = codec->fromUnicode(printingData["ticketNumber"].toString());
|
QByteArray ba_ticketNumber = codec->fromUnicode(printingData["ticketNumber"].toString());
|
||||||
memcpy((char*)dynTicketData->dynDat7, ba_ticketNumber.data(), std::min(ba_ticketNumber.size(),8));
|
memcpy((char*)dynTicketData->dynDat7, ba_ticketNumber.data(), std::min(ba_ticketNumber.size(),8));
|
||||||
|
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
/*
|
/*
|
||||||
uint8_t* buf = dynTicketData->licensePlate;
|
uint8_t* buf = dynTicketData->licensePlate;
|
||||||
@@ -1262,8 +1333,8 @@ void ATBDeviceControllerPlugin::onCashPayStopByEscrow()
|
|||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"CashPayStopByEscrow",
|
||||||
"");
|
"CashPayStopByEscrow");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::onCashPayStopByError()
|
void ATBDeviceControllerPlugin::onCashPayStopByError()
|
||||||
@@ -1280,8 +1351,8 @@ void ATBDeviceControllerPlugin::onCashPayStopByError()
|
|||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"onCashPayStopByError",
|
||||||
"");
|
"onCashPayStopByError");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::onCashPayStopByTimeout()
|
void ATBDeviceControllerPlugin::onCashPayStopByTimeout()
|
||||||
@@ -1298,8 +1369,8 @@ void ATBDeviceControllerPlugin::onCashPayStopByTimeout()
|
|||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"CashPayStopByTimeout",
|
||||||
"");
|
"CashPayStopByTimeout");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::onCashPayStopedSuccess()
|
void ATBDeviceControllerPlugin::onCashPayStopedSuccess()
|
||||||
@@ -1444,6 +1515,10 @@ void ATBDeviceControllerPlugin::onCashChangerState()
|
|||||||
"");
|
"");
|
||||||
changerStateRequestCounter = 0;
|
changerStateRequestCounter = 0;
|
||||||
lastChangerResult = 0;
|
lastChangerResult = 0;
|
||||||
|
|
||||||
|
// finalize vending:
|
||||||
|
hw->vend_success();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1498,6 +1573,10 @@ void ATBDeviceControllerPlugin::onCashChangerState()
|
|||||||
errorDescription);
|
errorDescription);
|
||||||
changerStateRequestCounter = 0;
|
changerStateRequestCounter = 0;
|
||||||
lastChangerResult = 0;
|
lastChangerResult = 0;
|
||||||
|
|
||||||
|
// finalize vending:
|
||||||
|
hw->vend_success();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1637,6 +1716,7 @@ void ATBDeviceControllerPlugin::onWokeUp(uchar source)
|
|||||||
{
|
{
|
||||||
if (source == 0x01 || source == 0xFE) {
|
if (source == 0x01 || source == 0xFE) {
|
||||||
// woke up from device controller
|
// woke up from device controller
|
||||||
|
hw->dc_autoRequest(true);
|
||||||
this->diag->diagRequest();
|
this->diag->diagRequest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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 -----------------------------------------
|
||||||
|
@@ -135,6 +135,7 @@ void DeviceControllerDiag::private_startDiag()
|
|||||||
qCritical() << "DeviceControllerDiag::private_startDiag() DCdata is +++not+++ valid";
|
qCritical() << "DeviceControllerDiag::private_startDiag() DCdata is +++not+++ valid";
|
||||||
|
|
||||||
// try it again
|
// try it again
|
||||||
|
hw->dc_autoRequest(true);
|
||||||
QTimer::singleShot(200, this, &DeviceControllerDiag::private_startDiag);
|
QTimer::singleShot(200, this, &DeviceControllerDiag::private_startDiag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,7 +165,8 @@ void DeviceControllerDiag::sys_superviseSystem()
|
|||||||
{
|
{
|
||||||
// es gibt keinerlei gültige Daten vom DC
|
// es gibt keinerlei gültige Daten vom DC
|
||||||
qCritical() << "DeviceControllerDiag::sys_superviseSystem() no valid data!";
|
qCritical() << "DeviceControllerDiag::sys_superviseSystem() no valid data!";
|
||||||
this->private_sendDiagEvent(DeviceController::State::E254);
|
hw->dc_autoRequest(true);
|
||||||
|
this->private_sendDiagEvent(DeviceController::State::M0254);
|
||||||
this->diagRequestTimeoutTimer->stop();
|
this->diagRequestTimeoutTimer->stop();
|
||||||
this->isRequestRunning = false;
|
this->isRequestRunning = false;
|
||||||
if (this->E255counter > 5) { this->restartCArun(); }
|
if (this->E255counter > 5) { this->restartCArun(); }
|
||||||
@@ -230,13 +232,13 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
// Service or battery door is open
|
// Service or battery door is open
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
qCritical() << "DeviceControllerDiag::sys_superviseSystem() Service or battery door is open, goto INTRUSION MODE";
|
qCritical() << "DeviceControllerDiag::sys_superviseSystem() Service or battery door is open, goto INTRUSION MODE";
|
||||||
this->private_sendDiagEvent(DeviceController::State::E253);
|
this->private_sendDiagEvent(DeviceController::State::M0253);
|
||||||
}
|
}
|
||||||
if (dynMaCond.middleDoor) {
|
if (dynMaCond.middleDoor) {
|
||||||
// vault door is open
|
// vault door is open
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
qCritical() << "DeviceControllerDiag::sys_superviseSystem() vault door is open, goto INTRUSION MODE";
|
qCritical() << "DeviceControllerDiag::sys_superviseSystem() vault door is open, goto INTRUSION MODE";
|
||||||
this->private_sendDiagEvent(DeviceController::State::E252);
|
this->private_sendDiagEvent(DeviceController::State::M0252);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for invalid states:
|
// check for invalid states:
|
||||||
@@ -364,12 +366,12 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
|
|
||||||
if (dynMaCond.nowCardTest>0) {
|
if (dynMaCond.nowCardTest>0) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E072);
|
this->private_sendDiagEvent(DeviceController::State::M0072);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dynMaCond.startupTestIsRunning>0) {
|
if (dynMaCond.startupTestIsRunning>0) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E073);
|
this->private_sendDiagEvent(DeviceController::State::M0073);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modCond.voltage>=200) {
|
if (modCond.voltage>=200) {
|
||||||
@@ -524,28 +526,28 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
|||||||
this->_isErrorState = true;
|
this->_isErrorState = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DeviceController::State::E071: // cash box change is ongoing
|
case DeviceController::State::M0071: // cash box change is ongoing
|
||||||
eventClass = EVENT_CLASS::STATE;
|
eventClass = EVENT_CLASS::STATE;
|
||||||
parameter = "cash box change is ongoing";
|
parameter = "cash box change is ongoing";
|
||||||
break;
|
break;
|
||||||
case DeviceController::State::E072: // card test running
|
case DeviceController::State::M0072: // card test running
|
||||||
eventClass = EVENT_CLASS::STATE;
|
eventClass = EVENT_CLASS::STATE;
|
||||||
parameter = "card test running";
|
parameter = "card test running";
|
||||||
break;
|
break;
|
||||||
case DeviceController::State::E073: // startup-test is running
|
case DeviceController::State::M0073: // startup-test is running
|
||||||
eventClass = EVENT_CLASS::STATE;
|
eventClass = EVENT_CLASS::STATE;
|
||||||
parameter = "startup-test is running";
|
parameter = "startup-test is running";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DeviceController::State::E252: // cash box door open
|
case DeviceController::State::M0252: // cash box door open
|
||||||
eventClass = EVENT_CLASS::STATE;
|
eventClass = EVENT_CLASS::STATE;
|
||||||
parameter = "cash box door open";
|
parameter = "cash box door open";
|
||||||
break;
|
break;
|
||||||
case DeviceController::State::E253: // service or battery door open
|
case DeviceController::State::M0253: // service or battery door open
|
||||||
eventClass = EVENT_CLASS::STATE;
|
eventClass = EVENT_CLASS::STATE;
|
||||||
parameter = "service or battery door open";
|
parameter = "service or battery door open";
|
||||||
break;
|
break;
|
||||||
case DeviceController::State::E254: // no valid data from DeviceController
|
case DeviceController::State::M0254: // no valid data from DeviceController
|
||||||
eventClass = EVENT_CLASS::STATE;
|
eventClass = EVENT_CLASS::STATE;
|
||||||
parameter = "no valid data from DeviceController";
|
parameter = "no valid data from DeviceController";
|
||||||
break;
|
break;
|
||||||
|
@@ -41,13 +41,14 @@ namespace DeviceController {
|
|||||||
|
|
||||||
E034,
|
E034,
|
||||||
|
|
||||||
E071,
|
M0071, // cashbox change is ongoing
|
||||||
E072,
|
M0072, // cardtest is running
|
||||||
E073,
|
M0073, // startup-test is running
|
||||||
|
|
||||||
|
M0252, // cashbox door open
|
||||||
|
M0253, // service or battery door is open
|
||||||
|
M0254, // no valid data from DC
|
||||||
|
|
||||||
E252,
|
|
||||||
E253,
|
|
||||||
E254,
|
|
||||||
E255,
|
E255,
|
||||||
|
|
||||||
W001,
|
W001,
|
||||||
|
@@ -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