// CheckSwitch.h: interface for the CCheckSwitch class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_CHECKSWITCH_H__C85A84B3_B27C_11D7_8989_000629A6E157__INCLUDED_)
#define AFX_CHECKSWITCH_H__C85A84B3_B27C_11D7_8989_000629A6E157__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "cmnhdr.h"
#include "RunTask.h"
#include "Input.h"
#include "Output.h"
#include "commondef.h"

#ifdef  BUILD_MCCTRDLL
#define     MCCTRDLLCLASS   __declspec(dllexport)
#else
#define     MCCTRDLLCLASS   __declspec(dllimport)
#endif

struct stMSG_SEND
{
    bool bOnSend;
    bool bOffSend;
};

class MCCTRDLLCLASS CCheckSwitch : public CRunTask
{
public:
    bool SetOuputState(int nOutput, bool bState);
    void DoorLock(bool bLock = TRUE);
    bool IsEngineeringBypass();
    bool IsCurtainBypass();
    bool IsDoorBypass();
    bool IsHardwareBypass();
    bool IsStopButtonActivated();
    void InitParameters();
    void BypassEngineering(bool bBypass = TRUE);
    void BypassCurtain(bool bBypass = TRUE);
    void BypassDoor(bool bBypass = TRUE);
    void SetSystemOutput(int nOutput, COutput *copOutputPt);
    CCheckSwitch();
    virtual ~CCheckSwitch();

    UINT RunThread(void);

    void SetSwitch(int nSwitch, CInput *cipInputpt);

//  Set door switch, curtain and engineering switch warn to not send before
    void ResetSwitchWarning();

private:
    void CheckSwitch(int nSwitchNo, CInput *cipSwitch, stMSG_SEND *pMsgSend, bool *pIsSendBefore);
    void GetMainApp();
    void CheckSwitch(int nSwitchNo, CInput *cipSwitch,  stMSG_SEND *pMsgSend);

    CInput *m_cipSwitch[SWITCH_SYSTEM];

    stMSG_SEND m_stMsgSend[SWITCH_SYSTEM];

    COutput *m_copSystemDoor;
    COutput *m_copCurtainSensorReset;

    HWND hwndMainApp;

    bool m_bBypassDoor;
    bool m_bBypassCurtain;
    bool m_bBypassEngineering;
    bool m_bHardwareBypass;
};

#endif // !defined(AFX_CHECKSWITCH_H__C85A84B3_B27C_11D7_8989_000629A6E157__INCLUDED_)
