Update printing ticket (version 2.1)
Use hwapi::prn_getPrintResult() to detect print result.
This commit is contained in:
		@@ -407,15 +407,38 @@ void ATBDeviceControllerPlugin::onPrinterDataPrepared()
 | 
			
		||||
{
 | 
			
		||||
    this->hw->prn_printKombiticket(this->currentSelectedTicketType);
 | 
			
		||||
 | 
			
		||||
    // FAKE SIGNAL:
 | 
			
		||||
    QTimer::singleShot(4000, this, SLOT(onPrintFinishedOK()));
 | 
			
		||||
 | 
			
		||||
    // note: calling prn_getPrintResult() immediately may result in wrong answer!
 | 
			
		||||
    // We have to wait "about some seconds" until calling this function!
 | 
			
		||||
    QTimer::singleShot(4000, this, SLOT(onPrinterWaitForPrinting()));
 | 
			
		||||
 | 
			
		||||
    // old: use printer templates:
 | 
			
		||||
    // this->currentTemplate = 1;
 | 
			
		||||
    // this->onPrinterPrintNextTemplate();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ATBDeviceControllerPlugin::onPrinterWaitForPrinting()
 | 
			
		||||
{
 | 
			
		||||
    quint8 printerResult = this->hw->prn_getPrintResult();
 | 
			
		||||
 | 
			
		||||
    switch (printerResult) {
 | 
			
		||||
    case 0:    // still printing
 | 
			
		||||
        qCritical() << "--> printer: WaitForPrinting";
 | 
			
		||||
        QTimer::singleShot(2000, this, SLOT(onPrinterWaitForPrinting()));
 | 
			
		||||
        break;
 | 
			
		||||
    case 1:    // printing finished, Ok
 | 
			
		||||
        this->onPrintFinishedOK();
 | 
			
		||||
        break;
 | 
			
		||||
    case 2:    // printing finished, Error
 | 
			
		||||
        this->onPrintFinishedERR();
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        qCritical() << "DC Error: wait for printing";
 | 
			
		||||
        this->onPrintFinishedERR();
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ATBDeviceControllerPlugin::onPrinterPrintNextTemplate()
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -113,6 +113,7 @@ private slots:
 | 
			
		||||
 | 
			
		||||
   void onPrinterDataPrepared();
 | 
			
		||||
   void onPrinterPrintNextTemplate();
 | 
			
		||||
   void onPrinterWaitForPrinting();
 | 
			
		||||
 | 
			
		||||
   void onPrintFinishedOK();
 | 
			
		||||
   void onPrintFinishedERR();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user