Initialize vmc-pointer and connect with various slots in appControl and atbSystem.
This commit is contained in:
		@@ -21,29 +21,42 @@ ATBVMCPlugin::ATBVMCPlugin(QObject *parent)
 | 
			
		||||
  , m_serialPortName("")
 | 
			
		||||
  , m_useDebug(false)
 | 
			
		||||
  , m_pluginState(PLUGIN_STATE::NOT_INITIALIZED)
 | 
			
		||||
  , m_eventReceiver(nullptr)
 | 
			
		||||
  , m_settings(nullptr)
 | 
			
		||||
  , m_config(nullptr) {
 | 
			
		||||
  , m_vmc(nullptr) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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) {
 | 
			
		||||
    m_eventReceiver = eventReceiver;
 | 
			
		||||
    m_settings = &settings;
 | 
			
		||||
 | 
			
		||||
    // Beachte: QSettings hat .fileName().
 | 
			
		||||
    // Damit kann man dann ATBSystem benutzen.
 | 
			
		||||
    m_vmc = new VMC(appControl, &settings);
 | 
			
		||||
 | 
			
		||||
    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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user