Why does it NOT display Alarms from “Alarm Definition”?

We started with the AlarmViewer sample application.

Why does it NOT display Alarms from “Alarm Definition”,

even though they are displayed in the Smart-Client Alarm Manager workspace?

_obj1 = _messageCommunication.RegisterCommunicationFilter(NewAlarmMessageHandler, new VideoOS.Platform.Messaging.CommunicationIdFilter(VideoOS.Platform.Messaging.MessageId.Server.NewAlarmIndication), null, EndPointType.Server);
// AND also tried ...
_objE_Alarm = _messageCommunication.RegisterCommunicationFilter(_EMH_Alarm.NewEventMessageHandler, new VideoOS.Platform.Messaging.CommunicationIdFilter(VideoOS.Platform.Messaging.MessageId.Server.NewEventsIndication, VideoOS.Platform.Data.EventHeaderTypes.SystemAlarmType), null, EndPointType.Server);

This Managment-Client screenshot clarifies, “Alarm Definition”.

Why does it NOT display Alarms from “Alarm Definition”

Thank you for the screenshot, it is helpful for us to understand the issue. Let me ask you a bit silly question but did you refresh Management Client such as press F5?

Please finish answering this post. We added even more clarifications (yesterday July 13 at 10:08 AM). Thanks.

The problem has nothing to do with the Management Client. The screenshot from the Mgmt Client is just to indicate the types of alarms we are trying to view within our custom application [similar to Milestone’s AlarmViewer sample].

We have created alarms within the “Alarm Definition” subsystem. However, our custom application, which is derived from the AlarmViewer sample, does not display “Alarm Definition” alarms when they are triggered.

Our sample / snippet of code is showing the calls we have tried subscribing, in order to receive those triggered “Alarm Definition” alarms. Our question is … why can we see plenty of alarms … except the triggered “Alarm Definition” alarms?

I assumed that you have tested unmodified Alarm and Event Viewer sample, did it work? I need to hand over this question to Milestone Development but I am sorry, many developers are out of office due to vacation. We will get back to you as soon as possible. I am sorry for the inconvenience.

Do you get an error? What alarms are being displayed if not the alarms based on the alarm definitions seen in Management Client? If you’re seeing any alarms, then that implies you’re seeing alarms generated via MIP SDK directly, but you’re not seeing alarms generated by the event server based on the alarm definitions? It would be really odd and unusual to see one but not the other.

Or are you seeing NewEventIndication results with events like “motion started” or “device not responding”?

The following snippet shows a simple method to subscribe to NewAlarmIndication messages and print them to the console and it works for me. I’m running 2020 R2 with MIP SDK 2020 R2 in a 64bit project.

private static void ListenForAlarms(ServerId serverId, ManualResetEventSlim signal)
{
    try
    {
        MessageCommunicationManager.Start(serverId);
        using (var mc = MessageCommunicationManager.Get(serverId))
        {
            var obj = mc.RegisterCommunicationFilter(NewAlarmHandler,
                new CommunicationIdFilter(MessageId.Server.NewAlarmIndication));
            signal.Wait();
            mc.UnRegisterCommunicationFilter(obj);
        }
    }
    finally
    {
        MessageCommunicationManager.Stop(serverId);
    }
}
 
private static object NewAlarmHandler(Message message, FQID destination, FQID sender)
{
    Console.WriteLine(JsonConvert.SerializeObject(message, Formatting.Indented));
    return null;
}

And the following is the JSON representation of the alarm message received

{
  "MessageId": "Server.NewAlarmIndication",
  "RelatedFQID": null,
  "Data": {
    "EventHeader": {
      "ID": "8fcdb897-dc47-4a1b-ad15-71edb0447868",
      "Timestamp": "2020-07-14T17:43:32.5993849Z",
      "Type": "System Alarm",
      "Version": "1.0",
      "Priority": 1,
      "PriorityName": "High",
      "Name": "Test Alarm",
      "Message": "External Event",
      "Source": {
        "Name": "Test Trigger",
        "FQID": {
          "ServerId": {
            "Type": "XPCO",
            "Hostname": "msnode01.lab.local",
            "Port": 80,
            "Id": "266d03a1-9ca5-43dc-9638-2ae7ac9a45d2",
            "Scheme": "http"
          },
          "ParentId": "266d03a1-9ca5-43dc-9638-2ae7ac9a45d2",
          "ObjectId": "ce486af5-eef0-44fa-bcb4-88d3f143bde4",
          "FolderType": 0,
          "Kind": "c9bdac3f-41dc-4afa-b057-61767a3914b7"
        }
      },
      "MessageId": "0fcb1955-0e80-4fd4-a78a-db47ee89700c"
    },
    "Description": "",
    "State": 1,
    "StateName": "New",
    "CategoryName": "",
    "AssignedTo": "",
    "RuleList": [
      {
        "ID": "41c409d7-f5e9-4ad4-bde2-81fde40a760e",
        "Name": "Test Alarm",
        "Type": "4547f085-8b68-4639-826f-8722afb0ffc5"
      }
    ],
    "ReferenceList": []
  },
  "Reason": null,
  "ExternalMessageSourceEndPoint": {
    "ServerId": {
      "Type": "Service",
      "Hostname": "MSNODE01",
      "Port": 80,
      "Id": "6810bc2a-5ebb-4587-a183-2d5631e867b7",
      "Scheme": "http"
    },
    "ObjectId": "6810bc2a-5ebb-4587-a183-2d5631e867b7",
    "FolderType": 0,
    "Kind": "3b25fe94-7c2f-499a-86df-2fa68aa3e1b5"
  }
}

Finally, here is the alarm definition this alarm was based on. The trigger is a user-defined event.