Compare commits
	
		
			5 Commits
		
	
	
		
			2.2.9
			...
			pu/klaiped
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						2d60a7bd5c
	
				 | 
					
					
						|||
| 
						
						
							
						
						6d7d9ade70
	
				 | 
					
					
						|||
| 
						
						
							
						
						72dbc8b858
	
				 | 
					
					
						|||
| 
						
						
							
						
						32d70abf44
	
				 | 
					
					
						|||
| 
						
						
							
						
						c076090e03
	
				 | 
					
					
						
@@ -654,10 +654,21 @@ void ATBDeviceControllerPlugin::requestPrintReceipt(const QHash<QString, QVarian
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void ATBDeviceControllerPlugin::requestPrintReceipt(const QString & printingString)
 | 
					void ATBDeviceControllerPlugin::requestPrintReceipt(const QString & printingString)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    QByteArray ba = printingString.toUtf8();
 | 
					    QByteArray ba_receipt = this->codec->fromUnicode(printingString);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //QByteArray ba = printingString.toUtf8();
 | 
				
			||||||
    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_receipt);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // DEBUG
 | 
				
			||||||
 | 
					    //qCritical() << "---------------------------------------------------------------";
 | 
				
			||||||
 | 
					    //qCritical() << "ATBDeviceControllerPlugin::requestPrintReceipt()";
 | 
				
			||||||
 | 
					    //qCritical() << "    receipt data:";
 | 
				
			||||||
 | 
					    //qCritical() << QString(ba_receipt);
 | 
				
			||||||
 | 
					    //qCritical() << "---------------------------------------------------------------";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this->printResultCheckCounter = 0;
 | 
					    this->printResultCheckCounter = 0;
 | 
				
			||||||
    QTimer::singleShot(4000, this, SLOT(onPrinterWaitForPrintingReceipt()));
 | 
					    QTimer::singleShot(4000, this, SLOT(onPrinterWaitForPrintingReceipt()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -983,6 +994,9 @@ void ATBDeviceControllerPlugin::prepareDynTemplateData()
 | 
				
			|||||||
    case nsDeviceControllerInterface::TICKET_VARIANT::STOP_RECEIPT:
 | 
					    case nsDeviceControllerInterface::TICKET_VARIANT::STOP_RECEIPT:
 | 
				
			||||||
        private_setupDynTemplatData_STOP_RECEIPT(dynTicketData, this->currentTicket);
 | 
					        private_setupDynTemplatData_STOP_RECEIPT(dynTicketData, this->currentTicket);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					    case nsDeviceControllerInterface::TICKET_VARIANT::FINE_PAYMENT:
 | 
				
			||||||
 | 
					        private_setupDynTemplatData_FINE_PAYMENT(dynTicketData, this->currentTicket);
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
    case nsDeviceControllerInterface::TICKET_VARIANT::RECEIPT:
 | 
					    case nsDeviceControllerInterface::TICKET_VARIANT::RECEIPT:
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case nsDeviceControllerInterface::TICKET_VARIANT::ERROR_RECEIPT:
 | 
					    case nsDeviceControllerInterface::TICKET_VARIANT::ERROR_RECEIPT:
 | 
				
			||||||
@@ -1091,6 +1105,27 @@ void ATBDeviceControllerPlugin::private_setupDynTemplatData_FOOD_STAMP(struct T_
 | 
				
			|||||||
    qCritical() << "-------------------------------------------------------";
 | 
					    qCritical() << "-------------------------------------------------------";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void ATBDeviceControllerPlugin::private_setupDynTemplatData_FINE_PAYMENT(struct T_dynDat *dynTicketData,   Ticket *ticket)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    QDateTime currentDateTime    = QDateTime::fromString(ticket->getPrintingData()["currentDateTime"].toString(), Qt::ISODate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    QString currentDateString    = this->printerLocale.toString(currentDateTime.date(),    QLocale::ShortFormat);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 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));  // Szeged
 | 
				
			||||||
 | 
					    memcpy((char*)dynTicketData->dynDat6,       ba_amount.data(), std::min(ba_amount.size(),8));  // Schoenau
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    QByteArray ba_currentDate = codec->fromUnicode(currentDateString);
 | 
				
			||||||
 | 
					    memcpy((char*)dynTicketData->currentDate,   ba_currentDate.data(), std::min(ba_currentDate.size(),8));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    QByteArray ba_ticketId = codec->fromUnicode(ticket->getPrintingData()["ticketId"].toString());
 | 
				
			||||||
 | 
					    memcpy((char*)dynTicketData->dynDat7,       ba_amount.data(), std::min(ba_ticketId.size(),8));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/************************************************************************************************
 | 
					/************************************************************************************************
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -144,6 +144,7 @@ private:
 | 
				
			|||||||
   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);
 | 
				
			||||||
 | 
					   void private_setupDynTemplatData_FINE_PAYMENT(struct T_dynDat *dynTicketData,   Ticket *ticket);
 | 
				
			||||||
   // ---------------------------------------------------------------------------------------------
 | 
					   // ---------------------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private slots:
 | 
					private slots:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,6 +5,8 @@
 | 
				
			|||||||
#include <QUuid>
 | 
					#include <QUuid>
 | 
				
			||||||
#include <QDebug>
 | 
					#include <QDebug>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QProcess>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "support/JSON.h"
 | 
					#include "support/JSON.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -18,6 +20,7 @@ DeviceControllerDiag::DeviceControllerDiag(PersistentData *pData, QObject *paren
 | 
				
			|||||||
    , lastState(DeviceController::State::INITIAL_STATE)
 | 
					    , lastState(DeviceController::State::INITIAL_STATE)
 | 
				
			||||||
    , _isErrorState(false)
 | 
					    , _isErrorState(false)
 | 
				
			||||||
    , pData(pData)
 | 
					    , pData(pData)
 | 
				
			||||||
 | 
					    , E255counter(0)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    diagRequestTimeoutTimer = new QTimer(this);
 | 
					    diagRequestTimeoutTimer = new QTimer(this);
 | 
				
			||||||
    diagRequestTimeoutTimer->setInterval(1000*45);
 | 
					    diagRequestTimeoutTimer->setInterval(1000*45);
 | 
				
			||||||
@@ -104,14 +107,20 @@ void DeviceControllerDiag::private_startDiag()
 | 
				
			|||||||
        this->private_sendDiagEvent(DeviceController::State::E255);
 | 
					        this->private_sendDiagEvent(DeviceController::State::E255);
 | 
				
			||||||
        this->isRequestRunning  = false;
 | 
					        this->isRequestRunning  = false;
 | 
				
			||||||
        this->flagInterruptDiag = false;
 | 
					        this->flagInterruptDiag = false;
 | 
				
			||||||
 | 
					        if (this->E255counter > 5) {
 | 
				
			||||||
 | 
					            this->restartCArun();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else {
 | 
				
			||||||
 | 
					            this->E255counter++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // try it again, until success:
 | 
					            // try it again, until success:
 | 
				
			||||||
        QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
 | 
					            QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
 | 
				
			||||||
        /**
 | 
					            /**
 | 
				
			||||||
         * But please note:
 | 
					             * But please note:
 | 
				
			||||||
         * - diag does currently not stop suspend (start a background task)
 | 
					             * - diag does currently not stop suspend (start a background task)
 | 
				
			||||||
         * - diag is called again in ModeOOO wokeup()
 | 
					             * - diag is called again in ModeOOO wokeup()
 | 
				
			||||||
         */
 | 
					             */
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -146,6 +155,8 @@ void DeviceControllerDiag::sys_superviseSystem()
 | 
				
			|||||||
        this->private_sendDiagEvent(DeviceController::State::E255);
 | 
					        this->private_sendDiagEvent(DeviceController::State::E255);
 | 
				
			||||||
        this->flagInterruptDiag = false;
 | 
					        this->flagInterruptDiag = false;
 | 
				
			||||||
        this->isRequestRunning  = false;
 | 
					        this->isRequestRunning  = false;
 | 
				
			||||||
 | 
					        if (this->E255counter > 5) { this->restartCArun(); }
 | 
				
			||||||
 | 
					                              else { this->E255counter++; }
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -156,6 +167,8 @@ void DeviceControllerDiag::sys_superviseSystem()
 | 
				
			|||||||
        this->private_sendDiagEvent(DeviceController::State::E254);
 | 
					        this->private_sendDiagEvent(DeviceController::State::E254);
 | 
				
			||||||
        this->diagRequestTimeoutTimer->stop();
 | 
					        this->diagRequestTimeoutTimer->stop();
 | 
				
			||||||
        this->isRequestRunning  = false;
 | 
					        this->isRequestRunning  = false;
 | 
				
			||||||
 | 
					        if (this->E255counter > 5) { this->restartCArun(); }
 | 
				
			||||||
 | 
					                              else { this->E255counter++; }
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -168,7 +181,7 @@ void DeviceControllerDiag::sys_superviseSystem()
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        // noch keine Testergebnisse
 | 
					        // noch keine Testergebnisse
 | 
				
			||||||
        if (dynMaCond.startupTestIsRunning) {
 | 
					        if (dynMaCond.startupTestIsRunning) {
 | 
				
			||||||
            // TODO?
 | 
					            qCritical() << "            startupTestIsRunning --> call again";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -570,6 +583,10 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
 | 
				
			|||||||
        eventClass = EVENT_CLASS::WARNING;
 | 
					        eventClass = EVENT_CLASS::WARNING;
 | 
				
			||||||
        parameter  = "temperatur warning";
 | 
					        parameter  = "temperatur warning";
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					    case DeviceController::State::W255:   // restart carun
 | 
				
			||||||
 | 
					        eventClass = EVENT_CLASS::WARNING;
 | 
				
			||||||
 | 
					        parameter  = "restart carun";
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this->lastState = result;
 | 
					    this->lastState = result;
 | 
				
			||||||
@@ -599,3 +616,13 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * reset / restart / reinit deviceController
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void DeviceControllerDiag::restartCArun()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    this->E255counter = 0;
 | 
				
			||||||
 | 
					    this->private_sendDiagEvent(DeviceController::State::W255);
 | 
				
			||||||
 | 
					    QProcess::startDetached("/bin/systemctl", {"restart", "carun"});
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,6 +55,8 @@ namespace DeviceController {
 | 
				
			|||||||
        W003,
 | 
					        W003,
 | 
				
			||||||
        W004,
 | 
					        W004,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        W255,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        INITIAL_STATE
 | 
					        INITIAL_STATE
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
    Q_ENUM_NS(State)
 | 
					    Q_ENUM_NS(State)
 | 
				
			||||||
@@ -94,6 +96,11 @@ public slots:
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    void diagReInit();
 | 
					    void diagReInit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * reset / restart / reinit deviceController
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    void restartCArun();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
signals:
 | 
					signals:
 | 
				
			||||||
    void diagResponse(ATBMachineEvent* machineEvent);
 | 
					    void diagResponse(ATBMachineEvent* machineEvent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -118,6 +125,8 @@ private:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    PersistentData* pData;
 | 
					    PersistentData* pData;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    int E255counter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private slots:
 | 
					private slots:
 | 
				
			||||||
    void onDiagRequestTimeoutTimerTimeout();
 | 
					    void onDiagRequestTimeoutTimerTimeout();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -126,7 +135,6 @@ private slots:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    void sys_superviseSystem();
 | 
					    void sys_superviseSystem();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // DEVICECONTROLLERDIAG_H
 | 
					#endif // DEVICECONTROLLERDIAG_H
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -203,7 +203,7 @@ signals:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Q_DECLARE_INTERFACE(DeviceControllerInterface,
 | 
					Q_DECLARE_INTERFACE(DeviceControllerInterface,
 | 
				
			||||||
                    "eu.atb.ptu.plugin.DeviceControllerInterface/1.1.4")
 | 
					                    "eu.atb.ptu.plugin.DeviceControllerInterface/1.1.5")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace nsDeviceControllerInterface {
 | 
					namespace nsDeviceControllerInterface {
 | 
				
			||||||
@@ -236,6 +236,7 @@ namespace nsDeviceControllerInterface {
 | 
				
			|||||||
        ERROR_RECEIPT,
 | 
					        ERROR_RECEIPT,
 | 
				
			||||||
        START_RECEIPT,   // e.g. Szeged Start
 | 
					        START_RECEIPT,   // e.g. Szeged Start
 | 
				
			||||||
        STOP_RECEIPT,    // e.g. Szeged Stop
 | 
					        STOP_RECEIPT,    // e.g. Szeged Stop
 | 
				
			||||||
 | 
					        FINE_PAYMENT,    // e.g. Klaipeda
 | 
				
			||||||
        FOOD_STAMP
 | 
					        FOOD_STAMP
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -64,6 +64,9 @@ bool Ticket::initNew(TICKET_VARIANT ticketVariant, const QList<quint8> & templat
 | 
				
			|||||||
    case TICKET_VARIANT::STOP_RECEIPT:
 | 
					    case TICKET_VARIANT::STOP_RECEIPT:
 | 
				
			||||||
        this->_templateList << 24 << 25 << 26;
 | 
					        this->_templateList << 24 << 25 << 26;
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					    case TICKET_VARIANT::FINE_PAYMENT:
 | 
				
			||||||
 | 
					        this->_templateList << 24 << 25 << 26;
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
    case TICKET_VARIANT::FOOD_STAMP:
 | 
					    case TICKET_VARIANT::FOOD_STAMP:
 | 
				
			||||||
         if (printingData.contains("dyn1_list")) {
 | 
					         if (printingData.contains("dyn1_list")) {
 | 
				
			||||||
            this->_hasTemplateDynData = true;
 | 
					            this->_hasTemplateDynData = true;
 | 
				
			||||||
@@ -160,6 +163,9 @@ QDebug operator<<(QDebug debug, TICKET_VARIANT ticketVariant)
 | 
				
			|||||||
        case TICKET_VARIANT::STOP_RECEIPT:
 | 
					        case TICKET_VARIANT::STOP_RECEIPT:
 | 
				
			||||||
            debug << "TICKET_VARIANT::STOP_RECEIPT";
 | 
					            debug << "TICKET_VARIANT::STOP_RECEIPT";
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					        case TICKET_VARIANT::FINE_PAYMENT:
 | 
				
			||||||
 | 
					            debug << "TICKET_VARIANT::FINE_PAYMENT";
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
        case TICKET_VARIANT::FOOD_STAMP:
 | 
					        case TICKET_VARIANT::FOOD_STAMP:
 | 
				
			||||||
            debug << "TICKET_VARIANT::FOOD_STAMP";
 | 
					            debug << "TICKET_VARIANT::FOOD_STAMP";
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user