Exemple #1
0
 public MagneticSteel(ControlUnitMediator unitMediator, BoardCardControl2 boardCardCtr,
                      int startChannle,
                      int endChannle,
                      DeviceEnd deviceEnd,
                      MagneticSteelEnd magneticSteelEnd,
                      string name,
                      UInt32 timeOut = 2000) : base(unitMediator)
 {
     this.boardCardCtr = boardCardCtr;
     this.startChannle = startChannle;
     this.endChannle   = endChannle;
     if (this.boardCardCtr != null)
     {
         this.boardCardCtr.InterruptEvent += new EventHandler <DiSnapEventArgs>(TriggerMagneticSteelEvent);
     }
     this.hasEndSignal       = false;
     this.hasStartSignal     = false;
     this.timeOut            = timeOut;
     this.signalTimeoutTimer = new MyTimer(timeOut);
     this.deviceEnd          = deviceEnd;
     this.magneticSteelEnd   = magneticSteelEnd;
     this.name     = name;
     this.spacing  = 270;
     this.timingSW = new Stopwatch();
 }
        public byte ReadLiquidLevelSwitchStatus()
        {
            if (!this.hasPumping)
            {
                return(1);
            }

            BoardCardControl2 liquidLevelSwitchCtr =
                this.boardCardManager.GetBoardCardByDescription(liquidLevelSwitchChannle.DeviceDescription);

            //int startPort = 0;
            //int portCount = 0;
            if (liquidLevelSwitchCtr != null)
            {
                byte[] buffer = new byte[2];
                liquidLevelSwitchCtr.Read(0, 1, out buffer);
                if (this.liquidLevelSwitchChannle.Channle < 8)
                {
                    return((byte)((buffer[0] >> this.liquidLevelSwitchChannle.Channle) & 0x01));
                }
                else
                {
                    return((byte)((buffer[1] >> (this.liquidLevelSwitchChannle.Channle - 8)) & 0x01));
                }
            }

            return(1);
        }
        public void CloseFan()
        {
            BoardCardControl2 fanCtr =
                this.boardCardManager.GetBoardCardByDescription(this.fanChannle.DeviceDescription);

            if (fanCtr != null)
            {
                fanCtr[fanChannle.Channle] = 0;
                fanCtr.WriteData();
            }
        }
        public void CloseMotor()
        {
            BoardCardControl2 motorCtr =
                this.boardCardManager.GetBoardCardByDescription(motorChannle.DeviceDescription);

            if (motorCtr != null)
            {
                motorCtr[motorChannle.Channle] = 0;
                motorCtr.WriteData();
            }
        }
        public void CloseWaterPump()
        {
            if (!this.hasPumping)
            {
                return;
            }

            BoardCardControl2 waterPumpCtr =
                this.boardCardManager.GetBoardCardByDescription(waterPumpChannle.DeviceDescription);

            if (waterPumpCtr != null)
            {
                waterPumpCtr[waterPumpChannle.Channle] = 0;
                waterPumpCtr.WriteData();
            }
        }
        private void CaissonParameterConfigDlg_Load(object sender, EventArgs e)
        {
            List <string> boardDis = BoardCardControl2.SearchAllDevices();

            this.motorboardDiscmb.DataSource        = boardDis;
            this.fanBoardDiscmb.DataSource          = boardDis;
            this.pumpBoardDiscmb.DataSource         = boardDis;
            this.liquidLevelSwitchDiscmb.DataSource = boardDis;

            List <int> channles = new List <int>();

            for (int i = 0; i < 16; i++)
            {
                channles.Add(i);
            }

            this.motorBoardChannlecmb.DataSource        = channles;
            this.fanChannlecmb.DataSource               = channles;
            this.pumpChannlecmb.DataSource              = channles;
            this.liquidLevelSwitchChannlecmb.DataSource = channles;
        }