Module: RSMP::TLC::Modules::DetectorLogics

Included in:
TrafficController
Defined in:
lib/rsmp/tlc/modules/detector_logics.rb

Overview

Detector logic management for traffic controller Handles detector logic status queries and forcing

Instance Method Summary collapse

Instance Method Details

#add_detector_logic(logic) ⇒ Object



7
8
9
# File 'lib/rsmp/tlc/modules/detector_logics.rb', line 7

def add_detector_logic(logic)
  @detector_logics << logic
end

#handle_m0021(arg, _options = {}) ⇒ Object

M0021 - Force detector logic



12
13
14
# File 'lib/rsmp/tlc/modules/detector_logics.rb', line 12

def handle_m0021(arg, _options = {})
  @node.verify_security_code 2, arg['securityCode']
end

#handle_s0002(_status_code, status_name = nil, _options = {}) ⇒ Object

S0002 - Detector logic status



17
18
19
20
21
22
# File 'lib/rsmp/tlc/modules/detector_logics.rb', line 17

def handle_s0002(_status_code, status_name = nil, _options = {})
  case status_name
  when 'detectorlogicstatus'
    TrafficControllerSite.make_status @detector_logics.map { |dl| bool_to_digit(dl.value) }.join
  end
end

#handle_s0016(_status_code, status_name = nil, _options = {}) ⇒ Object

S0016 - Number of detector logics



25
26
27
28
29
30
# File 'lib/rsmp/tlc/modules/detector_logics.rb', line 25

def handle_s0016(_status_code, status_name = nil, _options = {})
  case status_name
  when 'number'
    TrafficControllerSite.make_status @detector_logics.size
  end
end

#handle_s0021(_status_code, status_name = nil, _options = {}) ⇒ Object

S0021 - Detector logic forcing status



33
34
35
36
37
38
# File 'lib/rsmp/tlc/modules/detector_logics.rb', line 33

def handle_s0021(_status_code, status_name = nil, _options = {})
  case status_name
  when 'detectorlogics'
    TrafficControllerSite.make_status @detector_logics.map { |logic| bool_to_digit(logic.forced) }.join
  end
end

#handle_s0031(_status_code, status_name = nil, _options = {}) ⇒ Object

S0031 - Trigger level sensitivity for loop detector



41
42
43
44
45
46
# File 'lib/rsmp/tlc/modules/detector_logics.rb', line 41

def handle_s0031(_status_code, status_name = nil, _options = {})
  case status_name
  when 'status'
    TrafficControllerSite.make_status ''
  end
end