Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
7d5d3b4de0
|
|||
|
4a0418611e
|
|||
|
6a667d03ea
|
|||
|
232deb9245
|
@@ -24,8 +24,7 @@
|
|||||||
|
|
||||||
|
|
||||||
ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent)
|
ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent)
|
||||||
: currentProgramMode(PROGRAM_MODE::INIT)
|
: isMaster(false)
|
||||||
, isMaster(false)
|
|
||||||
, pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
, pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
||||||
, eventReceiver(nullptr)
|
, eventReceiver(nullptr)
|
||||||
, latestAccountNumber(0)
|
, latestAccountNumber(0)
|
||||||
@@ -44,18 +43,11 @@ PLUGIN_STATE ATBDeviceControllerPlugin::initDCPlugin(QObject *eventReceiver, con
|
|||||||
// read variables from setting
|
// read variables from setting
|
||||||
this->serialPortName = settings.value("ATBDeviceControllerPlugin/serialPort", "ttymxc2").toString();
|
this->serialPortName = settings.value("ATBDeviceControllerPlugin/serialPort", "ttymxc2").toString();
|
||||||
QByteArray printerEncoding = settings.value("ATBDeviceControllerPlugin/printerEncoding", "ISO 8859-2").toString().toLatin1();
|
QByteArray printerEncoding = settings.value("ATBDeviceControllerPlugin/printerEncoding", "ISO 8859-2").toString().toLatin1();
|
||||||
// QByteArray printerEncoding = settings.value("ATBDeviceControllerPlugin/printerEncoding", "Windows-1250").toString().toLatin1();
|
|
||||||
QString printerLocaleString = settings.value("ATBDeviceControllerPlugin/printerLocale", "de_DE").toString().toLatin1();
|
QString printerLocaleString = settings.value("ATBDeviceControllerPlugin/printerLocale", "de_DE").toString().toLatin1();
|
||||||
this->printerLocale = QLocale(printerLocaleString);
|
this->printerLocale = QLocale(printerLocaleString);
|
||||||
|
|
||||||
this->initTicketTemplateList(&settings);
|
this->initTicketTemplateList(&settings);
|
||||||
|
|
||||||
// configurable default printer settings for 'prn_sendText()' used e.g. for bank receipts
|
|
||||||
this->printerDefaultFont.font = settings.value("ATBDeviceControllerPlugin/printerDefaultFont", "8").toUInt();
|
|
||||||
this->printerDefaultFont.size = settings.value("ATBDeviceControllerPlugin/printerDefaultSize", "12").toUInt();
|
|
||||||
this->printerDefaultFont.width = settings.value("ATBDeviceControllerPlugin/printerDefaultWidth", "0").toUInt();
|
|
||||||
this->printerDefaultFont.height = settings.value("ATBDeviceControllerPlugin/printerDefaultHeight", "0").toUInt();
|
|
||||||
|
|
||||||
this->init_sc_dbus();
|
this->init_sc_dbus();
|
||||||
|
|
||||||
QString persistentDataFile = "/mnt/system_data/dc_persistentData.dat";
|
QString persistentDataFile = "/mnt/system_data/dc_persistentData.dat";
|
||||||
@@ -133,7 +125,7 @@ PLUGIN_STATE ATBDeviceControllerPlugin::initDCPlugin(QObject *eventReceiver, con
|
|||||||
this->codec = QTextCodec::codecForName(printerEncoding);
|
this->codec = QTextCodec::codecForName(printerEncoding);
|
||||||
|
|
||||||
if (this->codec == nullptr) {
|
if (this->codec == nullptr) {
|
||||||
printerEncoding = "Windows-1250";
|
printerEncoding = "ISO 8859-1";
|
||||||
qCritical() << "ATBDeviceControllerPlugin: ERROR: printer encoding \"" << printerEncoding << "\" is not supported!";
|
qCritical() << "ATBDeviceControllerPlugin: ERROR: printer encoding \"" << printerEncoding << "\" is not supported!";
|
||||||
qCritical() << " ... use default encoding: " << printerEncoding;
|
qCritical() << " ... use default encoding: " << printerEncoding;
|
||||||
this->codec = QTextCodec::codecForName(printerEncoding);
|
this->codec = QTextCodec::codecForName(printerEncoding);
|
||||||
@@ -299,14 +291,12 @@ void ATBDeviceControllerPlugin::onChangedProgramModeToSELL()
|
|||||||
hw->dc_autoRequest(true);
|
hw->dc_autoRequest(true);
|
||||||
hw->rtc_setDateTime();
|
hw->rtc_setDateTime();
|
||||||
hw->mdb_switchWake(0); // wakeup MDB components
|
hw->mdb_switchWake(0); // wakeup MDB components
|
||||||
this->currentProgramMode = PROGRAM_MODE::SELL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::onChangedProgramModeToSERVICE()
|
void ATBDeviceControllerPlugin::onChangedProgramModeToSERVICE()
|
||||||
{
|
{
|
||||||
hw->dc_autoRequest(true);
|
hw->dc_autoRequest(true);
|
||||||
hw->mdb_switchWake(0); // wakeup MDB components
|
hw->mdb_switchWake(0); // wakeup MDB components
|
||||||
this->currentProgramMode = PROGRAM_MODE::SERVICE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::onChangedProgramModeToIDLE()
|
void ATBDeviceControllerPlugin::onChangedProgramModeToIDLE()
|
||||||
@@ -314,19 +304,12 @@ void ATBDeviceControllerPlugin::onChangedProgramModeToIDLE()
|
|||||||
hw->dc_autoRequest(true);
|
hw->dc_autoRequest(true);
|
||||||
this->diag->diagRequest();
|
this->diag->diagRequest();
|
||||||
hw->mdb_switchWake(1);
|
hw->mdb_switchWake(1);
|
||||||
this->currentProgramMode = PROGRAM_MODE::IDLE;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::onChangedProgramModeToOOO()
|
void ATBDeviceControllerPlugin::onChangedProgramModeToOOO()
|
||||||
{
|
{
|
||||||
// trigger diagRequest on SERVICE -> IDLE
|
|
||||||
if (this->currentProgramMode == PROGRAM_MODE::SERVICE) {
|
|
||||||
hw->dc_autoRequest(true);
|
|
||||||
this->diag->diagRequest();
|
|
||||||
hw->mdb_switchWake(1);
|
|
||||||
}
|
|
||||||
this->currentProgramMode = PROGRAM_MODE::OOO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::requestDiag()
|
void ATBDeviceControllerPlugin::requestDiag()
|
||||||
@@ -834,19 +817,13 @@ void ATBDeviceControllerPlugin::requestPrintReceipt(const QHash<QString, QVarian
|
|||||||
|
|
||||||
void ATBDeviceControllerPlugin::requestPrintReceipt(const QString & printingString)
|
void ATBDeviceControllerPlugin::requestPrintReceipt(const QString & printingString)
|
||||||
{
|
{
|
||||||
this->codec = QTextCodec::codecForName("ISO 8859-2");
|
|
||||||
|
|
||||||
QByteArray ba_receipt = this->codec->fromUnicode(printingString);
|
QByteArray ba_receipt = this->codec->fromUnicode(printingString);
|
||||||
|
|
||||||
//QByteArray ba = printingString.toUtf8();
|
//QByteArray ba = printingString.toUtf8();
|
||||||
hw->prn_switchPower(true);
|
hw->prn_switchPower(true);
|
||||||
hw->prn_setFonts(printerDefaultFont.font,
|
hw->prn_setFonts(8,12,0,0);
|
||||||
printerDefaultFont.size,
|
|
||||||
printerDefaultFont.width,
|
|
||||||
printerDefaultFont.height);
|
|
||||||
|
|
||||||
qCritical().noquote() << ba_receipt.toHex(' ');
|
|
||||||
hw->prn_sendText(&ba_receipt);
|
hw->prn_sendText(&ba_receipt);
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
//qCritical() << "---------------------------------------------------------------";
|
//qCritical() << "---------------------------------------------------------------";
|
||||||
//qCritical() << "ATBDeviceControllerPlugin::requestPrintReceipt()";
|
//qCritical() << "ATBDeviceControllerPlugin::requestPrintReceipt()";
|
||||||
@@ -861,73 +838,6 @@ void ATBDeviceControllerPlugin::requestPrintReceipt(const QString & printingStri
|
|||||||
//QTimer::singleShot(2000, this, [this](){ hw->prn_cut(3); } );
|
//QTimer::singleShot(2000, this, [this](){ hw->prn_cut(3); } );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::requestPrintFiscal(const QString & printingString)
|
|
||||||
{
|
|
||||||
this->codec = QTextCodec::codecForName("Windows-1250");
|
|
||||||
|
|
||||||
qCritical() << "Printer codec forced:"
|
|
||||||
<< this->codec->name();
|
|
||||||
|
|
||||||
QByteArray ba_receipt = this->codec->fromUnicode(printingString);
|
|
||||||
|
|
||||||
//QByteArray ba = printingString.toUtf8();
|
|
||||||
hw->prn_switchPower(true);
|
|
||||||
hw->prn_sendPrnSetup(100, 25, 'c', 0);
|
|
||||||
hw->prn_setFonts(printerDefaultFont.font,
|
|
||||||
//printerDefaultFont.size,
|
|
||||||
11,
|
|
||||||
printerDefaultFont.width,
|
|
||||||
printerDefaultFont.height);
|
|
||||||
|
|
||||||
qCritical() << "Receipt bytes (hex):";
|
|
||||||
qCritical().noquote() << ba_receipt.toHex(' ');
|
|
||||||
hw->prn_sendText(&ba_receipt);
|
|
||||||
// DEBUG
|
|
||||||
//qCritical() << "---------------------------------------------------------------";
|
|
||||||
//qCritical() << "ATBDeviceControllerPlugin::requestPrintFiscal()";
|
|
||||||
//qCritical() << " receipt data:";
|
|
||||||
//qCritical() << QString(ba_receipt);
|
|
||||||
//qCritical() << "---------------------------------------------------------------";
|
|
||||||
|
|
||||||
|
|
||||||
this->printResultCheckCounter = 0;
|
|
||||||
//QTimer::singleShot(2000, this, SLOT(onPrinterWaitForPrintingReceipt()));
|
|
||||||
|
|
||||||
//QTimer::singleShot(2000, this, [this](){ hw->prn_cut(3); } );
|
|
||||||
}
|
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::requestPrintQR(const QString & printingString)
|
|
||||||
{
|
|
||||||
QByteArray ba_qr = this->codec->fromUnicode(printingString);
|
|
||||||
|
|
||||||
QString nl = "\n";
|
|
||||||
QByteArray ba_nl = this->codec->fromUnicode(nl);
|
|
||||||
|
|
||||||
//QByteArray ba = printingString.toUtf8();
|
|
||||||
hw->prn_switchPower(true);
|
|
||||||
hw->prn_sendText(&ba_nl);
|
|
||||||
hw->prn_sendQRdata(&ba_qr);
|
|
||||||
hw->prn_printQRcode();
|
|
||||||
hw->prn_sendText(&ba_nl);
|
|
||||||
// DEBUG
|
|
||||||
qCritical() << "---------------------------------------------------------------";
|
|
||||||
qCritical() << "ATBDeviceControllerPlugin::requestPrintQR()";
|
|
||||||
qCritical() << " QR data:";
|
|
||||||
qCritical() << QString(ba_qr);
|
|
||||||
qCritical() << "---------------------------------------------------------------";
|
|
||||||
|
|
||||||
|
|
||||||
this->printResultCheckCounter = 0;
|
|
||||||
//QTimer::singleShot(2000, this, SLOT(onPrinterWaitForPrintingFiscal()));
|
|
||||||
|
|
||||||
//QTimer::singleShot(2000, this, [this](){ hw->prn_cut(3); } );
|
|
||||||
}
|
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::requestPrintCut(const qint16 & printTimer)
|
|
||||||
{
|
|
||||||
QTimer::singleShot(printTimer, this, SLOT(onPrinterWaitForPrintingReceipt()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::onPrinterWaitForPrintingReceipt()
|
void ATBDeviceControllerPlugin::onPrinterWaitForPrintingReceipt()
|
||||||
{
|
{
|
||||||
quint8 printerResult = this->hw->prn_getPrintResult();
|
quint8 printerResult = this->hw->prn_getPrintResult();
|
||||||
@@ -974,53 +884,6 @@ void ATBDeviceControllerPlugin::onPrinterWaitForPrintingReceipt()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::onPrinterWaitForPrintingFiscal()
|
|
||||||
{
|
|
||||||
quint8 printerResult = this->hw->prn_getPrintResult();
|
|
||||||
|
|
||||||
switch (printerResult) {
|
|
||||||
case 0: // still printing
|
|
||||||
qCritical() << "--> printer: WaitForPrintingReceipt";
|
|
||||||
QTimer::singleShot(2000, this, SLOT(onPrinterWaitForPrintingReceipt()));
|
|
||||||
break;
|
|
||||||
case 1: // printing finished, Ok
|
|
||||||
qCritical() << "DC Finished printing fiscal";
|
|
||||||
emit this->printFiscalFinished(nsDeviceControllerInterface::RESULT_STATE::SUCCESS,
|
|
||||||
// TODO: TicketNumber
|
|
||||||
"",
|
|
||||||
"");
|
|
||||||
hw->prn_switchPower(true);
|
|
||||||
QTimer::singleShot(200, this, [this](){ hw->prn_cut(3); } );
|
|
||||||
break;
|
|
||||||
case 2: // printing finished, Error
|
|
||||||
qCritical() << "DC Error: wait for printing fiscal";
|
|
||||||
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
|
|
||||||
|
|
||||||
emit this->printFiscalFinished(nsDeviceControllerInterface::RESULT_STATE::ERROR_BACKEND,
|
|
||||||
this->errorCode,
|
|
||||||
this->errorDescription);
|
|
||||||
hw->prn_switchPower(true);
|
|
||||||
QTimer::singleShot(200, this, [this](){ hw->prn_cut(3); } );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
qCritical() << "DC Error: wait for printing fiscal: printerResult = " << printerResult;
|
|
||||||
this->errorCode = "PRINTER"; // TODO: get more detailed error code from low level API
|
|
||||||
this->errorDescription = "Printer error(" + QString(printerResult) + ")";
|
|
||||||
|
|
||||||
emit this->printFiscalFinished(nsDeviceControllerInterface::RESULT_STATE::ERROR_BACKEND,
|
|
||||||
this->errorCode,
|
|
||||||
this->errorDescription);
|
|
||||||
// do an emergency cut
|
|
||||||
hw->prn_switchPower(true);
|
|
||||||
QTimer::singleShot(200, this, [this](){ hw->prn_cut(3); } );
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ATBDeviceControllerPlugin::requestPrintTicket(const QHash<QString, QVariant> & printingData)
|
void ATBDeviceControllerPlugin::requestPrintTicket(const QHash<QString, QVariant> & printingData)
|
||||||
{
|
{
|
||||||
@@ -2065,17 +1928,8 @@ int ATBDeviceControllerPlugin::init_sc_dbus()
|
|||||||
|
|
||||||
void ATBDeviceControllerPlugin::onWokeUp(uchar source)
|
void ATBDeviceControllerPlugin::onWokeUp(uchar source)
|
||||||
{
|
{
|
||||||
/* PTU5 wakeup sources:
|
if (source == 0x01 || source == 0xFE) {
|
||||||
* 0x01 - on wakeup from DeviceController
|
// woke up from device controller
|
||||||
* 0x02 - on wakeup from WakeupButton
|
|
||||||
* 0x03 - on wakeup from ResetKey
|
|
||||||
* 0x04 - on wakeup from rtc
|
|
||||||
* 0xFE - signal emitted by timer (on mains powered machines)
|
|
||||||
* 0xFF - unknown wakeup source
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (source == 0x01 || source == 0x03 || source == 0xFE) {
|
|
||||||
// woke up from device controller, rtc or timer
|
|
||||||
hw->dc_autoRequest(true);
|
hw->dc_autoRequest(true);
|
||||||
this->diag->diagRequest();
|
this->diag->diagRequest();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,23 +25,6 @@ using namespace nsDeviceControllerInterface;
|
|||||||
|
|
||||||
class QSettings;
|
class QSettings;
|
||||||
|
|
||||||
enum class PROGRAM_MODE {
|
|
||||||
INIT,
|
|
||||||
IDLE,
|
|
||||||
SELL,
|
|
||||||
SERVICE,
|
|
||||||
OOO,
|
|
||||||
NOT_DEFINED
|
|
||||||
};
|
|
||||||
|
|
||||||
class PrinterDefaultsFont
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
quint8 font;
|
|
||||||
quint8 size;
|
|
||||||
quint8 width;
|
|
||||||
quint8 height;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ATBDeviceControllerPlugin :
|
class ATBDeviceControllerPlugin :
|
||||||
public DeviceControllerInterface
|
public DeviceControllerInterface
|
||||||
@@ -79,9 +62,6 @@ public:
|
|||||||
void requestPrintTicket(nsDeviceControllerInterface::TICKET_VARIANT ticketVariant, const QHash<QString, QVariant> & printingData);
|
void requestPrintTicket(nsDeviceControllerInterface::TICKET_VARIANT ticketVariant, const QHash<QString, QVariant> & printingData);
|
||||||
void requestPrintReceipt(const QHash<QString, QVariant> & printingData);
|
void requestPrintReceipt(const QHash<QString, QVariant> & printingData);
|
||||||
void requestPrintReceipt(const QString & printingString);
|
void requestPrintReceipt(const QString & printingString);
|
||||||
void requestPrintFiscal(const QString & printingString);
|
|
||||||
void requestPrintQR(const QString & printingString);
|
|
||||||
void requestPrintCut(const qint16 & printTimer);
|
|
||||||
|
|
||||||
// TASKS: Account -------------------------------------------------------------
|
// TASKS: Account -------------------------------------------------------------
|
||||||
void requestAccount();
|
void requestAccount();
|
||||||
@@ -120,8 +100,6 @@ private:
|
|||||||
|
|
||||||
QString serialPortName;
|
QString serialPortName;
|
||||||
|
|
||||||
PROGRAM_MODE currentProgramMode;
|
|
||||||
|
|
||||||
bool useDebug;
|
bool useDebug;
|
||||||
|
|
||||||
bool isMaster;
|
bool isMaster;
|
||||||
@@ -143,8 +121,6 @@ private:
|
|||||||
|
|
||||||
QTextCodec *codec;
|
QTextCodec *codec;
|
||||||
|
|
||||||
PrinterDefaultsFont printerDefaultFont;
|
|
||||||
|
|
||||||
bool private_loadCashAgentLib(QString pluginName);
|
bool private_loadCashAgentLib(QString pluginName);
|
||||||
|
|
||||||
quint8 currentSelectedTicketType;
|
quint8 currentSelectedTicketType;
|
||||||
@@ -188,7 +164,6 @@ private slots:
|
|||||||
void onPrinterPrintNextTemplate();
|
void onPrinterPrintNextTemplate();
|
||||||
void onPrinterWaitForPrintingTicket();
|
void onPrinterWaitForPrintingTicket();
|
||||||
void onPrinterWaitForPrintingReceipt();
|
void onPrinterWaitForPrintingReceipt();
|
||||||
void onPrinterWaitForPrintingFiscal();
|
|
||||||
|
|
||||||
void onPrinterPrepareDynTemplateData();
|
void onPrinterPrepareDynTemplateData();
|
||||||
|
|
||||||
|
|||||||
@@ -113,8 +113,8 @@ void DeviceControllerDiag::private_startDiag()
|
|||||||
qCritical() << "DeviceControllerDiag::private_startDiag() interrupted!";
|
qCritical() << "DeviceControllerDiag::private_startDiag() interrupted!";
|
||||||
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255);
|
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255);
|
||||||
if (!this->previousMachineEventSet.contains(E255Event)) {
|
if (!this->previousMachineEventSet.contains(E255Event)) {
|
||||||
this->private_setDiagEvent(DeviceController::State::E255);
|
machineEventSet.insert(E255Event);
|
||||||
this->private_sendDiagEvent(E255Event, DeviceController::Action::SET);
|
private_sendDiagEvent(E255Event, DeviceController::Action::SET);
|
||||||
}
|
}
|
||||||
if (this->E255counter > 5) {
|
if (this->E255counter > 5) {
|
||||||
this->restartCArun();
|
this->restartCArun();
|
||||||
@@ -132,9 +132,9 @@ void DeviceControllerDiag::private_startDiag()
|
|||||||
* - diag is called again in ModeOOO wokeup()
|
* - diag is called again in ModeOOO wokeup()
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
this->diagRequestTimeoutTimer->stop();
|
||||||
this->private_finishDiag(false);
|
this->isRequestRunning = false;
|
||||||
|
this->flagInterruptDiag = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ void DeviceControllerDiag::private_startDiag()
|
|||||||
if (result) {
|
if (result) {
|
||||||
qCritical() << "DeviceControllerDiag::private_startDiag() DCdata is valid";
|
qCritical() << "DeviceControllerDiag::private_startDiag() DCdata is valid";
|
||||||
this->machineEventSet.remove(DCMachineEvent(DeviceController::State::E255));
|
this->machineEventSet.remove(DCMachineEvent(DeviceController::State::E255));
|
||||||
this->machineEventSet.remove(DCMachineEvent(DeviceController::State::M0255));
|
this->machineEventSet.remove(DCMachineEvent(DeviceController::State::W255));
|
||||||
QTimer::singleShot(200, this, &DeviceControllerDiag::sys_superviseSystem);
|
QTimer::singleShot(200, this, &DeviceControllerDiag::sys_superviseSystem);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -178,16 +178,15 @@ void DeviceControllerDiag::sys_superviseSystem()
|
|||||||
// send
|
// send
|
||||||
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255);
|
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::E255);
|
||||||
if (!this->previousMachineEventSet.contains(E255Event)) {
|
if (!this->previousMachineEventSet.contains(E255Event)) {
|
||||||
this->private_setDiagEvent(DeviceController::State::E255);
|
machineEventSet.insert(E255Event);
|
||||||
this->private_sendDiagEvent(E255Event, DeviceController::Action::SET);
|
private_sendDiagEvent(E255Event, DeviceController::Action::SET);
|
||||||
}
|
}
|
||||||
if (this->E255counter > 5) { this->restartCArun(); }
|
if (this->E255counter > 5) { this->restartCArun(); }
|
||||||
else { this->E255counter++; }
|
else { this->E255counter++; }
|
||||||
|
|
||||||
QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
|
QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
|
||||||
|
this->diagRequestTimeoutTimer->stop();
|
||||||
this->private_finishDiag(false);
|
this->isRequestRunning = false;
|
||||||
|
this->flagInterruptDiag = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,14 +196,16 @@ void DeviceControllerDiag::sys_superviseSystem()
|
|||||||
qCritical() << "DeviceControllerDiag::sys_superviseSystem() no valid data!";
|
qCritical() << "DeviceControllerDiag::sys_superviseSystem() no valid data!";
|
||||||
hw->dc_autoRequest(true);
|
hw->dc_autoRequest(true);
|
||||||
|
|
||||||
DCMachineEvent M0254Event = DCMachineEvent(DeviceController::State::M0254);
|
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::M0254);
|
||||||
this->private_setDiagEvent(DeviceController::State::M0254);
|
previousMachineEventSet.insert(E255Event);
|
||||||
this->private_sendDiagEvent(M0254Event, DeviceController::Action::SET);
|
private_sendDiagEvent(E255Event, DeviceController::Action::SET);
|
||||||
|
|
||||||
if (this->E255counter > 5) { this->restartCArun(); }
|
if (this->E255counter > 5) { this->restartCArun(); }
|
||||||
else { this->E255counter++; }
|
else { this->E255counter++; }
|
||||||
QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
|
QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
|
||||||
this->private_finishDiag(false);
|
this->diagRequestTimeoutTimer->stop();
|
||||||
|
this->isRequestRunning = false;
|
||||||
|
this->flagInterruptDiag = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,7 +477,7 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
|
|
||||||
|
|
||||||
// finish diag
|
// finish diag
|
||||||
this->private_finishDiag(true);
|
this->private_finishDiag();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -485,20 +486,14 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
* Single point to finish a diag process:
|
* Single point to finish a diag process:
|
||||||
* -
|
* -
|
||||||
*/
|
*/
|
||||||
void DeviceControllerDiag::private_finishDiag(bool dataValid)
|
void DeviceControllerDiag::private_finishDiag()
|
||||||
{
|
{
|
||||||
this->diagRequestTimeoutTimer->stop();
|
this->diagRequestTimeoutTimer->stop();
|
||||||
this->isRequestRunning = false;
|
this->isRequestRunning = false;
|
||||||
this->flagInterruptDiag = false;
|
this->flagInterruptDiag = false;
|
||||||
|
|
||||||
// add new elements from machineEventSet
|
this->previousMachineEventSet.unite(machineEventSet); // add new elements from machineEventSet
|
||||||
this->previousMachineEventSet.unite(machineEventSet);
|
this->previousMachineEventSet.intersect(machineEventSet); // remove elements not in machineEventSet
|
||||||
|
|
||||||
if (dataValid) {
|
|
||||||
// remove elements not in machineEventSet
|
|
||||||
// ... only if data is valid
|
|
||||||
this->previousMachineEventSet.intersect(machineEventSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->isDiagBackgroundTask) {
|
if (this->isDiagBackgroundTask) {
|
||||||
this->isDiagBackgroundTask = false;
|
this->isDiagBackgroundTask = false;
|
||||||
@@ -685,8 +680,8 @@ void DeviceControllerDiag::private_sendDiagEvent(DCMachineEvent result, DeviceCo
|
|||||||
eventClass = EVENT_CLASS::WARNING;
|
eventClass = EVENT_CLASS::WARNING;
|
||||||
parameter = "temperatur warning";
|
parameter = "temperatur warning";
|
||||||
break;
|
break;
|
||||||
case DeviceController::State::M0255: // restart carun
|
case DeviceController::State::W255: // restart carun
|
||||||
eventClass = EVENT_CLASS::STATE;
|
eventClass = EVENT_CLASS::WARNING;
|
||||||
parameter = "restart carun";
|
parameter = "restart carun";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -727,10 +722,10 @@ void DeviceControllerDiag::restartCArun()
|
|||||||
this->E255counter = 0;
|
this->E255counter = 0;
|
||||||
|
|
||||||
|
|
||||||
DCMachineEvent M0255Event = DCMachineEvent(DeviceController::State::M0255);
|
DCMachineEvent W255Event = DCMachineEvent(DeviceController::State::W255);
|
||||||
if (!this->previousMachineEventSet.contains(M0255Event)) {
|
if (!this->previousMachineEventSet.contains(W255Event)) {
|
||||||
machineEventSet.insert(M0255Event);
|
machineEventSet.insert(W255Event);
|
||||||
private_sendDiagEvent(M0255Event, DeviceController::Action::SET);
|
private_sendDiagEvent(W255Event, DeviceController::Action::SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
QProcess::startDetached("/bin/systemctl", {"restart", "carun"});
|
QProcess::startDetached("/bin/systemctl", {"restart", "carun"});
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ namespace DeviceController {
|
|||||||
M0252, // cashbox door open
|
M0252, // cashbox door open
|
||||||
M0253, // service or battery door is open
|
M0253, // service or battery door is open
|
||||||
M0254, // no valid data from DC
|
M0254, // no valid data from DC
|
||||||
M0255, // restart carun
|
|
||||||
|
|
||||||
E255,
|
E255,
|
||||||
|
|
||||||
@@ -58,6 +57,8 @@ namespace DeviceController {
|
|||||||
W003,
|
W003,
|
||||||
W004,
|
W004,
|
||||||
|
|
||||||
|
W255,
|
||||||
|
|
||||||
INITIAL_STATE
|
INITIAL_STATE
|
||||||
};
|
};
|
||||||
Q_ENUM_NS(State)
|
Q_ENUM_NS(State)
|
||||||
@@ -170,7 +171,7 @@ private slots:
|
|||||||
void private_setDiagEvent(DeviceController::State result);
|
void private_setDiagEvent(DeviceController::State result);
|
||||||
void private_sendDiagEvent(DCMachineEvent result, DeviceController::Action action);
|
void private_sendDiagEvent(DCMachineEvent result, DeviceController::Action action);
|
||||||
|
|
||||||
void private_finishDiag(bool dataValid = false);
|
void private_finishDiag();
|
||||||
|
|
||||||
void sys_superviseSystem();
|
void sys_superviseSystem();
|
||||||
|
|
||||||
|
|||||||
@@ -77,9 +77,6 @@ public:
|
|||||||
virtual void requestPrintTicket(nsDeviceControllerInterface::TICKET_VARIANT ticketVariant, const QHash<QString, QVariant> & printingData) = 0;
|
virtual void requestPrintTicket(nsDeviceControllerInterface::TICKET_VARIANT ticketVariant, const QHash<QString, QVariant> & printingData) = 0;
|
||||||
virtual void requestPrintReceipt(const QHash<QString, QVariant> & printingData) = 0;
|
virtual void requestPrintReceipt(const QHash<QString, QVariant> & printingData) = 0;
|
||||||
virtual void requestPrintReceipt(const QString & printingString) = 0;
|
virtual void requestPrintReceipt(const QString & printingString) = 0;
|
||||||
virtual void requestPrintFiscal(const QString & printingString) = 0;
|
|
||||||
virtual void requestPrintQR(const QString & printingSTring) = 0;
|
|
||||||
virtual void requestPrintCut(const qint16 & printTimer) = 0;
|
|
||||||
|
|
||||||
// read coin/cash processing variants
|
// read coin/cash processing variants
|
||||||
virtual nsDeviceControllerInterface::COIN_PROCESSOR coinProcessor() = 0;
|
virtual nsDeviceControllerInterface::COIN_PROCESSOR coinProcessor() = 0;
|
||||||
@@ -118,10 +115,6 @@ signals:
|
|||||||
void printReceiptFinished(nsDeviceControllerInterface::RESULT_STATE resultState,
|
void printReceiptFinished(nsDeviceControllerInterface::RESULT_STATE resultState,
|
||||||
const QString & errorCode,
|
const QString & errorCode,
|
||||||
const QString & errorDescription);
|
const QString & errorDescription);
|
||||||
void printFiscalFinished(nsDeviceControllerInterface::RESULT_STATE resultState,
|
|
||||||
const QString & errorCode,
|
|
||||||
const QString & errorDescription);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void coinAttached();
|
void coinAttached();
|
||||||
|
|||||||
Reference in New Issue
Block a user