Пример #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);
         }
     }
 }
Пример #2
0
        public void TestRun()
        {
            int num;
            int SendDelay = myZtool.GetSendDelay();

            if (TestDeviceRunTime >= ZigbeeCommon.Tick)
            {
                TestDeviceRunTime -= ZigbeeCommon.Tick;
            }
            else
            {
                TestDeviceRunTime = 0;
            }
            if (TestDeviceRunTime == 0)
            {
                TestDeviceRunTime = SendDelay;
                num = ZigbeeApi.Device.GetDeviceCount();
                if (TestDeviceIndex >= num)
                {
                    TestDeviceIndex = 0;
                }
                ZigbeeDevice.Device_t dev = ZigbeeApi.Device.GetDevice(TestDeviceIndex);
                if (dev != null)
                {
                    if ((dev.PointList != null) && (dev.PointList.Count > 0))
                    {
                        for (int i = 0; i < dev.PointList.Count; i++)
                        {
                            UInt16 cID = ZigbeeApi.Device.GetOnOffcID(dev.PointList[i]);
                            if (cID != 0xFFFF)
                            {
                                ZigbeeApi.Instance.ReqSendOnOff(dev.addr, dev.PointList[i].point, OnOff);
                            }
                        }
                    }
                }
                if (TestDeviceIndex == 0)
                {
                    if (OnOff > 0)
                    {
                        OnOff = 0x00;
                    }
                    else
                    {
                        OnOff = 0x01;
                    }
                }
                TestDeviceIndex++;
            }
        }