Initialize vmc-pointer and connect with various slots in appControl and atbSystem.

This commit is contained in:
Gerhard Hoffmann 2023-11-13 13:54:52 +01:00
parent a1b1cedd09
commit 365b02a9c9

View File

@ -21,29 +21,42 @@ ATBVMCPlugin::ATBVMCPlugin(QObject *parent)
, m_serialPortName("") , m_serialPortName("")
, m_useDebug(false) , m_useDebug(false)
, m_pluginState(PLUGIN_STATE::NOT_INITIALIZED) , m_pluginState(PLUGIN_STATE::NOT_INITIALIZED)
, m_eventReceiver(nullptr) , m_vmc(nullptr) {
, m_settings(nullptr)
, m_config(nullptr) {
} }
ATBVMCPlugin::~ATBVMCPlugin() { ATBVMCPlugin::~ATBVMCPlugin() {
if (m_vmc) {
delete m_vmc;
m_vmc = nullptr;
}
} }
PLUGIN_STATE ATBVMCPlugin::initVMCPlugin(QObject *eventReceiver,
// ----------------------------------------------------------------------------
// interface:
PLUGIN_STATE ATBVMCPlugin::initVMCPlugin(QObject *appControl,
QObject *atbSystem,
QObject *hmiConfig,
QSettings const &settings) { QSettings const &settings) {
m_eventReceiver = eventReceiver;
m_settings = &settings;
// Beachte: QSettings hat .fileName(). m_vmc = new VMC(appControl, &settings);
// Damit kann man dann ATBSystem benutzen.
return PLUGIN_STATE::INITIALIZED; // -------------------- 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);
PLUGIN_STATE ATBVMCPlugin::initVMCPlugin(QObject *eventReceiver, ATBHMIconfig *config) {
m_eventReceiver = eventReceiver;
m_settings = &config->getSettings();
m_config = config;
return PLUGIN_STATE::INITIALIZED; return PLUGIN_STATE::INITIALIZED;
} }