Dear Sir/Madam,
We are currently using Component SDK to trigger an alarm.
Beside the source camera, now, we need to add a related camera into that alarm.
Please advise how to do this. Is there a component SDK sample using related camera for generating an alarm? Thank you.
Best Regards
Thank you for your assistance.
We like to know if it is possible to add a related camera for a SDK generated alarm. We have the impression that only predefined alarm with alarm definition which is triggered by an event could specify related camera, please advise the correct understanding, thank you.
It is recommended to have an Alarm Definition, this mechanism will allow the users to add extra instructions, disable alarms, etc. It will also allow the user to add extra related cameras through configuring it in the Alarm Definition.
If you want to send alarms directly you can do so. You can add a related camera by adding it to the Alarms ReferenceList object.
https://doc.developer.milestonesys.com/html/index.html?base=miphelp/class_video_o_s_1_1_platform_1_1_data_1_1_alarm.html&tree=tree_search.html?search=referencelist
No sample adds related cameras but this sample sends a direct alarm..
https://doc.developer.milestonesys.com/html/index.html?base=samples/componentsamples/libraryeventgenerator/readme.html&tree=tree_2.html
Hi Sir,
I use below peice of code to link two related camera to an alarm.
Related cameras do not link to the alarm at SmartClient.
Could you advise what missing in the code or what wrong of the code to link related camera to an alarm.
It is really appreciated for you to provide a small piece of code to correctly link related camera to an alarm, thank you.
Alarm alarm = new Alarm()
{
EventHeader = eventHeader,
StateName = "New",
State = 1,
AssignedTo = "Operator",
CategoryName = "iPIDS-OCS"
};
try
{
Log.Debug("getting related camera ... ");
ReferenceList refList = new ReferenceList();
Reference aRef = new Reference();
Log.Debug("camList\[5\].camName = " + camList\[5\].camName);
Log.Debug("camList\[4\].camName = " + camList\[4\].camName);
aRef.FQID = camList\[5\].camFQID;
refList.Add(aRef);
aRef.FQID = camList\[4\].camFQID;
refList.Add(aRef);
alarm.ReferenceList = refList;
//alarm.ExtensionData ???
Log.Debug("related camera added. ");
}
catch (Exception ex)
{
Log.Fatal("Fatal at link related camera to alarm. ");
Log.Fatal("Fatal = " + ex.ToString());
}
The code looks correct, I cannot see how you then send it but it looks correct..
I tested by adding these lines to the LibraryEventGenerator (EventForm.cs, line 157)
alarm.ReferenceList = new ReferenceList();
Reference cameraRef = new Reference();
var sourceCamera = Configuration.Instance.GetItem(new Guid("4A28D7F4-6616-4EE8-BCC2-741E98418DEC"), Kind.Camera);
cameraRef.FQID = sourceCamera.FQID;
alarm.ReferenceList.Add(cameraRef);
Hi Sir,
By using your way of linking related camera, now, we are also able to get related camera for our alarm at alarm mgr. Thank you very much for your assistance.
Hi Sir,
Using this way, it seems we are not able to add more than one related camera.
I also tried LibraryEventGenerator, it is not able to bring in more than one related camera neither. Please confirm if we can add more than one related camera into an alarm or not, thank you.
For me it works perfectly..
I tested by using this code where you can add more cameras until you cancel..
alarm.ReferenceList = new ReferenceList();
Item CameraToAdd = null;
do
{
CameraToAdd = SelectCam();
if (CameraToAdd != null)
{
Reference cameraRef = new Reference();
cameraRef.FQID = CameraToAdd.FQID;
alarm.ReferenceList.Add(cameraRef);
}
} while (CameraToAdd != null);
..
private Item SelectCam()
{
ItemPickerWpfWindow itemPicker = new ItemPickerWpfWindow()
{
SelectionMode = SelectionModeOptions.SingleSelect,
AutoExpand = true,
Items = Configuration.Instance.GetItemsByKind(Kind.Camera)
};
if (itemPicker.ShowDialog().Value)
{
return itemPicker.SelectedItems.First();
}
return null;
}