Module: RSMP::Validator::Helpers::Input

Includes:
Status
Included in:
Alarms
Defined in:
lib/rsmp/validator/helpers/input.rb

Overview

Helper methods for testing RSMP input/output functionality.

Instance Method Summary collapse

Methods included from Status

#wait_for_status

Instance Method Details

#force_input_and_confirm(site_proxy, input:, value:, within:) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rsmp/validator/helpers/input.rb', line 8

def force_input_and_confirm(site_proxy, input:, value:, within:)
  site_proxy.tlc.force_input(input:, status: 'True', value:, within:)
  digit = (value == 'True' ? '1' : '0')

  wait_for_status(
    site_proxy,
    "input #{input} to be #{value}",
    [
      { 'sCI' => 'S0003', 'n' => 'inputstatus', 's' => /^.{#{input - 1}}#{digit}/ }
    ]
  )
end

#switch_input(site_proxy, indx, within:) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/rsmp/validator/helpers/input.rb', line 21

def switch_input(site_proxy, indx, within:)
  site_proxy.tlc.set_input(input: indx.to_s, status: 'True', within:)

  wait_for_status(
    site_proxy,
    "input #{indx} to be True",
    [
      { 'sCI' => 'S0003', 'n' => 'inputstatus', 's' => /^.{#{indx - 1}}1/ }
    ]
  )

  site_proxy.tlc.set_input(input: indx.to_s, status: 'False', within:)
  wait_for_status(
    site_proxy,
    "input #{indx} to be False",
    [{ 'sCI' => 'S0003', 'n' => 'inputstatus', 's' => /^.{#{indx - 1}}0/ }]
  )
end