Module: RSMP::TLC::Proxy::Detectors

Included in:
SupervisorInterface
Defined in:
lib/rsmp/tlc/proxy/detectors.rb

Overview

Command methods for operational control of a remote TLC. Covers functional position, emergency routes, I/O modes, signal group orders, and system settings.

Instance Method Summary collapse

Instance Method Details

#force_detector_logic(component_id, status:, mode:, within:) ⇒ Object

M0008 - Force detector logic to a given mode and status. component_id must refer to the detector logic component, not main.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rsmp/tlc/proxy/detectors.rb', line 9

def force_detector_logic(component_id, status:, mode:, within:)
  readiness = validate_ready 'force detector logic'
  return readiness if readiness.failure?

  security_code = security_code_for(2)

  command_list = [{
    'cCI' => 'M0008',
    'cO' => 'setForceDetectorLogic',
    'n' => 'status',
    'v' => command_value('M0008', 'status', status)
  }, {
    'cCI' => 'M0008',
    'cO' => 'setForceDetectorLogic',
    'n' => 'securityCode',
    'v' => security_code.to_s
  }, {
    'cCI' => 'M0008',
    'cO' => 'setForceDetectorLogic',
    'n' => 'mode',
    'v' => command_value('M0008', 'mode', mode)
  }]
  send_command_and_collect(command_list, component: component_id, within: within)
end

#force_detector_logic!Object



34
35
36
# File 'lib/rsmp/tlc/proxy/detectors.rb', line 34

def force_detector_logic!(...)
  force_detector_logic(...).value!
end

#set_trigger_level(status, within:) ⇒ Object

M0021 - Set the trigger level for traffic counting.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/rsmp/tlc/proxy/detectors.rb', line 39

def set_trigger_level(status, within:)
  readiness = validate_ready 'set trigger level'
  return readiness if readiness.failure?

  raise 'TLC main component not found' unless main

  security_code = security_code_for(2)

  command_list = [{
    'cCI' => 'M0021',
    'cO' => 'setLevel',
    'n' => 'status',
    'v' => command_value('M0021', 'status', status)
  }, {
    'cCI' => 'M0021',
    'cO' => 'setLevel',
    'n' => 'securityCode',
    'v' => security_code.to_s
  }]
  send_command_and_collect(command_list, within: within)
end

#set_trigger_level!Object



61
62
63
# File 'lib/rsmp/tlc/proxy/detectors.rb', line 61

def set_trigger_level!(...)
  set_trigger_level(...).value!
end