Alarm Notification Module API

Hi,

the Programmers-Guide (section 3.9.6 - Alarming) mentions a seperate API for Alarm Notification. Is there a documentation or even an example for this API aside from the javadocs?

If not, could someone please confirm that i’m on the right way with the following hook class (i used a modified driver module hook here):

package com.chitek.ignition.alarming.notification.ucp;

import org.apache.log4j.Logger;

import com.inductiveautomation.ignition.alarming.AlarmNotificationContext;
import com.inductiveautomation.ignition.common.licensing.LicenseState;
import com.inductiveautomation.ignition.gateway.model.AbstractGatewayModuleHook;
import com.inductiveautomation.ignition.gateway.model.GatewayContext;
import com.inductiveautomation.ignition.gateway.services.ModuleServiceConsumer;

public class ModuleHook extends AbstractGatewayModuleHook implements ModuleServiceConsumer {

	private GatewayContext gatewayContext;
	private AlarmNotificationContext alarmNotificationContext;

	@Override
	public void setup(GatewayContext gatewayContext) {
		this.gatewayContext = gatewayContext;
	}

	@Override
	public void startup(LicenseState licenseState) {
		gatewayContext.getModuleServicesManager().subscribe(AlarmNotificationContext.class, this);
	}

	@Override
	public void shutdown() {
		gatewayContext.getModuleServicesManager().unsubscribe(AlarmNotificationContext.class, this);
		
		if (alarmNotificationContext != null) {
			try {
				alarmNotificationContext.getAlarmNotificationManager().removeAlarmNotificationProfileType(new UcpSmsNotificationProfileType());
			} catch (Exception e) {
				Logger.getLogger(UcpSmsNotification.loggerName).error("Exception while removing AlarmNotificationProfileType", e);
			}
		}
	}
	
	@Override
	public void serviceReady(Class<?> serviceClass) {
		
		if (serviceClass == AlarmNotificationContext.class) {
			alarmNotificationContext = (AlarmNotificationContext) gatewayContext.getModuleServicesManager().getService(AlarmNotificationContext.class);

			try {
				alarmNotificationContext.getAlarmNotificationManager().addAlarmNotificationProfileType(new UcpSmsNotificationProfileType());
			} catch (Exception e) {
				Logger.getLogger(UcpSmsNotification.loggerName).error("Exception while adding AlarmNotificationProfileType", e);
			}
		}
	}

	@Override
	public void serviceShutdown(Class<?> serviceClass) {
		
		if (serviceClass == AlarmNotificationContext.class) {
			alarmNotificationContext = null;
			Logger.getLogger(UcpSmsNotification.loggerName).debug("AlarmNotificationContext has been shut down");
		}
	}

}

Thanks in advance,
Carsten

Yeah, it looks like you’re on the right track here. We should really have an SDK example for adding custom AlarmNotificationProfiles.

I’m gonna make a ticket for this, which doesn’t guarantee it will happen quickly, but it’s better than no ticket! :smiley:

Just in case anybody else is missing an example:
I published the finished module on github. This is a little notification profile that supports SMS notification using a default GSM-modem.

Kevin, for my part you may close the ticket :smiling_imp:

Thanks! :thumb_left: