Compare commits
	
		
			10 Commits
		
	
	
		
			improveDev
			...
			pu/account
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						7d5d3b4de0
	
				 | 
					
					
						|||
| 
						
						
							
						
						4a0418611e
	
				 | 
					
					
						|||
| 
						
						
							
						
						6a667d03ea
	
				 | 
					
					
						|||
| 
						
						
							
						
						232deb9245
	
				 | 
					
					
						|||
| 
						
						
							
						
						a87a4e6c14
	
				 | 
					
					
						|||
| 
						
						
							
						
						0467db23d1
	
				 | 
					
					
						|||
| 
						
						
							
						
						e1470d13f1
	
				 | 
					
					
						|||
| 
						
						
							
						
						1165c4b92f
	
				 | 
					
					
						|||
| 
						
						
							
						
						40acd0e0c4
	
				 | 
					
					
						|||
| 
						
						
							
						
						fe3696ce9c
	
				 | 
					
					
						
@@ -27,6 +27,7 @@ ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent)
 | 
				
			|||||||
    : isMaster(false)
 | 
					    : isMaster(false)
 | 
				
			||||||
    , pluginState(PLUGIN_STATE::NOT_INITIALIZED)
 | 
					    , pluginState(PLUGIN_STATE::NOT_INITIALIZED)
 | 
				
			||||||
    , eventReceiver(nullptr)
 | 
					    , eventReceiver(nullptr)
 | 
				
			||||||
 | 
					    , latestAccountNumber(0)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    this->setParent(parent);
 | 
					    this->setParent(parent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -311,6 +312,12 @@ void ATBDeviceControllerPlugin::onChangedProgramModeToOOO()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void ATBDeviceControllerPlugin::requestDiag()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    hw->dc_autoRequest(true);
 | 
				
			||||||
 | 
					    this->diag->diagRequest();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TASKS: Cash handling -------------------------------------------------------
 | 
					// TASKS: Cash handling -------------------------------------------------------
 | 
				
			||||||
void ATBDeviceControllerPlugin::requestStartCashInput(const QString & amount)
 | 
					void ATBDeviceControllerPlugin::requestStartCashInput(const QString & amount)
 | 
				
			||||||
@@ -477,13 +484,13 @@ void ATBDeviceControllerPlugin::private_startAccount()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    qsort( backupedAccNumbers, nrOfVals, sizeof (uint16_t), Utils::compare );
 | 
					    qsort( backupedAccNumbers, nrOfVals, sizeof (uint16_t), Utils::compare );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    uint16_t latestAccountNumber = backupedAccNumbers[nrOfVals-1];
 | 
					    this->latestAccountNumber = backupedAccNumbers[nrOfVals-1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // DEBUG
 | 
					    // DEBUG
 | 
				
			||||||
    qCritical() << "       latestAccountNumber = " << latestAccountNumber;
 | 
					    qCritical() << "       latestAccountNumber = " << this->latestAccountNumber;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    hw->log_selectVaultRecord(latestAccountNumber);
 | 
					    hw->log_selectVaultRecord(this->latestAccountNumber);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this->accountCheckCounter = 0;
 | 
					    this->accountCheckCounter = 0;
 | 
				
			||||||
    QTimer::singleShot(500, this, SLOT(private_checkAccountData()));
 | 
					    QTimer::singleShot(500, this, SLOT(private_checkAccountData()));
 | 
				
			||||||
@@ -506,11 +513,25 @@ void ATBDeviceControllerPlugin::private_checkAccountData()
 | 
				
			|||||||
            // cannot get accountData within ~10*500ms
 | 
					            // cannot get accountData within ~10*500ms
 | 
				
			||||||
            qCritical() << "checkAccountData() failed";
 | 
					            qCritical() << "checkAccountData() failed";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // simulate:
 | 
					            JSON::setPrettySerialize(false);
 | 
				
			||||||
            this->private_getAccountData();
 | 
					            JSON::JsonObject json = JSON::objectBuilder()
 | 
				
			||||||
 | 
					                      ->set("Error", QString("check account data failed"))
 | 
				
			||||||
 | 
					                      ->set("AccountNumber", this->latestAccountNumber)
 | 
				
			||||||
 | 
					                ->create();
 | 
				
			||||||
 | 
					            QString parameterJsonString = JSON::serialize(json);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // TODO: create and send an HealthEvent...
 | 
					            QString eventId = QUuid::createUuid().toString(QUuid::WithoutBraces).mid(0, 8);
 | 
				
			||||||
 | 
					            ATBMachineEvent *machineEvent = new ATBMachineEvent(
 | 
				
			||||||
 | 
					                        eventId,                           // id
 | 
				
			||||||
 | 
					                        "DC",                              // device name: PTU/PRINTER/DC/...
 | 
				
			||||||
 | 
					                        EVENT_CLASS::STATE,                // reason of event: Error/Warning/Alarm
 | 
				
			||||||
 | 
					                        "M01000",                          // eventName
 | 
				
			||||||
 | 
					                        1,                                 // state
 | 
				
			||||||
 | 
					                        parameterJsonString,               // parameter
 | 
				
			||||||
 | 
					                        "ACCOUNT"                          // second level info
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					            QCoreApplication::postEvent(this, machineEvent);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -527,6 +548,14 @@ void ATBDeviceControllerPlugin::private_getAccountData()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    QHash<QString, QVariant> accountData;
 | 
					    QHash<QString, QVariant> accountData;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (this->latestAccountNumber != retVR.AccountingNumber) {
 | 
				
			||||||
 | 
					        // this is the wrong account! -> read again
 | 
				
			||||||
 | 
					        hw->log_selectVaultRecord(this->latestAccountNumber);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        QTimer::singleShot(500, this, SLOT(private_checkAccountData()));
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    accountData.insert("AccountingNumber", QString::number(retVR.AccountingNumber));
 | 
					    accountData.insert("AccountingNumber", QString::number(retVR.AccountingNumber));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -87,7 +87,7 @@ public slots:
 | 
				
			|||||||
    void reboot();
 | 
					    void reboot();
 | 
				
			||||||
    void reset();
 | 
					    void reset();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void requestDiag();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
signals:
 | 
					signals:
 | 
				
			||||||
    // public Signals are defined in interface
 | 
					    // public Signals are defined in interface
 | 
				
			||||||
@@ -130,6 +130,8 @@ private:
 | 
				
			|||||||
   // counts failed hw->log_chkIfVaultRecordAvailable()
 | 
					   // counts failed hw->log_chkIfVaultRecordAvailable()
 | 
				
			||||||
   int accountCheckCounter;
 | 
					   int accountCheckCounter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   uint16_t latestAccountNumber;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   // counts faild hw->prn-getPrintResult()
 | 
					   // counts faild hw->prn-getPrintResult()
 | 
				
			||||||
   int printResultCheckCounter;
 | 
					   int printResultCheckCounter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,7 +62,6 @@ void DeviceControllerDiag::diagRequest()
 | 
				
			|||||||
        qCritical() << "DeviceControllerDiag::diagRequest() is already running";
 | 
					        qCritical() << "DeviceControllerDiag::diagRequest() is already running";
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    this->machineEventSet.clear();
 | 
					 | 
				
			||||||
    this->isRequestRunning = true;
 | 
					    this->isRequestRunning = true;
 | 
				
			||||||
    this->diagRequestTimeoutTimer->start();
 | 
					    this->diagRequestTimeoutTimer->start();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -133,7 +132,9 @@ void DeviceControllerDiag::private_startDiag()
 | 
				
			|||||||
             * - diag is called again in ModeOOO wokeup()
 | 
					             * - diag is called again in ModeOOO wokeup()
 | 
				
			||||||
             */
 | 
					             */
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        this->private_finishDiag();
 | 
					        this->diagRequestTimeoutTimer->stop();
 | 
				
			||||||
 | 
					        this->isRequestRunning  = false;
 | 
				
			||||||
 | 
					        this->flagInterruptDiag = false;
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -183,7 +184,9 @@ void DeviceControllerDiag::sys_superviseSystem()
 | 
				
			|||||||
        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();
 | 
					        this->diagRequestTimeoutTimer->stop();
 | 
				
			||||||
 | 
					        this->isRequestRunning  = false;
 | 
				
			||||||
 | 
					        this->flagInterruptDiag = false;
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -194,13 +197,15 @@ void DeviceControllerDiag::sys_superviseSystem()
 | 
				
			|||||||
        hw->dc_autoRequest(true);
 | 
					        hw->dc_autoRequest(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::M0254);
 | 
					        DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::M0254);
 | 
				
			||||||
        machineEventSet.insert(E255Event);
 | 
					        previousMachineEventSet.insert(E255Event);
 | 
				
			||||||
        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->private_finishDiag();
 | 
					        this->diagRequestTimeoutTimer->stop();
 | 
				
			||||||
 | 
					        this->isRequestRunning  = false;
 | 
				
			||||||
 | 
					        this->flagInterruptDiag = false;
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -232,6 +237,8 @@ void DeviceControllerDiag::sys_superviseSystem()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void DeviceControllerDiag::sub_componentAssessment()
 | 
					void DeviceControllerDiag::sub_componentAssessment()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    this->machineEventSet.clear();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool flag_sendOperate = true;
 | 
					    bool flag_sendOperate = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct T_moduleCondition modCond = {};
 | 
					    struct T_moduleCondition modCond = {};
 | 
				
			||||||
@@ -716,8 +723,10 @@ void DeviceControllerDiag::restartCArun()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DCMachineEvent W255Event = DCMachineEvent(DeviceController::State::W255);
 | 
					    DCMachineEvent W255Event = DCMachineEvent(DeviceController::State::W255);
 | 
				
			||||||
    machineEventSet.insert(W255Event);
 | 
					    if (!this->previousMachineEventSet.contains(W255Event)) {
 | 
				
			||||||
    private_sendDiagEvent(W255Event, DeviceController::Action::SET);
 | 
					        machineEventSet.insert(W255Event);
 | 
				
			||||||
 | 
					        private_sendDiagEvent(W255Event, DeviceController::Action::SET);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QProcess::startDetached("/bin/systemctl", {"restart", "carun"});
 | 
					    QProcess::startDetached("/bin/systemctl", {"restart", "carun"});
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -104,6 +104,9 @@ public slots:
 | 
				
			|||||||
    virtual void reboot() = 0;
 | 
					    virtual void reboot() = 0;
 | 
				
			||||||
    virtual void reset() = 0;
 | 
					    virtual void reset() = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    virtual void requestDiag() = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
signals:
 | 
					signals:
 | 
				
			||||||
    void printTicketFinished(nsDeviceControllerInterface::RESULT_STATE resultState,
 | 
					    void printTicketFinished(nsDeviceControllerInterface::RESULT_STATE resultState,
 | 
				
			||||||
@@ -213,7 +216,7 @@ signals:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Q_DECLARE_INTERFACE(DeviceControllerInterface,
 | 
					Q_DECLARE_INTERFACE(DeviceControllerInterface,
 | 
				
			||||||
                    "eu.atb.ptu.plugin.DeviceControllerInterface/1.2.1")
 | 
					                    "eu.atb.ptu.plugin.DeviceControllerInterface/1.2.2")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace nsDeviceControllerInterface {
 | 
					namespace nsDeviceControllerInterface {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user