How do I retrieve User Alarm Change State?

I would like to register a recevier for User Changed Alarme State, for instance from New to Close, from Alarm Line. How can I do that?

Many Thanks in advance,

Freddy

You can either use MIP messaging and listen on the VideoOS.Platform.Messaging.MessageId.Server.ChangedAlarmIndication message. Have a look at the Alarm and Event Viewer sample: https://doc.developer.milestonesys.com/html/index.html?base=samples/alarmviewer_sample.html&tree=tree_2.html

Or you can use the IAlarmClient interface: https://doc.developer.milestonesys.com/html/index.html?base=miphelp/interface_video_o_s_1_1_platform_1_1_proxy_1_1_alarm_client_1_1_i_alarm_client.html&tree=tree_search.html?search=ialarmclient

The above mentioned sample also shows how to work with this interface, but the methods that will be of interest for you are: StartAlarmLineSession, StopAlarmLineSession, GetSessionAlarmLines

Thank You Peter, it’s working fine.

Hereafter the code used to register two callback:

            // Registra il Callback dei nuovi Allarmi - Creazione FloatingWindows
            _newAlarmEventReceiver = EnvironmentManager.Instance.RegisterReceiver(new MessageReceiver(NewAlarmEventReceiver), new MessageIdFilter(MessageId.Server.NewAlarmIndication));
 
            // Registra il CallBack dell'Ack degli Allarmi - Chiusura FloatingWindows
            _ackAlarmEventReceiver = EnvironmentManager.Instance.RegisterReceiver(new MessageReceiver(AckAlarmEventReceiver), new MessageIdFilter(MessageId.Server.ChangedAlarmIndication));

Can you please explain me why the first one operate on SC environment while the other on ES environment?

Many Thanks,

Frediano

Hi Frediano. Could you please explain what you mean here? Do we understand you correctly that only MessageId.Server.NewAlarmIndication works in SC environment, while MessageId.Server.ChangedAlarmIndication doesn’t ?

Yes, you are right.

I’m developing a plugin that works only on SC environment using breakpoints to debug it. The bp inside NewAlarmIndication task works while it is not the same for ChangedAlarmIndication task. This is the reason of my first request, I supposed it was not the right event to listen. After Peter’s answer I tried to debug connecting Visual Studio to ES service, instead of SC, and in this way the bp inside ChangedAlarmIndication are working.

Freddy

Hi. Since the ChangedAlarmIndication is sent through message communication, try to register to it like this:

MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);

_messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

_obj = _messageCommunication.RegisterCommunicationFilter(MessageHandler,

new CommunicationIdFilter(MessageId.Server.ChangedAlarmIndication));

Thank You Andriy,

in this way it works perfectly on SC Environment

Freddy