Compare commits

..

1 Commits

4 changed files with 15 additions and 58 deletions

View File

@@ -27,7 +27,6 @@ ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent)
: isMaster(false)
, pluginState(PLUGIN_STATE::NOT_INITIALIZED)
, eventReceiver(nullptr)
, latestAccountNumber(0)
{
this->setParent(parent);
@@ -312,12 +311,6 @@ void ATBDeviceControllerPlugin::onChangedProgramModeToOOO()
}
void ATBDeviceControllerPlugin::requestDiag()
{
hw->dc_autoRequest(true);
this->diag->diagRequest();
}
// TASKS: Cash handling -------------------------------------------------------
void ATBDeviceControllerPlugin::requestStartCashInput(const QString & amount)
@@ -484,13 +477,13 @@ void ATBDeviceControllerPlugin::private_startAccount()
qsort( backupedAccNumbers, nrOfVals, sizeof (uint16_t), Utils::compare );
this->latestAccountNumber = backupedAccNumbers[nrOfVals-1];
uint16_t latestAccountNumber = backupedAccNumbers[nrOfVals-1];
// DEBUG
qCritical() << " latestAccountNumber = " << this->latestAccountNumber;
qCritical() << " latestAccountNumber = " << latestAccountNumber;
hw->log_selectVaultRecord(this->latestAccountNumber);
hw->log_selectVaultRecord(latestAccountNumber);
this->accountCheckCounter = 0;
QTimer::singleShot(500, this, SLOT(private_checkAccountData()));
@@ -513,25 +506,11 @@ void ATBDeviceControllerPlugin::private_checkAccountData()
// cannot get accountData within ~10*500ms
qCritical() << "checkAccountData() failed";
JSON::setPrettySerialize(false);
JSON::JsonObject json = JSON::objectBuilder()
->set("Error", QString("check account data failed"))
->set("AccountNumber", this->latestAccountNumber)
->create();
QString parameterJsonString = JSON::serialize(json);
// simulate:
this->private_getAccountData();
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);
// TODO: create and send an HealthEvent...
}
}
}
@@ -548,14 +527,6 @@ void ATBDeviceControllerPlugin::private_getAccountData()
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));

View File

@@ -87,7 +87,7 @@ public slots:
void reboot();
void reset();
void requestDiag();
signals:
// public Signals are defined in interface
@@ -130,8 +130,6 @@ private:
// counts failed hw->log_chkIfVaultRecordAvailable()
int accountCheckCounter;
uint16_t latestAccountNumber;
// counts faild hw->prn-getPrintResult()
int printResultCheckCounter;

View File

@@ -62,6 +62,7 @@ void DeviceControllerDiag::diagRequest()
qCritical() << "DeviceControllerDiag::diagRequest() is already running";
return;
}
this->machineEventSet.clear();
this->isRequestRunning = true;
this->diagRequestTimeoutTimer->start();
@@ -132,9 +133,7 @@ void DeviceControllerDiag::private_startDiag()
* - diag is called again in ModeOOO wokeup()
*/
}
this->diagRequestTimeoutTimer->stop();
this->isRequestRunning = false;
this->flagInterruptDiag = false;
this->private_finishDiag();
return;
}
@@ -184,9 +183,7 @@ void DeviceControllerDiag::sys_superviseSystem()
if (this->E255counter > 5) { this->restartCArun(); }
else { this->E255counter++; }
QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
this->diagRequestTimeoutTimer->stop();
this->isRequestRunning = false;
this->flagInterruptDiag = false;
this->private_finishDiag();
return;
}
@@ -197,15 +194,13 @@ void DeviceControllerDiag::sys_superviseSystem()
hw->dc_autoRequest(true);
DCMachineEvent E255Event = DCMachineEvent(DeviceController::State::M0254);
previousMachineEventSet.insert(E255Event);
machineEventSet.insert(E255Event);
private_sendDiagEvent(E255Event, DeviceController::Action::SET);
if (this->E255counter > 5) { this->restartCArun(); }
else { this->E255counter++; }
QTimer::singleShot(400, this, &DeviceControllerDiag::diagRequest);
this->diagRequestTimeoutTimer->stop();
this->isRequestRunning = false;
this->flagInterruptDiag = false;
this->private_finishDiag();
return;
}
@@ -237,8 +232,6 @@ void DeviceControllerDiag::sys_superviseSystem()
void DeviceControllerDiag::sub_componentAssessment()
{
this->machineEventSet.clear();
bool flag_sendOperate = true;
struct T_moduleCondition modCond = {};
@@ -723,10 +716,8 @@ void DeviceControllerDiag::restartCArun()
DCMachineEvent W255Event = DCMachineEvent(DeviceController::State::W255);
if (!this->previousMachineEventSet.contains(W255Event)) {
machineEventSet.insert(W255Event);
private_sendDiagEvent(W255Event, DeviceController::Action::SET);
}
machineEventSet.insert(W255Event);
private_sendDiagEvent(W255Event, DeviceController::Action::SET);
QProcess::startDetached("/bin/systemctl", {"restart", "carun"});
}

View File

@@ -104,9 +104,6 @@ public slots:
virtual void reboot() = 0;
virtual void reset() = 0;
virtual void requestDiag() = 0;
signals:
void printTicketFinished(nsDeviceControllerInterface::RESULT_STATE resultState,
@@ -216,7 +213,7 @@ signals:
Q_DECLARE_INTERFACE(DeviceControllerInterface,
"eu.atb.ptu.plugin.DeviceControllerInterface/1.2.2")
"eu.atb.ptu.plugin.DeviceControllerInterface/1.2.1")
namespace nsDeviceControllerInterface {