Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ae59e77dba | |||
| 34023bd82f | |||
| f7e9c74dde | |||
|
7a9f523b59
|
|||
|
9d81e1217e
|
|||
|
feb53f8174
|
|||
|
60f7a79dbe
|
|||
|
238ea71280
|
|||
|
eb33c4e920
|
|||
|
26c2120743
|
|||
|
2452499073
|
|||
|
420ca94f41
|
|||
|
5fef45ba3e
|
|||
|
5c40e088aa
|
|||
|
577411289e
|
|||
|
cc27b982ff
|
@@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
|
|
||||||
ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent)
|
ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent)
|
||||||
: isMaster(false)
|
: currentProgramMode(PROGRAM_MODE::INIT)
|
||||||
|
, isMaster(false)
|
||||||
, pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
, pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
||||||
, eventReceiver(nullptr)
|
, eventReceiver(nullptr)
|
||||||
, latestAccountNumber(0)
|
, latestAccountNumber(0)
|
||||||
@@ -43,11 +44,18 @@ 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";
|
||||||
@@ -125,7 +133,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 = "ISO 8859-1";
|
printerEncoding = "Windows-1250";
|
||||||
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);
|
||||||
@@ -291,12 +299,14 @@ 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()
|
||||||
@@ -304,12 +314,19 @@ 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()
|
||||||
@@ -817,13 +834,19 @@ 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(8,12,0,0);
|
hw->prn_setFonts(printerDefaultFont.font,
|
||||||
hw->prn_sendText(&ba_receipt);
|
printerDefaultFont.size,
|
||||||
|
printerDefaultFont.width,
|
||||||
|
printerDefaultFont.height);
|
||||||
|
|
||||||
|
qCritical().noquote() << ba_receipt.toHex(' ');
|
||||||
|
hw->prn_sendText(&ba_receipt);
|
||||||
// DEBUG
|
// DEBUG
|
||||||
//qCritical() << "---------------------------------------------------------------";
|
//qCritical() << "---------------------------------------------------------------";
|
||||||
//qCritical() << "ATBDeviceControllerPlugin::requestPrintReceipt()";
|
//qCritical() << "ATBDeviceControllerPlugin::requestPrintReceipt()";
|
||||||
@@ -838,6 +861,73 @@ 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();
|
||||||
@@ -884,6 +974,53 @@ 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)
|
||||||
{
|
{
|
||||||
@@ -1928,8 +2065,17 @@ int ATBDeviceControllerPlugin::init_sc_dbus()
|
|||||||
|
|
||||||
void ATBDeviceControllerPlugin::onWokeUp(uchar source)
|
void ATBDeviceControllerPlugin::onWokeUp(uchar source)
|
||||||
{
|
{
|
||||||
if (source == 0x01 || source == 0xFE) {
|
/* PTU5 wakeup sources:
|
||||||
// woke up from device controller
|
* 0x01 - on wakeup from DeviceController
|
||||||
|
* 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,6 +25,23 @@ 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
|
||||||
@@ -62,6 +79,9 @@ 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();
|
||||||
@@ -100,6 +120,8 @@ private:
|
|||||||
|
|
||||||
QString serialPortName;
|
QString serialPortName;
|
||||||
|
|
||||||
|
PROGRAM_MODE currentProgramMode;
|
||||||
|
|
||||||
bool useDebug;
|
bool useDebug;
|
||||||
|
|
||||||
bool isMaster;
|
bool isMaster;
|
||||||
@@ -121,6 +143,8 @@ private:
|
|||||||
|
|
||||||
QTextCodec *codec;
|
QTextCodec *codec;
|
||||||
|
|
||||||
|
PrinterDefaultsFont printerDefaultFont;
|
||||||
|
|
||||||
bool private_loadCashAgentLib(QString pluginName);
|
bool private_loadCashAgentLib(QString pluginName);
|
||||||
|
|
||||||
quint8 currentSelectedTicketType;
|
quint8 currentSelectedTicketType;
|
||||||
@@ -164,6 +188,7 @@ 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)) {
|
||||||
machineEventSet.insert(E255Event);
|
this->private_setDiagEvent(DeviceController::State::E255);
|
||||||
private_sendDiagEvent(E255Event, DeviceController::Action::SET);
|
this->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->isRequestRunning = false;
|
this->private_finishDiag(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::W255));
|
this->machineEventSet.remove(DCMachineEvent(DeviceController::State::M0255));
|
||||||
QTimer::singleShot(200, this, &DeviceControllerDiag::sys_superviseSystem);
|
QTimer::singleShot(200, this, &DeviceControllerDiag::sys_superviseSystem);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -178,15 +178,16 @@ 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)) {
|
||||||
machineEventSet.insert(E255Event);
|
this->private_setDiagEvent(DeviceController::State::E255);
|
||||||
private_sendDiagEvent(E255Event, DeviceController::Action::SET);
|
this->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->isRequestRunning = false;
|
this->private_finishDiag(false);
|
||||||
this->flagInterruptDiag = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,16 +197,14 @@ 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 E255Event = DCMachineEvent(DeviceController::State::M0254);
|
DCMachineEvent M0254Event = DCMachineEvent(DeviceController::State::M0254);
|
||||||
previousMachineEventSet.insert(E255Event);
|
this->private_setDiagEvent(DeviceController::State::M0254);
|
||||||
private_sendDiagEvent(E255Event, DeviceController::Action::SET);
|
this->private_sendDiagEvent(M0254Event, 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,7 +476,7 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
|
|
||||||
|
|
||||||
// finish diag
|
// finish diag
|
||||||
this->private_finishDiag();
|
this->private_finishDiag(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -486,14 +485,20 @@ void DeviceControllerDiag::sub_componentAssessment()
|
|||||||
* Single point to finish a diag process:
|
* Single point to finish a diag process:
|
||||||
* -
|
* -
|
||||||
*/
|
*/
|
||||||
void DeviceControllerDiag::private_finishDiag()
|
void DeviceControllerDiag::private_finishDiag(bool dataValid)
|
||||||
{
|
{
|
||||||
this->diagRequestTimeoutTimer->stop();
|
this->diagRequestTimeoutTimer->stop();
|
||||||
this->isRequestRunning = false;
|
this->isRequestRunning = false;
|
||||||
this->flagInterruptDiag = false;
|
this->flagInterruptDiag = false;
|
||||||
|
|
||||||
this->previousMachineEventSet.unite(machineEventSet); // add new elements from machineEventSet
|
// add new elements from machineEventSet
|
||||||
this->previousMachineEventSet.intersect(machineEventSet); // remove elements not in machineEventSet
|
this->previousMachineEventSet.unite(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;
|
||||||
@@ -680,8 +685,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::W255: // restart carun
|
case DeviceController::State::M0255: // restart carun
|
||||||
eventClass = EVENT_CLASS::WARNING;
|
eventClass = EVENT_CLASS::STATE;
|
||||||
parameter = "restart carun";
|
parameter = "restart carun";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -722,10 +727,10 @@ void DeviceControllerDiag::restartCArun()
|
|||||||
this->E255counter = 0;
|
this->E255counter = 0;
|
||||||
|
|
||||||
|
|
||||||
DCMachineEvent W255Event = DCMachineEvent(DeviceController::State::W255);
|
DCMachineEvent M0255Event = DCMachineEvent(DeviceController::State::M0255);
|
||||||
if (!this->previousMachineEventSet.contains(W255Event)) {
|
if (!this->previousMachineEventSet.contains(M0255Event)) {
|
||||||
machineEventSet.insert(W255Event);
|
machineEventSet.insert(M0255Event);
|
||||||
private_sendDiagEvent(W255Event, DeviceController::Action::SET);
|
private_sendDiagEvent(M0255Event, DeviceController::Action::SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
QProcess::startDetached("/bin/systemctl", {"restart", "carun"});
|
QProcess::startDetached("/bin/systemctl", {"restart", "carun"});
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ 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,
|
||||||
|
|
||||||
@@ -57,8 +58,6 @@ namespace DeviceController {
|
|||||||
W003,
|
W003,
|
||||||
W004,
|
W004,
|
||||||
|
|
||||||
W255,
|
|
||||||
|
|
||||||
INITIAL_STATE
|
INITIAL_STATE
|
||||||
};
|
};
|
||||||
Q_ENUM_NS(State)
|
Q_ENUM_NS(State)
|
||||||
@@ -171,7 +170,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();
|
void private_finishDiag(bool dataValid = false);
|
||||||
|
|
||||||
void sys_superviseSystem();
|
void sys_superviseSystem();
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,9 @@ 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;
|
||||||
@@ -115,6 +118,10 @@ 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