Exemple #1
0
 public Device_t GetNewDevieInfo()
 {
     if (NewDeviceList.Count > 0)
     {
         UInt16 addr = (UInt16)NewDeviceList[0];
         NewDeviceList.Remove(addr);
         Device_t dev = GetDevice(addr);
         return(dev);
     }
     return(null);
 }
Exemple #2
0
 public void AddDevice(UInt16 addr, byte[] exAddr)
 {
     if ((CheckExist(addr) == false) && (addr > 0))
     {
         Device_t dev = new Device_t();
         dev.addr      = addr;
         dev.exAddr    = exAddr;
         dev.PointList = new List <Point_t>();
         DeviceList.Add(dev);
         ReqActivePoints(dev.addr);
     }
 }
Exemple #3
0
        public float GetLossPercent(UInt16 addr)
        {
            Device_t dev = GetDevice(addr);
            float    f   = (float)0.0;

            if (dev != null)
            {
                if (dev.SendCnt > 0)
                {
                    f = ((float)dev.LossCnt / dev.SendCnt) * (float)100.0;
                }
            }
            return(f);
        }
Exemple #4
0
 private Boolean CheckDeviceInfoComplite(Device_t dev)
 {
     if (dev.PointList.Count == 0)
     {
         return(false);
     }
     foreach (Point_t ep in dev.PointList)
     {
         if ((ep.inCLusterID == null) && (ep.outClusterID == null))
         {
             return(false);
         }
     }
     return(true);
 }
Exemple #5
0
        private Point_t GetPoint(UInt16 addr, byte point)
        {
            Device_t dev = GetDevice(addr);

            if (dev != null)
            {
                foreach (Point_t p in dev.PointList)
                {
                    if (p.point == point)
                    {
                        return(p);
                    }
                }
            }
            return(null);
        }
Exemple #6
0
 private void RemovePoint(Device_t dev, byte point)
 {
     try
     {
         foreach (Point_t p in dev.PointList)
         {
             if (p.point == point)
             {
                 dev.PointList.Remove(p);
             }
         }
     }
     catch (System.InvalidOperationException ex)
     {
         return;
     }
 }