Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
58c99753a9
|
|||
e703befb2f
|
|||
83bcdcb47e
|
|||
70e6ec293d
|
|||
3601f2d868
|
|||
0876fa229e
|
|||
1c13d92171
|
|||
10b0e494b2
|
@@ -733,6 +733,15 @@ void ATBDeviceControllerPlugin::requestPrintTicket(nsDeviceControllerInterface::
|
|||||||
{
|
{
|
||||||
QList<quint8> templateList = this->ticketTemplateList[ticketVariant];
|
QList<quint8> templateList = this->ticketTemplateList[ticketVariant];
|
||||||
|
|
||||||
|
if (templateList.isEmpty()) {
|
||||||
|
qCritical() << "ATBDeviceControllerPlugin::requestPrintTicket()";
|
||||||
|
qCritical() << " TICKET_VARIANT: " << ticketVariant;
|
||||||
|
qCritical() << " -> templateList is empty!";
|
||||||
|
qCritical() << " -> switching to legacy interface";
|
||||||
|
this->requestPrintTicket(printingData);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
qCritical() << "------------------------------------------------------------------------";
|
qCritical() << "------------------------------------------------------------------------";
|
||||||
qCritical() << "ATBDeviceControllerPlugin::requestPrintTicket()";
|
qCritical() << "ATBDeviceControllerPlugin::requestPrintTicket()";
|
||||||
@@ -797,7 +806,7 @@ void ATBDeviceControllerPlugin::requestPrintReceipt(const QString & printingStri
|
|||||||
|
|
||||||
|
|
||||||
this->printResultCheckCounter = 0;
|
this->printResultCheckCounter = 0;
|
||||||
QTimer::singleShot(4000, this, SLOT(onPrinterWaitForPrintingReceipt()));
|
QTimer::singleShot(2000, this, SLOT(onPrinterWaitForPrintingReceipt()));
|
||||||
|
|
||||||
//QTimer::singleShot(2000, this, [this](){ hw->prn_cut(3); } );
|
//QTimer::singleShot(2000, this, [this](){ hw->prn_cut(3); } );
|
||||||
}
|
}
|
||||||
@@ -818,7 +827,7 @@ void ATBDeviceControllerPlugin::onPrinterWaitForPrintingReceipt()
|
|||||||
"",
|
"",
|
||||||
"");
|
"");
|
||||||
hw->prn_switchPower(true);
|
hw->prn_switchPower(true);
|
||||||
hw->prn_cut(3);
|
QTimer::singleShot(200, this, [this](){ hw->prn_cut(3); } );
|
||||||
break;
|
break;
|
||||||
case 2: // printing finished, Error
|
case 2: // printing finished, Error
|
||||||
qCritical() << "DC Error: wait for printing receipt";
|
qCritical() << "DC Error: wait for printing receipt";
|
||||||
@@ -828,15 +837,21 @@ void ATBDeviceControllerPlugin::onPrinterWaitForPrintingReceipt()
|
|||||||
emit this->printReceiptFinished(nsDeviceControllerInterface::RESULT_STATE::ERROR_BACKEND,
|
emit this->printReceiptFinished(nsDeviceControllerInterface::RESULT_STATE::ERROR_BACKEND,
|
||||||
this->errorCode,
|
this->errorCode,
|
||||||
this->errorDescription);
|
this->errorDescription);
|
||||||
|
hw->prn_switchPower(true);
|
||||||
|
QTimer::singleShot(200, this, [this](){ hw->prn_cut(3); } );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qCritical() << "DC Error: wait for printing receipt";
|
qCritical() << "DC Error: wait for printing receipt: printerResult = " << printerResult;
|
||||||
this->errorCode = "PRINTER"; // TODO: get more detailed error code from low level API
|
this->errorCode = "PRINTER"; // TODO: get more detailed error code from low level API
|
||||||
this->errorDescription = "Printer error"; // TODO: get more detailed error description from low level API
|
this->errorDescription = "Printer error(" + QString(printerResult) + ")";
|
||||||
|
|
||||||
emit this->printReceiptFinished(nsDeviceControllerInterface::RESULT_STATE::ERROR_BACKEND,
|
emit this->printReceiptFinished(nsDeviceControllerInterface::RESULT_STATE::ERROR_BACKEND,
|
||||||
this->errorCode,
|
this->errorCode,
|
||||||
this->errorDescription);
|
this->errorDescription);
|
||||||
|
// do an emergency cut
|
||||||
|
hw->prn_switchPower(true);
|
||||||
|
QTimer::singleShot(200, this, [this](){ hw->prn_cut(3); } );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1183,6 +1198,36 @@ void ATBDeviceControllerPlugin::prepareDynTemplateData()
|
|||||||
case nsDeviceControllerInterface::TICKET_VARIANT::FOOD_STAMP:
|
case nsDeviceControllerInterface::TICKET_VARIANT::FOOD_STAMP:
|
||||||
private_setupDynTemplatData_FOOD_STAMP(dynTicketData, this->currentTicket);
|
private_setupDynTemplatData_FOOD_STAMP(dynTicketData, this->currentTicket);
|
||||||
break;
|
break;
|
||||||
|
case nsDeviceControllerInterface::TICKET_VARIANT::FIXED_PRICE_1:
|
||||||
|
private_setupDynTemplateData_FIXED_PRICE(dynTicketData, this->currentTicket);
|
||||||
|
break;
|
||||||
|
case nsDeviceControllerInterface::TICKET_VARIANT::FIXED_PRICE_2:
|
||||||
|
private_setupDynTemplateData_FIXED_PRICE(dynTicketData, this->currentTicket);
|
||||||
|
break;
|
||||||
|
case nsDeviceControllerInterface::TICKET_VARIANT::FIXED_PRICE_3:
|
||||||
|
private_setupDynTemplateData_FIXED_PRICE(dynTicketData, this->currentTicket);
|
||||||
|
break;
|
||||||
|
case nsDeviceControllerInterface::TICKET_VARIANT::FIXED_PRICE_4:
|
||||||
|
private_setupDynTemplateData_FIXED_PRICE(dynTicketData, this->currentTicket);
|
||||||
|
break;
|
||||||
|
case nsDeviceControllerInterface::TICKET_VARIANT::FIXED_PRICE_5:
|
||||||
|
private_setupDynTemplateData_FIXED_PRICE(dynTicketData, this->currentTicket);
|
||||||
|
break;
|
||||||
|
case nsDeviceControllerInterface::TICKET_VARIANT::FIXED_PRICE_6:
|
||||||
|
private_setupDynTemplateData_FIXED_PRICE(dynTicketData, this->currentTicket);
|
||||||
|
break;
|
||||||
|
case nsDeviceControllerInterface::TICKET_VARIANT::FIXED_PRICE_7:
|
||||||
|
private_setupDynTemplateData_FIXED_PRICE(dynTicketData, this->currentTicket);
|
||||||
|
break;
|
||||||
|
case nsDeviceControllerInterface::TICKET_VARIANT::FIXED_PRICE_8:
|
||||||
|
private_setupDynTemplateData_FIXED_PRICE(dynTicketData, this->currentTicket);
|
||||||
|
break;
|
||||||
|
case nsDeviceControllerInterface::TICKET_VARIANT::FIXED_PRICE_9:
|
||||||
|
private_setupDynTemplateData_FIXED_PRICE(dynTicketData, this->currentTicket);
|
||||||
|
break;
|
||||||
|
case nsDeviceControllerInterface::TICKET_VARIANT::FIXED_PRICE_10:
|
||||||
|
private_setupDynTemplateData_FIXED_PRICE(dynTicketData, this->currentTicket);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
private_setupDynTemplateData_DEFAULT(dynTicketData, this->currentTicket);
|
private_setupDynTemplateData_DEFAULT(dynTicketData, this->currentTicket);
|
||||||
break;
|
break;
|
||||||
@@ -1377,6 +1422,48 @@ void ATBDeviceControllerPlugin::private_setupDynTemplateData_DEFAULT(struct T_dy
|
|||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ATBDeviceControllerPlugin::private_setupDynTemplateData_FIXED_PRICE(struct T_dynDat *dynTicketData, Ticket *ticket)
|
||||||
|
{
|
||||||
|
QDateTime parkingEndDateTime = QDateTime::fromString(ticket->getPrintingData()["parkingEnd"].toString(), Qt::ISODate);
|
||||||
|
QDateTime currentDateTime = QDateTime::fromString(ticket->getPrintingData()["currentDateTime"].toString(), Qt::ISODate);
|
||||||
|
|
||||||
|
QString parkingEndDateString = TicketUtils::getLocaleDateString(this->printerLocale, parkingEndDateTime.date());
|
||||||
|
QString currentDateString = TicketUtils::getLocaleDateString(this->printerLocale, currentDateTime.date());
|
||||||
|
|
||||||
|
|
||||||
|
// set dynamic printer data:
|
||||||
|
QByteArray ba_licenseplate = codec->fromUnicode(ticket->getPrintingData()["licenseplate"].toString());
|
||||||
|
memcpy((char*)dynTicketData->licensePlate, ba_licenseplate.data(), std::min(ba_licenseplate.size(),8));
|
||||||
|
|
||||||
|
QByteArray ba_amount = codec->fromUnicode(ticket->getPrintingData()["amount"].toString());
|
||||||
|
memcpy((char*)dynTicketData->vendingPrice, ba_amount.data(), std::min(ba_amount.size(),8));
|
||||||
|
|
||||||
|
QByteArray ba_parkingEndTime = codec->fromUnicode(parkingEndDateTime.toString("hh:mm"));
|
||||||
|
memcpy((char*)dynTicketData->parkingEnd, ba_parkingEndTime.data(), std::min(ba_parkingEndTime.size(),8));
|
||||||
|
|
||||||
|
QByteArray ba_parkingEndDate = codec->fromUnicode(parkingEndDateString);
|
||||||
|
memcpy((char*)dynTicketData->currentTime, ba_parkingEndDate.data(), std::min(ba_parkingEndDate.size(),8));
|
||||||
|
// ! and yes... 'ParkingEndDate' is 'currentTime'
|
||||||
|
|
||||||
|
QByteArray ba_currentDate = codec->fromUnicode(currentDateString);
|
||||||
|
memcpy((char*)dynTicketData->currentDate, ba_currentDate.data(), std::min(ba_currentDate.size(),8));
|
||||||
|
|
||||||
|
// Ticket-Number
|
||||||
|
QByteArray ba_ticketNumber = codec->fromUnicode(ticket->getPrintingData()["ticketNumber"].toString());
|
||||||
|
memcpy((char*)dynTicketData->dynDat5, ba_ticketNumber.data(), std::min(ba_ticketNumber.size(),8));
|
||||||
|
|
||||||
|
// Product-Text 1
|
||||||
|
QByteArray ba_productText1 = codec->fromUnicode(ticket->getPrintingData()["productText"].toString()).left(8);
|
||||||
|
memcpy((char*)dynTicketData->dynDat6, ba_productText1.data(), std::min(ba_productText1.size(),8));
|
||||||
|
|
||||||
|
// Product-Text 2
|
||||||
|
QByteArray ba_productText2 = codec->fromUnicode(ticket->getPrintingData()["productText"].toString()).mid(8,8);
|
||||||
|
memcpy((char*)dynTicketData->dynDat7, ba_productText2.data(), std::min(ba_productText2.size(),8));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************************************
|
/************************************************************************************************
|
||||||
* cash payment
|
* cash payment
|
||||||
*/
|
*/
|
||||||
|
@@ -146,6 +146,7 @@ private:
|
|||||||
void prepareDynTemplateData();
|
void prepareDynTemplateData();
|
||||||
|
|
||||||
void private_setupDynTemplateData_DEFAULT(struct T_dynDat *dynTicketData, Ticket *ticket);
|
void private_setupDynTemplateData_DEFAULT(struct T_dynDat *dynTicketData, Ticket *ticket);
|
||||||
|
void private_setupDynTemplateData_FIXED_PRICE(struct T_dynDat *dynTicketData, Ticket *ticket);
|
||||||
void private_setupDynTemplateData_START_RECEIPT(struct T_dynDat *dynTicketData, Ticket *ticket);
|
void private_setupDynTemplateData_START_RECEIPT(struct T_dynDat *dynTicketData, Ticket *ticket);
|
||||||
void private_setupDynTemplatData_STOP_RECEIPT(struct T_dynDat *dynTicketData, Ticket *ticket);
|
void private_setupDynTemplatData_STOP_RECEIPT(struct T_dynDat *dynTicketData, Ticket *ticket);
|
||||||
void private_setupDynTemplatData_FOOD_STAMP(struct T_dynDat *dynTicketData, Ticket *ticket);
|
void private_setupDynTemplatData_FOOD_STAMP(struct T_dynDat *dynTicketData, Ticket *ticket);
|
||||||
|
@@ -104,7 +104,7 @@ void DeviceControllerDiag::private_startDiag()
|
|||||||
// check for DiagRequestTimeoutTimerTimeout:
|
// check for DiagRequestTimeoutTimerTimeout:
|
||||||
if (this->flagInterruptDiag) {
|
if (this->flagInterruptDiag) {
|
||||||
qCritical() << "DeviceControllerDiag::private_startDiag() interrupted!";
|
qCritical() << "DeviceControllerDiag::private_startDiag() interrupted!";
|
||||||
this->private_sendDiagEvent(DeviceController::State::E255);
|
this->private_setDiagEvent(DeviceController::State::E255);
|
||||||
this->isRequestRunning = false;
|
this->isRequestRunning = false;
|
||||||
this->flagInterruptDiag = false;
|
this->flagInterruptDiag = false;
|
||||||
if (this->E255counter > 5) {
|
if (this->E255counter > 5) {
|
||||||
@@ -153,7 +153,7 @@ void DeviceControllerDiag::sys_superviseSystem()
|
|||||||
// check for DiagRequestTimeoutTimerTimeout:
|
// check for DiagRequestTimeoutTimerTimeout:
|
||||||
if (this->flagInterruptDiag) {
|
if (this->flagInterruptDiag) {
|
||||||
qCritical() << "DeviceControllerDiag::sys_superviseSystem() interrupted!";
|
qCritical() << "DeviceControllerDiag::sys_superviseSystem() interrupted!";
|
||||||
this->private_sendDiagEvent(DeviceController::State::E255);
|
this->private_setDiagEvent(DeviceController::State::E255);
|
||||||
this->flagInterruptDiag = false;
|
this->flagInterruptDiag = false;
|
||||||
this->isRequestRunning = false;
|
this->isRequestRunning = false;
|
||||||
if (this->E255counter > 5) { this->restartCArun(); }
|
if (this->E255counter > 5) { this->restartCArun(); }
|
||||||
@@ -166,7 +166,7 @@ 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!";
|
||||||
hw->dc_autoRequest(true);
|
hw->dc_autoRequest(true);
|
||||||
this->private_sendDiagEvent(DeviceController::State::M0254);
|
this->private_setDiagEvent(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(); }
|
||||||
@@ -223,7 +223,7 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
|
|
||||||
if (dynMaCond.onAlarm>0) {
|
if (dynMaCond.onAlarm>0) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::A000);
|
this->private_setDiagEvent(DeviceController::State::A000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for open doors
|
// check for open doors
|
||||||
@@ -232,41 +232,41 @@ 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::M0253);
|
this->private_setDiagEvent(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::M0252);
|
this->private_setDiagEvent(DeviceController::State::M0252);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for invalid states:
|
// check for invalid states:
|
||||||
|
|
||||||
if (modCond.rtc>=200) {
|
if (modCond.rtc>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E002);
|
this->private_setDiagEvent(DeviceController::State::E002);
|
||||||
}
|
}
|
||||||
if (modCond.printer==200 || modCond.printer==201) { // 200: not connected 201: printer-HW-error 202: no paper
|
if (modCond.printer==200 || modCond.printer==201) { // 200: not connected 201: printer-HW-error 202: no paper
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E020);
|
this->private_setDiagEvent(DeviceController::State::E020);
|
||||||
}
|
}
|
||||||
if (modCond.printer==202) {
|
if (modCond.printer==202) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E018);
|
this->private_setDiagEvent(DeviceController::State::E018);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modCond.coinBlocker>=200) {
|
if (modCond.coinBlocker>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E025);
|
this->private_setDiagEvent(DeviceController::State::E025);
|
||||||
}
|
}
|
||||||
if (modCond.mdbBus>=200) {
|
if (modCond.mdbBus>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E034);
|
this->private_setDiagEvent(DeviceController::State::E034);
|
||||||
}
|
}
|
||||||
if (modCond.intEe>=200) {
|
if (modCond.intEe>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E011);
|
this->private_setDiagEvent(DeviceController::State::E011);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2023-07-26: workaround for 00281/Szeged --------------------------------------------------------------
|
// 2023-07-26: workaround for 00281/Szeged --------------------------------------------------------------
|
||||||
@@ -276,16 +276,16 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
if (devPara.kindOfCoinChecker > 0) {
|
if (devPara.kindOfCoinChecker > 0) {
|
||||||
if (modCond.coinSafe==201) { // full
|
if (modCond.coinSafe==201) { // full
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E007);
|
this->private_setDiagEvent(DeviceController::State::E007);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe==200) { // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
if (modCond.coinSafe==200) { // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E009);
|
this->private_setDiagEvent(DeviceController::State::E009);
|
||||||
}
|
}
|
||||||
if (modCond.coinEscrow>=200) {
|
if (modCond.coinEscrow>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
// coinEscrow>200 is considered a warning:
|
// coinEscrow>200 is considered a warning:
|
||||||
this->private_sendDiagEvent(DeviceController::State::W010);
|
this->private_setDiagEvent(DeviceController::State::W010);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// -----------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------
|
||||||
@@ -308,15 +308,15 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
if (modCond.coinEscrow>=200) {
|
if (modCond.coinEscrow>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
// coinEscrow>200 is considered a warning:
|
// coinEscrow>200 is considered a warning:
|
||||||
this->private_sendDiagEvent(DeviceController::State::W010);
|
this->private_setDiagEvent(DeviceController::State::W010);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe==201) { // full
|
if (modCond.coinSafe==201) { // full
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E007);
|
this->private_setDiagEvent(DeviceController::State::E007);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe==200) { // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
if (modCond.coinSafe==200) { // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E009);
|
this->private_setDiagEvent(DeviceController::State::E009);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if (devPara.kindOfCoinChecker==3)
|
if (devPara.kindOfCoinChecker==3)
|
||||||
@@ -324,15 +324,15 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
if (modCond.changer>=200) {
|
if (modCond.changer>=200) {
|
||||||
// Fehler Münzver.
|
// Fehler Münzver.
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E026);
|
this->private_setDiagEvent(DeviceController::State::E026);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe==201) { // full
|
if (modCond.coinSafe==201) { // full
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E007);
|
this->private_setDiagEvent(DeviceController::State::E007);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe == 200) { // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
if (modCond.coinSafe == 200) { // 200: kasse fehlt 201: voll 100:fast voll 1:ok
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E009);
|
this->private_setDiagEvent(DeviceController::State::E009);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,61 +361,86 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
|
|
||||||
if (dynMaCond.modeAbrech>0) {
|
if (dynMaCond.modeAbrech>0) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E011);
|
this->private_setDiagEvent(DeviceController::State::E011);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dynMaCond.nowCardTest>0) {
|
if (dynMaCond.nowCardTest>0) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::M0072);
|
this->private_setDiagEvent(DeviceController::State::M0072);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dynMaCond.startupTestIsRunning>0) {
|
if (dynMaCond.startupTestIsRunning>0) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::M0073);
|
this->private_setDiagEvent(DeviceController::State::M0073);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modCond.voltage>=200) {
|
if (modCond.voltage>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E003);
|
this->private_setDiagEvent(DeviceController::State::E003);
|
||||||
}
|
}
|
||||||
if (modCond.temper>=200) {
|
if (modCond.temper>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::W004);
|
this->private_setDiagEvent(DeviceController::State::W004);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for warnings
|
// check for warnings
|
||||||
if (modCond.printer>=100 && modCond.printer<200) {
|
if (modCond.printer>=100 && modCond.printer<200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::W001);
|
this->private_setDiagEvent(DeviceController::State::W001);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe>=100 && modCond.coinSafe<200) {
|
if (modCond.coinSafe>=100 && modCond.coinSafe<200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::W002);
|
this->private_setDiagEvent(DeviceController::State::W002);
|
||||||
}
|
}
|
||||||
if (modCond.voltage>=100 && modCond.voltage<200) {
|
if (modCond.voltage>=100 && modCond.voltage<200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::W003);
|
this->private_setDiagEvent(DeviceController::State::W003);
|
||||||
}
|
}
|
||||||
if (modCond.temper>=100 && modCond.temper<200) {
|
if (modCond.temper>=100 && modCond.temper<200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::W004);
|
this->private_setDiagEvent(DeviceController::State::W004);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag_sendOperate) {
|
if (flag_sendOperate) {
|
||||||
this->private_sendDiagEvent(DeviceController::State::O000);
|
this->private_setDiagEvent(DeviceController::State::O000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// compare machineEventSets
|
||||||
|
// New events: present in current but not previous
|
||||||
|
QSet<DeviceController::State> newEvents = this->machineEventSet - this->previousMachineEventSet;
|
||||||
|
|
||||||
|
// Reset events: present in previous but not current
|
||||||
|
QSet<DeviceController::State> resetEvents = this->previousMachineEventSet - this->machineEventSet;
|
||||||
|
|
||||||
|
// Triggering Actions
|
||||||
|
// Iterate through the results
|
||||||
|
for (const DeviceController::State& event : newEvents) {
|
||||||
|
private_sendDiagEvent(event, DeviceController::Action::SET); // New event detected
|
||||||
|
}
|
||||||
|
|
||||||
|
// Proposal: send reset
|
||||||
|
/*
|
||||||
|
for (const DeviceController::State& event : resetEvents) {
|
||||||
|
private_sendDiagEvent(event, DeviceController::Action::RESET); // Event no longer present
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// finish diag
|
// finish diag
|
||||||
|
|
||||||
this->diagRequestTimeoutTimer->stop();
|
this->diagRequestTimeoutTimer->stop();
|
||||||
this->isRequestRunning = false;
|
this->isRequestRunning = false;
|
||||||
this->flagInterruptDiag = false;
|
this->flagInterruptDiag = false;
|
||||||
|
|
||||||
|
this->previousMachineEventSet = machineEventSet;
|
||||||
|
this->machineEventSet.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DeviceControllerDiag::private_sendDiagEvent
|
* @brief DeviceControllerDiag::private_setDiagEvent
|
||||||
* @param result - result value from 'sub_componentAssessment()',
|
* @param result - result value from 'sub_componentAssessment()',
|
||||||
* - 0x00 everything is fine
|
* - 0x00 everything is fine
|
||||||
* - 0xFF on timer interrupt
|
* - 0xFF on timer interrupt
|
||||||
@@ -423,25 +448,21 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
* - 0xFD Service or battery door is open
|
* - 0xFD Service or battery door is open
|
||||||
* - 0xFE vault door is open
|
* - 0xFE vault door is open
|
||||||
*/
|
*/
|
||||||
void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
void DeviceControllerDiag::private_setDiagEvent(DeviceController::State result)
|
||||||
{
|
{
|
||||||
qCritical() << "DeviceControllerDiag::private_sendDiagEvent() result: " << result;
|
qCritical() << "DeviceControllerDiag::private_setDiagEvent() result: " << result;
|
||||||
|
|
||||||
if (this->eventReceiver == nullptr) {
|
if (this->eventReceiver == nullptr) {
|
||||||
qCritical() << "DeviceControllerDiag: no eventReceiver";
|
qCritical() << "DeviceControllerDiag: no eventReceiver";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (machineEventSet.contains(result)) {
|
machineEventSet.insert(result);
|
||||||
// do not send already sent events
|
}
|
||||||
qCritical() << " ... is in machineEventList";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
machineEventSet.insert(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result, DeviceController::Action action)
|
||||||
|
{
|
||||||
QString eventId = QUuid::createUuid().toString(QUuid::WithoutBraces).mid(0, 8);
|
QString eventId = QUuid::createUuid().toString(QUuid::WithoutBraces).mid(0, 8);
|
||||||
|
|
||||||
QString eventName = QMetaEnum::fromType<DeviceController::State>().valueToKey(result);;
|
QString eventName = QMetaEnum::fromType<DeviceController::State>().valueToKey(result);;
|
||||||
@@ -608,7 +629,7 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
|||||||
"DC",
|
"DC",
|
||||||
eventClass,
|
eventClass,
|
||||||
eventName,
|
eventName,
|
||||||
1, // eventState
|
action, // eventState
|
||||||
parameter,
|
parameter,
|
||||||
"" // second level info
|
"" // second level info
|
||||||
);
|
);
|
||||||
@@ -625,6 +646,6 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
|||||||
void DeviceControllerDiag::restartCArun()
|
void DeviceControllerDiag::restartCArun()
|
||||||
{
|
{
|
||||||
this->E255counter = 0;
|
this->E255counter = 0;
|
||||||
this->private_sendDiagEvent(DeviceController::State::W255);
|
this->private_setDiagEvent(DeviceController::State::W255);
|
||||||
QProcess::startDetached("/bin/systemctl", {"restart", "carun"});
|
QProcess::startDetached("/bin/systemctl", {"restart", "carun"});
|
||||||
}
|
}
|
||||||
|
@@ -61,6 +61,14 @@ namespace DeviceController {
|
|||||||
INITIAL_STATE
|
INITIAL_STATE
|
||||||
};
|
};
|
||||||
Q_ENUM_NS(State)
|
Q_ENUM_NS(State)
|
||||||
|
|
||||||
|
|
||||||
|
enum Action {
|
||||||
|
SET = 1,
|
||||||
|
RESET = 0
|
||||||
|
};
|
||||||
|
Q_ENUM_NS(Action)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -122,6 +130,7 @@ private:
|
|||||||
|
|
||||||
DeviceController::State lastState;
|
DeviceController::State lastState;
|
||||||
QSet<DeviceController::State> machineEventSet;
|
QSet<DeviceController::State> machineEventSet;
|
||||||
|
QSet<DeviceController::State> previousMachineEventSet;
|
||||||
bool _isErrorState;
|
bool _isErrorState;
|
||||||
|
|
||||||
PersistentData* pData;
|
PersistentData* pData;
|
||||||
@@ -132,7 +141,8 @@ private slots:
|
|||||||
void onDiagRequestTimeoutTimerTimeout();
|
void onDiagRequestTimeoutTimerTimeout();
|
||||||
|
|
||||||
void private_startDiag(); // diag entry method
|
void private_startDiag(); // diag entry method
|
||||||
void private_sendDiagEvent(DeviceController::State result);
|
void private_setDiagEvent(DeviceController::State result);
|
||||||
|
void private_sendDiagEvent(DeviceController::State result, DeviceController::Action action);
|
||||||
|
|
||||||
void sys_superviseSystem();
|
void sys_superviseSystem();
|
||||||
|
|
||||||
|
@@ -204,6 +204,66 @@ QDebug operator<<(QDebug debug, TICKET_VARIANT ticketVariant)
|
|||||||
case TICKET_VARIANT::PARKING_TICKET:
|
case TICKET_VARIANT::PARKING_TICKET:
|
||||||
debug << "TICKET_VARIANT::PARKING_TICKET";
|
debug << "TICKET_VARIANT::PARKING_TICKET";
|
||||||
break;
|
break;
|
||||||
|
case TICKET_VARIANT::PARKING_TICKET_CAR:
|
||||||
|
debug << "TICKET_VARIANT::PARKING_TICKET_CAR";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::PARKING_TICKET_CAMPER:
|
||||||
|
debug << "TICKET_VARIANT::PARKING_TICKET_CAMPER";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::PARKING_TICKET_VAN:
|
||||||
|
debug << "TICKET_VARIANT::PARKING_TICKET_VAN";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::DAY_TICKET:
|
||||||
|
debug << "TICKET_VARIANT::DAY_TICKET";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::DAY_TICKET_CHILD:
|
||||||
|
debug << "TICKET_VARIANT::DAY_TICKET_CHILD";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::DAY_TICKET_TEEN:
|
||||||
|
debug << "TICKET_VARIANT::DAY_TICKET_TEEN";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::DAY_TICKET_ADULT:
|
||||||
|
debug << "TICKET_VARIANT::DAY_TICKET_ADULT";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::DAY_TICKET_CAR:
|
||||||
|
debug << "TICKET_VARIANT::DAY_TICKET_CAR";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::DAY_TICKET_CAMPER:
|
||||||
|
debug << "TICKET_VARIANT::DAY_TICKET_CAMPER";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::DAY_TICKET_VAN:
|
||||||
|
debug << "TICKET_VARIANT::DAY_TICKET_VAN";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::FIXED_PRICE_1:
|
||||||
|
debug << "TICKET_VARIANT::FIXED_PRICE_1";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::FIXED_PRICE_2:
|
||||||
|
debug << "TICKET_VARIANT::FIXED_PRICE_2";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::FIXED_PRICE_3:
|
||||||
|
debug << "TICKET_VARIANT::FIXED_PRICE_3";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::FIXED_PRICE_4:
|
||||||
|
debug << "TICKET_VARIANT::FIXED_PRICE_4";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::FIXED_PRICE_5:
|
||||||
|
debug << "TICKET_VARIANT::FIXED_PRICE_5";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::FIXED_PRICE_6:
|
||||||
|
debug << "TICKET_VARIANT::FIXED_PRICE_6";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::FIXED_PRICE_7:
|
||||||
|
debug << "TICKET_VARIANT::FIXED_PRICE_7";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::FIXED_PRICE_8:
|
||||||
|
debug << "TICKET_VARIANT::FIXED_PRICE_8";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::FIXED_PRICE_9:
|
||||||
|
debug << "TICKET_VARIANT::FIXED_PRICE_9";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::FIXED_PRICE_10:
|
||||||
|
debug << "TICKET_VARIANT::FIXED_PRICE_10";
|
||||||
|
break;
|
||||||
case TICKET_VARIANT::RECEIPT:
|
case TICKET_VARIANT::RECEIPT:
|
||||||
debug << "TICKET_VARIANT::RECEIPT";
|
debug << "TICKET_VARIANT::RECEIPT";
|
||||||
break;
|
break;
|
||||||
@@ -225,6 +285,12 @@ QDebug operator<<(QDebug debug, TICKET_VARIANT ticketVariant)
|
|||||||
case TICKET_VARIANT::FREE_TICKET:
|
case TICKET_VARIANT::FREE_TICKET:
|
||||||
debug << "TICKET_VARIANT::FREE_TICKET";
|
debug << "TICKET_VARIANT::FREE_TICKET";
|
||||||
break;
|
break;
|
||||||
|
case TICKET_VARIANT::NO_TICKET:
|
||||||
|
debug << "TICKET_VARIANT::NO_TICKET";
|
||||||
|
break;
|
||||||
|
case TICKET_VARIANT::INVALID:
|
||||||
|
debug << "TICKET_VARIANT::INVALID";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return debug;
|
return debug;
|
||||||
|
Reference in New Issue
Block a user