rsmp 0.8.3 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yaml +14 -0
- data/.ruby-version +1 -1
- data/Gemfile.lock +46 -67
- data/README.md +2 -2
- data/bin/console +1 -1
- data/config/tlc.yaml +8 -6
- data/documentation/classes_and_modules.md +4 -4
- data/documentation/collecting_message.md +2 -2
- data/documentation/tasks.md +149 -0
- data/lib/rsmp/archive.rb +3 -3
- data/lib/rsmp/cli.rb +27 -4
- data/lib/rsmp/collect/aggregated_status_collector.rb +1 -1
- data/lib/rsmp/collect/collector.rb +13 -6
- data/lib/rsmp/collect/command_response_collector.rb +1 -1
- data/lib/rsmp/collect/state_collector.rb +1 -1
- data/lib/rsmp/collect/status_collector.rb +2 -1
- data/lib/rsmp/components.rb +3 -3
- data/lib/rsmp/convert/export/json_schema.rb +4 -4
- data/lib/rsmp/convert/import/yaml.rb +1 -1
- data/lib/rsmp/error.rb +0 -3
- data/lib/rsmp/inspect.rb +1 -1
- data/lib/rsmp/logger.rb +5 -5
- data/lib/rsmp/logging.rb +1 -1
- data/lib/rsmp/message.rb +1 -1
- data/lib/rsmp/node.rb +10 -45
- data/lib/rsmp/proxy.rb +184 -134
- data/lib/rsmp/rsmp.rb +1 -1
- data/lib/rsmp/site.rb +24 -61
- data/lib/rsmp/site_proxy.rb +33 -37
- data/lib/rsmp/supervisor.rb +25 -21
- data/lib/rsmp/supervisor_proxy.rb +55 -29
- data/lib/rsmp/task.rb +84 -0
- data/lib/rsmp/tlc/signal_group.rb +17 -7
- data/lib/rsmp/tlc/signal_plan.rb +2 -2
- data/lib/rsmp/tlc/traffic_controller.rb +125 -39
- data/lib/rsmp/tlc/traffic_controller_site.rb +51 -35
- data/lib/rsmp/version.rb +1 -1
- data/lib/rsmp.rb +1 -1
- data/rsmp.gemspec +7 -7
- metadata +20 -20
- data/lib/rsmp/site_proxy_wait.rb +0 -0
- data/lib/rsmp/wait.rb +0 -16
- data/test.rb +0 -27
@@ -5,9 +5,12 @@ module RSMP
|
|
5
5
|
# and keeps track of signal plans, detector logics, inputs, etc. which do
|
6
6
|
# not have dedicated components.
|
7
7
|
class TrafficController < Component
|
8
|
-
attr_reader :pos, :cycle_time, :plan
|
8
|
+
attr_reader :pos, :cycle_time, :plan, :cycle_counter,
|
9
|
+
:yellow_flash, :dark_mode,
|
10
|
+
:startup_sequence_active, :startup_sequence, :startup_sequence_pos
|
9
11
|
|
10
|
-
def initialize node:, id:, cycle_time: 10, signal_plans
|
12
|
+
def initialize node:, id:, cycle_time: 10, signal_plans:,
|
13
|
+
startup_sequence:, live_output:nil
|
11
14
|
super node: node, id: id, grouped: true
|
12
15
|
@signal_groups = []
|
13
16
|
@detector_logics = []
|
@@ -15,31 +18,44 @@ module RSMP
|
|
15
18
|
@cycle_time = cycle_time
|
16
19
|
@num_traffic_situations = 1
|
17
20
|
@num_inputs = 8
|
21
|
+
@startup_sequence = startup_sequence
|
22
|
+
@live_output = live_output
|
18
23
|
reset
|
19
24
|
end
|
20
25
|
|
21
|
-
def
|
22
|
-
@
|
23
|
-
@plan = 0
|
24
|
-
@dark_mode = false
|
26
|
+
def reset_modes
|
27
|
+
@dark_mode = true
|
25
28
|
@yellow_flash = false
|
26
29
|
@booting = false
|
27
|
-
@control_mode = 'control'
|
28
|
-
@police_key = 0
|
29
|
-
@intersection = 0
|
30
30
|
@is_starting = false
|
31
|
-
@
|
32
|
-
@emergency_route_number = 0
|
33
|
-
@traffic_situation = 0
|
31
|
+
@control_mode = 'control'
|
34
32
|
@manual_control = false
|
35
33
|
@fixed_time_control = false
|
36
34
|
@isolated_control = false
|
37
35
|
@yellow_flash = false
|
38
36
|
@all_red = false
|
37
|
+
@police_key = 0
|
38
|
+
end
|
39
|
+
|
40
|
+
def reset
|
41
|
+
reset_modes
|
42
|
+
|
43
|
+
@cycle_counter = 0
|
44
|
+
@plan = 1
|
45
|
+
@intersection = 0
|
46
|
+
@emergency_route = false
|
47
|
+
@emergency_route_number = 0
|
48
|
+
@traffic_situation = 0
|
39
49
|
|
40
50
|
@inputs = '0'*@num_inputs
|
41
51
|
@input_activations = '0'*@num_inputs
|
42
52
|
@input_results = '0'*@num_inputs
|
53
|
+
|
54
|
+
@day_time_table = {}
|
55
|
+
@startup_sequence_active = false
|
56
|
+
@startup_sequence_initiated_at = nil
|
57
|
+
@startup_sequence_pos = 0
|
58
|
+
@time_int = nil
|
43
59
|
end
|
44
60
|
|
45
61
|
def clock
|
@@ -64,46 +80,100 @@ module RSMP
|
|
64
80
|
end
|
65
81
|
|
66
82
|
def timer now
|
67
|
-
# TODO
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
83
|
+
# TODO use monotone timer, to avoid jumps in case the user sets the system time
|
84
|
+
time = Time.now.to_i
|
85
|
+
return if time == @time_int
|
86
|
+
@time_int = time
|
87
|
+
move_cycle_counter
|
88
|
+
move_startup_sequence if @startup_sequence_active
|
89
|
+
|
90
|
+
@signal_groups.each { |group| group.timer }
|
91
|
+
|
92
|
+
output_states
|
93
|
+
end
|
94
|
+
|
95
|
+
def move_cycle_counter
|
96
|
+
counter = Time.now.to_i % @cycle_time
|
97
|
+
@cycle_counter = counter
|
75
98
|
end
|
76
99
|
|
77
|
-
def
|
78
|
-
|
79
|
-
|
100
|
+
def startup_state
|
101
|
+
return unless @startup_sequence_active
|
102
|
+
return unless @startup_sequence_pos
|
103
|
+
@startup_sequence[ @startup_sequence_pos ]
|
104
|
+
end
|
105
|
+
|
106
|
+
def initiate_startup_sequence
|
107
|
+
log "Initiating startup sequence", level: :info
|
108
|
+
reset_modes
|
109
|
+
@dark_mode = false
|
110
|
+
@startup_sequence_active = true
|
111
|
+
@startup_sequence_initiated_at = nil
|
112
|
+
@startup_sequence_pos = nil
|
113
|
+
end
|
114
|
+
|
115
|
+
def end_startup_sequence
|
116
|
+
@startup_sequence_active = false
|
117
|
+
@startup_sequence_initiated_at = nil
|
118
|
+
@startup_sequence_pos = nil
|
119
|
+
@yellow_flash = false
|
120
|
+
@dark_mode = false
|
121
|
+
end
|
122
|
+
|
123
|
+
def move_startup_sequence
|
124
|
+
was = @startup_sequence_pos
|
125
|
+
if @startup_sequence_initiated_at == nil
|
126
|
+
@startup_sequence_initiated_at = Time.now.to_i + 1
|
127
|
+
@startup_sequence_pos = 0
|
128
|
+
else
|
129
|
+
@startup_sequence_pos = Time.now.to_i - @startup_sequence_initiated_at
|
130
|
+
end
|
131
|
+
if @startup_sequence_pos >= @startup_sequence.size
|
132
|
+
end_startup_sequence
|
80
133
|
end
|
81
|
-
#output_states
|
82
134
|
end
|
83
135
|
|
84
136
|
def output_states
|
137
|
+
return unless @live_output
|
138
|
+
|
85
139
|
str = @signal_groups.map do |group|
|
86
|
-
|
87
|
-
|
140
|
+
state = group.state
|
141
|
+
s = "#{group.c_id}:#{state}"
|
142
|
+
if state =~ /^[1-9]$/
|
88
143
|
s.colorize(:green)
|
89
|
-
elsif
|
144
|
+
elsif state =~ /^[NOP]$/
|
90
145
|
s.colorize(:yellow)
|
91
|
-
elsif
|
92
|
-
s.colorize(
|
146
|
+
elsif state =~ /^[ae]$/
|
147
|
+
s.colorize(:light_black)
|
148
|
+
elsif state =~ /^[f]$/
|
149
|
+
s.colorize(:yellow)
|
150
|
+
elsif state =~ /^[g]$/
|
151
|
+
s.colorize(:red)
|
93
152
|
else
|
94
153
|
s.colorize(:red)
|
95
154
|
end
|
96
155
|
end.join ' '
|
156
|
+
|
157
|
+
modes = '.'*9
|
158
|
+
modes[0] = 'B' if @booting
|
159
|
+
modes[1] = 'S' if @startup_sequence_active
|
160
|
+
modes[2] = 'D' if @dark_mode
|
161
|
+
modes[3] = 'Y' if @yellow_flash
|
162
|
+
modes[4] = 'M' if @manual_control
|
163
|
+
modes[5] = 'F' if @fixed_time_control
|
164
|
+
modes[6] = 'R' if @all_red
|
165
|
+
modes[7] = 'I' if @isolated_control
|
166
|
+
modes[8] = 'P' if @police_key != 0
|
167
|
+
|
97
168
|
plan = "P#{@plan}"
|
98
|
-
|
169
|
+
|
170
|
+
File.open @live_output, 'w' do |file|
|
171
|
+
file.puts "#{modes} #{plan.rjust(2)} #{@cycle_counter.to_s.rjust(3)} #{str}\r"
|
172
|
+
end
|
99
173
|
end
|
100
174
|
|
101
175
|
def format_signal_group_status
|
102
|
-
|
103
|
-
'c' * @signal_groups.size
|
104
|
-
else
|
105
|
-
@signal_groups.map { |group| group.state }.join
|
106
|
-
end
|
176
|
+
@signal_groups.map { |group| group.state }.join
|
107
177
|
end
|
108
178
|
|
109
179
|
def handle_command command_code, arg
|
@@ -214,6 +284,18 @@ module RSMP
|
|
214
284
|
|
215
285
|
def handle_m0017 arg
|
216
286
|
@node.verify_security_code 2, arg['securityCode']
|
287
|
+
arg['status'].split(',').each do |item|
|
288
|
+
elems = item.split('-')
|
289
|
+
nr = elems[0].to_i
|
290
|
+
plan = elems[1].to_i
|
291
|
+
hour = elems[2].to_i
|
292
|
+
min = elems[3].to_i
|
293
|
+
if nr<0 || nr>12
|
294
|
+
raise InvalidMessage.new "time table id must be between 0 and 12, got #{nr}"
|
295
|
+
end
|
296
|
+
#p "nr: #{nr}, plan #{plan} at #{hour}:#{min}"
|
297
|
+
@day_time_table[nr] = {plan: plan, hour: hour, min:min}
|
298
|
+
end
|
217
299
|
end
|
218
300
|
|
219
301
|
def handle_m0018 arg
|
@@ -256,7 +338,7 @@ module RSMP
|
|
256
338
|
return unless i>=0 && i<@num_inputs
|
257
339
|
@inputs[i] = (arg['value'] ? '1' : '0')
|
258
340
|
end
|
259
|
-
|
341
|
+
|
260
342
|
def set_fixed_time_control status
|
261
343
|
@fixed_time_control = status
|
262
344
|
end
|
@@ -276,6 +358,7 @@ module RSMP
|
|
276
358
|
log "Switching to mode #{mode}", level: :info
|
277
359
|
case mode
|
278
360
|
when 'NormalControl'
|
361
|
+
initiate_startup_sequence if @yellow_flash || @dark_mode
|
279
362
|
@yellow_flash = false
|
280
363
|
@dark_mode = false
|
281
364
|
when 'YellowFlash'
|
@@ -308,9 +391,9 @@ module RSMP
|
|
308
391
|
when 'signalgroupstatus'
|
309
392
|
TrafficControllerSite.make_status format_signal_group_status
|
310
393
|
when 'cyclecounter'
|
311
|
-
TrafficControllerSite.make_status @
|
394
|
+
TrafficControllerSite.make_status @cycle_counter.to_s
|
312
395
|
when 'basecyclecounter'
|
313
|
-
TrafficControllerSite.make_status @
|
396
|
+
TrafficControllerSite.make_status @cycle_counter.to_s
|
314
397
|
when 'stage'
|
315
398
|
TrafficControllerSite.make_status 0.to_s
|
316
399
|
end
|
@@ -511,7 +594,10 @@ module RSMP
|
|
511
594
|
def handle_s0027 status_code, status_name=nil
|
512
595
|
case status_name
|
513
596
|
when 'status'
|
514
|
-
|
597
|
+
status = @day_time_table.map do |i,item|
|
598
|
+
"#{i}-#{item[:plan]}-#{item[:hour]}-#{item[:min]}"
|
599
|
+
end.join(',')
|
600
|
+
TrafficControllerSite.make_status status
|
515
601
|
end
|
516
602
|
end
|
517
603
|
|
@@ -5,14 +5,31 @@ module RSMP
|
|
5
5
|
attr_accessor :main, :signal_plans
|
6
6
|
|
7
7
|
def initialize options={}
|
8
|
+
# setup options before calling super initializer,
|
9
|
+
# since build of components depend on options
|
8
10
|
@sxl = 'traffic_light_controller'
|
9
11
|
@security_codes = options[:site_settings]['security_codes']
|
10
12
|
@interval = options[:site_settings].dig('intervals','timer') || 1
|
13
|
+
@startup_sequence = options[:site_settings]['startup_sequence'] || 'efg'
|
11
14
|
build_plans options[:site_settings].dig('signal_plans')
|
15
|
+
|
12
16
|
super options
|
17
|
+
|
13
18
|
unless @main
|
14
19
|
raise ConfigurationError.new "TLC must have a main component"
|
15
20
|
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def start
|
25
|
+
super
|
26
|
+
start_tlc_timer
|
27
|
+
@main.initiate_startup_sequence
|
28
|
+
end
|
29
|
+
|
30
|
+
def stop_subtasks
|
31
|
+
stop_tlc_timer
|
32
|
+
super
|
16
33
|
end
|
17
34
|
|
18
35
|
def build_plans signal_plans
|
@@ -37,7 +54,9 @@ module RSMP
|
|
37
54
|
when 'main'
|
38
55
|
@main = TrafficController.new node: self, id: id,
|
39
56
|
cycle_time: settings['cycle_time'],
|
40
|
-
|
57
|
+
startup_sequence: @startup_sequence,
|
58
|
+
signal_plans: @signal_plans,
|
59
|
+
live_output: @site_settings['live_output']
|
41
60
|
when 'signal_group'
|
42
61
|
group = SignalGroup.new node: self, id: id
|
43
62
|
@main.add_signal_group group
|
@@ -49,48 +68,45 @@ module RSMP
|
|
49
68
|
end
|
50
69
|
end
|
51
70
|
|
52
|
-
def
|
53
|
-
super
|
54
|
-
start_timer
|
55
|
-
end
|
56
|
-
|
57
|
-
def start_timer
|
71
|
+
def start_tlc_timer
|
58
72
|
task_name = "tlc timer"
|
59
73
|
log "Starting #{task_name} with interval #{@interval} seconds", level: :debug
|
60
74
|
|
61
75
|
@timer = @task.async do |task|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
next_time += @interval
|
87
|
-
duration = next_time - Time.now.to_f
|
88
|
-
task.sleep duration
|
89
|
-
end
|
76
|
+
task.annotate task_name
|
77
|
+
run_tlc_timer task
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def run_tlc_timer task
|
82
|
+
next_time = Time.now.to_f
|
83
|
+
loop do
|
84
|
+
begin
|
85
|
+
timer(@clock.now)
|
86
|
+
rescue StandardError => e
|
87
|
+
notify_error e, level: :internal
|
88
|
+
ensure
|
89
|
+
# adjust sleep duration to avoid drift. so wake up always happens on the
|
90
|
+
# same fractional second.
|
91
|
+
# note that Time.now is not monotonic. If the clock is changed,
|
92
|
+
# either manaully or via NTP, the sleep interval might jump.
|
93
|
+
# an alternative is to use ::Process.clock_gettime(::Process::CLOCK_MONOTONIC),
|
94
|
+
# to get the current time. this ensures a constant interval, but
|
95
|
+
# if the clock is changed, the wake up would then happen on a different
|
96
|
+
# fractional second
|
97
|
+
next_time += @interval
|
98
|
+
duration = next_time - Time.now.to_f
|
99
|
+
task.sleep duration
|
90
100
|
end
|
91
101
|
end
|
92
102
|
end
|
93
103
|
|
104
|
+
def stop_tlc_timer
|
105
|
+
return unless @timer
|
106
|
+
@timer.stop
|
107
|
+
@timer = nil
|
108
|
+
end
|
109
|
+
|
94
110
|
def timer now
|
95
111
|
return unless @main
|
96
112
|
@main.timer now
|
data/lib/rsmp/version.rb
CHANGED
data/lib/rsmp.rb
CHANGED
@@ -10,10 +10,10 @@ require 'json_schemer'
|
|
10
10
|
require 'async/queue'
|
11
11
|
|
12
12
|
require 'rsmp/rsmp'
|
13
|
+
require 'rsmp/task'
|
13
14
|
require 'rsmp/deep_merge'
|
14
15
|
require 'rsmp/inspect'
|
15
16
|
require 'rsmp/logging'
|
16
|
-
require 'rsmp/wait'
|
17
17
|
require 'rsmp/node'
|
18
18
|
require 'rsmp/supervisor'
|
19
19
|
require 'rsmp/components'
|
data/rsmp.gemspec
CHANGED
@@ -31,16 +31,16 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
33
|
spec.add_dependency "async", "~> 1.29.1"
|
34
|
-
spec.add_dependency "async-io", "~> 1.32.
|
34
|
+
spec.add_dependency "async-io", "~> 1.32.2"
|
35
35
|
spec.add_dependency "colorize", "~> 0.8.1"
|
36
|
-
spec.add_dependency "thor", "~> 1.
|
36
|
+
spec.add_dependency "thor", "~> 1.2.1"
|
37
37
|
spec.add_dependency "rsmp_schemer"
|
38
38
|
|
39
|
-
spec.add_development_dependency "bundler", "~> 2.
|
40
|
-
spec.add_development_dependency "rake", "~> 13.0.
|
39
|
+
spec.add_development_dependency "bundler", "~> 2.3.6"
|
40
|
+
spec.add_development_dependency "rake", "~> 13.0.6"
|
41
41
|
spec.add_development_dependency "rspec", "~> 3.10.0"
|
42
|
-
spec.add_development_dependency "rspec-expectations", "~> 3.10.
|
42
|
+
spec.add_development_dependency "rspec-expectations", "~> 3.10.2"
|
43
43
|
spec.add_development_dependency "timecop", "~> 0.9.4"
|
44
|
-
spec.add_development_dependency "cucumber", "~>
|
45
|
-
spec.add_development_dependency "aruba" , "~>
|
44
|
+
spec.add_development_dependency "cucumber", "~> 7.1.0"
|
45
|
+
spec.add_development_dependency "aruba" , "~> 2.0.0"
|
46
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emil Tin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.32.
|
33
|
+
version: 1.32.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.32.
|
40
|
+
version: 1.32.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: colorize
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.2.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.2.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rsmp_schemer
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,28 +86,28 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 2.
|
89
|
+
version: 2.3.6
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 2.
|
96
|
+
version: 2.3.6
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 13.0.
|
103
|
+
version: 13.0.6
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 13.0.
|
110
|
+
version: 13.0.6
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 3.10.
|
131
|
+
version: 3.10.2
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 3.10.
|
138
|
+
version: 3.10.2
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: timecop
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,28 +156,28 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
159
|
+
version: 7.1.0
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
166
|
+
version: 7.1.0
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: aruba
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: 2.0.0
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
180
|
+
version: 2.0.0
|
181
181
|
description: Easy RSMP site and supervisor communication.
|
182
182
|
email:
|
183
183
|
- zf0f@kk.dk
|
@@ -186,6 +186,7 @@ executables:
|
|
186
186
|
extensions: []
|
187
187
|
extra_rdoc_files: []
|
188
188
|
files:
|
189
|
+
- ".github/workflows/rspec.yaml"
|
189
190
|
- ".gitignore"
|
190
191
|
- ".gitmodules"
|
191
192
|
- ".rspec"
|
@@ -203,6 +204,7 @@ files:
|
|
203
204
|
- documentation/classes_and_modules.md
|
204
205
|
- documentation/collecting_message.md
|
205
206
|
- documentation/message_distribution.md
|
207
|
+
- documentation/tasks.md
|
206
208
|
- exe/rsmp
|
207
209
|
- lib/rsmp.rb
|
208
210
|
- lib/rsmp/archive.rb
|
@@ -234,18 +236,16 @@ files:
|
|
234
236
|
- lib/rsmp/rsmp.rb
|
235
237
|
- lib/rsmp/site.rb
|
236
238
|
- lib/rsmp/site_proxy.rb
|
237
|
-
- lib/rsmp/site_proxy_wait.rb
|
238
239
|
- lib/rsmp/supervisor.rb
|
239
240
|
- lib/rsmp/supervisor_proxy.rb
|
241
|
+
- lib/rsmp/task.rb
|
240
242
|
- lib/rsmp/tlc/detector_logic.rb
|
241
243
|
- lib/rsmp/tlc/signal_group.rb
|
242
244
|
- lib/rsmp/tlc/signal_plan.rb
|
243
245
|
- lib/rsmp/tlc/traffic_controller.rb
|
244
246
|
- lib/rsmp/tlc/traffic_controller_site.rb
|
245
247
|
- lib/rsmp/version.rb
|
246
|
-
- lib/rsmp/wait.rb
|
247
248
|
- rsmp.gemspec
|
248
|
-
- test.rb
|
249
249
|
homepage: https://github.com/rsmp-nordic/rsmp
|
250
250
|
licenses:
|
251
251
|
- MIT
|
@@ -269,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
269
269
|
- !ruby/object:Gem::Version
|
270
270
|
version: '0'
|
271
271
|
requirements: []
|
272
|
-
rubygems_version: 3.
|
272
|
+
rubygems_version: 3.3.3
|
273
273
|
signing_key:
|
274
274
|
specification_version: 4
|
275
275
|
summary: RoadSide Message Protocol (RSMP) library.
|
data/lib/rsmp/site_proxy_wait.rb
DELETED
File without changes
|
data/lib/rsmp/wait.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
module RSMP
|
2
|
-
module Wait
|
3
|
-
# wait for an async condition to signal, then yield to block
|
4
|
-
# if block returns true we're done. otherwise, wait again
|
5
|
-
def wait_for condition, timeout, &block
|
6
|
-
raise RuntimeError.new("Can't wait for condition because task is not running") unless @task.running?
|
7
|
-
@task.with_timeout(timeout) do
|
8
|
-
while @task.running? do
|
9
|
-
value = condition.wait
|
10
|
-
result = yield value
|
11
|
-
return result if result # return result of check, if not nil
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
data/test.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
class A
|
2
|
-
def go &block
|
3
|
-
@block = block # block will be converted automatically to a Proc
|
4
|
-
indirect
|
5
|
-
end
|
6
|
-
|
7
|
-
def call
|
8
|
-
@block.call
|
9
|
-
end
|
10
|
-
|
11
|
-
def indirect
|
12
|
-
call
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
a = A.new
|
18
|
-
|
19
|
-
a.go do
|
20
|
-
break # this is ok. break causes the block to exit, and the encasing method to return - go() will exit
|
21
|
-
end
|
22
|
-
|
23
|
-
# this raises an error. the block we passed to go() will be called again, and it tries to break
|
24
|
-
# but we're not inside a method we can exit from
|
25
|
-
|
26
|
-
|
27
|
-
a.indirect
|