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
- #send_alarm(_component, alarm, options = {}) ⇒ Object
Instance Method Details
#handle_alarm_acknowledge(message) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/rsmp/proxy/supervisor/modules/alarms.rb', line 38 def handle_alarm_acknowledge() component_id = .attributes['cId'] component = @site.find_component component_id alarm_code = .attribute('aCId') log "Received #{message.type} #{alarm_code} acknowledgement", message: , level: :log acknowledge component.acknowledge_alarm alarm_code end |
#handle_alarm_request(message) ⇒ Object
65 66 67 68 69 |
# File 'lib/rsmp/proxy/supervisor/modules/alarms.rb', line 65 def handle_alarm_request() log "Received #{message.type}", message: , level: :log acknowledge send_active_alarms end |
#handle_alarm_resume(message) ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/rsmp/proxy/supervisor/modules/alarms.rb', line 56 def handle_alarm_resume() component_id = .attributes['cId'] component = @site.find_component component_id alarm_code = .attribute('aCId') log "Received #{message.type} #{alarm_code} resume", message: , level: :log acknowledge component.resume_alarm alarm_code end |
#handle_alarm_suspend(message) ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/rsmp/proxy/supervisor/modules/alarms.rb', line 47 def handle_alarm_suspend() component_id = .attributes['cId'] component = @site.find_component component_id alarm_code = .attribute('aCId') log "Received #{message.type} #{alarm_code} suspend", message: , level: :log acknowledge component.suspend_alarm alarm_code end |
#process_alarm(message) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rsmp/proxy/supervisor/modules/alarms.rb', line 23 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
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rsmp/proxy/supervisor/modules/alarms.rb', line 12 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 |
#send_alarm(_component, alarm, options = {}) ⇒ Object
6 7 8 9 10 |
# File 'lib/rsmp/proxy/supervisor/modules/alarms.rb', line 6 def send_alarm(_component, alarm, = {}) send_and_optionally_collect alarm, do || Collector.new self, .merge(task: @task, type: 'MessageAck') end end |