Retrieving alarm list in Smart Client

Hi, I need to create a custom alarm manager with extended filter capabilities in its own tab in Smart Client.

How can I retrieve the alarm list? I tried to call IAlarmClient.GetAlarmLines from the Init method of a ViewItemWpfUserControl with an alarm client created from AlarmClientManager, but got a System.ServiceModel.FaultException.

I solved it by fetching the alarms in an event server plugin and sending them serialized to the smart client plugin through a communication filter. So it works fine now, but please let me know if I have missed anything and there’s a better way.

You can use this code inside SC …

				_alarmClient = _alarmClientManager.GetAlarmClient(EnvironmentManager.Instance.MasterSite.ServerId);
				_alarms = _alarmClient.GetAlarmLines(0, maxExport, new VideoOS.Platform.Proxy.Alarm.AlarmFilter()
				{
					Orders = new OrderBy[]
					{
						new OrderBy() { Order = Order.Descending, Target = Target.Timestamp }
					},
					Conditions = new VideoOS.Platform.Proxy.Alarm.Condition[]
					{
							new VideoOS.Platform.Proxy.Alarm.Condition() { Operator = Operator.GreaterThan, Target = Target.Timestamp, Value = dtStart },
							new VideoOS.Platform.Proxy.Alarm.Condition() { Operator = Operator.LessThan, Target = Target.Timestamp, Value = dtEnd }
					}
				});

Freddy

This is what I did, unfortunately it causes a FaultException when running in smart client.

Undantagstyp:System.ServiceModel.FaultException
Undantagsmeddelande:Ett fel inträffade under verifiering av säkerheten för meddelandet.
Undantagskälla:mscorlib
Undantagsmålplats: HandleReturnMessage
 
Server stack trace: 
   vid System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   vid System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   vid System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   vid System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

The code I posted is from a SC-only plugin that has been working perfectly for a couple of years, which simply allows you to export all the alarms of a time interval to Excel. It has no ES components.

Freddy

Im interested in pulling alarm reports as referenced above. Where/how do i utilize the code in SC?

This is my plugin, only in Alarm Workspace …

Click to open this windows …

After setting Time Interval the plugin use the code i’ve posted, so it can show how may alarm are present, if you click to Anteprima (Preview) …

Immagine 2024-08-21 140529

If you click on Export button you have to provide name an location of .csv file

Freddy