From 7c3bc484af212c005ff45f6f5f392c29aec8134d Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Tue, 20 Jun 2023 13:23:36 +0200 Subject: [PATCH] Handle door events (note) This events come somtimes very unreliably. --- src/ATBAPP/ATBDeviceControllerPlugin.cpp | 19 +++++++++++++++---- src/ATBAPP/ATBDeviceControllerPlugin.h | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.cpp b/src/ATBAPP/ATBDeviceControllerPlugin.cpp index 88083e0..8dc29c3 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.cpp +++ b/src/ATBAPP/ATBDeviceControllerPlugin.cpp @@ -41,7 +41,7 @@ ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent) : connect(dynamic_cast(hw), SIGNAL(hwapi_doorVaultDoorOpened()), this, SLOT(onVaultDoorOpened()), Qt::QueuedConnection); // Screen?? with message connect(dynamic_cast(hw), SIGNAL(hwapi_doorCoinBoxRemoved()), this, SLOT(onCoinBoxRemoved()), Qt::QueuedConnection); // Create/Send Account connect(dynamic_cast(hw), SIGNAL(hwapi_doorCoinBoxInserted()), this, SLOT(onCoinBoxInserted()), Qt::QueuedConnection); - //connect(dynamic_cast(hw), SIGNAL(hwapi_doorCBinAndAllDoorsClosed()), this, SLOT( ??? )), Qt::QueuedConnection); + connect(dynamic_cast(hw), SIGNAL(hwapi_doorCBinAndAllDoorsClosed()), this, SLOT(onCBinAndAllDoorsClosed()), Qt::QueuedConnection); connect(dynamic_cast(hw), SIGNAL(hwapi_doorAllDoorsClosed()), this, SLOT(onAllDoorsClosed()), Qt::QueuedConnection); // check for errors, switch to mode IDLE @@ -242,6 +242,10 @@ void ATBDeviceControllerPlugin::onVaultDoorOpened() // - show special screen / message on screen // - create an HealthEvent (-> ISMAS-Event) qCritical() << "ATBDeviceControllerPlugin::onVaultDoorOpened()"; + + // TODO: Start background task "ACCOUNT" + + // do not: emit this->requestModeSERVICE(); } void ATBDeviceControllerPlugin::onCoinBoxRemoved() @@ -256,11 +260,18 @@ void ATBDeviceControllerPlugin::onCoinBoxInserted() qCritical() << "ATBDeviceControllerPlugin::onCoinBoxInserted()"; } +void ATBDeviceControllerPlugin::onCBinAndAllDoorsClosed() +{ + qCritical() << "ATBDeviceControllerPlugin::onCBinAndAllDoorsClosed()"; + + // TODO: Stop background task "ACCOUNT" + + QTimer::singleShot(2000, this, SIGNAL(requestModeIDLE())); +} + + void ATBDeviceControllerPlugin::onAllDoorsClosed() { - // TODO: - // - check for errors, switch to mode IDLE - qCritical() << "ATBDeviceControllerPlugin::onAllDoorsClosed()"; emit this->requestModeIDLE(); diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.h b/src/ATBAPP/ATBDeviceControllerPlugin.h index 3e36777..177bbdd 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.h +++ b/src/ATBAPP/ATBDeviceControllerPlugin.h @@ -129,6 +129,7 @@ private slots: void onCoinBoxRemoved(); void onCoinBoxInserted(); void onAllDoorsClosed(); + void onCBinAndAllDoorsClosed(); // account handling void private_startAccount();