Example #1
0
        /// <summary>
        /// 应答参数设置
        /// </summary>
        private void ProcResponseParam()
        {
            FrameUnit frameUnit = FrameManager.CreateFrame(frameBuffer1, 0x01);

            byte[] data = new byte[4];
            try
            {
                while (true)
                {
                    frameUnit.WaitData(-1);
                    data[0] = frameBuffer1[7];
                    data[1] = frameBuffer1[8];
                    data[2] = (byte)(boardType);
                    data[3] = (byte)(paramResponse);
                    Thread.Sleep(100);
                    FrameTransmit.Send(boardAddr, 1, 1, data, 4);
                }
            }
            catch (ThreadAbortException)
            {
            }
            finally
            {
                FrameManager.DeleteFrame(frameUnit);
            }
        }
Example #2
0
        /// <summary>
        /// 应答固件升级
        /// </summary>
        private void ProcResponseFirmware()
        {
            FrameUnit frameUnit = FrameManager.CreateFrame(frameBuffer2, 0x02);

            byte[] data = new byte[4];
            try
            {
                while (true)
                {
                    frameUnit.WaitData(-1);
                    data[0] = frameBuffer2[7];
                    data[1] = frameBuffer2[8];
                    data[2] = frameBuffer2[9];// (byte)(boardType);
                    data[3] = (byte)(firmwareResponse);

                    FrameTransmit.Send(boardAddr, 1, 0x02, data, 4);
                }
            }
            catch (ThreadAbortException)
            {
            }
            finally
            {
                FrameManager.DeleteFrame(frameUnit);
            }
        }
Example #3
0
        /// <summary>
        /// 开入板报警数据
        /// </summary>
        private void ProcKRBWarning()
        {
            byte[]    frameData = new byte[16];
            FrameUnit frameUnit = FrameManager.CreateFrame(frameData, 0x40);

            try
            {
                while (true)
                {
                    if (warningTime < 0)
                    {
                        frameUnit.WaitData(-1);
                    }
                    else
                    {
                        Thread.Sleep(warningTime);
                    }

                    FrameTransmit.Send(boardAddr, 1, 0x40, ChannelData1, DataCount1);
                }
            }
            catch (ThreadAbortException)
            {
            }
            finally
            {
            }
        }
Example #4
0
        private void button4_Click(object sender, EventArgs e)
        {
            string[] txtVals = textBox8.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            byte[] data = new byte[txtVals.Length];
            for (int i = 0; i < txtVals.Length; i++)
            {
                data[i] = byte.Parse(txtVals[i], System.Globalization.NumberStyles.AllowHexSpecifier);
            }
            FrameTransmit.Send(boardAddr, 1, byte.Parse(textBox7.Text, System.Globalization.NumberStyles.AllowHexSpecifier), data, data.Length);
        }
Example #5
0
        private void button3_Click(object sender, EventArgs e)
        {
            int chanNum = int.Parse(textBox6.Text);

            byte[] data = new byte[7];

            data[0] = (byte)((type << 4) | (boardAddr & 0x0f));
            data[1] = (byte)(chanNum & 0xff);

            data[2] = (byte)(((chanNum >> 8) & 0x03) << 2);
            string[] txtVals = textBox5.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            data[3] = byte.Parse(txtVals[0], System.Globalization.NumberStyles.AllowHexSpecifier);
            data[4] = byte.Parse(txtVals[1], System.Globalization.NumberStyles.AllowHexSpecifier);
            data[5] = byte.Parse(txtVals[2], System.Globalization.NumberStyles.AllowHexSpecifier);
            data[6] = byte.Parse(txtVals[3], System.Globalization.NumberStyles.AllowHexSpecifier);
            FrameTransmit.Send(boardAddr, 1, 0xa1, data, 7);
        }
Example #6
0
        private void ProcKRBSwitch()
        {
            byte[]    frameData = new byte[16];
            FrameUnit frameUnit = FrameManager.CreateFrame(frameData, cmdType);

            try
            {
                while (true)
                {
                    frameUnit.WaitData(-1);

                    FrameTransmit.Send(boardAddr, 1, cmdType, ChannelDataKRB, DataCountKRB + 1);
                }
            }
            catch (ThreadAbortException)
            {
            }
            finally
            {
                FrameManager.DeleteFrame(frameUnit);
            }
        }
Example #7
0
        private void ProcBoardStatus()
        {
            byte[]    frameData = new byte[16];
            FrameUnit frameUnit = FrameManager.CreateFrame(frameData, 0x10);

            byte[] data = new byte[1];
            try
            {
                while (true)
                {
                    frameUnit.WaitData(-1);
                    data[0] = (byte)boardStatus;
                    FrameTransmit.Send(boardAddr, 1, 0x10, data, 1);
                }
            }
            catch (ThreadAbortException)
            {
            }
            finally
            {
                FrameManager.DeleteFrame(frameUnit);
            }
        }
Example #8
0
        private void ProcUpdateStatus()
        {
            FrameUnit frameUnit = FrameManager.CreateFrame(frameBuffer3, 0x03);

            byte[] data = new byte[1];
            try
            {
                while (true)
                {
                    frameUnit.WaitData(-1);
                    data[0] = (byte)updateStatus;

                    FrameTransmit.Send(boardAddr, 1, 0x03, data, 1);
                }
            }
            catch (ThreadAbortException)
            {
            }
            finally
            {
                FrameManager.DeleteFrame(frameUnit);
            }
        }
Example #9
0
        private void ProcVersion()
        {
            byte[]    frameData = new byte[16];
            FrameUnit frameUnit = FrameManager.CreateFrame(frameData, 0x07);

            byte[] data = new byte[2];
            try
            {
                while (true)
                {
                    frameUnit.WaitData(-1);
                    data[0] = (byte)version1;
                    data[1] = (byte)version2;
                    FrameTransmit.Send(boardAddr, 1, 0x07, data, 2);
                }
            }
            catch (ThreadAbortException)
            {
            }
            finally
            {
                FrameManager.DeleteFrame(frameUnit);
            }
        }