I am trying to add an AlarmDefinition with the SDK using the Configuration API’s AddAlarmDefinitionServerTask. But whenever I call Execute() on the Task I get an ArgumentExceptionFault with the message “Sources out of range”.
I could not find any explanation how that string is supposed to be formatted within the documentation. I assume it’s a comma seperated list of paths?
I tired it for example with “Camera[<Guid_of_camera>]” but it didn’t work. For my usecase one camera would be sufficient anyway,
I even created an AlarmDefinition by hand with the Management Client, retrieved it from the management server and created a new AddAlarmDefinitionServerTask via ManagementServer.AlarmDefinitionFolder.AddAlarmDefinition() and set its properties to the exact same values (minus the name which has to be unique) and it still threw an exception on Execute().
Any ideas?
When doing the same in the Config API Client sample
I notice
-when I switch [Triggering event group] from System event to something else and back I get the “Triggering event type is out of range”
-depending on the choice here the [Triggering event type] drop down is populated with different list of objects
-when I switch [Triggering event type] to something I get “Sources is out of range”
-when I use the select button and get the [Sources] right there is no error, I am able to use the Add alarm definition button and create the alarm defintion
Learning from this: So depending on how you do this you will either get errors while building the right command data, or if you fill the whole you will have to be very careful what you fill into the data set.
If this “hint” does not lead you to a solution of this issue you can perhaps show me a snippet of your code and I might be able to see how it goes wrong.
I was able to narrow the problem down to the following:
I can not set a source for an alarm definition whenever I have chosen an analytics event as the trigger.
The strange part is that I can create an Alarm Definition just fine with the Management Client like that:
I can also load this newly created alarm definition with the Configuration API client. However I cannot save the alarm definition with the config client, even if I don’t change a single property. Same error as in my code: “Sources out of range”.
I can save it, if I change the triggering event from an analytics event to another event type like System Event / Enabled. But I can never save anything if I choose “Analytics Event” as event type - always the sources are out range. Also when having chosen an an analytics event the member picker tree view for the sources property is not populated - as in there is nothing valid to pick. It works just fine and shows e.g. my cameras when having picked “System Event”.
Additionally here is a code snippet how I want to add the alarm definition in my plugin:
var managementServer = new ManagementServer(EnvironmentManager.Instance.MasterSite);
var addAlarmTask = managementServer.AlarmDefinitionFolder.AddAlarmDefinition();
addAlarmTask.Name = "a name";
addAlarmTask.Description = "a decription";
addAlarmTask.EventTypeGroup = addAlarmTask.EventTypeGroupValues["Analytics Events"];
addAlarmTask.EventType = "<guid of event>"
addAlarmTask.SourceList = "Camera[<guid of camera>]";
//I dont't know if setting these following properties is necessary, but the code fails regardless if i set them or don't
addAlarmTask.EnableRule ="0";
addAlarmTask.TimeProfile = "TimeProfile[00000000-0000-0000-0000-000000000000]";
addAlarmTask.EnableEventList = "";
addAlarmTask.DisableEventList = "";
addAlarmTask.ManagementTimeoutTime = "00:01:00";
addAlarmTask.ManagementTimeoutEventList = "";
addAlarmTask.RelatedCameraList = "";
addAlarmTask.RelatedMap = "";
addAlarmTask.Priority = addAlarmTask.PriorityValues["High"];
addAlarmTask.Category = "00000000-0000-0000-0000-000000000000";
addAlarmTask.TriggerEventlist = "";
addAlarmTask.Execute();
I am reporting this to Milestone Development as a bug. I will update here when there is news to tell.
A fix has been developed for the issue you have experienced here and this fix will be included in the XProtect 2018R3 with expected release on October 2.