/*******************************************************************************
*                                                                              *
* Société de Transports de Montréal.                                    	   *
* 2012                                                                         *
*                                                                              *
* Projet Zones Tests                                                           *
*                                                                              *
*                                                                              *
*                                                                              *
*******************************************************************************/
/*
    Description:
    Description du fichier si nécessaire.
    
*/

/* ************************************************************************** */
/* Revision:
### 20170822 JFM
    Verision d'origine.
    
### YYYYMMDD Description du besoin ou du bug
    Description du changement.
 */

/* ************************************************************************** */

#ifndef DuCollege_H
#define DuCollege_H
#include "Station.h"

#define DUCOLLEGE_STATION_KEY 0x0058000
#define DUCOLLEGE_NB_EXTERNAL_INPUT_430_MODULES 1
#define DUCOLLEGE_NB_EXTERNAL_OUTPUT_440_MODULES 1
#define DUCOLLEGE_NB_EXTERNAL_MIXED_470_MODULES 0

//Since it's necessary to execute a very fast acquisition and analysis
//of magnetic sensors through the PCI I/O adapter, we will use masks
//instead of bitfields for those sensors.  This will accelerate
//treatment by avoiding the use of a memcpy().
#define DUCOLLEGE_ZT1_S1_MASK 0x00000001
#define DUCOLLEGE_ZT1_S2_MASK 0x00000002
#define DUCOLLEGE_ZT1_PI_MASK 0x00000004
#define DUCOLLEGE_ZT1_PE_MASK 0x00000008
#define DUCOLLEGE_ZT1_FN_MASK 0x00000010
#define DUCOLLEGE_ZT2_S1_MASK 0x00000020
#define DUCOLLEGE_ZT2_PI_MASK 0x00000040
#define DUCOLLEGE_ZT2_PE_MASK 0x00000080

//External (ethernet) input module masks for DUCOLLEGE
#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
#define DUCOLLEGE_OUT_VP1_MASK		0x00000001
#define DUCOLLEGE_OUT_VP2_MASK		0x00000002
#define DUCOLLEGE_OUT_VP3_MASK		0x00000004
#define DUCOLLEGE_OUT_VP4_MASK		0x00000008
#define DUCOLLEGE_OUT_VP5_MASK		0x00000010
#define DUCOLLEGE_OUT_VP6_MASK		0x00000020
#define DUCOLLEGE_OUT_VF1_MASK		0x00000040
#define DUCOLLEGE_OUT_VF2_MASK		0x00000080
#define DUCOLLEGE_OUT_VF3_MASK		0x00000100
#define DUCOLLEGE_OUT_VF4_MASK		0x00000200
#define DUCOLLEGE_OUT_VF5_MASK		0x00000400
#define DUCOLLEGE_OUT_WP1_MASK		0x00000800
#define DUCOLLEGE_OUT_WP2_MASK		0x00001000
#define DUCOLLEGE_OUT_WP3_MASK		0x00002000
#define DUCOLLEGE_OUT_WP4_MASK		0x00004000
#define DUCOLLEGE_OUT_WP5_MASK		0x00008000
#define DUCOLLEGE_OUT_WP6_MASK		0x00010000
#define DUCOLLEGE_OUT_DPE_MASK		0x00020000
#define DUCOLLEGE_OUT_DPI_MASK		0x00040000
#define DUCOLLEGE_OUT_V00_MASK		0x00080000
#define DUCOLLEGE_OUT_DPG_MASK		0x00100000
#define DUCOLLEGE_OUT_DFR_MASK		0x00200000
#define DUCOLLEGE_OUT_RF_MASK		0x00400000
#define DUCOLLEGE_OUT_RF2_MASK		0x00800000
#define DUCOLLEGE_OUT_VEL_MASK		0x01000000
#define DUCOLLEGE_OUT_VEL2_MASK		0x02000000
#define DUCOLLEGE_OUT_DPI2_MASK		0x04000000
#define DUCOLLEGE_OUT_DPE2_MASK		0x08000000
#define DUCOLLEGE_OUT_V002_MASK		0x10000000
#define DUCOLLEGE_OUT_PEQ1_MASK     0x20000000
#define DUCOLLEGE_OUT_PEQ2_MASK     0x40000000
#define DUCOLLEGE_OUT_WATCHDOG_MASK 0x80000000

#define DUCOLLEGE_SDF_ACQUISITION_CHANNEL 0


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();

};

#endif // DuCollege_H

