ZT/sources/PCIIO/PCIThread.h

91 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 ZT2ANALYSISTHREAD_H
#define ZT2ANALYSISTHREAD_H
#include <QObject>
#include "GlobalDefine.h"
#include "Station.h"
#include <QMutex>
#include "ZTData.h"
#include "QElapsedTimer"
class CPCIIOMgr;
//class CAbstractLazerProbe;
class CZT2AnalysisThread : public QObject
{
Q_OBJECT
public:
CZT2AnalysisThread();
unsigned int Init(CPCIIOMgr *PCIIOHandle,GenericInputMasks_t *InputMasks,QElapsedTimer *RefTimer);
void TerminateAnalysis();
bool UpdateDetectionConfig(CZTDetectionFunctionConfig*);
private:
enum eTrainState
{
ZT2_PRE_DETECTION_STATE,
ZT2_WAIT_FOR_S1_STATE,
ZT2_S1_ACTIVE_STATE,
ZT1_TRAIN_TRANSIT_FINISHED_STATE
};
void RegisterDetection(unsigned int DetectionID, unsigned int Rank, qint64 TimeStamp);
unsigned int mZT2TrainState;
unsigned int mLastInputs;
bool mExitLoop;
QMutex mMutex;
bool mZT2Analyzing;
CPCIIOMgr *mPCIInputsHandle;
GenericInputMasks_t *mInputMasksPtr;
QElapsedTimer *mReferenceTimer;
CZTDetectionFunctionConfig mDetectionConfig;
public slots:
void AnalyzeZT2Train();
signals:
void ZT2DataUpdate(CZT2ThreadData* );
void DetectionTriggered(CZTDetectionData* );
};
#endif // ZT2ANALYSISTHREAD_H