Class: RSMP::TLC::DetectorLogic
Constant Summary
ComponentBase::AGGREGATED_STATUS_KEYS
Instance Attribute Summary collapse
#aggregated_status, #aggregated_status_bools, #alarms, #c_id, #grouped, #node, #ntsOId, #statuses, #xNId
Instance Method Summary
collapse
-
#force_detector_logic(forced, value) ⇒ Object
-
#get_status(code, name = nil, options = {}) ⇒ Object
-
#handle_command(command_code, arg, options = {}) ⇒ Object
-
#handle_m0008(arg, options = {}) ⇒ Object
-
#handle_s0201(status_code, status_name = nil, options = {}) ⇒ Object
-
#handle_s0202(status_code, status_name = nil, options = {}) ⇒ Object
-
#handle_s0203(status_code, status_name = nil, options = {}) ⇒ Object
-
#handle_s0204(status_code, status_name = nil, options = {}) ⇒ Object
-
#initialize(node:, id:) ⇒ DetectorLogic
constructor
A new instance of DetectorLogic.
Methods inherited from Component
#acknowledge_alarm, #activate_alarm, #deactivate_alarm, #resume_alarm, #status_updates_sent, #suspend_alarm
#aggregated_status_changed, #clear_aggregated_status, #clear_alarm_timestamps, #get_alarm_state, #log, #now, #set_aggregated_status, #set_aggregated_status_bools
Methods included from Inspect
#inspect, #inspector
Constructor Details
Returns a new instance of DetectorLogic.
6
7
8
9
10
|
# File 'lib/rsmp/tlc/detector_logic.rb', line 6
def initialize node:, id:
super node: node, id: id, grouped: false
@forced = 0
@value = 0
end
|
Instance Attribute Details
#forced ⇒ Object
Returns the value of attribute forced.
4
5
6
|
# File 'lib/rsmp/tlc/detector_logic.rb', line 4
def forced
@forced
end
|
#value ⇒ Object
Returns the value of attribute value.
4
5
6
|
# File 'lib/rsmp/tlc/detector_logic.rb', line 4
def value
@value
end
|
Instance Method Details
#force_detector_logic(forced, value) ⇒ Object
90
91
92
93
94
95
96
97
98
|
# File 'lib/rsmp/tlc/detector_logic.rb', line 90
def force_detector_logic forced, value
@forced = forced
@value = value
if @forced
log "Forcing to #{value}", level: :info
else
log "Releasing", level: :info
end
end
|
#get_status(code, name = nil, options = {}) ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/rsmp/tlc/detector_logic.rb', line 12
def get_status code, name=nil, options={}
case code
when 'S0201', 'S0202', 'S0203', 'S0204'
return send("handle_#{code.downcase}", code, name)
else
raise InvalidMessage.new "unknown status code #{code}"
end
end
|
#handle_command(command_code, arg, options = {}) ⇒ Object
73
74
75
76
77
78
79
80
|
# File 'lib/rsmp/tlc/detector_logic.rb', line 73
def handle_command command_code, arg, options={}
case command_code
when 'M0008'
handle_m0008 arg
else
raise UnknownCommand.new "Unknown command #{command_code}"
end
end
|
#handle_m0008(arg, options = {}) ⇒ Object
82
83
84
85
86
87
88
|
# File 'lib/rsmp/tlc/detector_logic.rb', line 82
def handle_m0008 arg, options={}
@node.verify_security_code 2, arg['securityCode']
status = arg['status']=='True'
mode = arg['mode']=='True'
force_detector_logic status, mode
arg
end
|
#handle_s0201(status_code, status_name = nil, options = {}) ⇒ Object
#handle_s0202(status_code, status_name = nil, options = {}) ⇒ Object
#handle_s0203(status_code, status_name = nil, options = {}) ⇒ Object
#handle_s0204(status_code, status_name = nil, options = {}) ⇒ Object