Пример #1
0
        /// <summary>
        /// 切换巡检状态:0/采集记录(暂停巡检),1/巡检
        /// </summary>
        /// <param name="stateChk">巡检类型</param>
        private void reChecking(int stateChk)
        {
            CmdProtocol cmd = this.cmdGather;

            if (null == cmd)
            {
                return;
            }
            CmdState st = cmd.CheckState();

            cmd.TimeSendInv   = new TimeSpan(24, 0, 0);
            cmd.TimeLimit     = new TimeSpan(4 * cmd.TimeOut.Ticks);
            cmd.TimeFailLimit = cmd.TimeLimit;
            if (CmdState.Response == st || CmdState.Request == st || CmdState.ReqTimeout == st)
            {
                cmd.EventWh.Reset();
                cmd.EventWh.WaitOne(cmd.TimeOut, false);
            }
            this.commimgr.ClearBuffer(this.target);
            this.stateChecking = stateChk;
            string tag = "@设备地址=" + Convert.ToString(this.station);

            if (1 == stateChk)
            {
                cmd.setCommand("门禁", "检测状态", tag);
            }
            else
            {
                cmd.setCommand(new byte[0]);
            }
            if (0 < stateChk)
            {
                cmd.TimeSendInv     = this.tsinv;
                cmd.TimeLimit       = TimeSpan.MaxValue;
                cmd.TimeFailLimit   = TimeSpan.MaxValue;
                cmd.FailProAf       = FailAftPro.Ignor;
                cmd.TimeSendInv     = this.tsinv;
                cmd.IsResposeHandle = isResponse;
                this.commimgr.SendCommand(this.target, cmd);
            }
            Debug.WriteLine("巡检类型:" + stateChk);
        }