Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            byte[] Buf  = new byte[1500];
            byte[] Tata = new byte[1];
            Tata[0] = byte.Parse(textBox6.Text);
            int Length = ZigBeeBus.ZigBee_SendMsg(ref Buf, 0x11, 0x31, Tata, (byte)Tata.Length);

            ZigBeeBus.ZigBee_CheckCrc(Buf);
            textBox4.Text = Tools.HexToString(Buf, Length);
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            byte[] Buf  = new byte[1500];
            byte[] Tata = new byte[8];
            Tools.ByteFromFloat(float.Parse(textBox1.Text), ref Tata, 0, 0);
            Tools.ByteFromFloat(float.Parse(textBox2.Text), ref Tata, 4, 0);
            int Length = ZigBeeBus.ZigBee_SendMsg(ref Buf, 0x10, 0x30, Tata, (byte)Tata.Length);

            ZigBeeBus.ZigBee_CheckCrc(Buf);
            textBox3.Text = Tools.HexToString(Buf, Length);
        }
Ejemplo n.º 3
0
        public static byte[] ZigBee_Write64Bytes(uint OnlyAddr, byte[] DataI, byte PageIndex)
        {
            byte[] Buf  = new byte[1500];
            byte[] Data = new byte[65];
            Data[0] = PageIndex;
            for (int i = 0; i < 64; i++)
            {
                Data[1 + i] = DataI[i];
            }
            int Length = ZigBeeBus.ZigBee_SendMsg(ref Buf, OnlyAddr, (byte)ACFF.SCFF_Write64Byte, Data, (byte)Data.Length);

            ZigBeeBus.ZigBee_CheckCrc(Buf);
            return(Buf);
        }
Ejemplo n.º 4
0
        public int SendData(byte[] TxBuffer, int TxLength, ref byte[] RxBuffer, int RxLength)
        {
            int Length = 0;

            for (int n = 0; n < RxLength; n++)
            {
                RxBuffer[n] = 0;
            }
            if (!SP.IsOpen)
            {
                return(0);
            }
            for (int i = 0; i < 10; i++)
            {
                Length = SendDataOne(TxBuffer, TxLength, ref RxBuffer, RxLength);
                if (ZigBeeBus.ZigBee_CheckCrc(RxBuffer))
                {
                    return(Length);
                }
            }
            MessageBox.Show("重试次数过多");
            return(Length);
        }