Premier commit suite au crash du repo le 10 juillet 2017
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Classe instantiable d'un module d'entrées externe simulé. Dérivée de COutputModule, elle
|
||||
permet d'émuler les sorties du module externe en réimplémentant les fonctions
|
||||
génériques de sa classe de base. La classe notifie le simulateur d'un changement
|
||||
d'état des sorties afin que ce dernier puisse les afficher visuellement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "SImulatorOutputModule.h"
|
||||
#include "ZTSimulator.h"
|
||||
|
||||
CSImulatorOutputModule::CSImulatorOutputModule()
|
||||
{
|
||||
mOutputBuffer = 0;
|
||||
mSimulatorPtr = 0;
|
||||
}
|
||||
|
||||
unsigned int CSImulatorOutputModule::SetOutput(unsigned char *buffer)
|
||||
{
|
||||
// quint32 temp;
|
||||
// mRdWrLock.lockForWrite();
|
||||
// mOutputBuffer |= FlagMask;
|
||||
// temp = mOutputBuffer;
|
||||
// mRdWrLock.unlock();
|
||||
Q_UNUSED(buffer)
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CSImulatorOutputModule::SetOutput(quint32 buffer)
|
||||
{
|
||||
quint32 temp;
|
||||
mRdWrLock.lockForWrite();
|
||||
mOutputBuffer = buffer;
|
||||
temp = mOutputBuffer;
|
||||
mRdWrLock.unlock();
|
||||
|
||||
|
||||
// mSimulatorPtr->UpdateOutputsDisplay(temp);
|
||||
emit UpdateOutputsDisplay(temp);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CSImulatorOutputModule::SetOutputFlags(quint32 FlagMask)
|
||||
{
|
||||
quint32 temp;
|
||||
mRdWrLock.lockForWrite();
|
||||
mOutputBuffer |= FlagMask;
|
||||
temp = mOutputBuffer;
|
||||
mRdWrLock.unlock();
|
||||
|
||||
emit UpdateOutputsDisplay(temp);
|
||||
// mSimulatorPtr->UpdateOutputsDisplay(temp);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CSImulatorOutputModule::ClearOutputFlags(quint32 FlagMask)
|
||||
{
|
||||
unsigned int temp;
|
||||
mRdWrLock.lockForWrite();
|
||||
mOutputBuffer &= ~FlagMask;
|
||||
temp = mOutputBuffer;
|
||||
mRdWrLock.unlock();
|
||||
|
||||
/* mSimulatorPtr->UpdateOutputsDisplay(temp)*/;
|
||||
emit UpdateOutputsDisplay(temp);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
|
||||
unsigned int CSImulatorOutputModule::ToggleOutputFlags(quint32 FlagMask)
|
||||
{
|
||||
unsigned int temp;
|
||||
mRdWrLock.lockForWrite();
|
||||
mOutputBuffer ^= FlagMask;
|
||||
temp = mOutputBuffer;
|
||||
mRdWrLock.unlock();
|
||||
|
||||
// mSimulatorPtr->UpdateOutputsDisplay(temp);
|
||||
emit UpdateOutputsDisplay(temp);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Description du fichier si nécessaire.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef SIMULATOROUTPUTMODULE_H
|
||||
#define SIMULATOROUTPUTMODULE_H
|
||||
|
||||
#include "GlobalDefine.h"
|
||||
#include "OutputModule.h"
|
||||
#include <QReadWriteLock>
|
||||
#include <QObject>
|
||||
|
||||
class CZTSimulator;
|
||||
|
||||
class CSImulatorOutputModule:public QObject, public COutputModule
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSImulatorOutputModule();
|
||||
void BindSimPtr(CZTSimulator *Ptr){mSimulatorPtr = Ptr;}
|
||||
|
||||
virtual unsigned int SetOutput(unsigned char* buffer);
|
||||
virtual unsigned int SetOutput(quint32 buffer);
|
||||
virtual unsigned int SetOutputFlags(quint32 Flags);
|
||||
virtual unsigned int ClearOutputFlags(quint32 Flags);
|
||||
virtual unsigned int ToggleOutputFlags(quint32 Flags);
|
||||
|
||||
private:
|
||||
quint32 mOutputBuffer;
|
||||
QReadWriteLock mRdWrLock;
|
||||
CZTSimulator *mSimulatorPtr;
|
||||
|
||||
signals:
|
||||
void UpdateOutputsDisplay(quint32);
|
||||
|
||||
};
|
||||
|
||||
#endif // SIMULATOROUTPUTMODULE_H
|
||||
@@ -0,0 +1,256 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 - 2013 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Gère la création et l'exécution d'un scénario de passage de train simulé.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "SimulationScenario.h"
|
||||
|
||||
#define BOGIE_DELAY 100
|
||||
#define SENSOR_DELAY 100
|
||||
|
||||
CSimulationScenario::CSimulationScenario()
|
||||
{
|
||||
mCurStep = 0;
|
||||
|
||||
mScenarioTimer = new QTimer();
|
||||
mScenarioTimer->setSingleShot(true);
|
||||
connect(mScenarioTimer,SIGNAL(timeout()),this,SLOT(ScenarioTimerExpired()));
|
||||
}
|
||||
|
||||
CSimulationScenario::~CSimulationScenario()
|
||||
{
|
||||
DestroyScenario();
|
||||
}
|
||||
|
||||
unsigned int CSimulationScenario::CreateScenario()
|
||||
{
|
||||
|
||||
|
||||
// //MPM10
|
||||
// InsertNewStep(STEP_ACTION_REGISTER_ZT1_ITI,300);
|
||||
// InsertNewStep(STEP_ACTION_OCCUPY_ZT1_APPROACH,300);
|
||||
// InsertNewStep(STEP_ACTION_OCCUPY_ZT1,300);
|
||||
|
||||
// for(int bogie = 1; bogie <= 3; bogie++)
|
||||
// {
|
||||
|
||||
// //if(bogie != 5 /*&& bogie != 6*/)
|
||||
//// InsertNewStep(STEP_ACTION_ACTIVATE_PGI,0);
|
||||
//// InsertNewStep(STEP_ACTION_ACTIVATE_PGE,5);
|
||||
|
||||
// InsertNewStep(STEP_ACTION_ACTIVATE_S1,SENSOR_DELAY);
|
||||
// InsertNewStep(STEP_ACTION_DEACTIVATE_S1,BOGIE_DELAY);
|
||||
|
||||
// InsertNewStep(STEP_ACTION_DEACTIVATE_PGI,0);
|
||||
// InsertNewStep(STEP_ACTION_DEACTIVATE_PGE,0);
|
||||
|
||||
//// if(bogie != 5 && bogie != 6)
|
||||
// InsertNewStep(STEP_ACTION_ACTIVATE_FN,5);
|
||||
// InsertNewStep(STEP_ACTION_ACTIVATE_FN,5);
|
||||
|
||||
//// if(bogie == 12)
|
||||
//// InsertNewStep(STEP_ACTION_ACTIVATE_PPI,0);
|
||||
|
||||
// InsertNewStep(STEP_ACTION_ACTIVATE_S2,SENSOR_DELAY);
|
||||
// InsertNewStep(STEP_ACTION_DEACTIVATE_S2,SENSOR_DELAY);
|
||||
|
||||
|
||||
// InsertNewStep(STEP_ACTION_DEACTIVATE_FN,5);
|
||||
|
||||
// InsertNewStep(STEP_ACTION_DEACTIVATE_PPI,5);
|
||||
|
||||
// InsertNewStep(STEP_ACTION_ACTIVATE_S1,SENSOR_DELAY);
|
||||
// InsertNewStep(STEP_ACTION_DEACTIVATE_S1,BOGIE_DELAY);
|
||||
|
||||
|
||||
// //if(bogie != 5 /*&& bogie != 6 && bogie != 7*/)
|
||||
//// InsertNewStep(STEP_ACTION_ACTIVATE_PGI,0);
|
||||
//// InsertNewStep(STEP_ACTION_ACTIVATE_PGE,5);
|
||||
// InsertNewStep(STEP_ACTION_ACTIVATE_S2,SENSOR_DELAY);
|
||||
// InsertNewStep(STEP_ACTION_DEACTIVATE_S2,BOGIE_DELAY);
|
||||
// InsertNewStep(STEP_ACTION_DEACTIVATE_PGI,0);
|
||||
// InsertNewStep(STEP_ACTION_DEACTIVATE_PGE,0);
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// // InsertNewStep(STEP_ACTION_DESTROY_ZT1_ITI,800);
|
||||
// InsertNewStep(STEP_ACTION_FREE_ZT1_APPROACH,800);
|
||||
// InsertNewStep(STEP_ACTION_FREE_ZT1,800);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//// //ZT2
|
||||
|
||||
|
||||
// InsertNewStep(STEP_ACTION_REGISTER_ZT2_ITI,300);
|
||||
// InsertNewStep(STEP_ACTION_OCCUPY_ZT2,300);
|
||||
|
||||
// for(int bogie = 1; bogie <= 18; bogie++)
|
||||
// {
|
||||
// InsertNewStep(STEP_ACTION_ACTIVATE_ZT2_S1,SENSOR_DELAY);
|
||||
// InsertNewStep(STEP_ACTION_DEACTIVATE_ZT2_S1,BOGIE_DELAY);
|
||||
|
||||
// // if(bogie == 5 || bogie == 2)
|
||||
// {
|
||||
// // InsertNewStep(STEP_ACTION_ACTIVATE_ZT2_PPE,5);
|
||||
// // InsertNewStep(STEP_ACTION_DEACTIVATE_ZT2_PPE,1);
|
||||
|
||||
// }
|
||||
|
||||
// // if(bogie == 3 || bogie == 10)
|
||||
// {
|
||||
//// InsertNewStep(STEP_ACTION_ACTIVATE_ZT2_PPI,3);
|
||||
//// InsertNewStep(STEP_ACTION_DEACTIVATE_ZT2_PPI,1);
|
||||
|
||||
// }
|
||||
|
||||
// //if(bogie != 3)
|
||||
// {
|
||||
// InsertNewStep(STEP_ACTION_ACTIVATE_ZT2_S1,SENSOR_DELAY);
|
||||
// InsertNewStep(STEP_ACTION_DEACTIVATE_ZT2_S1,BOGIE_DELAY);
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
|
||||
// InsertNewStep(STEP_ACTION_DESTROY_ZT2_ITI,800);
|
||||
// InsertNewStep(STEP_ACTION_FREE_ZT2,800);
|
||||
|
||||
|
||||
|
||||
//// MR
|
||||
InsertNewStep(STEP_ACTION_REGISTER_ZT1_ITI,300);
|
||||
InsertNewStep(STEP_ACTION_OCCUPY_ZT1_APPROACH,300);
|
||||
InsertNewStep(STEP_ACTION_OCCUPY_ZT1,300);
|
||||
|
||||
for(int bogie = 1; bogie <= 12; bogie++)
|
||||
{
|
||||
// if(bogie != 5 && bogie != 7)
|
||||
InsertNewStep(STEP_ACTION_ACTIVATE_PGI,0);
|
||||
InsertNewStep(STEP_ACTION_ACTIVATE_PGE,0);
|
||||
InsertNewStep(STEP_ACTION_ACTIVATE_S1,SENSOR_DELAY);
|
||||
InsertNewStep(STEP_ACTION_DEACTIVATE_S1,BOGIE_DELAY);
|
||||
InsertNewStep(STEP_ACTION_DEACTIVATE_PGI,0);
|
||||
InsertNewStep(STEP_ACTION_DEACTIVATE_PGE,0);
|
||||
|
||||
|
||||
// if(bogie != 5 && bogie != 8)
|
||||
InsertNewStep(STEP_ACTION_ACTIVATE_FN,0);
|
||||
|
||||
InsertNewStep(STEP_ACTION_ACTIVATE_S1,SENSOR_DELAY);
|
||||
InsertNewStep(STEP_ACTION_ACTIVATE_S2,SENSOR_DELAY);
|
||||
InsertNewStep(STEP_ACTION_DEACTIVATE_S1,BOGIE_DELAY);
|
||||
// if(bogie == 12)
|
||||
// InsertNewStep(STEP_ACTION_ACTIVATE_PPI,0);
|
||||
|
||||
// if(bogie != 5 && bogie != 8)
|
||||
InsertNewStep(STEP_ACTION_DEACTIVATE_FN,0);
|
||||
|
||||
// InsertNewStep(STEP_ACTION_ACTIVATE_S2,SENSOR_DELAY);
|
||||
InsertNewStep(STEP_ACTION_DEACTIVATE_S2,BOGIE_DELAY);
|
||||
|
||||
// if(bogie == 12)
|
||||
// InsertNewStep(STEP_ACTION_DEACTIVATE_PPI,0);
|
||||
|
||||
if(bogie != 2 && bogie != 11)
|
||||
InsertNewStep(STEP_ACTION_ACTIVATE_PGI,0);
|
||||
if(bogie != 2 && bogie != 11)
|
||||
InsertNewStep(STEP_ACTION_ACTIVATE_PGE,0);
|
||||
InsertNewStep(STEP_ACTION_ACTIVATE_S2,SENSOR_DELAY);
|
||||
InsertNewStep(STEP_ACTION_DEACTIVATE_S2,BOGIE_DELAY);
|
||||
InsertNewStep(STEP_ACTION_DEACTIVATE_PGI,0);
|
||||
InsertNewStep(STEP_ACTION_DEACTIVATE_PGE,0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
InsertNewStep(STEP_ACTION_DESTROY_ZT1_ITI,800);
|
||||
|
||||
InsertNewStep(STEP_ACTION_FREE_ZT1,800);
|
||||
|
||||
InsertNewStep(STEP_ACTION_FREE_ZT1_APPROACH,800);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CSimulationScenario::DestroyScenario()
|
||||
{
|
||||
for(int i = 0; i < mScenarioStepsList.size(); i++)
|
||||
{
|
||||
delete mScenarioStepsList.at(i);
|
||||
}
|
||||
mScenarioStepsList.clear();
|
||||
return RET_OK;
|
||||
}
|
||||
unsigned int CSimulationScenario::Start()
|
||||
{
|
||||
emit ExecuteNextStep(mScenarioStepsList.at(mCurStep));
|
||||
mScenarioTimer->start(mScenarioStepsList.at(mCurStep)->StepDelayMillisecs);
|
||||
return RET_OK;
|
||||
}
|
||||
unsigned int CSimulationScenario::Reset()
|
||||
{
|
||||
mScenarioTimer->stop();
|
||||
mCurStep = 0;
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
void CSimulationScenario::ScenarioTimerExpired()
|
||||
{
|
||||
if(mCurStep == mScenarioStepsList.size()) //the simulation is finished
|
||||
{
|
||||
Reset();
|
||||
emit ScenarioCompleted();
|
||||
return;
|
||||
}
|
||||
|
||||
emit ExecuteNextStep(mScenarioStepsList.at(mCurStep));
|
||||
mScenarioTimer->start(mScenarioStepsList.at(mCurStep)->StepDelayMillisecs);
|
||||
mCurStep++;
|
||||
|
||||
}
|
||||
|
||||
//Cette fonction ajoute un événement dans la liste. Le paramètre Delay correspond
|
||||
//au nombre de millisecondes de délai entre l'exécution de cet événement et l'exécution
|
||||
//de l'événement subséquent. Un délai de 0 correspond au délai le plus court que la boucle
|
||||
//d'exécution est capable de générer.
|
||||
//Ex.: InsertNewStep(STEP_ACTION_REGISTER_ZT1_ITI,300);
|
||||
//Activera l'entrée itinéraire ZT1 dans le simulateur et l'étape suivante sera
|
||||
//exécutée 300ms plus tard.
|
||||
//NOTE: Les délais sont approximatifs et gagnent de la précision lorsque le programme
|
||||
//roule sur un ordinateur plus puissant.
|
||||
unsigned int CSimulationScenario::InsertNewStep(unsigned int StepID, int Delay)
|
||||
{
|
||||
CSimulationStep *NewStep = new CSimulationStep;
|
||||
|
||||
NewStep->StepAction = StepID;
|
||||
NewStep->StepDelayMillisecs = Delay;
|
||||
mScenarioStepsList.append(NewStep);
|
||||
|
||||
return mScenarioStepsList.size();
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 - 2013 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Description du fichier si nécessaire.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef SIMULATIONSCENARIO_H
|
||||
#define SIMULATIONSCENARIO_H
|
||||
#include "GlobalDefine.h"
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
enum eStepActionID
|
||||
{
|
||||
STEP_ACTION_DELAY,
|
||||
STEP_ACTION_ACTIVATE_S1,
|
||||
STEP_ACTION_DEACTIVATE_S1,
|
||||
STEP_ACTION_ACTIVATE_S2,
|
||||
STEP_ACTION_DEACTIVATE_S2,
|
||||
STEP_ACTION_ACTIVATE_FN,
|
||||
STEP_ACTION_DEACTIVATE_FN,
|
||||
STEP_ACTION_ACTIVATE_PPI,
|
||||
STEP_ACTION_DEACTIVATE_PPI,
|
||||
STEP_ACTION_ACTIVATE_PPE,
|
||||
STEP_ACTION_DEACTIVATE_PPE,
|
||||
STEP_ACTION_ACTIVATE_PGI,
|
||||
STEP_ACTION_DEACTIVATE_PGI,
|
||||
STEP_ACTION_ACTIVATE_PGE,
|
||||
STEP_ACTION_DEACTIVATE_PGE,
|
||||
STEP_ACTION_REGISTER_ZT1_ITI,
|
||||
STEP_ACTION_DESTROY_ZT1_ITI,
|
||||
STEP_ACTION_REGISTER_ZT2_ITI,
|
||||
STEP_ACTION_DESTROY_ZT2_ITI,
|
||||
STEP_ACTION_OCCUPY_ZT1_APPROACH,
|
||||
STEP_ACTION_FREE_ZT1_APPROACH,
|
||||
STEP_ACTION_OCCUPY_ZT1,
|
||||
STEP_ACTION_FREE_ZT1,
|
||||
STEP_ACTION_OCCUPY_ZT2_APPROACH,
|
||||
STEP_ACTION_FREE_ZT2_APPROACH,
|
||||
STEP_ACTION_OCCUPY_ZT2,
|
||||
STEP_ACTION_FREE_ZT2,
|
||||
STEP_ACTION_ACTIVATE_ZT2_S1,
|
||||
STEP_ACTION_DEACTIVATE_ZT2_S1,
|
||||
STEP_ACTION_ACTIVATE_ZT2_PPI,
|
||||
STEP_ACTION_DEACTIVATE_ZT2_PPI,
|
||||
STEP_ACTION_ACTIVATE_ZT2_PPE,
|
||||
STEP_ACTION_DEACTIVATE_ZT2_PPE,
|
||||
|
||||
STEP_ACTION_SCENARIO_END
|
||||
};
|
||||
|
||||
class CSimulationStep
|
||||
{
|
||||
public:
|
||||
unsigned int StepAction; //the action to execute
|
||||
int StepDelayMillisecs; //the amount of time before the next action
|
||||
};
|
||||
|
||||
class CSimulationScenario : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSimulationScenario();
|
||||
virtual ~CSimulationScenario();
|
||||
|
||||
unsigned int CreateScenario();
|
||||
unsigned int DestroyScenario();
|
||||
unsigned int Start();
|
||||
unsigned int Pause();
|
||||
unsigned int Reset();
|
||||
|
||||
unsigned int InsertNewStep(unsigned int StepID, int Delay);
|
||||
|
||||
private:
|
||||
QList<CSimulationStep*> mScenarioStepsList;
|
||||
int mCurStep;
|
||||
QTimer *mScenarioTimer;
|
||||
|
||||
signals:
|
||||
void ExecuteNextStep(CSimulationStep*);
|
||||
void ScenarioCompleted();
|
||||
|
||||
public slots:
|
||||
void ScenarioTimerExpired();
|
||||
};
|
||||
|
||||
|
||||
#endif // SIMULATIONSCENARIO_H
|
||||
@@ -0,0 +1,87 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Classe instantiable gestionnaire simulé d'entrées/sorties externes.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "GlobalDefine.h"
|
||||
#include "SimulatorIOManager.h"
|
||||
|
||||
CSimulatorIOManager::CSimulatorIOManager()
|
||||
{
|
||||
|
||||
}
|
||||
CSimulatorIOManager::~CSimulatorIOManager()
|
||||
{
|
||||
delete mInputsModule;
|
||||
delete mOutputsModule;
|
||||
delete mMixedModule;
|
||||
}
|
||||
|
||||
void CSimulatorIOManager::DestroyModule()
|
||||
{
|
||||
delete mInputsModule;
|
||||
delete mOutputsModule;
|
||||
delete mMixedModule;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorIOManager::InitIO()
|
||||
{
|
||||
CEngLog::instance()->AddLogString(QString("CSimulatorIOManager::Init()"));
|
||||
mInputsModule = new CSimulatorInputModule();
|
||||
mOutputsModule = new CSImulatorOutputModule;
|
||||
mMixedModule = new CSimulatorMixedModule();
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
CIOModule *CSimulatorIOManager::GetModule(eIOModuleType_t type, unsigned int ModuleID)
|
||||
{
|
||||
Q_UNUSED(ModuleID);
|
||||
switch(type)
|
||||
{
|
||||
case IO_MODULE_INPUT_TYPE:
|
||||
{
|
||||
return mInputsModule;
|
||||
break;
|
||||
}
|
||||
case IO_MODULE_OUTPUT_TYPE:
|
||||
{
|
||||
return mOutputsModule;
|
||||
break;
|
||||
}
|
||||
case IO_MODULE_MIXED_TYPE:
|
||||
{
|
||||
return mMixedModule;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
case IO_MODULE_INVALID_TYPE:
|
||||
{
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Description du fichier si nécessaire.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef SIMULATORIOMANAGER_H
|
||||
#define SIMULATORIOMANAGER_H
|
||||
#include "IOManager.h"
|
||||
#include "SimulatorInputModule.h"
|
||||
#include "SImulatorOutputModule.h"
|
||||
#include "SimulatorMixedModule.h"
|
||||
|
||||
class CSimulatorIOManager: public CIOManager
|
||||
{
|
||||
public:
|
||||
CSimulatorIOManager();
|
||||
virtual ~CSimulatorIOManager();
|
||||
|
||||
virtual unsigned int InitIO();
|
||||
virtual CIOModule *GetModule(eIOModuleType_t type, unsigned int ModuleID);
|
||||
void DestroyModule();
|
||||
|
||||
private:
|
||||
CSimulatorInputModule *mInputsModule;
|
||||
CSImulatorOutputModule *mOutputsModule;
|
||||
CSimulatorMixedModule *mMixedModule;
|
||||
};
|
||||
|
||||
#endif // SIMULATORIOMANAGER_H
|
||||
@@ -0,0 +1,98 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Classe instantiable d'un module simulé d'entrées externes. Dérivée de CInputModule, elle
|
||||
permet d'émuler les entrées du module externe en réimplémentant les fonctions
|
||||
génériques de sa classe de base. Le simulateur peut changer l'état des entrées
|
||||
par les fonctions Set...
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "SimulatorInputModule.h"
|
||||
#include "Angrignon.h"
|
||||
|
||||
CSimulatorInputModule::CSimulatorInputModule()
|
||||
{
|
||||
mInputBuf = 0;
|
||||
}
|
||||
|
||||
CSimulatorInputModule::~CSimulatorInputModule()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//unsigned int CSimulatorInputModule::GetInputs(unsigned char *DataBuf)
|
||||
//{
|
||||
|
||||
// memcpy(DataBuf,&mInputBuf,sizeof(mInputBuf));
|
||||
|
||||
// return RET_OK;
|
||||
//}
|
||||
|
||||
unsigned int CSimulatorInputModule::GetInputs()
|
||||
{
|
||||
unsigned int temp;
|
||||
mRdWrLock.lockForRead();
|
||||
temp = mInputBuf;
|
||||
mRdWrLock.unlock();
|
||||
return temp;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorInputModule::GetInputBuf()
|
||||
{
|
||||
unsigned int temp;
|
||||
mRdWrLock.lockForRead();
|
||||
temp = mInputBuf;
|
||||
mRdWrLock.unlock();
|
||||
return temp;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorInputModule::SetInputBufFlags(unsigned int FlagMask)
|
||||
{
|
||||
unsigned int temp;
|
||||
mRdWrLock.lockForWrite();
|
||||
mInputBuf |= FlagMask;
|
||||
temp = mInputBuf;
|
||||
mRdWrLock.unlock();
|
||||
return temp;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorInputModule::SetInputBufValue(unsigned int value)
|
||||
{
|
||||
unsigned int temp;
|
||||
mRdWrLock.lockForWrite();
|
||||
mInputBuf = value;
|
||||
temp = mInputBuf;
|
||||
mRdWrLock.unlock();
|
||||
return temp;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorInputModule::ClearInputBufFlags(unsigned int FlagMask)
|
||||
{
|
||||
unsigned int temp;
|
||||
mRdWrLock.lockForWrite();
|
||||
mInputBuf &= ~FlagMask;
|
||||
temp = mInputBuf;
|
||||
mRdWrLock.unlock();
|
||||
return temp;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Description du fichier si nécessaire.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef SIMULATORINPUTMODULE_H
|
||||
#define SIMULATORINPUTMODULE_H
|
||||
#include "GlobalDefine.h"
|
||||
#include "InputModule.h"
|
||||
#include <QReadWriteLock>
|
||||
|
||||
class CSimulatorInputModule : public CInputModule
|
||||
{
|
||||
public:
|
||||
CSimulatorInputModule();
|
||||
~CSimulatorInputModule();
|
||||
|
||||
unsigned int GetInputs(unsigned char *DataBuf);
|
||||
virtual unsigned int GetInputs();
|
||||
unsigned int GetInputBuf();
|
||||
|
||||
unsigned int SetInputBufValue(unsigned int value);
|
||||
unsigned int SetInputBufFlags(unsigned int FlagMask);
|
||||
unsigned int ClearInputBufFlags(unsigned int FlagMask);
|
||||
|
||||
private:
|
||||
|
||||
unsigned int mInputBuf;
|
||||
QReadWriteLock mRdWrLock;
|
||||
|
||||
};
|
||||
|
||||
#endif // SIMULATORINPUTMODULE_H
|
||||
@@ -0,0 +1,132 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 - 2013 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Classe instantiable d'une sonde lazer simulée.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "SimulatorLazerProbe.h"
|
||||
#include "AbstractLazerProbeMgr.h"
|
||||
#include "GlobalDefine.h"
|
||||
|
||||
CSimulatorLazerProbe::CSimulatorLazerProbe(unsigned int ProbeID, unsigned int ProbeType)
|
||||
{
|
||||
mProbeID = ProbeID;
|
||||
mProbeType = ProbeType;
|
||||
mData = 100;
|
||||
mProbeAlive = true;
|
||||
}
|
||||
|
||||
CSimulatorLazerProbe::~CSimulatorLazerProbe()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
unsigned int CSimulatorLazerProbe::OpenPort(QString PortName)
|
||||
{
|
||||
mPortName = PortName;
|
||||
return LAZERPROBES_MGR_RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorLazerProbe::GetType()
|
||||
{
|
||||
return mProbeType;
|
||||
}
|
||||
|
||||
QString CSimulatorLazerProbe::GetPortName()
|
||||
{
|
||||
return mPortName;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorLazerProbe::GetID()
|
||||
{
|
||||
return mProbeID;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorLazerProbe::StartAcquisition()
|
||||
{
|
||||
return LAZERPROBES_MGR_RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorLazerProbe::StopAcquisition()
|
||||
{
|
||||
return LAZERPROBES_MGR_RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorLazerProbe::GetLastData()
|
||||
{
|
||||
unsigned int temp;
|
||||
|
||||
// mMutex.lock();
|
||||
// temp = mData;
|
||||
// mMutex.unlock();
|
||||
|
||||
|
||||
mRdWrLock.lockForRead();
|
||||
temp = mData;
|
||||
mRdWrLock.unlock();
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorLazerProbe::SetData(unsigned int data)
|
||||
{
|
||||
mRdWrLock.lockForWrite();
|
||||
mData = data;
|
||||
mRdWrLock.unlock();
|
||||
|
||||
emit NewProbeData(data,mProbeType);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorLazerProbe::FlushProbeData()
|
||||
{
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
bool CSimulatorLazerProbe::IsProbeAlive()
|
||||
{
|
||||
bool alive;
|
||||
mRdWrLock.lockForRead();
|
||||
alive = mProbeAlive;
|
||||
mRdWrLock.unlock();
|
||||
|
||||
return alive;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorLazerProbe::SetProbeAlive()
|
||||
{
|
||||
mRdWrLock.lockForWrite();
|
||||
mProbeAlive = true;
|
||||
mRdWrLock.unlock();
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorLazerProbe::SetProbeDead()
|
||||
{
|
||||
mRdWrLock.lockForWrite();
|
||||
mProbeAlive = false;
|
||||
mRdWrLock.unlock();
|
||||
return RET_OK;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 - 2013 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Description du fichier si nécessaire.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef SIMULATORLAZERPROBE_H
|
||||
#define SIMULATORLAZERPROBE_H
|
||||
#include "AbstractLazerProbe.h"
|
||||
#include <QMutex>
|
||||
#include <QObject>
|
||||
#include <QReadWriteLock>
|
||||
|
||||
class CSimulatorLazerProbe : public QObject, public CAbstractLazerProbe
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSimulatorLazerProbe(unsigned int ProbeID, unsigned int ProbeType);
|
||||
~CSimulatorLazerProbe();
|
||||
|
||||
unsigned int OpenPort(QString PortName);
|
||||
unsigned int GetType();
|
||||
QString GetPortName();
|
||||
unsigned int GetID();
|
||||
unsigned int StartAcquisition();
|
||||
unsigned int StopAcquisition();
|
||||
unsigned int GetLastData();
|
||||
unsigned int SetData(unsigned int data);
|
||||
unsigned int FlushProbeData();
|
||||
bool IsProbeAlive();
|
||||
|
||||
unsigned int SetProbeAlive();
|
||||
unsigned int SetProbeDead();
|
||||
|
||||
unsigned int mData;
|
||||
|
||||
private:
|
||||
QString mPortName;
|
||||
unsigned int mProbeID;
|
||||
unsigned int mProbeType;
|
||||
QMutex mMutex;
|
||||
QReadWriteLock mRdWrLock;
|
||||
bool mProbeAlive;
|
||||
|
||||
signals:
|
||||
void NewProbeData(unsigned int,unsigned int);
|
||||
|
||||
};
|
||||
|
||||
#endif // SIMULATORLAZERPROBE_H
|
||||
@@ -0,0 +1,75 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 - 2013 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Classe instantiable du gestionnaire de sondes lazer simulé.
|
||||
Crée les objets CSimulatorLazerProbe et les rend disponibles via la fonction
|
||||
générique GetLazerProbeHandle.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "SimulatorLazerProbesMgr.h"
|
||||
|
||||
CSimulatorLazerProbesMgr::CSimulatorLazerProbesMgr()
|
||||
{
|
||||
mInternalLazerProbe = mExternalLazerProbe = 0;
|
||||
}
|
||||
|
||||
CSimulatorLazerProbesMgr::~CSimulatorLazerProbesMgr()
|
||||
{
|
||||
if(mExternalLazerProbe)
|
||||
delete mExternalLazerProbe;
|
||||
|
||||
if(mInternalLazerProbe)
|
||||
delete mInternalLazerProbe;
|
||||
}
|
||||
|
||||
CAbstractLazerProbe *CSimulatorLazerProbesMgr::GetLazerProbeHandle(eLazerProbeType_t LazerProbeType, unsigned int LazerProbeID)
|
||||
{
|
||||
Q_UNUSED(LazerProbeID)
|
||||
switch(LazerProbeType)
|
||||
{
|
||||
case LAZER_PROBE_TYPE_EXTERNAL:
|
||||
{
|
||||
return mExternalLazerProbe;
|
||||
break;
|
||||
}
|
||||
case LAZER_PROBE_TYPE_INTERNAL:
|
||||
{
|
||||
return mInternalLazerProbe;
|
||||
break;
|
||||
}
|
||||
case LAZER_PROBE_TYPE_INVALID:
|
||||
default:
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int CSimulatorLazerProbesMgr::InitLazerProbes()
|
||||
{
|
||||
mExternalLazerProbe = new CSimulatorLazerProbe(1,LAZER_PROBE_TYPE_EXTERNAL);
|
||||
mInternalLazerProbe = new CSimulatorLazerProbe(1,LAZER_PROBE_TYPE_INTERNAL);
|
||||
return LAZERPROBES_MGR_RET_OK;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 - 2013 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Description du fichier si nécessaire.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef SIMULATORLAZERPROBESMGR_H
|
||||
#define SIMULATORLAZERPROBESMGR_H
|
||||
|
||||
#include "AbstractLazerProbeMgr.h"
|
||||
#include "SimulatorLazerProbe.h"
|
||||
|
||||
class CSimulatorLazerProbesMgr : public CAbstractLazerProbeMgr
|
||||
{
|
||||
public:
|
||||
CSimulatorLazerProbesMgr();
|
||||
~CSimulatorLazerProbesMgr();
|
||||
|
||||
virtual unsigned int InitLazerProbes(void);
|
||||
virtual CAbstractLazerProbe *GetLazerProbeHandle(eLazerProbeType_t LazerProbeType, unsigned int LazerProbeID);
|
||||
|
||||
private:
|
||||
CAbstractLazerProbe *mInternalLazerProbe, *mExternalLazerProbe;
|
||||
|
||||
};
|
||||
|
||||
#endif // SIMULATORLAZERPROBESMGR_H
|
||||
@@ -0,0 +1,60 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Classe instantiable d'un module d'entrées/sorties externe mixte simulé.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "SimulatorMixedModule.h"
|
||||
|
||||
|
||||
|
||||
CSimulatorMixedModule::CSimulatorMixedModule()
|
||||
{
|
||||
mRealExtenalMixedModule = 0;
|
||||
}
|
||||
|
||||
void CSimulatorMixedModule::BindRealExternalMixedModule(CAnalogInputModule *MixedModule)
|
||||
{
|
||||
mRealExtenalMixedModule = MixedModule;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorMixedModule::GetAnalogInput(int Channel, int *Data)
|
||||
{
|
||||
Q_UNUSED(Channel);
|
||||
Q_UNUSED(Data);
|
||||
|
||||
if(mRealExtenalMixedModule == 0)
|
||||
return 0;
|
||||
|
||||
return mRealExtenalMixedModule->GetAnalogInput(Channel,Data);
|
||||
// return 1;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorMixedModule::GetAnalogInput(int Channel, double &Data)
|
||||
{
|
||||
int reading;
|
||||
unsigned int ret = GetAnalogInput(Channel,&reading);
|
||||
Data = (double)reading;
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Description du fichier si nécessaire.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef SIMULATORMIXEDMODULE_H
|
||||
#define SIMULATORMIXEDMODULE_H
|
||||
#include "GlobalDefine.h"
|
||||
#include "AnalogInputModule.h"
|
||||
|
||||
class CSimulatorMixedModule: public CAnalogInputModule
|
||||
{
|
||||
public:
|
||||
CSimulatorMixedModule();
|
||||
|
||||
virtual unsigned int GetAnalogInput(int Channel, int *Data);
|
||||
virtual unsigned int GetAnalogInput(int Channel, double &Data);
|
||||
|
||||
void BindRealExternalMixedModule(CAnalogInputModule *MixedModule);
|
||||
|
||||
private:
|
||||
CAnalogInputModule *mRealExtenalMixedModule;
|
||||
};
|
||||
|
||||
#endif // SIMULATORMIXEDMODULE_H
|
||||
@@ -0,0 +1,83 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 - 2013 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Classe instantiable d'une carte d'entrées PCI. Dérivée de CPCIIOMgr, elle
|
||||
permet d'émuler les entrées de la carte PCI en réimplémentant les fonctions
|
||||
génériques de sa classe de base. Les fonctions SetInputBufFlags et SetInputBufValue
|
||||
permettent au simulateur d'assigner les valeurs des entrées qui doivent être
|
||||
lues par le programme.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "SimulatorPCIIO.h"
|
||||
|
||||
CSimulatorPCIIO::CSimulatorPCIIO()
|
||||
{
|
||||
mSimPCIInputsBuffer = 0;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorPCIIO::GetInputs()
|
||||
{
|
||||
unsigned int temp;
|
||||
|
||||
mRdWrLock.lockForRead(); //lock for thread access
|
||||
temp = mSimPCIInputsBuffer;
|
||||
mRdWrLock.unlock();
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorPCIIO::OpenPCIInterface()
|
||||
{
|
||||
return PCIIO_OK;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorPCIIO::SetInputBufFlags(unsigned int FlagMask)
|
||||
{
|
||||
unsigned int temp;
|
||||
mRdWrLock.lockForWrite();
|
||||
mSimPCIInputsBuffer |= FlagMask;
|
||||
temp = mSimPCIInputsBuffer;
|
||||
mRdWrLock.unlock();
|
||||
return temp;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorPCIIO::SetInputBufValue(unsigned int value)
|
||||
{
|
||||
unsigned int temp;
|
||||
mRdWrLock.lockForWrite();
|
||||
mSimPCIInputsBuffer = value;
|
||||
temp = mSimPCIInputsBuffer;
|
||||
mRdWrLock.unlock();
|
||||
return temp;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorPCIIO::ClearInputBufFlags(unsigned int FlagMask)
|
||||
{
|
||||
unsigned int temp;
|
||||
mRdWrLock.lockForWrite();
|
||||
mSimPCIInputsBuffer ^= FlagMask;
|
||||
temp = mSimPCIInputsBuffer;
|
||||
mRdWrLock.unlock();
|
||||
return temp;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 - 2013 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Description du fichier si nécessaire.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef SIMULATORPCIIO_H
|
||||
#define SIMULATORPCIIO_H
|
||||
#include "PCIIOMgr.h"
|
||||
#include <QReadWriteLock>
|
||||
|
||||
class CSimulatorPCIIO : public CPCIIOMgr
|
||||
{
|
||||
public:
|
||||
CSimulatorPCIIO();
|
||||
|
||||
virtual unsigned int OpenPCIInterface(void);
|
||||
virtual unsigned int GetInputs(void);
|
||||
|
||||
unsigned int SetInputBufValue(unsigned int value);
|
||||
unsigned int SetInputBufFlags(unsigned int FlagMask);
|
||||
unsigned int ClearInputBufFlags(unsigned int FlagMask);
|
||||
|
||||
private:
|
||||
unsigned int mSimPCIInputsBuffer;
|
||||
QReadWriteLock mRdWrLock;
|
||||
|
||||
};
|
||||
|
||||
#endif // SIMULATORPCIIO_H
|
||||
@@ -0,0 +1,279 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 - 2013 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Cette classe est un thread qui roule en parallèle au programme. Elle est
|
||||
responsable de l'analyse en temps réel du passage d'un train. Elle fait la
|
||||
lecture des entrées sur la carte PCI et analyse les déclenchements au fur
|
||||
et à mesure qu'un train chemine sur la ZT2
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "GlobalDefine.h"
|
||||
#include "SimulatorThread.h"
|
||||
#include "PCIIOMgr.h"
|
||||
#include "AbstractLazerProbe.h"
|
||||
#include <QElapsedTimer>
|
||||
#include "ZTconfigmgr.h"
|
||||
|
||||
//const char * ErrorString[25] = {"Erreur de comptage S1-S2",
|
||||
// "Déclenchement frotteur négatif",
|
||||
// "Déclenchement pneu de guidage intérieur",
|
||||
// "Déclenchement pneu de guidage extérieur",
|
||||
// "Déclenchement pneu porteur intérieur",
|
||||
// "Déclenchement pneu porteur extérieur",
|
||||
// "Pré-détection frotteur négatif"};
|
||||
|
||||
CSimulatorThread::CSimulatorThread()
|
||||
{
|
||||
mExitLoop = false;
|
||||
mSimThreadRunning = false;
|
||||
mLogElement = 0;
|
||||
}
|
||||
|
||||
unsigned int CSimulatorThread::Init(CSimulatorInputModule *InputModule, CSImulatorOutputModule *OutputModule, CSimulatorPCIIO *PCIIO, CSimulatorLazerProbe *InternalLazerProbe,CSimulatorLazerProbe *ExternalLazerProbe,GenericInputMasks_t *StationInputMasks)
|
||||
{
|
||||
mInputModule = InputModule;
|
||||
mOutputModule = OutputModule;
|
||||
mPCIIO = PCIIO;
|
||||
mInternalLazerProbe = InternalLazerProbe;
|
||||
mExternalLazerProbe = ExternalLazerProbe;
|
||||
mStationInputMasks = StationInputMasks;
|
||||
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
void CSimulatorThread::SetLogElement(CLogElement *element)
|
||||
{
|
||||
mLogElement = element;
|
||||
}
|
||||
|
||||
void CSimulatorThread::StartSim()
|
||||
{
|
||||
|
||||
if(mLogElement == 0)
|
||||
return;
|
||||
|
||||
qDebug("Sim Thread started!");
|
||||
mExitLoop = false;
|
||||
mSimThreadRunning = true;
|
||||
|
||||
bool Run = true;
|
||||
CZT1LogElement *ZT1LogData = 0;
|
||||
CZT2LogElement *ZT2LogData = 0;
|
||||
|
||||
if(mLogElement->mZTLogType == ZT1_LOG_TYPE)
|
||||
ZT1LogData = (CZT1LogElement*) mLogElement;
|
||||
else
|
||||
ZT2LogData = (CZT2LogElement*) mLogElement;
|
||||
|
||||
QElapsedTimer AcquisitionTimer;
|
||||
AcquisitionTimer.start();
|
||||
|
||||
qint64 index = 0;
|
||||
qint64 NextEventTime;
|
||||
|
||||
//Init the lazer probes values.
|
||||
|
||||
|
||||
if(ZT1LogData != 0)
|
||||
{
|
||||
bool ExtSet = false, IntSet = false;
|
||||
for(int i = 0; i < ZT1LogData->mZTLogData.size(); i++)
|
||||
{
|
||||
if(ZT1LogData->mZTLogData.at(i)->mZT1ThreadData != 0)
|
||||
{
|
||||
if(ExtSet == false)
|
||||
{
|
||||
if(ZT1LogData->mZTLogData.at(i)->mZT1ThreadData->mPGExtValue != 0)
|
||||
{
|
||||
mExternalLazerProbe->SetData(ZT1LogData->mZTLogData.at(i)->mZT1ThreadData->mPGExtValue);
|
||||
ExtSet = true;
|
||||
}
|
||||
}
|
||||
if(IntSet == false)
|
||||
{
|
||||
if(ZT1LogData->mZTLogData.at(i)->mZT1ThreadData->mPGIntValue != 0)
|
||||
{
|
||||
mInternalLazerProbe->SetData(ZT1LogData->mZTLogData.at(i)->mZT1ThreadData->mPGIntValue);
|
||||
IntSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(IntSet == true && ExtSet == true)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// mInternalLazerProbe->SetData(ZT1LogData->mFlags.mIntPGOffset);
|
||||
// mExternalLazerProbe->SetData(ZT1LogData->mFlags.mExtPGOffset);
|
||||
NextEventTime = ZT1LogData->mZTLogData.at(index)->mTimestamp;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if(ZT2LogData->mZTLogData.at(index)->mZT2ThreadData != 0)
|
||||
// NextEventTime = ZT2LogData->mZTLogData.at(index)->mZT2ThreadData->mTimeStamp;
|
||||
// else
|
||||
NextEventTime = ZT2LogData->mZTLogData.at(index)->mTimestamp;
|
||||
}
|
||||
|
||||
unsigned int PCIStartBuf = mPCIIO->GetInputs();
|
||||
// mPCIIO->SetInputBufValue(0);
|
||||
unsigned int ModuleStartBuf = mInputModule->GetInputBuf();
|
||||
// mInputModule->SetInputBufValue(mInputModule);
|
||||
|
||||
NextEventTime = 0;
|
||||
mSimTimer.start();
|
||||
|
||||
while(Run == true)
|
||||
{
|
||||
|
||||
|
||||
if(mSimTimer.nsecsElapsed() >= NextEventTime)
|
||||
{
|
||||
// qDebug("%lld - %lld",mSimTimer.nsecsElapsed(),NextEventTime);
|
||||
if(ZT1LogData != 0)
|
||||
{
|
||||
CZT1ThreadData *Data = ZT1LogData->mZTLogData.at(index)->mZT1ThreadData;
|
||||
if(Data != 0)
|
||||
{
|
||||
unsigned int PCIData = PCIStartBuf;
|
||||
|
||||
if(Data->mFN == 1)
|
||||
PCIData ^= mStationInputMasks->InputZT1FNMask;
|
||||
if(Data->mPExt == 1)
|
||||
PCIData ^= mStationInputMasks->InputZT1PIMask;
|
||||
if(Data->mPInt == 1)
|
||||
PCIData ^= mStationInputMasks->InputZT1PIMask;
|
||||
if(Data->mS1 == 1)
|
||||
PCIData |= mStationInputMasks->InputZT1S1Mask;
|
||||
if(Data->mS2 == 1)
|
||||
PCIData |= mStationInputMasks->InputZT1S2Mask;
|
||||
|
||||
mPCIIO->SetInputBufValue(PCIData);
|
||||
|
||||
mExternalLazerProbe->SetData(Data->mPGExtValue);
|
||||
mInternalLazerProbe->SetData(Data->mPGIntValue);
|
||||
}
|
||||
|
||||
unsigned int InputModuleData = ModuleStartBuf;
|
||||
|
||||
CZT1LogData *LogData = ZT1LogData->mZTLogData.at(index);
|
||||
if(LogData->mCIZT1 == 1)
|
||||
{
|
||||
InputModuleData |= mStationInputMasks->InputZT1ITIMask;
|
||||
}
|
||||
if(LogData->mCDVARM_ZT1 == 1)
|
||||
{
|
||||
InputModuleData &= ~(mStationInputMasks->InputCDVZT1Mask);
|
||||
}
|
||||
if(LogData->mCDVApproach_ZT1 == 1)
|
||||
{
|
||||
InputModuleData &= ~(mStationInputMasks->InputCDVZT1ApproachMask);
|
||||
}
|
||||
|
||||
mInputModule->SetInputBufValue(InputModuleData);
|
||||
|
||||
index++;
|
||||
if(index >= ZT1LogData->mZTLogData.size())
|
||||
{
|
||||
Run = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// NextEventTime = ZT1LogData->mZTLogData.at(index)->mTimestamp;
|
||||
NextEventTime = ZT1LogData->mZTLogData.at(index)->mTimestamp - ZT1LogData->mZTLogData.at(index-1)->mTimestamp;
|
||||
//qDebug("Next %lld",NextEventTime);
|
||||
mSimTimer.start();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CZT2ThreadData *Data = ZT2LogData->mZTLogData.at(index)->mZT2ThreadData;
|
||||
if(Data != 0)
|
||||
{
|
||||
unsigned int PCIData = PCIStartBuf;
|
||||
|
||||
if(Data->mPPInt == 1)
|
||||
PCIData ^= mStationInputMasks->InputZT2PIMask;
|
||||
if(Data->mPPExt == 1)
|
||||
PCIData ^= mStationInputMasks->InputZT2PEMask;
|
||||
if(Data->mS1 == 1)
|
||||
PCIData |= mStationInputMasks->InputZT2S1Mask;
|
||||
|
||||
mPCIIO->SetInputBufValue(PCIData);
|
||||
}
|
||||
|
||||
|
||||
unsigned int InputModuleData = ModuleStartBuf;
|
||||
CZT2LogData *LogData = ZT2LogData->mZTLogData.at(index);
|
||||
if(LogData->mCIZT2 == 1)
|
||||
{
|
||||
InputModuleData |= mStationInputMasks->InputZT2ITIMask;
|
||||
}
|
||||
if(LogData->mCDVARM_ZT2 == 1)
|
||||
{
|
||||
InputModuleData ^= mStationInputMasks->InputCDVZT2Mask;
|
||||
}
|
||||
if(LogData->mCDVApproach_ZT2 == 1)
|
||||
{
|
||||
InputModuleData ^= mStationInputMasks->InputCDVZT2ApproachMask;
|
||||
}
|
||||
|
||||
mInputModule->SetInputBufValue(InputModuleData);
|
||||
|
||||
index++;
|
||||
if(index >= ZT2LogData->mZTLogData.size())
|
||||
{
|
||||
Run = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if(ZT2LogData->mZTLogData.at(index)->mZT2ThreadData != 0)
|
||||
// NextEventTime = ZT2LogData->mZTLogData.at(index)->mZT2ThreadData->mTimeStamp;
|
||||
// else
|
||||
NextEventTime = ZT2LogData->mZTLogData.at(index)->mTimestamp;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
mMutex.lock();
|
||||
if(mExitLoop == true)
|
||||
Run = false;
|
||||
mMutex.unlock();
|
||||
}//while
|
||||
|
||||
mSimThreadRunning = false;
|
||||
emit SimFinished();
|
||||
|
||||
}
|
||||
|
||||
void CSimulatorThread::Terminate()
|
||||
{
|
||||
mMutex.lock();
|
||||
mExitLoop = true;
|
||||
mMutex.unlock();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* 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
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,148 @@
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Société de Transports de Montréal. *
|
||||
* 2012 *
|
||||
* *
|
||||
* Projet Zones Tests *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
/*
|
||||
Description:
|
||||
Description du fichier si nécessaire.
|
||||
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* Revision:
|
||||
### YYYMMDD JFM
|
||||
Verision d'origine.
|
||||
|
||||
### YYYYMMDD Description du besoin ou du bug
|
||||
Description du changement.
|
||||
*/
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef CZTSIMULATOR_H
|
||||
#define CZTSIMULATOR_H
|
||||
#include <QGraphicsWidget>
|
||||
#include "SimulatorIOManager.h"
|
||||
#include "GlobalDefine.h"
|
||||
#include "Station.h"
|
||||
#include "SimulatorLazerProbesMgr.h"
|
||||
#include "SimulatorIOManager.h"
|
||||
#include "SimulatorPCIIO.h"
|
||||
#include "CDVItem.h"
|
||||
#include "ToggleTextButtonWidget.h"
|
||||
#include "PushButton.h"
|
||||
#include <QTimer>
|
||||
#include "SimulationScenario.h"
|
||||
#include <QElapsedTimer>
|
||||
#include "LedWidget.h"
|
||||
#include "SimulatorThread.h"
|
||||
#include <QCheckBox>
|
||||
#include "USBDriveInterface.h"
|
||||
#include "IOManager.h"
|
||||
|
||||
|
||||
|
||||
#define SIM_LAZER_PROBES_UPDATE_TIMEOUT 1 //milliseconds
|
||||
#define USE_REAL_ANALOG_EXTERNAL_MODULE
|
||||
|
||||
class CZTPage;
|
||||
|
||||
|
||||
class CZTSimulator : public QGraphicsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CZTSimulator(CSimulatorIOManager *mIOMgrPtr);
|
||||
~CZTSimulator();
|
||||
|
||||
|
||||
|
||||
|
||||
void Show();
|
||||
unsigned int Init(CZTPage *MainPagePtr, CStation *Station, CIOManager *IOMgrPtr,CPCIIOMgr *PCIIO,CAbstractLazerProbeMgr *LazerProbesMgr,CUSBDriveInterface *UsbDriveInterface, CAnalogInputModule *RealAnalogModule=0);
|
||||
void UpdateSimulatorDisplay();
|
||||
// void UpdateOutputsDisplay(quint32 Outputs);
|
||||
void StartSim();
|
||||
void SetPGTreshold(qint32 Treshold);
|
||||
|
||||
private:
|
||||
CSimulatorIOManager *mIOMgrPtr;
|
||||
CSimulatorPCIIO *mPCIIO;
|
||||
CSimulatorLazerProbesMgr *mLazerProbesMgr;
|
||||
CSimulatorLazerProbe *mInternalLazerProbe, *mExternalLazerProbe;
|
||||
CZTPage *mMainPagePtr;
|
||||
CStation *mStationPtr;
|
||||
CSimulatorInputModule *mInputModule;
|
||||
CSImulatorOutputModule *mOutputModule;
|
||||
CSimulatorMixedModule *mMixedModule;
|
||||
|
||||
CSimulatorThread *mSimWorkerThread;
|
||||
QThread *mSimThread;
|
||||
CLogElement *mSimLogElement;
|
||||
CUSBDriveInterface *mUSBDriveInterfacePtr;
|
||||
|
||||
GenericInputMasks_t *mStationInputMasks;
|
||||
GenericOutputMasks_t *mStationOutputMasks;
|
||||
|
||||
//Simulator GUI items
|
||||
QList<CCDVItem*> mSimCDVItemsList;
|
||||
CToggleTextButtonWidget *mITIZT1ToggleBtn, *mITIZT2ToggleBtn, *mITIZT1AltToggleBtn;
|
||||
CToggleTextButtonWidget *mS1SimBtn, *mS2SimBtn, *mS1S2SimBtn, *mFNSimBtn, *mPPISimBtn, *mPPESimBtn;
|
||||
CToggleTextButtonWidget *mZT2S1SimBtn, *mZT2PPISimBtn,*mZT2PPESimBtn;
|
||||
CPushButton *mSimulationStartBtn, *mSimFileOpenBtn, *mSimDirOpenButton;
|
||||
CToggleTextButtonWidget *mAN1SimBtn, *mAN2SimBtn;
|
||||
QCheckBox *mLoopSimCheckbox;
|
||||
QCheckBox *mProbesAliveCheckBox;
|
||||
|
||||
//USB stick presence emulation
|
||||
QCheckBox *mUSBKeyEmuEnableCheckBox;
|
||||
CToggleTextButtonWidget *mUSBKeyPresenceToggleBtn;
|
||||
|
||||
//General simulator stuff
|
||||
QElapsedTimer *mSimulationElapsedTimer;
|
||||
QTimer mFileSimLoopDelayTimer;
|
||||
|
||||
//Simulation scenario stuff
|
||||
CSimulationScenario *mScenario;
|
||||
|
||||
//Lazer probes simulation
|
||||
QTimer *mLazerProbesUpdateTimer;
|
||||
unsigned int mPGTreshold;
|
||||
unsigned int mPGIValue, mPGEValue;
|
||||
|
||||
//Outputs display
|
||||
CLedWidget *LedWidget[GENERIC_OUTPUT_NB_ID];
|
||||
|
||||
|
||||
void DestroyLogElement();
|
||||
|
||||
|
||||
public slots:
|
||||
void CDVItemRightClicked(CCDVItem *ClickedItem);
|
||||
void ItineraryToggleSwitchActivate(CToggleTextButtonWidget*);
|
||||
void ItineraryToggleSwitchDeActivate(CToggleTextButtonWidget*);
|
||||
void ZT1SensorBtnActivate(CToggleTextButtonWidget*);
|
||||
void ZT1SensorBtnDeActivate(CToggleTextButtonWidget*);
|
||||
void ZT2SensorBtnActivate(CToggleTextButtonWidget*);
|
||||
void ZT2SensorBtnDeActivate(CToggleTextButtonWidget*);
|
||||
void SimulationScenarioButtonPressed(CPushButton*);
|
||||
void SimulationScenarioExecStep(CSimulationStep*);
|
||||
void SimulationScenarioFinished();
|
||||
void LazerProbesSimTimerExpired();
|
||||
void FileSimFinished();
|
||||
void FileLoopDelayExpired();
|
||||
void USBEmulationCheckboxChanged(int state);
|
||||
void USBEmulationPresenceToggled(CToggleTextButtonWidget*);
|
||||
void UpdateOutputsDisplay(quint32);
|
||||
void SimulDefectLazerCheckboxChanged(int state);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // CZTSIMULATOR_H
|
||||
Reference in New Issue
Block a user