From 2cd73aaa8686467f62c5fcc3c6e6b9c5b70cbd1b Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Fri, 30 Jun 2023 10:40:14 +0200 Subject: [PATCH] Add interface methods startPhysicalLayer() / stopPhysicalLayer() --- src/ATBAPP/ATBDeviceControllerPlugin.cpp | 32 ++++++++++++++++++++++++ src/ATBAPP/ATBDeviceControllerPlugin.h | 3 ++- src/ATBAPP/DeviceControllerInterface.h | 4 +++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.cpp b/src/ATBAPP/ATBDeviceControllerPlugin.cpp index f8e1447..0a28659 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.cpp +++ b/src/ATBAPP/ATBDeviceControllerPlugin.cpp @@ -85,6 +85,38 @@ PLUGIN_STATE ATBDeviceControllerPlugin::initDCPlugin(QObject *eventReceiver, con } +void ATBDeviceControllerPlugin::startPhysicalLayer() +{ + if (this->pluginState == PLUGIN_STATE::NOT_INITIALIZED) + { + qCritical() << "ATBDeviceControllerPlugin::startPhysicalLayer(): plugin is not initialized"; + return; + } + + // open serial port + hw->dc_openSerial(5, "115200", this->serialPortName, 1); + + hw->dc_autoRequest(true); +} + +void ATBDeviceControllerPlugin::stopPhysicalLayer() +{ + if (this->pluginState == PLUGIN_STATE::NOT_INITIALIZED) + { + qCritical() << "ATBDeviceControllerPlugin::startPhysicalLayer(): plugin is not initialized"; + return; + } + + hw->dc_autoRequest(false); + + hw->dc_closeSerial(); +} + + + + + + // Handle Mode-Changes -------------------------------------------------------- void ATBDeviceControllerPlugin::onChangedProgramModeToSELL() diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.h b/src/ATBAPP/ATBDeviceControllerPlugin.h index e8557c9..8a31c91 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.h +++ b/src/ATBAPP/ATBDeviceControllerPlugin.h @@ -71,7 +71,8 @@ public slots: void onChangedProgramModeToIDLE(); void onChangedProgramModeToOOO(); - + void startPhysicalLayer(); + void stopPhysicalLayer(); diff --git a/src/ATBAPP/DeviceControllerInterface.h b/src/ATBAPP/DeviceControllerInterface.h index b660a4c..09d6e3d 100644 --- a/src/ATBAPP/DeviceControllerInterface.h +++ b/src/ATBAPP/DeviceControllerInterface.h @@ -81,6 +81,10 @@ public slots: virtual void onChangedProgramModeToIDLE() = 0; virtual void onChangedProgramModeToOOO() = 0; + virtual void startPhysicalLayer() = 0; + virtual void stopPhysicalLayer() = 0; + + signals: void printTicketFinished(nsDeviceControllerInterface::RESULT_STATE resultState, const QString & errorCode,