Example #1
0
 public void Add(vca vca)
 {
     if (vca.counts == null || vca.counts.Length == 0)
         return;
   
     foreach (var counter in vca.counts)
     {
         
         bool valueChanged = true;
         if(!_counterMap.ContainsKey(counter.name))
         {
             _counterMap.Add(counter.name, counter.val);
         }
         else if (_counterMap[counter.name] == counter.val)
         {
             valueChanged = false;
         }
         else
         {
             _counterMap[counter.name] = counter.val;
         }
       
         if(valueChanged)
         {
             _queue.Add(new Counter
             {
                 Name = counter.name,
                 Value = counter.val,
                 DateTime = DateTime.Now
             });
         }
     }
 }
Example #2
0
        public void Add(vca vca)
        {
            if (vca.objects == null || vca.objects.Length == 0)
                return;
            if (DateTime.Now.Subtract(lastAdd).TotalMinutes < 1)
                return;

            foreach (var box in vca.objects)
            {
                HeatPoint heatPoint = new HeatPoint();
                heatPoint.CreateTime = DateTime.Now;
                heatPoint.From = vca.cam_ip;
                var bb = box.bb;
                heatPoint.X = (bb.x + bb.w / 2) / 65535.0f;
                heatPoint.Y = (bb.y + bb.h / 2) / 65535.0f;
                

                _queue.Add(heatPoint);
                
            }
            log.Debug("Add heatpoint");
            lastAdd = DateTime.Now;
        }