Module: RSMP::SupervisorProxy::Modules::Alarms
- Included in:
- RSMP::SupervisorProxy
- Defined in:
- lib/rsmp/proxy/supervisor/modules/alarms.rb
Overview
Alarm handling
Instance Method Summary collapse
- #handle_alarm_acknowledge(message) ⇒ Object
- #handle_alarm_request(message) ⇒ Object
- #handle_alarm_resume(message) ⇒ Object
- #handle_alarm_suspend(message) ⇒ Object
- #process_alarm(message) ⇒ Object
- #send_active_alarms ⇒ Object
Instance Method Details
#handle_alarm_acknowledge(message) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/rsmp/proxy/supervisor/modules/alarms.rb', line 32 def handle_alarm_acknowledge() component_id = .attributes['cId'] component = @site.find_component component_id alarm_code = .attribute('aCId') log "Received #{.type} #{alarm_code} acknowledgement", message: , level: :log acknowledge component.acknowledge_alarm alarm_code end |
#handle_alarm_request(message) ⇒ Object
59 60 61 62 63 |
# File 'lib/rsmp/proxy/supervisor/modules/alarms.rb', line 59 def handle_alarm_request() log "Received #{.type}", message: , level: :log acknowledge send_active_alarms end |
#handle_alarm_resume(message) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/rsmp/proxy/supervisor/modules/alarms.rb', line 50 def handle_alarm_resume() component_id = .attributes['cId'] component = @site.find_component component_id alarm_code = .attribute('aCId') log "Received #{.type} #{alarm_code} resume", message: , level: :log acknowledge component.resume_alarm alarm_code end |
#handle_alarm_suspend(message) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/rsmp/proxy/supervisor/modules/alarms.rb', line 41 def handle_alarm_suspend() component_id = .attributes['cId'] component = @site.find_component component_id alarm_code = .attribute('aCId') log "Received #{.type} #{alarm_code} suspend", message: , level: :log acknowledge component.suspend_alarm alarm_code end |
#process_alarm(message) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rsmp/proxy/supervisor/modules/alarms.rb', line 17 def process_alarm() case when AlarmAcknowledge handle_alarm_acknowledge when AlarmSuspend handle_alarm_suspend when AlarmResume handle_alarm_resume when AlarmRequest handle_alarm_request else dont_acknowledge , 'Invalid alarm message type' end end |
#send_active_alarms ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/rsmp/proxy/supervisor/modules/alarms.rb', line 6 def send_active_alarms @site.components.each_pair do |_c_id, component| component.alarms.each_pair do |_alarm_code, alarm_state| if alarm_state.active alarm = AlarmIssue.new(alarm_state.to_hash.merge('aSp' => 'Issue')) alarm end end end end |