We are considering the possibility of an alarm being launched by a group of cameras and it would be convenient to identify them within a single alarm. As of now we have worked around this by sending an alarm for each of the implicated cameras. Is there a way to navigate the alarm manager list and get them from a background plugin?
An alarm can only have one source. However an alarm can have related cameras.
If an alarm has related cameras these cameras will be displayed in the Alarm Preview on the Alarm Manager in the Smart Client..
Try to see this thread.. https://developer.milestonesys.com/s/question/0D53X0000CvzwvlSQA/alarm-related-camera
I see there’s the option of adding the reference to a camera from the SDK, however, I would be more interested in knowing if this is possible to do from within the XML as we are sending these alarms through an external service. Is it?
I made it my point to try it before I answered. Perhaps it was good that I did. I am getting an exception from the Alarm Preview of the Smart Client when I try.
I will be reporting this to the developers at Milestone and they will figure out if I am doing something wrong or there is a bug in the Smart Client Preview pane.
Let me share how I did even if it might not solve anything in the current state.
You saw the sample modifications in the other thread, the sample assumes the use of MIP SDK. There is another sample where you send XML. Analytics Event Trigger via XML - https://doc.developer.milestonesys.com/html/index.html?base=samples/protocolsamples/triggeranalyticseventxml/readme.html&tree=tree_3.html
Follow the instructions to use this sample if you haven’t already tried it.
The idea is that you can send the exact same Analytics Events with this sample as with the other, you just need the right XML.
I figure the right XML looks a bit like this:
<AnalyticsEvent xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:milestone-systems">
<EventHeader>
<ID>00000000-0000-0000-0000-000000000000</ID>
<Timestamp>$timestamp$</Timestamp>
<Type>MyType</Type>
<!-- Insert Event Message here -->
<Message>MyAnalyticsEvent01</Message>
<CustomTag>TagFromXML</CustomTag>
<Source>
<FQID>
<ServerId>
<Id>6cdb1b2e-4608-439d-af48-37901ec70c78</Id>
</ServerId>
<ObjectId>5fea5c42-e75f-4db9-878f-dbdac85d5acc</ObjectId>
<ObjectIdString/>
<FolderType>0</FolderType>
<Kind>5135ba21-f1dc-4321-806a-6ce2017343c0</Kind>
</FQID>
</Source>
</EventHeader>
<Description>Analytics event description.</Description>
<Location>Event location 1</Location>
<ReferenceList>
<Reference>
<FQID>
<ServerId>
<Id>6cdb1b2e-4608-439d-af48-37901ec70c78</Id>
</ServerId>
<ObjectId>74d150c1-17c9-490f-aa1b-db723a1c51ef</ObjectId>
<ObjectIdString/>
<FolderType>0</FolderType>
<Kind>5135ba21-f1dc-4321-806a-6ce2017343c0</Kind>
</FQID>
<FQID>
<ServerId>
<Id>6cdb1b2e-4608-439d-af48-37901ec70c78</Id>
</ServerId>
<ObjectId>c5d3231a-8784-4ab6-9732-c6f08df1ae94</ObjectId>
<ObjectIdString/>
<FolderType>0</FolderType>
<Kind>5135ba21-f1dc-4321-806a-6ce2017343c0</Kind>
</FQID>
</Reference>
</ReferenceList>
<Vendor>
<Name>My Smart Video</Name>
</Vendor>
</AnalyticsEvent>
(The sample replaces $timestamp$)
If you want to try this yourself I would like to share a little helper function I made for the LibraryEventGenerator sample, it helps me to make a correct FQID node for the XML:
private void OutputFQIDasXML(FQID id)
{
string format = $"<FQID><ServerId><Id>{id.ServerId.Id}</Id></ServerId><ObjectId>{id.ObjectId.ToString()}</ObjectId><FolderType>{(int)id.FolderType}</FolderType><Kind>{id.Kind}</Kind></FQID>";
Debug.WriteLine(format);
System.Windows.Forms.Clipboard.SetText(format);
MessageBox.Show(format,"This is string is put in Clipboard");
}
If you try this please report back to me: Do you see an exception in the Smart Client Alarm Manager when you see the Alarm by clicking on the alarm line in the Alarm List?
Indeed, we are using the example to send XML from outside, and I feel like that could work as a solution.
Let me get back to you as soon as I can get to work with this.
II have heard back from Milestone Development. They say that it is a bug and they will fix it in a future release. Interestingly they added that this issue is easy to mitigate. An error happened while the XML is deserialized because there is no in the
In this example there is a Hostname and no error will happen.
<FQID>
<ServerId>
<Hostname>localhost</Hostname>
<Id>c09653e5-5080-4d5f-9c12-6923929efd18</Id>
</ServerId>
<ObjectId>47f25aa7-065a-47e6-a470-4bd3815f724a</ObjectId>
<FolderType>0</FolderType>
<Kind>5135ba21-f1dc-4321-806a-6ce2017343c0</Kind>
</FQID>
Hostname will not always be working with “localhost”.
I previously posted a snippet of code to generate the FQID XML, here is a corrected snippet..
private void OutputFQIDasXML(FQID id)
{
string format = $"<FQID><ServerId><Hostname>{id.ServerId.ServerHostname}</Hostname><Id>{id.ServerId.Id}</Id></ServerId><ObjectId>{id.ObjectId.ToString()}</ObjectId><FolderType>{(int)id.FolderType}</FolderType><Kind>{id.Kind}</Kind></FQID>";
System.Windows.Forms.Clipboard.SetText(format);
MessageBox.Show(format,"This is string is put in Clipboard");
}