1. for the ANPR matched alarm, which event we need to define in XProtect? User-Defined Events or Analytics Events;2. how to build up the relationship between Plugin and Xproect about ANPR Matched alarm.

We are designing ANPR plugin, Hikvision Camera can do ANPR, and we create License Plate Match list in the plugin for match list alarm, and trigger the rules defined in XProtect. For example, we defined ANPR match lists in the plugin, named “black list1”.

1. we need to define an alarm in User-Defined Events or Analytics Events for ANPR matched alarm. Which event we need to define for this ANPR matched alarm? User-Defined Events or Analytics Events? what is the difference between these two events? we have to use User-Defined Events?

2. If there is a license plate in “black list1” appeared, must we define the name of events in User-Defined Events or Analytics Events the same as “black list1”? In order to know which match list trigger the rule defined in User-Defined Events or Analytics Events.

In Milestone XProtect LPR events are created as plugin events (the Sensor Monitor sample shows an example).

The events submitted by NewEventCommand are created like this:

        private static AnalyticsEvent CreateEvent(DetectedLicensePlate detectionInfo, Guid listId, string listName, Guid sourceId, string sourceName, DateTime expireTimestamp)
        {
            //TODO: missing fields e.g. source name
            AnalyticsEvent lprEvent = new AnalyticsEvent();
            lprEvent.EventHeader = new EventHeader();
            lprEvent.EventHeader.Timestamp = detectionInfo.Time;
            lprEvent.EventHeader.Message = listName;
            lprEvent.EventHeader.ID = Guid.NewGuid();
            lprEvent.EventHeader.CustomTag = GetMappedCountryCode(detectionInfo.LicensePlate.Country.CountryCode);
            lprEvent.EventHeader.Source = new EventSource();
            lprEvent.EventHeader.Source.Name = detectionInfo.CameraName;
            lprEvent.EventHeader.Source.FQID = detectionInfo.CameraId;
            lprEvent.EventHeader.Type = "LPR Event"; // Column isn't translated
            //Set lprEvent.EventHeader.MessageId. This is done through reflection because we want to maintain backwards compatibility with old event server having an MIP version where EventHeader.MessageId is not available. Also see DTS 44052 
            PropertyInfo propertyInfo = lprEvent.EventHeader.GetType().GetProperty("MessageId");
            if (propertyInfo != null)
            {
                propertyInfo.SetValue(lprEvent.EventHeader, listId, null);
            }
 
            //Adding matched list as rule
            lprEvent.RuleList = new RuleList();
            Rule rule = new Rule() { ID = listId, Name = listName, Type = Constants.LPRListType };
            lprEvent.RuleList.Add(rule);
 
            //Adding source as rule
            Rule sourceRule = new Rule() { ID = sourceId, Name = sourceName, Type = Constants.LPRSourceType };
            lprEvent.RuleList.Add(sourceRule);
 
            //Adding bounding box
            lprEvent.ObjectList = new AnalyticsObjectList();
            AnalyticsObject aObject = new AnalyticsObject();
            aObject.Name = detectionInfo.LicensePlate.RegistrationNumber.Value;
            aObject.Value = detectionInfo.LicensePlate.RegistrationNumber.Value;
            aObject.Confidence = detectionInfo.LicensePlate.Confidence.Value;
            aObject.Type = Constants.LPRPlateObjectType;
            aObject.AlarmTrigger = true;
            aObject.Polygon = new TPolygon();
            aObject.Polygon.Closed = true;
            aObject.Polygon.Color = new TColor() { A = 255, R = 255, G = 0, B = 0 };
 
            var location = detectionInfo.LicensePlate.Location;
            if (location != null)
            {
                aObject.Polygon.PointList = new PointList();
                aObject.Polygon.PointList.Add(new TPoint() { X = location.UpperLeft.X, Y = location.UpperLeft.Y });
                aObject.Polygon.PointList.Add(new TPoint() { X = location.UpperRight.X, Y = location.UpperRight.Y });
                aObject.Polygon.PointList.Add(new TPoint() { X = location.LowerRight.X, Y = location.LowerRight.Y });
                aObject.Polygon.PointList.Add(new TPoint() { X = location.LowerLeft.X, Y = location.LowerLeft.Y });
            }
            lprEvent.ObjectList.Add(aObject);
 
            return lprEvent;
        }

It is up to the user to create Alarm Definitions that transform a triggered event to an Alarm.