Ejemplo n.º 1
0
        private void loadClientEvent()
        {
            try
            {
                IAlarmClient alarmClient = _alarmClientManager.GetAlarmClient(EnvironmentManager.Instance.MasterSite.ServerId);

                EventLine[] events = alarmClient.GetEventLines(0, 10,
                                                               new VideoOS.Platform.Proxy.Alarm.EventFilter()
                {
                });


                foreach (EventLine line in events)
                {
                    BaseEvent       baseevent = alarmClient.GetEvent(line.Id);
                    DataGridViewRow row       = new DataGridViewRow();
                    row.Tag = baseevent;
                    row.CreateCells(dataGridViewAlarm, baseevent.EventHeader.Type, baseevent.EventHeader.Message, line.Timestamp.ToLocalTime(), line.SourceName);
                    dataGridViewAlarm.Rows.Add(row);
                }
            }
            catch (Exception ex)
            {
                EnvironmentManager.Instance.ExceptionDialog("loading Event", ex);
            }
        }
Ejemplo n.º 2
0
        private EventLine[] GetAnalyticsEventList(DateTime periodStart, DateTime periodEnd)
        {
            AlarmClientManager _alarmClientManager = new AlarmClientManager();

            int eventCount = (int)(_startCache + _endCache) / 500;

            try
            {
                IAlarmClient alarmClient = _alarmClientManager.GetAlarmClient(EnvironmentManager.Instance.MasterSite.ServerId);
                EventLine[]  events      = alarmClient.GetEventLines(0, eventCount, new VideoOS.Platform.Proxy.Alarm.EventFilter()
                {
                    Conditions = new Condition[] { new Condition()
                                                   {
                                                       Operator = Operator.NotEquals, Target = Target.Type, Value = "System Event"
                                                   },
                                                   new Condition()
                                                   {
                                                       Operator = Operator.LessThan, Target = Target.Timestamp, Value = periodEnd
                                                   },
                                                   new Condition()
                                                   {
                                                       Operator = Operator.GreaterThan, Target = Target.Timestamp, Value = periodStart
                                                   } }
                });
                return(events);
            }
            catch (Exception ex)
            {
                // this will happen if for instance the Event Server cannot be contacted. Showing error each time is quite intrusive, so let's just log.
                EnvironmentManager.Instance.Log(true, nameof(OverlayGraphOnEventBackgroundPlugin), "Exception thrown: " + ex.Message);
                return(new EventLine[] { });
            }
        }
Ejemplo n.º 3
0
        private void loadClientAccess()
        {
            try
            {
                IAlarmClient alarmClient = _alarmClientManager.GetAlarmClient(EnvironmentManager.Instance.MasterSite.ServerId);

                EventLine[] events = alarmClient.GetEventLines(0, 10,
                                                               new VideoOS.Platform.Proxy.Alarm.EventFilter()
                {
                    Conditions = new Condition[] { new Condition()
                                                   {
                                                       Operator = Operator.Equals, Target = Target.Type, Value = "Access Control System Event"
                                                   } }
                });


                foreach (EventLine line in events)
                {
                    BaseEvent          baseevent          = alarmClient.GetEvent(line.Id);
                    AccessControlEvent accessControlEvent = baseevent as AccessControlEvent;
                    if (accessControlEvent != null)
                    {
                        DataGridViewRow row = new DataGridViewRow();
                        row.Tag = baseevent;
                        string credentialHolderId = "";
                        string systemId           = "";
                        if (accessControlEvent.RelatedAccessControlCredentialHolderIds != null)
                        {
                            if (accessControlEvent.RelatedAccessControlCredentialHolderIds.Length > 0)
                            {
                                credentialHolderId = accessControlEvent.RelatedAccessControlCredentialHolderIds[0];
                            }
                        }
                        if (accessControlEvent.AccessControlSystemId != null)
                        {
                            systemId = accessControlEvent.AccessControlSystemId.ToString();
                        }
                        row.CreateCells(
                            dataGridViewAlarm,
                            baseevent.EventHeader.Type,
                            baseevent.EventHeader.Message,
                            line.Timestamp.ToLocalTime(),
                            line.SourceName,
                            credentialHolderId,
                            systemId);
                        dataGridViewAlarm.Rows.Add(row);
                    }
                }
            }
            catch (Exception ex)
            {
                EnvironmentManager.Instance.ExceptionDialog("loading Acces Control System Event", ex);
            }
        }
Ejemplo n.º 4
0
        private void loadClientAnalytics()
        {
            try
            {
                IAlarmClient alarmClient = _alarmClientManager.GetAlarmClient(EnvironmentManager.Instance.MasterSite.ServerId);

                EventLine[] events = alarmClient.GetEventLines(0, 10,
                                                               new VideoOS.Platform.Proxy.Alarm.EventFilter()
                {
                    Conditions = new Condition[] { new Condition()
                                                   {
                                                       Operator = Operator.NotEquals, Target = Target.Type, Value = "System Event"
                                                   } }
                });


                foreach (EventLine line in events)
                {
                    BaseEvent       baseevent = alarmClient.GetEvent(line.Id);
                    DataGridViewRow row       = new DataGridViewRow();
                    row.Tag = baseevent;

                    AnalyticsEvent aEvent = baseevent as AnalyticsEvent;
                    if (aEvent != null)
                    {
                        row.CreateCells(
                            dataGridViewAlarm,
                            baseevent.EventHeader.Type,
                            line.ObjectValue,
                            baseevent.EventHeader.Message,
                            line.CustomTag,
                            line.Timestamp.ToLocalTime(),
                            line.SourceName);
                        dataGridViewAlarm.Rows.Add(row);
                    }
                }
            }
            catch (Exception ex)
            {
                EnvironmentManager.Instance.ExceptionDialog("loading Analytics", ex);
            }
        }
Ejemplo n.º 5
0
        private void loadClientLPR()
        {
            try
            {
                IAlarmClient alarmClient = _alarmClientManager.GetAlarmClient(EnvironmentManager.Instance.MasterSite.ServerId);

                EventLine[] events = alarmClient.GetEventLines(0, 10,
                                                               new VideoOS.Platform.Proxy.Alarm.EventFilter()
                {
                    Conditions = new Condition[] { new Condition()
                                                   {
                                                       Operator = Operator.Equals, Target = Target.Type, Value = "LPR Event"
                                                   } }
                });


                foreach (EventLine line in events)
                {
                    BaseEvent       baseevent = alarmClient.GetEvent(line.Id);
                    DataGridViewRow row       = new DataGridViewRow();
                    row.Tag = baseevent;
                    AnalyticsEvent aEvent = baseevent as AnalyticsEvent;
                    if (aEvent != null)
                    {
                        string oValue      = "";
                        string oConfidence = "";
                        if (aEvent.ObjectList != null && aEvent.ObjectList.Count > 0)
                        {
                            oValue      = aEvent.ObjectList[0].Value ?? "";
                            oConfidence = aEvent.ObjectList[0].Confidence.ToString("F5");
                        }
                        row.CreateCells(dataGridViewAlarm, aEvent.EventHeader.Type, oValue, oConfidence, aEvent.EventHeader.CustomTag, aEvent.EventHeader.Timestamp.ToLocalTime(), aEvent.EventHeader.Source.Name);
                        dataGridViewAlarm.Rows.Add(row);
                    }
                }
            }
            catch (Exception ex)
            {
                EnvironmentManager.Instance.ExceptionDialog("loading LPR Analytics", ex);
            }
        }