Module: RSMP::TLC::Modules::SignalGroups
- Included in:
- TrafficController
- Defined in:
- lib/rsmp/tlc/modules/signal_groups.rb
Overview
Signal groups and signal priority management Handles signal group status and priority requests
Instance Method Summary collapse
- #add_signal_group(group) ⇒ Object
-
#handle_m0022(arg, _options = {}) ⇒ Object
M0022 - Signal priority request.
- #priority_list ⇒ Object
-
#prune_priorities ⇒ Object
remove all stale priority requests.
- #signal_priority_changed(priority, state) ⇒ Object
Instance Method Details
#add_signal_group(group) ⇒ Object
7 8 9 |
# File 'lib/rsmp/tlc/modules/signal_groups.rb', line 7 def add_signal_group(group) @signal_groups << group end |
#handle_m0022(arg, _options = {}) ⇒ Object
M0022 - Signal priority request
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rsmp/tlc/modules/signal_groups.rb', line 29 def handle_m0022(arg, = {}) id = arg['requestId'] type = arg['type'] priority = find_signal_priority(id) case type when 'new' create_priority_request(id, priority, arg) when 'update' update_priority_request(id, priority) when 'cancel' cancel_priority_request(id, priority) else raise MessageRejected, "Unknown type #{type}" end end |
#priority_list ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/rsmp/tlc/modules/signal_groups.rb', line 18 def priority_list @signal_priorities.map do |priority| { 'r' => priority.id, 't' => RSMP::Clock.to_s(priority.updated), 's' => priority.state } end end |
#prune_priorities ⇒ Object
remove all stale priority requests
14 15 16 |
# File 'lib/rsmp/tlc/modules/signal_groups.rb', line 14 def prune_priorities @signal_priorities.delete_if(&:prune?) end |
#signal_priority_changed(priority, state) ⇒ Object
11 |
# File 'lib/rsmp/tlc/modules/signal_groups.rb', line 11 def signal_priority_changed(priority, state); end |