Beispiel #1
0
        public async Task SaveHeatPointServerAsync(HeatPoint input)
        {
            try
            {
                var content = new StringContent(JsonConvert.SerializeObject(input), new UTF8Encoding(), "application/json");
                var response = await _http.PostAsync(AppConfig.HeatPointApi, content);

                response.EnsureSuccessStatusCode();
            }
            catch (AggregateException ae)
            {
                Console.WriteLine(ae.InnerException.Message);
            }
            catch(Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Beispiel #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;
        }