Ejemplo n.º 1
0
 private void ShowNewDeviceInfo()
 {
     if (ShowDeviceInfoRuntime >= ZigbeeCommon.Tick)
     {
         ShowDeviceInfoRuntime -= ZigbeeCommon.Tick;
     }
     else
     {
         ShowDeviceInfoRuntime = 0;
     }
     if (ShowDeviceInfoRuntime == 0)
     {
         ShowDeviceInfoRuntime = ZigbeeCommon.ShowDeviceInfoUpdateTime;
         ZigbeeDevice.Device_t dev = ZigbeeApi.Device.GetNewDevieInfo();
         if (dev != null)
         {
             String str = "New Device:" + dev.addr.ToString("X4") + "\r\n";
             foreach (ZigbeeDevice.Point_t p in dev.PointList)
             {
                 if (p.inCLusterID != null && p.outClusterID != null)
                 {
                     str += "Point:" + p.point.ToString("X2") + "\r\n";
                     str += "device ID:" + p.devID.ToString("X4") + " ver:" + p.ver.ToString("X2") + "\r\n";
                     str += "Input  Cluster ID:" + ZigbeeCommon.U16toHexStr(p.inCLusterID, 0, p.inCLusterID.Length) + "\r\n";
                     str += "Output Cluster ID:" + ZigbeeCommon.U16toHexStr(p.outClusterID, 0, p.outClusterID.Length) + "\r\n";
                 }
             }
             str += "\r\n";
             myZtool.UpdateRecieveTextBox(str);
         }
     }
 }
Ejemplo n.º 2
0
        private void AppProc(byte[] pkg, int len)
        {
            int  Index = 4;
            byte cmd0;
            byte cmd1;
            byte dlen;

            cmd0 = pkg[2];
            cmd1 = pkg[3];
            dlen = pkg[4];
            UInt16 addr = ZigbeeCommon.BtoU16(pkg, Index);

            if (Device.CheckExist(addr) == true)
            {
                string str = "app rec:";
                str += ZigbeeCommon.BtoHexStr(pkg, 0, pkg.Length);
                myZtool.UpdateRecieveTextBox(str);
                Device.ReceiveCount(addr);
            }
            else
            {
                Device.AddDevice(addr, null);
            }
        }