Add a flashing event in the events bar when a ZT1 or ZT2 train passage is inhibited by CC (Modbus).
This commit is contained in:
parent
2f1ea1b5e5
commit
a55770c693
Binary file not shown.
@ -28,9 +28,10 @@
|
|||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
|
|
||||||
CEvent::CEvent(unsigned int EventType, QString EventLabel, bool IsItemAnimated)
|
CEvent::CEvent(unsigned int EventType, QString EventLabel, bool IsItemAnimated, int Color)
|
||||||
{
|
{
|
||||||
mEventType = EventType;
|
mEventType = EventType;
|
||||||
mEventLabel = EventLabel;
|
mEventLabel = EventLabel;
|
||||||
mItemAnimated = IsItemAnimated;
|
mItemAnimated = IsItemAnimated;
|
||||||
|
mEventColor = Color;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,11 +35,12 @@
|
|||||||
class CEvent
|
class CEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CEvent(unsigned int EventType, QString EventLabel,bool IsItemAnimated);
|
CEvent(unsigned int EventType, QString EventLabel,bool IsItemAnimated, int Color);
|
||||||
|
|
||||||
unsigned int mEventType;
|
unsigned int mEventType;
|
||||||
QString mEventLabel;
|
QString mEventLabel;
|
||||||
bool mItemAnimated;
|
bool mItemAnimated;
|
||||||
|
int mEventColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EVENT_H
|
#endif // EVENT_H
|
||||||
|
|||||||
@ -81,6 +81,7 @@ bool CEventMgr::AddEvent(unsigned int EventID)
|
|||||||
|
|
||||||
QString Label;
|
QString Label;
|
||||||
bool IsAnimated = false;
|
bool IsAnimated = false;
|
||||||
|
int Color = CEventItem::EVENT_ITEM_COLOR_RED;
|
||||||
switch(EventID)
|
switch(EventID)
|
||||||
{
|
{
|
||||||
case EVENT_FN_HS:
|
case EVENT_FN_HS:
|
||||||
@ -129,9 +130,23 @@ bool CEventMgr::AddEvent(unsigned int EventID)
|
|||||||
IsAnimated = true;
|
IsAnimated = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case EVENT_ZT1_INHIBITION:
|
||||||
|
{
|
||||||
|
Label = "Passage ZT1 inhibé";
|
||||||
|
IsAnimated = true;
|
||||||
|
Color = CEventItem::EVENT_ITEM_COLOR_GREEN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EVENT_ZT2_INHIBITION:
|
||||||
|
{
|
||||||
|
Label = "Passage ZT2 inhibé";
|
||||||
|
IsAnimated = true;
|
||||||
|
Color = CEventItem::EVENT_ITEM_COLOR_GREEN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CEvent *NewEvent = new CEvent(EventID,Label,IsAnimated);
|
CEvent *NewEvent = new CEvent(EventID,Label,IsAnimated,Color);
|
||||||
mEventsList.append(NewEvent);
|
mEventsList.append(NewEvent);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -45,6 +45,8 @@ enum eEventTypeID
|
|||||||
EVENT_CA_PG,
|
EVENT_CA_PG,
|
||||||
EVENT_PEQ1,
|
EVENT_PEQ1,
|
||||||
EVENT_MAINTENANCE,
|
EVENT_MAINTENANCE,
|
||||||
|
EVENT_ZT1_INHIBITION,
|
||||||
|
EVENT_ZT2_INHIBITION,
|
||||||
EVENT_MAX_EVENT_ID
|
EVENT_MAX_EVENT_ID
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -34,13 +34,17 @@
|
|||||||
#include "CDV.h"
|
#include "CDV.h"
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
|
|
||||||
CEventItem::CEventItem(QString Label,bool Animated,QGraphicsItem *Parent)
|
CEventItem::CEventItem(QString Label, bool Animated, QGraphicsItem *Parent, int Color)
|
||||||
{
|
{
|
||||||
setParentItem(Parent);
|
setParentItem(Parent);
|
||||||
|
|
||||||
// mCDVFreeBrush = new QBrush(Qt::gray);
|
|
||||||
// mCDVITICommandedBrush = new QBrush(Qt::darkGreen);
|
if(Color != EVENT_ITEM_COLOR_RED && Color != EVENT_ITEM_COLOR_GREEN)
|
||||||
// mCDVOccupiedBrush = new QBrush(Qt::yellow);
|
{
|
||||||
|
Color = EVENT_ITEM_COLOR_RED;
|
||||||
|
}
|
||||||
|
|
||||||
|
mColor = Color;
|
||||||
|
|
||||||
setGeometry(0,0,40,25);
|
setGeometry(0,0,40,25);
|
||||||
mCurBrush = new QBrush(Qt::lightGray);
|
mCurBrush = new QBrush(Qt::lightGray);
|
||||||
@ -75,7 +79,16 @@ void CEventItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
|||||||
QRectF EventRect = rect();
|
QRectF EventRect = rect();
|
||||||
|
|
||||||
if(mAnimated)
|
if(mAnimated)
|
||||||
mCurBrush->setColor(QColor(255,mAlpha,mAlpha,255));
|
{
|
||||||
|
if(mColor == EVENT_ITEM_COLOR_RED)
|
||||||
|
{
|
||||||
|
mCurBrush->setColor(QColor(255,mAlpha,mAlpha,255));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mCurBrush->setColor(QColor(mAlpha,255,mAlpha,255));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
painter->setBrush(*mCurBrush);
|
painter->setBrush(*mCurBrush);
|
||||||
painter->setPen(Qt::black);
|
painter->setPen(Qt::black);
|
||||||
|
|||||||
@ -39,7 +39,14 @@ class CEventItem : public QGraphicsWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CEventItem(QString Label,bool Animated,QGraphicsItem *Parent = 0);
|
enum eEventColor
|
||||||
|
{
|
||||||
|
EVENT_ITEM_COLOR_RED,
|
||||||
|
EVENT_ITEM_COLOR_GREEN
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
CEventItem(QString Label,bool Animated,QGraphicsItem *Parent = 0, int Color = EVENT_ITEM_COLOR_RED);
|
||||||
~CEventItem();
|
~CEventItem();
|
||||||
|
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
@ -59,6 +66,7 @@ private:
|
|||||||
bool mAnimated;
|
bool mAnimated;
|
||||||
QTimeLine *mAnimationTimeline;
|
QTimeLine *mAnimationTimeline;
|
||||||
unsigned int mAlpha;
|
unsigned int mAlpha;
|
||||||
|
int mColor;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void EventItemRightClicked(CEventItem*);
|
void EventItemRightClicked(CEventItem*);
|
||||||
|
|||||||
@ -72,7 +72,7 @@ void CEventsBar::UpdateEventsList()
|
|||||||
|
|
||||||
for(int i = 0; i < mEventsList->size(); i++)
|
for(int i = 0; i < mEventsList->size(); i++)
|
||||||
{
|
{
|
||||||
CEventItem *NewItem = new CEventItem(mEventsList->at(i)->mEventLabel,mEventsList->at(i)->mItemAnimated,this);
|
CEventItem *NewItem = new CEventItem(mEventsList->at(i)->mEventLabel,mEventsList->at(i)->mItemAnimated,this,mEventsList->at(i)->mEventColor);
|
||||||
mEventsItemList.append(NewItem);
|
mEventsItemList.append(NewItem);
|
||||||
}
|
}
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
|
|||||||
@ -36,13 +36,16 @@
|
|||||||
#include "math.h"
|
#include "math.h"
|
||||||
#include "MaintenancePage.h"
|
#include "MaintenancePage.h"
|
||||||
#include "RamMonitor.h"
|
#include "RamMonitor.h"
|
||||||
|
#include "Zonetest.h"
|
||||||
//#include "ModbusCCDefs.h"
|
//#include "ModbusCCDefs.h"
|
||||||
|
|
||||||
CZTStateMachine::CZTStateMachine(QObject *parent) :
|
CZTStateMachine::CZTStateMachine(CZoneTest *ZTPtr, QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
||||||
|
|
||||||
|
mProgramPtr = ZTPtr;
|
||||||
|
|
||||||
mZT1State = ZT1_WAIT_FOR_CI_STATE;
|
mZT1State = ZT1_WAIT_FOR_CI_STATE;
|
||||||
mZT2State = ZT2_WAIT_FOR_CI_STATE;
|
mZT2State = ZT2_WAIT_FOR_CI_STATE;
|
||||||
mZTState = ZT_INIT_STATE;
|
mZTState = ZT_INIT_STATE;
|
||||||
@ -320,10 +323,12 @@ unsigned int CZTStateMachine::ZT1StateMachine(unsigned int Event, unsigned int S
|
|||||||
if(mCIZT1Active == false)
|
if(mCIZT1Active == false)
|
||||||
{
|
{
|
||||||
mZT1State = ZT1_WAIT_FOR_CI_STATE;
|
mZT1State = ZT1_WAIT_FOR_CI_STATE;
|
||||||
|
mProgramPtr->SetZT1InhibitionState(false);
|
||||||
}
|
}
|
||||||
if(!mZTStationPtr->IsZT1CDVOccupied() && !mZTStationPtr->IsZT1SubsequentCDVOccupied())
|
if(!mZTStationPtr->IsZT1CDVOccupied() && !mZTStationPtr->IsZT1SubsequentCDVOccupied())
|
||||||
{
|
{
|
||||||
mZT1State = ZT1_WAIT_FOR_TRAIN_STATE;
|
mZT1State = ZT1_WAIT_FOR_TRAIN_STATE;
|
||||||
|
mProgramPtr->SetZT1InhibitionState(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -355,8 +360,10 @@ unsigned int CZTStateMachine::ZT1StateMachine(unsigned int Event, unsigned int S
|
|||||||
mZT1TrainComposition = mModbusCCMgr->GetZT1TrainComposition();
|
mZT1TrainComposition = mModbusCCMgr->GetZT1TrainComposition();
|
||||||
mZTPagePTr->SetZT1TrainData(mTrainTypeDetected,mZT1TrainComposition);
|
mZTPagePTr->SetZT1TrainData(mTrainTypeDetected,mZT1TrainComposition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mProgramPtr->SetZT1InhibitionState(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(abort == false)
|
if(abort == false)
|
||||||
{
|
{
|
||||||
@ -1131,6 +1138,8 @@ unsigned int CZTStateMachine::ZT2StateMachine(unsigned int Event, unsigned int S
|
|||||||
mZT2TrainType = (unsigned)mModbusCCMgr->GetZT2TrainType();
|
mZT2TrainType = (unsigned)mModbusCCMgr->GetZT2TrainType();
|
||||||
mZT2TrainComposition = mModbusCCMgr->GetZT2TrainComposition();
|
mZT2TrainComposition = mModbusCCMgr->GetZT2TrainComposition();
|
||||||
mZTPagePTr->SetZT2TrainData(mZT2TrainType,mZT2TrainComposition);
|
mZTPagePTr->SetZT2TrainData(mZT2TrainType,mZT2TrainComposition);
|
||||||
|
|
||||||
|
mProgramPtr->SetZT2InhibitionState(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1203,6 +1212,7 @@ unsigned int CZTStateMachine::ZT2StateMachine(unsigned int Event, unsigned int S
|
|||||||
{
|
{
|
||||||
CZTLog::instance()->AddLogString("CDV ZT2 Libéré. ZT2 prête",true);
|
CZTLog::instance()->AddLogString("CDV ZT2 Libéré. ZT2 prête",true);
|
||||||
mZT2State = ZT2_WAIT_FOR_CI_STATE;
|
mZT2State = ZT2_WAIT_FOR_CI_STATE;
|
||||||
|
mProgramPtr->SetZT2InhibitionState(false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,13 +96,13 @@ enum ePostDetectionRet
|
|||||||
RET_POST_DETECTION_MAX_RET
|
RET_POST_DETECTION_MAX_RET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CZoneTest;
|
||||||
|
|
||||||
class CZTStateMachine : public QObject
|
class CZTStateMachine : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit CZTStateMachine(QObject *parent = 0);
|
explicit CZTStateMachine(CZoneTest *ZTPtr,QObject *parent = 0);
|
||||||
~CZTStateMachine();
|
~CZTStateMachine();
|
||||||
unsigned int ZTStateMachine(unsigned int Event, unsigned int SubEvent = 0); //Exécution de la SM principale
|
unsigned int ZTStateMachine(unsigned int Event, unsigned int SubEvent = 0); //Exécution de la SM principale
|
||||||
void BindPointers(CStation *ptr,CInputModule *InputModule,COutputModule *OutputModule,CZTPage *ZTPagePTr,CPCIIOMgr *PCIIOPtr,CAbstractLazerProbe *PGIntProbePtr, CAbstractLazerProbe *PGExtProbePTr,CLogMgr *LogMgr,CTKTransportInterface *TKTransport,CZTSimulator *ZTSimPtr = 0,CAnalogInputModule *DataQInterface = 0); //Assignation de pointeurs
|
void BindPointers(CStation *ptr,CInputModule *InputModule,COutputModule *OutputModule,CZTPage *ZTPagePTr,CPCIIOMgr *PCIIOPtr,CAbstractLazerProbe *PGIntProbePtr, CAbstractLazerProbe *PGExtProbePTr,CLogMgr *LogMgr,CTKTransportInterface *TKTransport,CZTSimulator *ZTSimPtr = 0,CAnalogInputModule *DataQInterface = 0); //Assignation de pointeurs
|
||||||
@ -171,6 +171,7 @@ private:
|
|||||||
int mAnalogReading;
|
int mAnalogReading;
|
||||||
|
|
||||||
|
|
||||||
|
CZoneTest *mProgramPtr;
|
||||||
CStation *mZTStationPtr;
|
CStation *mZTStationPtr;
|
||||||
CAnalogInputModule *mSDFAnalogMonitorInterface;
|
CAnalogInputModule *mSDFAnalogMonitorInterface;
|
||||||
CInputModule *mInputModule;
|
CInputModule *mInputModule;
|
||||||
|
|||||||
@ -76,7 +76,7 @@ CZoneTest::CZoneTest():
|
|||||||
connect(mZTStateMachineTimer, SIGNAL(timeout()), this, SLOT(SMTimerExpired()));
|
connect(mZTStateMachineTimer, SIGNAL(timeout()), this, SLOT(SMTimerExpired()));
|
||||||
panel.installEventFilter(this); //Install an event filter for CZoneTest to manage some events from GUI
|
panel.installEventFilter(this); //Install an event filter for CZoneTest to manage some events from GUI
|
||||||
|
|
||||||
mZTStateMachine = new CZTStateMachine();
|
mZTStateMachine = new CZTStateMachine(this);
|
||||||
mZTSimulator = 0;
|
mZTSimulator = 0;
|
||||||
mIOManager = 0;
|
mIOManager = 0;
|
||||||
mLazerProbesManager = 0;
|
mLazerProbesManager = 0;
|
||||||
@ -1222,6 +1222,32 @@ unsigned int CZoneTest::SetZTFunctionsConfig(const CTCPZTFunctionsStatus &Functi
|
|||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CZoneTest::SetZT1InhibitionState(bool InhibitionON)
|
||||||
|
{
|
||||||
|
if(InhibitionON)
|
||||||
|
{
|
||||||
|
mEventMgr->AddSingleEvent(EVENT_ZT1_INHIBITION);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mEventMgr->RemoveSingleEvent(EVENT_ZT1_INHIBITION);
|
||||||
|
}
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CZoneTest::SetZT2InhibitionState(bool InhibitionON)
|
||||||
|
{
|
||||||
|
if(InhibitionON)
|
||||||
|
{
|
||||||
|
mEventMgr->AddSingleEvent(EVENT_ZT2_INHIBITION);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mEventMgr->RemoveSingleEvent(EVENT_ZT2_INHIBITION);
|
||||||
|
}
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CZoneTest::ApplicationQuit(bool PowerButton)
|
void CZoneTest::ApplicationQuit(bool PowerButton)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -143,7 +143,9 @@ public:
|
|||||||
unsigned int DeleteZTLogRequest();
|
unsigned int DeleteZTLogRequest();
|
||||||
unsigned int SetZTFunctionsConfig(const CTCPZTFunctionsStatus &FunctionsConfig);
|
unsigned int SetZTFunctionsConfig(const CTCPZTFunctionsStatus &FunctionsConfig);
|
||||||
|
|
||||||
|
//ZTStateMachine requests
|
||||||
|
int SetZT1InhibitionState(bool InhibitionON);
|
||||||
|
int SetZT2InhibitionState(bool InhibitionON);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user