ZT/sources/Simulator/SimulatorThread.h

88 lines
2.7 KiB
C++

/*******************************************************************************
* *
* Société de Transports de Montréal. *
* 2012 - 2013 *
* *
* Projet Zones Tests *
* *
* *
* *
*******************************************************************************/
/*
Description:
Cette classe est un thread qui lit la carte PCI d'I/O sur laquelle sont
branchées les entrées à haute fréquence. La machine à états analyse le
passage du train et détecte les déclenchements (sondes, frotteur négatif,
pneu porteur). On utilise un thread car l'analyse doit se faire à très
haute fréquence sans être ralentie par l'interface graphique.
*/
/* ************************************************************************** */
/* Revision:
### YYYMMDD JFM
Verision d'origine.
### YYYYMMDD Description du besoin ou du bug
Description du changement.
*/
/* ************************************************************************** */
#ifndef SIMULATORTHREAD_H
#define SIMULATORTHREAD_H
#define ZT2_ANALYSIS_LOOP_PERIOD 500000 //500 us
#include <QObject>
#include "GlobalDefine.h"
#include "Station.h"
#include <QMutex>
#include "ZTData.h"
#include "QElapsedTimer"
#include "SimulatorInputModule.h"
#include "SImulatorOutputModule.h"
#include "SimulatorPCIIO.h"
#include "SimulatorLazerProbe.h"
#include "LogMgr.h"
class CPCIIOMgr;
//class CAbstractLazerProbe;
class CSimulatorThread : public QObject
{
Q_OBJECT
public:
CSimulatorThread();
unsigned int Init(CSimulatorInputModule *InputModule, CSImulatorOutputModule *OutputModule, CSimulatorPCIIO *PCIIO, CSimulatorLazerProbe *InternalLazerProbe,CSimulatorLazerProbe *ExternalLazerProbe,GenericInputMasks_t *StationInputMasks);
void Terminate();
void SetLogElement(CLogElement *element);
private:
CSimulatorInputModule *mInputModule;
CSImulatorOutputModule *mOutputModule;
CSimulatorPCIIO *mPCIIO;
CSimulatorLazerProbe *mInternalLazerProbe, *mExternalLazerProbe;
CLogElement *mLogElement;
GenericInputMasks_t *mStationInputMasks;
QElapsedTimer mSimTimer;
bool mExitLoop;
QMutex mMutex;
bool mSimThreadRunning;
public slots:
void StartSim();
signals:
void SimFinished();
};
#endif // SIMULATORTHREAD_H