コード例 #1
0
 public void ReqReadNV(UInt16 item, byte offset)
 {
     byte[] buf = new byte[3];
     ZigbeeCommon.U16toB(buf, 0, item);
     buf[2] = offset;
     Output.ReqSendCommand(0x21, 0x08, 0x00, buf);
 }
コード例 #2
0
 public void ReqActivePoints(UInt16 addr)
 {
     byte[] buf = new byte[4];
     ZigbeeCommon.U16toB(buf, 0, addr);
     ZigbeeCommon.U16toB(buf, 2, addr);
     ZigbeeApi.Output.ReqSendCommand(0x25, 0x05, 0, buf);
 }
コード例 #3
0
 static void ReqDescribe(UInt16 addr, byte point)
 {
     byte[] buf = new byte[5];
     ZigbeeCommon.U16toB(buf, 0, addr);
     ZigbeeCommon.U16toB(buf, 2, addr);
     buf[4] = point;
     ZigbeeApi.Output.ReqSendCommand(0x25, 0x04, 0, buf);
 }
コード例 #4
0
 public void ReqWriteNetWorkInfo(byte channel, UInt16 panID)
 {
     byte[] buf = new byte[13];
     buf[0] = channel;
     buf[1] = 0x00; //coordinator address
     buf[2] = 0x00; //coordinator address
     byte[] exaddr = Device.GetExAddr();
     Array.Copy(exaddr, 0, buf, 3, 8);
     ZigbeeCommon.U16toB(buf, 11, panID);
     ReqWriteNV(0x0021, 22, buf);
 }
コード例 #5
0
        public void ReqWriteNV(UInt16 item, byte offset, byte[] data)
        {
            byte slen = 4;

            if (data != null)
            {
                slen += (byte)data.Length;
            }
            byte[] buf = new byte[slen];
            ZigbeeCommon.U16toB(buf, 0, item);
            buf[2] = offset;
            buf[3] = (byte)data.Length;
            if (data != null)
            {
                Array.Copy(data, 0, buf, 4, data.Length);
            }
            Output.ReqSendCommand(0x21, 0x09, 0x00, buf);
        }
コード例 #6
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);
        }
コード例 #7
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);
        }