Diag: set timeout for diagRequest from config ...

Option: "ATBDeviceControllerPlugin/diagTimeout"
 Description: Timeout for diagRequest in seconds.
 Default value: 45s
This commit is contained in:
Siegfried Siegert 2024-06-03 12:09:34 +02:00
parent 962cd01eac
commit 492d3a107a
Signed by: SiegfriedSiegert
GPG Key ID: 68371E015E8F0B03
3 changed files with 9 additions and 2 deletions

View File

@ -82,6 +82,8 @@ PLUGIN_STATE ATBDeviceControllerPlugin::initDCPlugin(QObject *eventReceiver, con
this->diag = new DeviceControllerDiag(this->persistentData, this); this->diag = new DeviceControllerDiag(this->persistentData, this);
connect(this->diag, &DeviceControllerDiag::newVoltage, this, &ATBDeviceControllerPlugin::onNewVoltage); connect(this->diag, &DeviceControllerDiag::newVoltage, this, &ATBDeviceControllerPlugin::onNewVoltage);
int diagTimeout = settings.value("ATBDeviceControllerPlugin/diagTimeout", "45").toInt();
this->diag->setTimeout(diagTimeout);
// currentSelectedTicketType - number of used "Kombiticket" (deprecated) use TICKET_VARIANT in future // currentSelectedTicketType - number of used "Kombiticket" (deprecated) use TICKET_VARIANT in future
this->currentSelectedTicketType = 0; this->currentSelectedTicketType = 0;

View File

@ -20,7 +20,7 @@ DeviceControllerDiag::DeviceControllerDiag(PersistentData *pData, QObject *paren
, pData(pData) , pData(pData)
{ {
diagRequestTimeoutTimer = new QTimer(this); diagRequestTimeoutTimer = new QTimer(this);
diagRequestTimeoutTimer->setInterval(1000*20); // 20s diagRequestTimeoutTimer->setInterval(1000*45);
diagRequestTimeoutTimer->setSingleShot(true); diagRequestTimeoutTimer->setSingleShot(true);
connect(diagRequestTimeoutTimer, &QTimer::timeout, this, &DeviceControllerDiag::onDiagRequestTimeoutTimerTimeout); connect(diagRequestTimeoutTimer, &QTimer::timeout, this, &DeviceControllerDiag::onDiagRequestTimeoutTimerTimeout);
} }
@ -42,6 +42,11 @@ void DeviceControllerDiag::diagReInit()
this->_isErrorState = false; this->_isErrorState = false;
} }
void DeviceControllerDiag::setTimeout(int timeout)
{
this->diagRequestTimeoutTimer->setInterval(1000 * timeout);
}
void DeviceControllerDiag::diagRequest() void DeviceControllerDiag::diagRequest()
{ {
qCritical() << "DeviceControllerDiag::diagRequest()"; qCritical() << "DeviceControllerDiag::diagRequest()";

View File

@ -80,7 +80,7 @@ public:
bool isOperatingState(); bool isOperatingState();
QSet<DeviceController::State> getCurrentMachineState(); QSet<DeviceController::State> getCurrentMachineState();
void setTimeout(int timeout);
public slots: public slots:
/** /**