Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
d66363da46
|
|||
7b25f86d6b
|
|||
5a999a0494
|
|||
ec18ac45e4
|
|||
560b6d3221
|
|||
b946dc5a92
|
|||
ea7542a248
|
@@ -654,6 +654,7 @@ void ATBDeviceControllerPlugin::requestPrintReceipt(const QString & printingStri
|
|||||||
hw->prn_switchPower(true);
|
hw->prn_switchPower(true);
|
||||||
hw->prn_setFonts(8,12,0,0);
|
hw->prn_setFonts(8,12,0,0);
|
||||||
hw->prn_sendText(&ba);
|
hw->prn_sendText(&ba);
|
||||||
|
this->printResultCheckCounter = 0;
|
||||||
QTimer::singleShot(4000, this, SLOT(onPrinterWaitForPrintingReceipt()));
|
QTimer::singleShot(4000, this, SLOT(onPrinterWaitForPrintingReceipt()));
|
||||||
|
|
||||||
//QTimer::singleShot(2000, this, [this](){ hw->prn_cut(3); } );
|
//QTimer::singleShot(2000, this, [this](){ hw->prn_cut(3); } );
|
||||||
@@ -702,7 +703,8 @@ void ATBDeviceControllerPlugin::onPrinterWaitForPrintingReceipt()
|
|||||||
|
|
||||||
void ATBDeviceControllerPlugin::requestPrintTicket(const QHash<QString, QVariant> & printingData)
|
void ATBDeviceControllerPlugin::requestPrintTicket(const QHash<QString, QVariant> & printingData)
|
||||||
{
|
{
|
||||||
struct T_dynDat *dynTicketData = new T_dynDat;
|
struct T_dynDat dynamicTicketData;
|
||||||
|
struct T_dynDat *dynTicketData = &dynamicTicketData;
|
||||||
memset(dynTicketData, 0, sizeof(*dynTicketData));
|
memset(dynTicketData, 0, sizeof(*dynTicketData));
|
||||||
|
|
||||||
qCritical() << "ATBDeviceControllerPlugin::requestPrintTicket( " << endl
|
qCritical() << "ATBDeviceControllerPlugin::requestPrintTicket( " << endl
|
||||||
@@ -843,6 +845,7 @@ void ATBDeviceControllerPlugin::onPrinterDataPrepared()
|
|||||||
|
|
||||||
// note: calling prn_getPrintResult() immediately may result in wrong answer!
|
// note: calling prn_getPrintResult() immediately may result in wrong answer!
|
||||||
// We have to wait "about some seconds" until calling this function!
|
// We have to wait "about some seconds" until calling this function!
|
||||||
|
this->printResultCheckCounter = 0;
|
||||||
QTimer::singleShot(4000, this, SLOT(onPrinterWaitForPrintingTicket()));
|
QTimer::singleShot(4000, this, SLOT(onPrinterWaitForPrintingTicket()));
|
||||||
|
|
||||||
// old: use printer templates:
|
// old: use printer templates:
|
||||||
@@ -866,8 +869,17 @@ void ATBDeviceControllerPlugin::onPrinterWaitForPrintingTicket()
|
|||||||
this->onPrintFinishedERR();
|
this->onPrintFinishedERR();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qCritical() << "DC Error: wait for printing";
|
// result value is not defined (-> workaround for DC misbehaviour)
|
||||||
this->onPrintFinishedERR();
|
if (this->printResultCheckCounter < 10) {
|
||||||
|
this->printResultCheckCounter++;
|
||||||
|
qCritical() << "DC print result undefined: " << printerResult;
|
||||||
|
QTimer::singleShot(1000, this, SLOT(onPrinterWaitForPrintingTicket()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qCritical() << "DC Error: wait for printing";
|
||||||
|
this->onPrintFinishedERR();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -895,6 +907,7 @@ void ATBDeviceControllerPlugin::onPrinterPrintNextTemplate()
|
|||||||
|
|
||||||
if (this->currentTicket->templateList()->isEmpty()) {
|
if (this->currentTicket->templateList()->isEmpty()) {
|
||||||
// all templates are printed
|
// all templates are printed
|
||||||
|
this->printResultCheckCounter = 0;
|
||||||
QTimer::singleShot(2000, this, SLOT(onPrinterWaitForPrintingTicket()));
|
QTimer::singleShot(2000, this, SLOT(onPrinterWaitForPrintingTicket()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -946,7 +959,8 @@ void ATBDeviceControllerPlugin::onPrinterPrepareDynTemplateData()
|
|||||||
}
|
}
|
||||||
void ATBDeviceControllerPlugin::prepareDynTemplateData()
|
void ATBDeviceControllerPlugin::prepareDynTemplateData()
|
||||||
{
|
{
|
||||||
struct T_dynDat *dynTicketData = new T_dynDat;
|
struct T_dynDat dynamicTicketData;
|
||||||
|
struct T_dynDat *dynTicketData = &dynamicTicketData;
|
||||||
memset(dynTicketData, 0, sizeof(*dynTicketData));
|
memset(dynTicketData, 0, sizeof(*dynTicketData));
|
||||||
|
|
||||||
// setup dynTicketData dependent on currentTicket
|
// setup dynTicketData dependent on currentTicket
|
||||||
@@ -1504,7 +1518,7 @@ int ATBDeviceControllerPlugin::init_sc_dbus()
|
|||||||
|
|
||||||
void ATBDeviceControllerPlugin::onWokeUp(uchar source)
|
void ATBDeviceControllerPlugin::onWokeUp(uchar source)
|
||||||
{
|
{
|
||||||
if (source == 0x01) {
|
if (source == 0x01 || source == 0xFE) {
|
||||||
// woke up from device controller
|
// woke up from device controller
|
||||||
this->diag->diagRequest();
|
this->diag->diagRequest();
|
||||||
}
|
}
|
||||||
|
@@ -129,6 +129,9 @@ private:
|
|||||||
// counts failed hw->log_chkIfVaultRecordAvailable()
|
// counts failed hw->log_chkIfVaultRecordAvailable()
|
||||||
int accountCheckCounter;
|
int accountCheckCounter;
|
||||||
|
|
||||||
|
// counts faild hw->prn-getPrintResult()
|
||||||
|
int printResultCheckCounter;
|
||||||
|
|
||||||
// dbus
|
// dbus
|
||||||
int init_sc_dbus();
|
int init_sc_dbus();
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@ class ATBMachineEvent : public QEvent
|
|||||||
public:
|
public:
|
||||||
explicit ATBMachineEvent(const QString & id,
|
explicit ATBMachineEvent(const QString & id,
|
||||||
const QString & deviceName, // PTU/PRINTER/DC/...
|
const QString & deviceName, // PTU/PRINTER/DC/...
|
||||||
EVENT_CLASS eventClass, // reason of event: Error/Warning/Alarm
|
EVENT_CLASS eventClass, // reason of event: Error/Warning/Alarm
|
||||||
const QString & name, // 'Event': "E001", "W003"
|
const QString & name, // 'Event': "E001", "W003"
|
||||||
const int state,
|
const int state,
|
||||||
const QString & parameter,
|
const QString & parameter,
|
||||||
|
@@ -5,6 +5,9 @@
|
|||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include "support/JSON.h"
|
||||||
|
|
||||||
|
|
||||||
DeviceControllerDiag::DeviceControllerDiag(PersistentData *pData, QObject *parent)
|
DeviceControllerDiag::DeviceControllerDiag(PersistentData *pData, QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, coinProcessorType(nsDeviceControllerInterface::COIN_PROCESSOR::ESCROW)
|
, coinProcessorType(nsDeviceControllerInterface::COIN_PROCESSOR::ESCROW)
|
||||||
@@ -244,7 +247,8 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
}
|
}
|
||||||
if (modCond.coinEscrow>=200) {
|
if (modCond.coinEscrow>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E010);
|
// coinEscrow>200 is considered a warning:
|
||||||
|
this->private_sendDiagEvent(DeviceController::State::W010);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// -----------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------
|
||||||
@@ -266,7 +270,8 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
{
|
{
|
||||||
if (modCond.coinEscrow>=200) {
|
if (modCond.coinEscrow>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E010);
|
// coinEscrow>200 is considered a warning:
|
||||||
|
this->private_sendDiagEvent(DeviceController::State::W010);
|
||||||
}
|
}
|
||||||
if (modCond.coinSafe==201) { // full
|
if (modCond.coinSafe==201) { // full
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
@@ -338,7 +343,7 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
}
|
}
|
||||||
if (modCond.temper>=200) {
|
if (modCond.temper>=200) {
|
||||||
flag_sendOperate = false;
|
flag_sendOperate = false;
|
||||||
this->private_sendDiagEvent(DeviceController::State::E004);
|
this->private_sendDiagEvent(DeviceController::State::W004);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for warnings
|
// check for warnings
|
||||||
@@ -449,6 +454,10 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
|||||||
parameter = "coin escrow";
|
parameter = "coin escrow";
|
||||||
this->_isErrorState = true;
|
this->_isErrorState = true;
|
||||||
break;
|
break;
|
||||||
|
case DeviceController::State::W010: // coin escrow
|
||||||
|
eventClass = EVENT_CLASS::WARNING;
|
||||||
|
parameter = "coin escrow";
|
||||||
|
break;
|
||||||
case DeviceController::State::E011: // mem error int.ee.
|
case DeviceController::State::E011: // mem error int.ee.
|
||||||
eventClass = EVENT_CLASS::ERROR;
|
eventClass = EVENT_CLASS::ERROR;
|
||||||
parameter = "mem error int.ee.";
|
parameter = "mem error int.ee.";
|
||||||
@@ -506,10 +515,8 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
|||||||
parameter = "no valid data from DeviceController";
|
parameter = "no valid data from DeviceController";
|
||||||
break;
|
break;
|
||||||
case DeviceController::State::E255: // no valid data from DeviceController
|
case DeviceController::State::E255: // no valid data from DeviceController
|
||||||
eventClass = EVENT_CLASS::STATE;
|
eventClass = EVENT_CLASS::ERROR;
|
||||||
parameter = "";
|
parameter = "no valid data from DeviceController";
|
||||||
qCritical() << " ... ignore " << QMetaEnum::fromType<DeviceController::State>().valueToKey(result);
|
|
||||||
return;
|
|
||||||
break;
|
break;
|
||||||
case DeviceController::State::O000: // everything is fine
|
case DeviceController::State::O000: // everything is fine
|
||||||
this->machineEventSet.clear();
|
this->machineEventSet.clear();
|
||||||
@@ -545,6 +552,16 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
|||||||
|
|
||||||
this->lastState = result;
|
this->lastState = result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Variant: send 'parameter' as JSON:
|
||||||
|
*
|
||||||
|
JSON::setPrettySerialize(false);
|
||||||
|
JSON::JsonObject json = JSON::objectBuilder()
|
||||||
|
->set("description", parameter)
|
||||||
|
->create();
|
||||||
|
QString parameterJsonString = JSON::serialize(json);
|
||||||
|
*/
|
||||||
|
|
||||||
ATBMachineEvent *machineEvent = new ATBMachineEvent(
|
ATBMachineEvent *machineEvent = new ATBMachineEvent(
|
||||||
eventId,
|
eventId,
|
||||||
"DC",
|
"DC",
|
||||||
@@ -555,8 +572,6 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
|
|||||||
"" // second level info
|
"" // second level info
|
||||||
);
|
);
|
||||||
|
|
||||||
//emit diagResponse(machineEvent);
|
|
||||||
|
|
||||||
QCoreApplication::postEvent(eventReceiver, machineEvent);
|
QCoreApplication::postEvent(eventReceiver, machineEvent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,7 @@ namespace DeviceController {
|
|||||||
E008,
|
E008,
|
||||||
E009,
|
E009,
|
||||||
E010,
|
E010,
|
||||||
|
W010, // Coin Escrow
|
||||||
E011,
|
E011,
|
||||||
|
|
||||||
E018,
|
E018,
|
||||||
|
Reference in New Issue
Block a user