Module: RSMP::TLC::Proxy::IO

Included in:
TrafficControllerProxy
Defined in:
lib/rsmp/tlc/proxy/io.rb

Overview

Command methods for I/O control of a remote TLC. Covers detector logic, input/output forcing and setting.

Instance Method Summary collapse

Instance Method Details

#force_input(input:, status:, value:, within:) ⇒ Object

M0019 — Force an input to a given value.



55
56
57
58
59
60
61
62
63
# File 'lib/rsmp/tlc/proxy/io.rb', line 55

def force_input(input:, status:, value:, within:)
  validate_ready 'force input'
  raise 'TLC main component not found' unless main

  command_list = force_input_command_list(input, status, value)
  confirm_status = force_input_confirm_status(input, status, value)
  send_command_and_collect(command_list, within: within).ok!
  wait_for_status "force input #{input}", confirm_status, timeout: within
end

#force_output(output:, status:, value:, within:) ⇒ Object

M0020 — Force an output to a given value.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/rsmp/tlc/proxy/io.rb', line 66

def force_output(output:, status:, value:, within:)
  validate_ready 'force output'
  raise 'TLC main component not found' unless main

  security_code = security_code_for(2)

  command_list = [{
    'cCI' => 'M0020',
    'cO' => 'setOutput',
    'n' => 'status',
    'v' => status.to_s
  }, {
    'cCI' => 'M0020',
    'cO' => 'setOutput',
    'n' => 'securityCode',
    'v' => security_code.to_s
  }, {
    'cCI' => 'M0020',
    'cO' => 'setOutput',
    'n' => 'output',
    'v' => output.to_s
  }, {
    'cCI' => 'M0020',
    'cO' => 'setOutput',
    'n' => 'outputValue',
    'v' => value.to_s
  }]
  send_command_and_collect(command_list, within: within).ok!
end

#set_input(input:, status:, within:) ⇒ Object

M0006 — Set a single input to a given status.



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

def set_input(input:, status:, within:)
  validate_ready 'set input'
  raise 'TLC main component not found' unless main

  security_code = security_code_for(2)

  command_list = [{
    'cCI' => 'M0006',
    'cO' => 'setInput',
    'n' => 'status',
    'v' => status.to_s
  }, {
    'cCI' => 'M0006',
    'cO' => 'setInput',
    'n' => 'securityCode',
    'v' => security_code.to_s
  }, {
    'cCI' => 'M0006',
    'cO' => 'setInput',
    'n' => 'input',
    'v' => input.to_s
  }]
  send_command_and_collect(command_list, within: within).ok!
end

#set_inputs(status, within:) ⇒ Object

M0013 — Set all inputs via a bit-pattern string.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/rsmp/tlc/proxy/io.rb', line 34

def set_inputs(status, within:)
  validate_ready 'set inputs'
  raise 'TLC main component not found' unless main

  security_code = security_code_for(2)

  command_list = [{
    'cCI' => 'M0013',
    'cO' => 'setInput',
    'n' => 'status',
    'v' => status.to_s
  }, {
    'cCI' => 'M0013',
    'cO' => 'setInput',
    'n' => 'securityCode',
    'v' => security_code.to_s
  }]
  send_command_and_collect(command_list, within: within).ok!
end