Use the systemlink:alarm data type to create, update, and clear alarms in SystemLink.

Declare an alarm using the following command: alarm <variableName>.

After declaration, instantiate the alarm using the following function: [ alarm <alarmVariable>, systemLink:createAlarm <statusVariable> <optional> ]= sys:systemLink:createAlarm( text <id>, text <message>, alarm:severity <severity> ).

Example: SystemLink Alarms

program
   alarm myStaticAlarm
   text message(10) = "my message"
   systemLink:createAlarm status
   [ myStaticAlarm, status ] = sys:systemLink:createAlarm( "ID_1", message, alarm:severity:low )
   switch status
      case systemLink:createAlarm:ok 
         sys:loginfo(sys:ui, "alarm created" )
      case systemLink:createAlarm:error
         sys:loginfo(sys:ui, "alarm not created" )
   endswitch
endprogram

Clearing SystemLink Alarms

Use the following command to clear all alarms that the runtime system sent to SystemLink.

systemLink:clearAllAlarms <statusVariable> = sys:systemLink:clearAllAlarms( alarm:clearType <clearType> )

Example: Clearing SystemLink Alarms

program
   systemLink:clearAllAlarms status
   status = sys:systemLink:clearAllAlarms( systemLinkAlarm:clearType:clearedByUser )
endprogram