Hi Dojo,
Does someone has example code for taking ownership of an alarm?
Hi Jens,
I have the following code on a connector:
public static void TakeAlarmOwnership(this SLProtocol protocol, int dmaId, int alarmId, string message)
{
if (protocol == null)
{
throw new ArgumentNullException("protocol");
}
var setAlarmStateMessage = new SetAlarmStateMessage(dmaId, alarmId, 2 /*Take Owner*/, message);
protocol.SLNet.SendMessage(setAlarmStateMessage);
}
public static void ReleaseAlarmOwnership(this SLProtocol protocol, int dmaId, int alarmId)
{
if (protocol == null)
{
throw new ArgumentNullException("protocol");
}
var setAlarmStateMessage = new SetAlarmStateMessage(dmaId, alarmId, 3 /*Release Owner*/, string.Empty);
protocol.SLNet.SendMessage(setAlarmStateMessage);
}
Hi Jens, the following method can be used to acknowledge the alarm. If a user launches the script manually or attaches to it interactively, that user will become the owner of the alarm. If the script runs in the background, the alarm owner will become 'Administrator'.
engine.AcknowledgeAlarm(dataMinerID, alarmID, comment);