Alarm Object Attributes

The custom Alarm object provides the attributes listed in the following table; use the methods shown below in your custom object code to retrieve a value for each attribute:

 

Attribute

Method

Name

alarm.getName()

Description

alarm.getDescription()

Severity

alarm.getSeverity()

Type

alarm.getType()

Acknowledgement Date

alarm.getAcknowledgementDate()

Data Item Name

alarm.getDataItemName()

Data Item Value

alarm.getDataItemValue()

Date

alarm.getDate()

Asset

alarm.getDevice()

Asset Name

alarm.getDevice().getName()

Asset Serial Number

alarm.getDevice().getSerialNumber()

Model Number

alarm.getDevice().getModel().getName()

Missing

alarm.getDevice().isMissing()

 

Tip

A custom object that creates and stores an alarm, without acknowledging the alarm, results in the alarm being visible in the Asset dashboard of the related asset. However, the same custom object that is set up to create and then acknowledge the alarm results in the alarm never appearing, not even in the Historical Alarms page.

One reason for this is that stored procedure takes some time to create the alarm. To work around the timing issue, use a Thread.sleep.

The second reason is that the GetId() in the SDK's Alarm Object will not be populated when the alarm is created using the SDK object. To work around the GetId() not being populated, use an AlarmFinder AFTER the thread.sleep(). AlarmFinder.find() will return the alarm object. Then, using that alarm object, you can acknowledge the alarm. The following example shows you how:

 

import com.axeda.drm.sdk.data.AlarmEntry;

import com.axeda.drm.sdk.data.AlarmFinder;

import com.axeda.drm.sdk.data.Alarm;

 

AlarmEntry newAlarm = new AlarmEntry(context.context, context.device, "Alarm6", "desc", 10, null, false, new Date(), true);

newAlarm.store();

 

try

{

Thread.sleep(15000);

}

catch (InterruptedException ex)

{

}

 

AlarmFinder finder = new AlarmFinder(context.context);

finder.setAlarmName("Alarm6");

Alarm alarm = finder.find();

alarm.acknowledge();

 

 

Back to Custom Object wizard - Create or Edit Custom Object