Module: RSMP::SiteProxy::Modules::Alarms

Included in:
RSMP::SiteProxy
Defined in:
lib/rsmp/proxy/site/modules/alarms.rb

Overview

Handles alarm messages

Instance Method Summary collapse

Instance Method Details

#process_alarm(message) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/rsmp/proxy/site/modules/alarms.rb', line 6

def process_alarm(message)
  component = find_component message.attribute('cId')
  status = %w[ack aS sS].map { |key| message.attribute(key) }.join(',')
  component.handle_alarm message
  alarm_code = message.attribute('aCId')
  asp = message.attribute('aSp')
  log "Received #{message.type}, #{alarm_code} #{asp} [#{status}]", message: message, level: :log
  acknowledge message
end

#send_alarm_acknowledgement(component, alarm_code, options = {}) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/rsmp/proxy/site/modules/alarms.rb', line 16

def send_alarm_acknowledgement(component, alarm_code, options = {})
  message = RSMP::AlarmAcknowledged.new({
                                          'cId' => component,
                                          'aCId' => alarm_code
                                        })
  send_message message, validate: options[:validate]
  message
end