コード例 #1
0
        public void ReqSendCommand(UInt16 addr, byte point, UInt16 cID, byte[] data)
        {
            int slen = 8;

            if (data != null)
            {
                slen += data.Length;
            }
            byte[] buf   = new byte[slen];
            int    index = 0;
            byte   seq   = ZigbeeCommon.GetSeq();

            ZigbeeCommon.U16toB(buf, 0, addr); index += 2;
            buf[index++] = point;                             //2
            buf[index++] = seq;                               //3
            buf[index++] = 0x00;                              //disable response 4
            ZigbeeCommon.U16toB(buf, index, cID); index += 2; //5
            buf[index++] = (byte)data.Length;                 //
            Array.Copy(data, 0, buf, index, data.Length);
            Output.ReqSendCommand(0x29, 0x06, seq, buf);
        }
コード例 #2
0
        public void ReqSendOnOff(UInt16 addr, byte point, byte val)
        {
            byte[] buf   = new byte[14];
            int    index = 0;
            byte   seq   = ZigbeeCommon.GetSeq();

            ZigbeeCommon.U16toB(buf, 0, addr); index += 2;
            buf[index++] = point;                                //2
            buf[index++] = seq;                                  //3
            buf[index++] = 0x00;                                 //disable response 4
            ZigbeeCommon.U16toB(buf, index, 0x0006); index += 2; //5
            buf[index++] = 6;                                    //

            buf[index++] = val;
            buf[index++] = 0x01;
            buf[index++] = 0x00;

            buf[index++] = 0x00;
            buf[index++] = 0x00;

            buf[index++] = 0x00;
            Output.ReqSendCommand(0x29, 0x06, seq, buf);
        }