ZT/sources/Simulator/SimulationScenario.h

112 lines
3.0 KiB
C++

/*******************************************************************************
* *
* 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