Class: RSMP::TLC::SupervisorInterface

Inherits:
SXL::SupervisorInterface show all
Includes:
Proxy::Control, Proxy::Detectors, Proxy::IO, Proxy::Plans, Proxy::Status, Proxy::System
Defined in:
lib/rsmp/tlc/supervisor_interface.rb

Overview

Supervisor-side TLC SXL interface.

Instance Attribute Summary collapse

Attributes inherited from SXL::Interface

#name, #proxy, #version

Instance Method Summary collapse

Methods included from Proxy::System

#set_clock, #set_security_code

Methods included from Proxy::Detectors

#force_detector_logic, #set_trigger_level

Methods included from Proxy::Status

#fetch_signal_plan, #read_current_plan, #read_cycle_times, #read_dynamic_band, #wait_for_groups, #wait_for_normal_control, #wait_for_status

Methods included from Proxy::Plans

#order_signal_start, #order_signal_stop, #set_cycle_time, #set_day_table, #set_dynamic_bands, #set_dynamic_bands_timeout, #set_offset, #set_timeplan, #set_week_table

Methods included from Proxy::IO

#force_input, #force_output, #set_input, #set_inputs

Methods included from Proxy::Control

#set_emergency_route, #set_fixed_time, #set_functional_position, #set_traffic_situation, #unset_traffic_situation

Methods inherited from SXL::Interface

#components, #core_version, #main, #node, #sxl_version, #use_soc?, #validate_message!

Constructor Details

#initializeSupervisorInterface

Returns a new instance of SupervisorInterface.



16
17
18
19
20
21
22
23
24
# File 'lib/rsmp/tlc/supervisor_interface.rb', line 16

def initialize(...)
  super
  @timeplan_source = nil
  @timeplan = nil
  @functional_position = nil
  @yellow_flash = nil
  @traffic_situation = nil
  @timeouts = node.supervisor_settings.dig('default', 'timeouts') || {}
end

Instance Attribute Details

#functional_positionObject (readonly)

Returns the value of attribute functional_position.



13
14
15
# File 'lib/rsmp/tlc/supervisor_interface.rb', line 13

def functional_position
  @functional_position
end

#timeoutsObject (readonly)

Returns the value of attribute timeouts.



13
14
15
# File 'lib/rsmp/tlc/supervisor_interface.rb', line 13

def timeouts
  @timeouts
end

#timeplanObject (readonly)

Returns the value of attribute timeplan.



13
14
15
# File 'lib/rsmp/tlc/supervisor_interface.rb', line 13

def timeplan
  @timeplan
end

#timeplan_sourceObject (readonly)

Returns the value of attribute timeplan_source.



13
14
15
# File 'lib/rsmp/tlc/supervisor_interface.rb', line 13

def timeplan_source
  @timeplan_source
end

#traffic_situationObject (readonly)

Returns the value of attribute traffic_situation.



13
14
15
# File 'lib/rsmp/tlc/supervisor_interface.rb', line 13

def traffic_situation
  @traffic_situation
end

#yellow_flashObject (readonly)

Returns the value of attribute yellow_flash.



13
14
15
# File 'lib/rsmp/tlc/supervisor_interface.rb', line 13

def yellow_flash
  @yellow_flash
end

Instance Method Details

#current_planObject



26
27
28
# File 'lib/rsmp/tlc/supervisor_interface.rb', line 26

def current_plan
  @timeplan
end

#plan_sourceObject



30
31
32
# File 'lib/rsmp/tlc/supervisor_interface.rb', line 30

def plan_source
  @timeplan_source
end

#process_message(message) ⇒ Object



55
56
57
# File 'lib/rsmp/tlc/supervisor_interface.rb', line 55

def process_message(message)
  process_status_update message if message.is_a?(RSMP::StatusUpdate)
end

#process_status_update(message) ⇒ Object



48
49
50
51
52
53
# File 'lib/rsmp/tlc/supervisor_interface.rb', line 48

def process_status_update(message)
  status_values = message.attribute('sS')
  return unless status_values

  status_values.each { |item| cache_status_item(item) }
end

#subscribe_to_timeplanObject



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rsmp/tlc/supervisor_interface.rb', line 34

def subscribe_to_timeplan
  validate_ready 'subscribe to timeplan'

  status_list = [
    { 'sCI' => 'S0014', 'n' => 'status', 'uRt' => '0' },
    { 'sCI' => 'S0014', 'n' => 'source', 'uRt' => '0' }
  ]
  status_list.each { |item| item['sOc'] = true } if use_soc?

  raise 'TLC main component not found' unless main

  subscribe_to_status status_list, component: main.c_id
end

#timeplan_attributesObject



59
60
61
# File 'lib/rsmp/tlc/supervisor_interface.rb', line 59

def timeplan_attributes
  main&.statuses&.dig('S0014') || {}
end