diff --git a/Configuration/ZTSettings.ztc b/Configuration/ZTSettings.ztc index 46f0b6a..28147c4 100644 Binary files a/Configuration/ZTSettings.ztc and b/Configuration/ZTSettings.ztc differ diff --git a/sources/Station.cpp b/sources/Station.cpp index 58fc1c5..e998098 100644 --- a/sources/Station.cpp +++ b/sources/Station.cpp @@ -120,6 +120,16 @@ bool CStation::IsZT2CDVOccupied() return false; } +bool CStation::IsCIZT1ITIActive(unsigned int ExtInputData) +{ + return ((ExtInputData & mStationInputMasks.InputZT1ITIMask) != 0); +} + +bool CStation::IsCIZT2ITIActive(unsigned int ExtInputData) +{ + return ((ExtInputData & mStationInputMasks.InputZT2ITIMask) != 0); +} + bool CStation::IsZT1AlarmAutoAcquireCDVOccupied() { if(mZT1AlarmAutoAcquireCDV) diff --git a/sources/Station.h b/sources/Station.h index 41a322f..6188271 100644 --- a/sources/Station.h +++ b/sources/Station.h @@ -219,6 +219,9 @@ public: virtual unsigned int UpdateStationMasks(unsigned int ExtInputData); virtual GenericInputMasks_t *GetInputMasks(void); virtual GenericAnalogAcquisitionChannels_t *GetAnalogAcqChannels(void); + virtual bool IsCIZT1ITIActive(unsigned int ExtInputData); + virtual bool IsCIZT2ITIActive(unsigned int ExtInputDAta); + GenericOutputMasks_t *GetOutputMasks(void){return &mStationOutputMasks;} GenericAnalogAcquisitionChannels_t *GetAnalogChannels(){return &mAnalogAcqChannels;} virtual bool IsZT1ApproachCDVOccupied(); @@ -231,7 +234,7 @@ public: bool IsZT1AlarmAutoAcquireCDVOccupied(); bool IsZT2AlarmAutoAcquireCDVOccupied(); bool IsZT2ApproachCDVOccupied(); - bool IsZT1CIOpened(); + bool IsZT1ApproachPresent(); CCDV *GetZT1ApproachCDV(){return mZT1ApproachCDV;} diff --git a/sources/Stations/DuCollege.cpp b/sources/Stations/DuCollege.cpp index e73e55a..bfd9ee1 100644 --- a/sources/Stations/DuCollege.cpp +++ b/sources/Stations/DuCollege.cpp @@ -34,6 +34,7 @@ #ifndef WINDOWS_OS #include "ExternalIOMgr.h" #include "Seaio430driver.h" +#include "SwitchCDV.h" #endif //rydy @@ -59,10 +60,10 @@ CDuCollegeStation::CDuCollegeStation() mStationInputMasks.InputZT2PEMask = DUCOLLEGE_ZT2_PE_MASK; //External (ethernet) input module masks - mStationInputMasks.InputZT1ITIMask = DUCOLLEGE_IN_ZT1_ITI_MASK; + mStationInputMasks.InputZT1ITIMask = DUCOLLEGE_IN_ZT1_V2_ITI_MASK; mStationInputMasks.InputZT1ANMask = DUCOLLEGE_IN_ZT1_AN_MASK; mStationInputMasks.InputZT1ARFMask = DUCOLLEGE_IN_ZT1_ARF_MASK; - mStationInputMasks.InputZT2ITIMask = DUCOLLEGE_IN_ZT2_ITI_MASK; + mStationInputMasks.InputZT2ITIMask = 0; mStationInputMasks.InputZT2ANMask = DUCOLLEGE_IN_ZT2_AN_MASK; mStationInputMasks.InputZT2ARFMask = DUCOLLEGE_IN_ZT2_ARF_MASK; mStationInputMasks.InputStationIDMask = DUCOLLEGE_IN_STATION_ID_MASK; @@ -112,48 +113,119 @@ CDuCollegeStation::CDuCollegeStation() mStationHasZT2 = false; mTextualStationName = "Du Collège"; mTextualShortName = "COLG"; + + mCurZT1Itinerary = DUCOLLEGE_ZT1_NO_ITINERARY; } unsigned int CDuCollegeStation::BuildStationCDVList() { CCDV *NewCDV; mCDVList.empty(); + unsigned int SP2_V2_12_14_ItiMask = DUCOLLEGE_IN_ZT1_12_14_ITI_MASK | DUCOLLEGE_IN_ZT1_V2_ITI_MASK | DUCOLLEGE_IN_ZT1_SP2_ITI_MASK; - NewCDV = new CCDV(DUCOLLEGE_IN_ZT1_ITI_MASK,DUCOLLEGE_IN_CDV_14C_MASK,CDV_NORMAL_TYPE,"14C",1,1); + NewCDV = new CCDV(DUCOLLEGE_IN_ZT1_12_14_ITI_MASK,DUCOLLEGE_IN_CDV_14C_MASK,CDV_NORMAL_TYPE,"14C",1,1); mCDVList.append(NewCDV); - NewCDV = new CCDV(DUCOLLEGE_IN_ZT1_ITI_MASK,DUCOLLEGE_IN_CDV_14B_MASK,CDV_NORMAL_TYPE,"14B",1,2); + NewCDV = new CCDV(DUCOLLEGE_IN_ZT1_12_14_ITI_MASK,DUCOLLEGE_IN_CDV_14B_MASK,CDV_NORMAL_TYPE,"14B",1,2); mCDVList.append(NewCDV); - NewCDV = new CCDV(DUCOLLEGE_IN_ZT1_ITI_MASK,DUCOLLEGE_IN_CDV_14A_MASK,CDV_NORMAL_TYPE,"14A",1,3); + NewCDV = new CCDV(DUCOLLEGE_IN_ZT1_12_14_ITI_MASK,DUCOLLEGE_IN_CDV_14A_MASK,CDV_NORMAL_TYPE,"14A",1,3); mZT1AlarmAutoAcquireCDV = NewCDV; mCDVList.append(NewCDV); - NewCDV = new CCDV(DUCOLLEGE_IN_ZT1_ITI_MASK,DUCOLLEGE_IN_CDV_13B_MASK,CDV_NORMAL_TYPE,"13B",1,4); + NewCDV = new CCDV(SP2_V2_12_14_ItiMask,DUCOLLEGE_IN_CDV_13B_MASK,CDV_NORMAL_TYPE,"13B",1,4); mZT1SubsequentCDV = NewCDV; - mCDVList.append(NewCDV); + mCDVList.append(NewCDV); - NewCDV = new CCDV(DUCOLLEGE_IN_ZT1_ITI_MASK,DUCOLLEGE_IN_CDV_13A_MASK,CDV_NORMAL_TYPE,"13A ZT",1,5); +// CSwitchCDV *NewSwitchCDV = new CSwitchCDV(DUCOLLEGE_IN_ZT1_12_14_ITI_MASK,DUCOLLEGE_IN_ZT1_V2_ITI_MASK | DUCOLLEGE_IN_ZT1_SP2_ITI_MASK,DUCOLLEGE_IN_CDV_13B_MASK | DUCOLLEGE_IN_CDV_23B_MASK,CDV_SWITCH_TYPE,"13B",1,4); +// mCDVList.append((CCDV*)NewSwitchCDV); +// mZT1SubsequentCDV = (CCDV*)NewSwitchCDV; + + NewCDV = new CCDV(SP2_V2_12_14_ItiMask,DUCOLLEGE_IN_CDV_13A_MASK,CDV_NORMAL_TYPE,"13A ZT",1,5); mZT1CDV = NewCDV; mCDVList.append(NewCDV); - NewCDV = new CCDV(DUCOLLEGE_IN_ZT1_ITI_MASK,DUCOLLEGE_IN_CDV_12A_MASK,CDV_NORMAL_TYPE,"12A",1,6); + NewCDV = new CCDV(SP2_V2_12_14_ItiMask,DUCOLLEGE_IN_CDV_12B_MASK,CDV_NORMAL_TYPE,"12B",1,6); mCDVList.append(NewCDV); NewCDV->SetCDVDeck(true); - NewCDV = new CCDV(DUCOLLEGE_IN_ZT1_ITI_MASK,DUCOLLEGE_IN_CDV_12B_MASK,CDV_NORMAL_TYPE,"12B",1,7); + NewCDV = new CCDV(SP2_V2_12_14_ItiMask,DUCOLLEGE_IN_CDV_12A_MASK,CDV_NORMAL_TYPE,"12A",1,7); NewCDV->SetCDVDeck(true); mZT1ApproachCDV = NewCDV; mCDVList.append(NewCDV); - - NewCDV = new CCDV(0,DUCOLLEGE_IN_CDV_11B_MASK,CDV_NORMAL_TYPE,"11B",1,8); mCDVList.append(NewCDV); - NewCDV = new CCDV(0,DUCOLLEGE_IN_CDV_11A_MASK,CDV_NORMAL_TYPE,"11A",1,9); + NewCDV = new CCDV(DUCOLLEGE_IN_ZT1_V2_ITI_MASK | DUCOLLEGE_IN_ZT1_SP2_ITI_MASK,DUCOLLEGE_IN_CDV_23B_MASK,CDV_NORMAL_TYPE,"23B",2,4); mCDVList.append(NewCDV); - return RET_OK; + + NewCDV = new CCDV(DUCOLLEGE_IN_ZT1_V2_ITI_MASK | DUCOLLEGE_IN_ZT1_SP2_ITI_MASK,DUCOLLEGE_IN_CDV_23A_MASK,CDV_NORMAL_TYPE,"23A",2,5); + mCDVList.append(NewCDV); + + NewCDV = new CCDV(DUCOLLEGE_IN_ZT1_V2_ITI_MASK | DUCOLLEGE_IN_ZT1_SP2_ITI_MASK,DUCOLLEGE_IN_CDV_22B_MASK,CDV_NORMAL_TYPE,"22B",2,6); + mCDVList.append(NewCDV); + + NewCDV = new CCDV(DUCOLLEGE_IN_ZT1_V2_ITI_MASK | DUCOLLEGE_IN_ZT1_SP2_ITI_MASK,DUCOLLEGE_IN_CDV_22A_MASK,CDV_NORMAL_TYPE,"22A",2,7); + mCDVList.append(NewCDV); + + return RET_OK; +} + +unsigned int CDuCollegeStation::UpdateStationMasks(unsigned int ExtInputData) +{ + mStationInputMasks.InputZT1_StdITIMask = DUCOLLEGE_IN_ZT1_V2_ITI_MASK | DUCOLLEGE_IN_ZT1_SP2_ITI_MASK; + if(((DUCOLLEGE_IN_ZT1_SP2_ITI_MASK & ExtInputData)) != 0 || ((DUCOLLEGE_IN_ZT1_V2_ITI_MASK & ExtInputData) != 0)) + { + if(mCurZT1Itinerary != DUCOLLEGE_SP2_V2_ITINERARY) + { //Assign masks relative to 10/12 itinerary + mStationInputMasks.InputZT1ITIMask = DUCOLLEGE_IN_ZT1_V2_ITI_MASK | DUCOLLEGE_IN_ZT1_SP2_ITI_MASK;; + mCurZT1Itinerary = DUCOLLEGE_SP2_V2_ITINERARY; + qDebug("Itinéraire SP2/V2 configuré"); + } + + } +// else if((DUCOLLEGE_IN_ZT1_12_14_ITI_MASK & ExtInputData) != 0) +// { +// if(mCurZT1Itinerary != DUCOLLEGE_12_14_ITINERARY) +// { //Assign masks relative to 12/14 itinerary +// mStationInputMasks.InputZT1ITIMask = DUCOLLEGE_IN_ZT1_12_14_ITI_MASK; +// mCurZT1Itinerary = DUCOLLEGE_12_14_ITINERARY; +// qDebug("Itinéraire 12/14 configuré"); +// } +// } + else + { + mCurZT1Itinerary = DUCOLLEGE_ZT1_NO_ITINERARY; + } + + return RET_OK; +} + +int CDuCollegeStation::GetCurrentITI() +{ + //Seulement l'itinéraire primaire est renvoyé à la CC à DuCollège. + return ZT_PRIMARY_ITI; + + +// if(mCurZT1Itinerary == DUCOLLEGE_ZT1_NO_ITINERARY || mCurZT1Itinerary == DUCOLLEGE_12_14_ITINERARY) +// { +// return ZT_PRIMARY_ITI; +// } +// else if(mCurZT1Itinerary == DUCOLLEGE_SP2_V2_ITINERARY) +// { +// return ZT_SECONDARY_ITI; +// } +// else +// { +// qDebug("Invalid mCurZT1Itinerary in CDuCollegeStation. Weird stuff!"); +// return ZT_PRIMARY_ITI; +// } } +GenericInputMasks_t *CDuCollegeStation::GetInputMasks(void) +{ + return &mStationInputMasks; +} + diff --git a/sources/Stations/DuCollege.h b/sources/Stations/DuCollege.h index 319ff6f..67c9528 100644 --- a/sources/Stations/DuCollege.h +++ b/sources/Stations/DuCollege.h @@ -48,21 +48,39 @@ #define DUCOLLEGE_ZT2_PE_MASK 0x00000080 //External (ethernet) input module masks for DUCOLLEGE -#define DUCOLLEGE_IN_CDV_11A_MASK 0x00000001 -#define DUCOLLEGE_IN_CDV_11B_MASK 0x00000002 -#define DUCOLLEGE_IN_CDV_12A_MASK 0x00000004 -#define DUCOLLEGE_IN_CDV_12B_MASK 0x00000008 -#define DUCOLLEGE_IN_CDV_13A_MASK 0x00000010 -#define DUCOLLEGE_IN_CDV_13B_MASK 0x00000020 -#define DUCOLLEGE_IN_CDV_14A_MASK 0x00000040 -#define DUCOLLEGE_IN_CDV_14B_MASK 0x00000080 -#define DUCOLLEGE_IN_CDV_14C_MASK 0x00000100 -#define DUCOLLEGE_IN_ZT1_ITI_MASK 0x00000200 -#define DUCOLLEGE_IN_ZT2_ITI_MASK 0x00000400 -#define DUCOLLEGE_IN_ZT1_AN_MASK 0x00000800 -#define DUCOLLEGE_IN_ZT2_AN_MASK 0x00001000 -#define DUCOLLEGE_IN_ZT1_ARF_MASK 0x00002000 -#define DUCOLLEGE_IN_ZT2_ARF_MASK 0x00004000 +#define DUCOLLEGE_IN_CDV_11B_MASK 0x00000001 //1.2 +#define DUCOLLEGE_IN_CDV_12A_MASK 0x00000002 //1.1 +#define DUCOLLEGE_IN_CDV_12B_MASK 0x00000004 //2.1 +#define DUCOLLEGE_IN_CDV_13A_MASK 0x00000008 //2.2 +#define DUCOLLEGE_IN_CDV_13B_MASK 0x00000010 //3.1 +#define DUCOLLEGE_IN_CDV_14A_MASK 0x00000020 //9.2 +#define DUCOLLEGE_IN_CDV_14B_MASK 0x00000040 //10.1 +#define DUCOLLEGE_IN_CDV_14C_MASK 0x00000080 //13.1 +#define DUCOLLEGE_IN_CDV_23A_MASK 0x00000100 //13.2 +#define DUCOLLEGE_IN_ZT1_12_14_ITI_MASK 0x00000200 //6.1 +#define DUCOLLEGE_IN_ZT1_V2_ITI_MASK 0x00000400 //9.1 +#define DUCOLLEGE_IN_ZT1_AN_MASK 0x00000800 //8.2 +#define DUCOLLEGE_IN_ZT2_AN_MASK 0x00001000 //12.2 +#define DUCOLLEGE_IN_ZT1_ARF_MASK 0x00002000 //12.1 +#define DUCOLLEGE_IN_ZT2_ARF_MASK 0x00004000 //8.1 +#define DUCOLLEGE_IN_STATION_KEY1_MASK 0x00008000 //15.1 +#define DUCOLLEGE_IN_STATION_KEY2_MASK 0x00010000 //15.2 +#define DUCOLLEGE_IN_STATION_KEY3_MASK 0x00020000 //16.1 +#define DUCOLLEGE_IN_STATION_KEY4_MASK 0x00040000 //16.2 +#define DUCOLLEGE_IN_RESERVE4_MASK 0x00080000 //22.1 +#define DUCOLLEGE_IN_RESERVE5_MASK 0x00100000 //22.2 +#define DUCOLLEGE_IN_CDV_23B_MASK 0x00200000 //23.1 +#define DUCOLLEGE_IN_ZT1_SP2_ITI_MASK 0x00400000 //23.2 +#define DUCOLLEGE_IN_CDV_22A_MASK 0x00800000 //24.1 +#define DUCOLLEGE_IN_CDV_22B_MASK 0x01000000 //24.2 +#define DUCOLLEGE_IN_RESERVE6_MASK 0x02000000 //25.1 +#define DUCOLLEGE_IN_RESERVE7_MASK 0x04000000 //25.2 +#define DUCOLLEGE_IN_RESERVE8_MASK 0x08000000 //26.1 +#define DUCOLLEGE_IN_RESERVE9_MASK 0x10000000 //26.2 +#define DUCOLLEGE_IN_RESERVE10_MASK 0x20000000 //27.1 +#define DUCOLLEGE_IN_RESERVE11_MASK 0x40000000 //27.2 +#define DUCOLLEGE_IN_RESERVE12_MASK 0x80000000 //28.1 + #define DUCOLLEGE_IN_STATION_ID_MASK 0x00078000 //External (ethernet) output module masks for DUCOLLEGE @@ -107,10 +125,21 @@ class CDuCollegeStation : public CStation public: CDuCollegeStation(); - + virtual GenericInputMasks_t *GetInputMasks(void); + virtual unsigned int UpdateStationMasks(unsigned int ExtInputData); + virtual int GetCurrentITI(); private: + int mCurZT1Itinerary; + CCDV *mSP2_V2AlarmAutoAcquireCDV, *m12_14AlarmAutoAcquireCDV; + + enum eDUCollegeZT1Itineraries + { + DUCOLLEGE_SP2_V2_ITINERARY, + DUCOLLEGE_12_14_ITINERARY, + DUCOLLEGE_ZT1_NO_ITINERARY + }; virtual unsigned int BuildStationCDVList(); }; diff --git a/sources/ZTStateMachine.cpp b/sources/ZTStateMachine.cpp index eff569f..53ec714 100644 --- a/sources/ZTStateMachine.cpp +++ b/sources/ZTStateMachine.cpp @@ -166,8 +166,11 @@ unsigned int CZTStateMachine::ZTStateMachine(unsigned int Event, unsigned int Su //Update variables according to new inputs mZTStationPtr->UpdateCDVs(mCurInputs); - mCIZT1Active = ((mCurInputs & mZTInputMasks->InputZT1ITIMask) != 0); - mCIZT2Active = ((mCurInputs & mZTInputMasks->InputZT2ITIMask) != 0); + mCIZT1Active = mZTStationPtr->IsCIZT1ITIActive(mCurInputs); + mCIZT2Active = mZTStationPtr->IsCIZT2ITIActive(mCurInputs); +// mCIZT1Active = ((mCurInputs & mZTInputMasks->InputZT1ITIMask) != 0); +// mCIZT2Active = ((mCurInputs & mZTInputMasks->InputZT2ITIMask) != 0); + bool AN1State, AN2State; //If the ModbusCCPtr pointer is not 0, then we are using Modbus and AN states will come from there.