2023-11-10 11:59:00 +01:00
|
|
|
#include "src/ATBAPP/ATBVMCPlugin.h"
|
|
|
|
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QThread>
|
|
|
|
#include <QTextCodec>
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
#include <QPluginLoader>
|
|
|
|
#include <QDateTime>
|
|
|
|
#include <QFileInfo>
|
|
|
|
#include <QCoreApplication>
|
|
|
|
#include <QUuid>
|
|
|
|
|
|
|
|
#include <cstdlib>
|
|
|
|
|
|
|
|
ATBVMCPlugin::ATBVMCPlugin(QObject *parent)
|
2023-11-10 13:12:59 +01:00
|
|
|
: VMCInterface(parent)
|
|
|
|
, m_errorCode("")
|
2023-11-10 11:59:00 +01:00
|
|
|
, m_errorDescription("")
|
|
|
|
, m_pluginInfo("")
|
|
|
|
, m_serialPortName("")
|
|
|
|
, m_useDebug(false)
|
|
|
|
, m_pluginState(PLUGIN_STATE::NOT_INITIALIZED)
|
2023-11-13 13:54:52 +01:00
|
|
|
, m_vmc(nullptr) {
|
2023-11-10 11:59:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ATBVMCPlugin::~ATBVMCPlugin() {
|
2023-11-13 13:54:52 +01:00
|
|
|
if (m_vmc) {
|
|
|
|
delete m_vmc;
|
|
|
|
m_vmc = nullptr;
|
|
|
|
}
|
2023-11-10 11:59:00 +01:00
|
|
|
}
|
|
|
|
|
2023-11-13 13:54:52 +01:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// interface:
|
|
|
|
PLUGIN_STATE ATBVMCPlugin::initVMCPlugin(QObject *appControl,
|
|
|
|
QObject *atbSystem,
|
|
|
|
QObject *hmiConfig,
|
2023-11-10 11:59:00 +01:00
|
|
|
QSettings const &settings) {
|
2023-11-10 13:12:59 +01:00
|
|
|
|
2023-11-13 13:54:52 +01:00
|
|
|
m_vmc = new VMC(appControl, &settings);
|
2023-11-10 13:12:59 +01:00
|
|
|
|
2023-11-13 13:54:52 +01:00
|
|
|
// -------------------- connect vmc --------------------------------------------
|
|
|
|
connect(m_vmc, SIGNAL(VMCFormatedString(FormatedStringList)), appControl, SLOT(onVMCFormatedString(FormatedStringList)), Qt::QueuedConnection);
|
|
|
|
connect(m_vmc, SIGNAL(displayData(quint8,QString)), appControl, SLOT(onVMCSellData(quint8,QString)), Qt::QueuedConnection);
|
|
|
|
connect(m_vmc, SIGNAL(retriggerModeSell()), appControl, SLOT(restartSellModeTimeoutTimer()), Qt::QueuedConnection);
|
|
|
|
connect(m_vmc, SIGNAL(setVendingData(QString,QByteArray)), appControl, SLOT(onSetVendingData(QString,QByteArray)), Qt::QueuedConnection);
|
|
|
|
|
|
|
|
connect(m_vmc, SIGNAL(sysCommand(quint16, QByteArray)), atbSystem, SLOT(executeSystemCommand(quint16, QByteArray)), Qt::QueuedConnection);
|
|
|
|
connect(m_vmc, SIGNAL(newDateTime(QString)), atbSystem, SLOT(setDateTime(QString)), Qt::QueuedConnection);
|
|
|
|
connect(m_vmc, SIGNAL(wakeVMC()), atbSystem, SLOT(onWakeVMC()));
|
|
|
|
|
|
|
|
connect(m_vmc, SIGNAL(setCustNr(QString)), hmiConfig, SLOT(setCustNr(QString)), Qt::QueuedConnection);
|
|
|
|
connect(m_vmc, SIGNAL(setGroupNr(QString)), hmiConfig, SLOT(setGroupNr(QString)), Qt::QueuedConnection);
|
|
|
|
connect(m_vmc, SIGNAL(setZoneNr(QString)), hmiConfig, SLOT(setZoneNr(QString)), Qt::QueuedConnection);
|
|
|
|
connect(m_vmc, SIGNAL(setMachineNr(QString)), hmiConfig, SLOT(setMachineNr(QString)), Qt::QueuedConnection);
|
|
|
|
connect(m_vmc, SIGNAL(setDefaultLanguage(quint8)), hmiConfig, SLOT(setDefaultLanguage(quint8)), Qt::QueuedConnection);
|
2023-11-10 14:17:22 +01:00
|
|
|
|
|
|
|
return PLUGIN_STATE::INITIALIZED;
|
2023-11-10 11:59:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// mandantory ATBAPP plugin methods: ------------------------------------------
|
|
|
|
PLUGIN_STATE ATBVMCPlugin::getState() {
|
|
|
|
return PLUGIN_STATE::NOT_INITIALIZED;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString ATBVMCPlugin::getLastError() {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
QString ATBVMCPlugin::getLastErrorDescription() {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
QString const &ATBVMCPlugin::getPluginInfo() {
|
|
|
|
static QString info;
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
// helpers e.g. for debug / log
|
|
|
|
QString ATBVMCPlugin::getString(RESULT_STATE /*resultState*/) {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATBVMCPlugin::onChangedProgramModeToSELL() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATBVMCPlugin::onChangedProgramModeToSERVICE() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATBVMCPlugin::onChangedProgramModeToIDLE() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATBVMCPlugin::onChangedProgramModeToOOO() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATBVMCPlugin::startPhysicalLayer() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATBVMCPlugin::stopPhysicalLayer() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATBVMCPlugin::reboot() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATBVMCPlugin::reset() {
|
|
|
|
|
|
|
|
}
|