Hi.
I’m developing a client plugin using MilestoneSystems.VideoOS.Platform v.23.3.2.
I receive 2 custom LprEvents from a camera.
This is the first XML:
<?xml version="1.0" encoding="utf-8"?>
<AnalyticsEvent xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:milestone-systems">
<EventHeader>
<ID>00000000-0000-0000-0000-000000000000</ID>
<Timestamp>${VIRTUAL.ISO8601_TIMESTAMP}</Timestamp>
<Type>LprEvent</Type>
<Message>My-Custom-Event-1</Message>
<CustomTag>TagFromXML</CustomTag>
<Source>
<Name>${DEVICE.IP_ETHERNET}</Name>
</Source>
</EventHeader>
<Description>Transit analytics event data</Description>
<Location>-</Location>
<Vendor>
<Name>My Company Srl</Name>
</Vendor>
</AnalyticsEvent>
And this is the second one:
<?xml version="1.0" encoding="utf-8"?>
<AnalyticsEvent xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:milestone-systems">
<EventHeader>
<ID>00000000-0000-0000-0000-000000000000</ID>
<Timestamp>${VIRTUAL.ISO8601_TIMESTAMP}</Timestamp>
<Type>LprEvent</Type>
<Message>My-Custom-Event-2</Message>
<CustomTag>TagFromXML</CustomTag>
<Source>
<Name>${DEVICE.IP_ETHERNET}</Name>
</Source>
</EventHeader>
<Description>Transit analytics event content</Description>
<Location>-</Location>
<Vendor>
<Name>My Company Srl</Name>
</Vendor>
</AnalyticsEvent>
This is the code I’m trying to use to query the events:
List<Condition> conditionList = new List<Condition>();
OrderBy orderBy = new OrderBy();
Condition descCond = new Condition();
descCond.Operator = Operator.Equals;
descCond.Target = Target.Description;
descCond.Value = "Transit analytics event data";
conditionList.Add(descCond);
Condition typeCond = new Condition();
typeCond.Operator = Operator.Equals;
typeCond.Target = Target.Type;
typeCond.Value = "LprEvent";
conditionList.Add(typeCond);
Condition timeCond = new Condition();
timeCond.Operator = Operator.GreaterThan;
timeCond.Target = Target.Timestamp;
timeCond.Value = dateTimePickerStart.Value.ToUniversalTime();
conditionList.Add(timeCond);
Condition timeCondUpper = new Condition();
timeCondUpper.Operator = Operator.LessThan;
timeCondUpper.Target = Target.Timestamp;
timeCondUpper.Value = dateTimePickerEnd.Value.ToUniversalTime();
conditionList.Add(timeCondUpper);
CameraEntry camera = cameras[i];
Condition source = new Condition();
source.Operator = Operator.Contains;
source.Target = Target.SourceName;
source.Value = camera.Name;
conditionList.Add(source);
/* Order filter */
orderBy.Order = Order.Descending;
orderBy.Target = Target.Timestamp;
EventFilter eventFilter = new EventFilter();
eventFilter.Conditions = conditionList.ToArray();
eventFilter.Orders = new OrderBy[] { orderBy };
eventFilters.Add(eventFilter);
I want to retrieve only the events with description = “Transit analytics event data” but the query always returns to me all events, also events with description = “Transit analytics event content".
I also tried to filter by message and not by description with the same result…
I’d like not to filter in post-query code to avoid the overhaed of reading also unwanted events (other events should be managed in a different part of code and not always).
Could you please give some hints on how to manage this situation in the correct way?
Thank you and best regards,
Enrico