AlarmManager show related map

Hi,

We don’t have or define any alarm definition; we capture the events and generate alarms from the application.

In the SC alarm manager, we can see the alarms generated and show the camera view with the related cameras.

How do we send a map?

//copy event header info
EventHeader newEventHeader = new EventHeader()
{
    Timestamp = eventInfo.EventHeader.Timestamp,
    ID = eventInfo.EventHeader.ID,
    Name = eventInfo.EventHeader.Name,
    Type = eventInfo.EventHeader.Type,
    Message = sEventCustomName, 
    Source = eventInfo.EventHeader.Source,
    CustomTag = eventInfo.EventHeader.CustomTag,
};
          
Alarm alarm = new Alarm()
{
    EventHeader = newEventHeader,
    StateName = "New",
    State = 1, 
    ReferenceList = refList,//all related camera          
};
 
EnvironmentManager.Instance.SendMessage(new VideoOS.Platform.Messaging.Message(MessageId.Server.NewAlarmCommand) { Data = alarm });

We also have Maps GUIDs, but how do we send them during an alarm generation?

Thanks,

Vega Support

Dear Vega integrators,

unfortunately this functionality of the SC works only with the built-in alarm definitions.

Namely, there is no information in the alarm about the maps, that has to be shown on the map. Instead, UI searches for the alarm definition, that this alarm was triggered from and checks what is written in the alarm definition configuration (what map type/instance is set-up there).

Having that in mind, the only way to trick the SC UI and make it show a particular map is to pretend that your alarm was triggered by alarm definition.

So you have to create a real alarm definition, configure what map (instance) to be used for the alarms coming from it and set the alarm definition Id in the rulesList of the Alarm. The tricky point here is that this “fake” alarm definition should not generate actual alarms. So you have to configure for it some event that is not used into the system at all.

The code would look something like:

Guid AlarmRuleType_BuiltinAlarmDefinition = new Guid("4547f085-8b68-4639-826f-8722afb0ffc5");
var ruleList = new RuleList();
ruleList.Add(new Rule()
{
	// the ID of the alarm definition, with configured map instance
	ID = Guid.Parse("bac88821-3cdf-43c9-bdf9-21fcf6c559f2"),
	// fixed type of the built-in alarm definitions (rules)
	// use only that type !!!
	Type = AlarmRuleType_BuiltinAlarmDefinition.ToString(),
});
 
Alarm alarm = new Alarm()
{
    EventHeader = eventHeader,
    StateName = "New",
    State = 1,
    ReferenceList = refList, 
    RuleList = ruleList, 
};
 
EnvironmentManager.Instance.SendMessage(new VideoOS.Platform.Messaging.Message(MessageId.Server.NewAlarmCommand) { Data = alarm });

Not the best dev experience, but this is how it is.

Alarm alarm = new Alarm()
{
    EventHeader = newEventHeader,
    StateName = "New",
    State = 1, 
    ReferenceList = refList,//all related camera          
};

Can we insert the related map guid in the block above when we create a new alarm without creating a native alarm definition?

Nope,

As I’ve tried to explain in the previous post, you need to set reference to an alarm definition, that has this map configured.

This workaround works for Non-Federated sites. However, it does not seem to work for federated sites. Is there a solution for a Federated Site? Because the DummyAlarm we create is on the Parent Site, there is no dummy alarm on the child site. Even though we create DummyAlarm on the child site, the AlarmID will differ.