Compare commits
	
		
			6 Commits
		
	
	
		
			2.2.7
			...
			pu/klaiped
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						2d60a7bd5c
	
				 | 
					
					
						|||
| 
						
						
							
						
						6d7d9ade70
	
				 | 
					
					
						|||
| 
						
						
							
						
						72dbc8b858
	
				 | 
					
					
						|||
| 
						
						
							
						
						32d70abf44
	
				 | 
					
					
						|||
| 
						
						
							
						
						c076090e03
	
				 | 
					
					
						|||
| 
						
						
							
						
						6c2717c56b
	
				 | 
					
					
						
@@ -654,10 +654,21 @@ void ATBDeviceControllerPlugin::requestPrintReceipt(const QHash<QString, QVarian
 | 
			
		||||
 | 
			
		||||
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_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;
 | 
			
		||||
    QTimer::singleShot(4000, this, SLOT(onPrinterWaitForPrintingReceipt()));
 | 
			
		||||
 | 
			
		||||
@@ -983,6 +994,9 @@ void ATBDeviceControllerPlugin::prepareDynTemplateData()
 | 
			
		||||
    case nsDeviceControllerInterface::TICKET_VARIANT::STOP_RECEIPT:
 | 
			
		||||
        private_setupDynTemplatData_STOP_RECEIPT(dynTicketData, this->currentTicket);
 | 
			
		||||
        break;
 | 
			
		||||
    case nsDeviceControllerInterface::TICKET_VARIANT::FINE_PAYMENT:
 | 
			
		||||
        private_setupDynTemplatData_FINE_PAYMENT(dynTicketData, this->currentTicket);
 | 
			
		||||
        break;
 | 
			
		||||
    case nsDeviceControllerInterface::TICKET_VARIANT::RECEIPT:
 | 
			
		||||
        break;
 | 
			
		||||
    case nsDeviceControllerInterface::TICKET_VARIANT::ERROR_RECEIPT:
 | 
			
		||||
@@ -1091,6 +1105,27 @@ void ATBDeviceControllerPlugin::private_setupDynTemplatData_FOOD_STAMP(struct T_
 | 
			
		||||
    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_setupDynTemplatData_STOP_RECEIPT(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:
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,8 @@
 | 
			
		||||
#include <QUuid>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
 | 
			
		||||
#include <QProcess>
 | 
			
		||||
 | 
			
		||||
#include "support/JSON.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -18,6 +20,7 @@ DeviceControllerDiag::DeviceControllerDiag(PersistentData *pData, QObject *paren
 | 
			
		||||
    , lastState(DeviceController::State::INITIAL_STATE)
 | 
			
		||||
    , _isErrorState(false)
 | 
			
		||||
    , pData(pData)
 | 
			
		||||
    , E255counter(0)
 | 
			
		||||
{
 | 
			
		||||
    diagRequestTimeoutTimer = new QTimer(this);
 | 
			
		||||
    diagRequestTimeoutTimer->setInterval(1000*45);
 | 
			
		||||
@@ -104,14 +107,20 @@ void DeviceControllerDiag::private_startDiag()
 | 
			
		||||
        this->private_sendDiagEvent(DeviceController::State::E255);
 | 
			
		||||
        this->isRequestRunning  = false;
 | 
			
		||||
        this->flagInterruptDiag = false;
 | 
			
		||||
        if (this->E255counter > 5) {
 | 
			
		||||
            this->restartCArun();
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            this->E255counter++;
 | 
			
		||||
 | 
			
		||||
        // try it again, until success:
 | 
			
		||||
        QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
 | 
			
		||||
        /**
 | 
			
		||||
         * But please note:
 | 
			
		||||
         * - diag does currently not stop suspend (start a background task)
 | 
			
		||||
         * - diag is called again in ModeOOO wokeup()
 | 
			
		||||
         */
 | 
			
		||||
            // try it again, until success:
 | 
			
		||||
            QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
 | 
			
		||||
            /**
 | 
			
		||||
             * But please note:
 | 
			
		||||
             * - diag does currently not stop suspend (start a background task)
 | 
			
		||||
             * - diag is called again in ModeOOO wokeup()
 | 
			
		||||
             */
 | 
			
		||||
        }
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -146,6 +155,8 @@ void DeviceControllerDiag::sys_superviseSystem()
 | 
			
		||||
        this->private_sendDiagEvent(DeviceController::State::E255);
 | 
			
		||||
        this->flagInterruptDiag = false;
 | 
			
		||||
        this->isRequestRunning  = false;
 | 
			
		||||
        if (this->E255counter > 5) { this->restartCArun(); }
 | 
			
		||||
                              else { this->E255counter++; }
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -156,6 +167,8 @@ void DeviceControllerDiag::sys_superviseSystem()
 | 
			
		||||
        this->private_sendDiagEvent(DeviceController::State::E254);
 | 
			
		||||
        this->diagRequestTimeoutTimer->stop();
 | 
			
		||||
        this->isRequestRunning  = false;
 | 
			
		||||
        if (this->E255counter > 5) { this->restartCArun(); }
 | 
			
		||||
                              else { this->E255counter++; }
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -168,7 +181,7 @@ void DeviceControllerDiag::sys_superviseSystem()
 | 
			
		||||
    {
 | 
			
		||||
        // noch keine Testergebnisse
 | 
			
		||||
        if (dynMaCond.startupTestIsRunning) {
 | 
			
		||||
            // TODO?
 | 
			
		||||
            qCritical() << "            startupTestIsRunning --> call again";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -178,18 +191,6 @@ void DeviceControllerDiag::sys_superviseSystem()
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // all doors: 99: undefined  0:closed  1:open
 | 
			
		||||
    if (dynMaCond.lowerDoor || dynMaCond.upperDoor) {
 | 
			
		||||
        // 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::E253);
 | 
			
		||||
    }
 | 
			
		||||
    if (dynMaCond.middleDoor) {
 | 
			
		||||
        // vault door is open, goto INTRUSION MODE
 | 
			
		||||
        qCritical() << "DeviceControllerDiag::sys_superviseSystem() vault door is open, goto INTRUSION MODE";
 | 
			
		||||
        this->private_sendDiagEvent(DeviceController::State::E252);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    qCritical() << "      --> call  sub_componentAssessment()";
 | 
			
		||||
 | 
			
		||||
    sub_componentAssessment();
 | 
			
		||||
@@ -223,6 +224,21 @@ void DeviceControllerDiag::sub_componentAssessment()
 | 
			
		||||
        this->private_sendDiagEvent(DeviceController::State::A000);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // check for open doors
 | 
			
		||||
    // all doors: 99: undefined  0:closed  1:open
 | 
			
		||||
    if (dynMaCond.lowerDoor || dynMaCond.upperDoor) {
 | 
			
		||||
        // Service or battery door is open
 | 
			
		||||
        flag_sendOperate = false;
 | 
			
		||||
        qCritical() << "DeviceControllerDiag::sys_superviseSystem() Service or battery door is open, goto INTRUSION MODE";
 | 
			
		||||
        this->private_sendDiagEvent(DeviceController::State::E253);
 | 
			
		||||
    }
 | 
			
		||||
    if (dynMaCond.middleDoor) {
 | 
			
		||||
        // vault door is open
 | 
			
		||||
        flag_sendOperate = false;
 | 
			
		||||
        qCritical() << "DeviceControllerDiag::sys_superviseSystem() vault door is open, goto INTRUSION MODE";
 | 
			
		||||
        this->private_sendDiagEvent(DeviceController::State::E252);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // check for invalid states:
 | 
			
		||||
 | 
			
		||||
    if (modCond.rtc>=200) {
 | 
			
		||||
@@ -567,6 +583,10 @@ void DeviceControllerDiag::private_sendDiagEvent(DeviceController::State result)
 | 
			
		||||
        eventClass = EVENT_CLASS::WARNING;
 | 
			
		||||
        parameter  = "temperatur warning";
 | 
			
		||||
        break;
 | 
			
		||||
    case DeviceController::State::W255:   // restart carun
 | 
			
		||||
        eventClass = EVENT_CLASS::WARNING;
 | 
			
		||||
        parameter  = "restart carun";
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this->lastState = result;
 | 
			
		||||
@@ -596,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,
 | 
			
		||||
        W004,
 | 
			
		||||
 | 
			
		||||
        W255,
 | 
			
		||||
 | 
			
		||||
        INITIAL_STATE
 | 
			
		||||
    };
 | 
			
		||||
    Q_ENUM_NS(State)
 | 
			
		||||
@@ -94,6 +96,11 @@ public slots:
 | 
			
		||||
     */
 | 
			
		||||
    void diagReInit();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * reset / restart / reinit deviceController
 | 
			
		||||
     */
 | 
			
		||||
    void restartCArun();
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
    void diagResponse(ATBMachineEvent* machineEvent);
 | 
			
		||||
 | 
			
		||||
@@ -118,6 +125,8 @@ private:
 | 
			
		||||
 | 
			
		||||
    PersistentData* pData;
 | 
			
		||||
 | 
			
		||||
    int E255counter;
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
    void onDiagRequestTimeoutTimerTimeout();
 | 
			
		||||
 | 
			
		||||
@@ -126,7 +135,6 @@ private slots:
 | 
			
		||||
 | 
			
		||||
    void sys_superviseSystem();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // DEVICECONTROLLERDIAG_H
 | 
			
		||||
 
 | 
			
		||||
@@ -203,7 +203,7 @@ signals:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Q_DECLARE_INTERFACE(DeviceControllerInterface,
 | 
			
		||||
                    "eu.atb.ptu.plugin.DeviceControllerInterface/1.1.4")
 | 
			
		||||
                    "eu.atb.ptu.plugin.DeviceControllerInterface/1.1.5")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace nsDeviceControllerInterface {
 | 
			
		||||
@@ -236,6 +236,7 @@ namespace nsDeviceControllerInterface {
 | 
			
		||||
        ERROR_RECEIPT,
 | 
			
		||||
        START_RECEIPT,   // e.g. Szeged Start
 | 
			
		||||
        STOP_RECEIPT,    // e.g. Szeged Stop
 | 
			
		||||
        FINE_PAYMENT,    // e.g. Klaipeda
 | 
			
		||||
        FOOD_STAMP
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -64,6 +64,9 @@ bool Ticket::initNew(TICKET_VARIANT ticketVariant, const QList<quint8> & templat
 | 
			
		||||
    case TICKET_VARIANT::STOP_RECEIPT:
 | 
			
		||||
        this->_templateList << 24 << 25 << 26;
 | 
			
		||||
        break;
 | 
			
		||||
    case TICKET_VARIANT::FINE_PAYMENT:
 | 
			
		||||
        this->_templateList << 24 << 25 << 26;
 | 
			
		||||
        break;
 | 
			
		||||
    case TICKET_VARIANT::FOOD_STAMP:
 | 
			
		||||
         if (printingData.contains("dyn1_list")) {
 | 
			
		||||
            this->_hasTemplateDynData = true;
 | 
			
		||||
@@ -160,6 +163,9 @@ QDebug operator<<(QDebug debug, TICKET_VARIANT ticketVariant)
 | 
			
		||||
        case TICKET_VARIANT::STOP_RECEIPT:
 | 
			
		||||
            debug << "TICKET_VARIANT::STOP_RECEIPT";
 | 
			
		||||
            break;
 | 
			
		||||
        case TICKET_VARIANT::FINE_PAYMENT:
 | 
			
		||||
            debug << "TICKET_VARIANT::FINE_PAYMENT";
 | 
			
		||||
            break;
 | 
			
		||||
        case TICKET_VARIANT::FOOD_STAMP:
 | 
			
		||||
            debug << "TICKET_VARIANT::FOOD_STAMP";
 | 
			
		||||
            break;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user