rsmp 0.8.4 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yaml +21 -0
- data/.ruby-version +1 -1
- data/Gemfile.lock +51 -67
- data/README.md +2 -12
- data/bin/console +1 -1
- data/cucumber.yml +1 -0
- 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 +32 -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/deep_merge.rb +1 -0
- 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 +23 -60
- data/lib/rsmp/site_proxy.rb +33 -37
- data/lib/rsmp/supervisor.rb +25 -21
- data/lib/rsmp/supervisor_proxy.rb +58 -29
- data/lib/rsmp/task.rb +84 -0
- data/lib/rsmp/tlc/signal_group.rb +5 -3
- data/lib/rsmp/tlc/signal_plan.rb +2 -2
- data/lib/rsmp/tlc/traffic_controller.rb +97 -29
- data/lib/rsmp/tlc/traffic_controller_site.rb +43 -36
- data/lib/rsmp/version.rb +1 -1
- data/lib/rsmp.rb +1 -1
- data/rsmp.gemspec +7 -7
- metadata +21 -20
- data/lib/rsmp/site_proxy_wait.rb +0 -0
- data/lib/rsmp/wait.rb +0 -16
- data/test.rb +0 -27
@@ -23,27 +23,34 @@ module RSMP
|
|
23
23
|
reset
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
27
|
-
@cycle_counter = 0
|
28
|
-
@plan = 1
|
26
|
+
def reset_modes
|
29
27
|
@dark_mode = true
|
30
28
|
@yellow_flash = false
|
31
29
|
@booting = false
|
32
|
-
@control_mode = 'control'
|
33
|
-
@police_key = 0
|
34
|
-
@intersection = 0
|
35
30
|
@is_starting = false
|
36
|
-
@
|
37
|
-
@emergency_route_number = 0
|
38
|
-
@traffic_situation = 0
|
31
|
+
@control_mode = 'control'
|
39
32
|
@manual_control = false
|
40
33
|
@fixed_time_control = false
|
41
34
|
@isolated_control = false
|
42
35
|
@yellow_flash = false
|
43
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
|
44
49
|
|
45
50
|
@inputs = '0'*@num_inputs
|
46
51
|
@input_activations = '0'*@num_inputs
|
52
|
+
@input_forced = '0'*@num_inputs
|
53
|
+
@input_forced_values = '0'*@num_inputs
|
47
54
|
@input_results = '0'*@num_inputs
|
48
55
|
|
49
56
|
@day_time_table = {}
|
@@ -76,12 +83,14 @@ module RSMP
|
|
76
83
|
|
77
84
|
def timer now
|
78
85
|
# TODO use monotone timer, to avoid jumps in case the user sets the system time
|
79
|
-
@signal_groups.each { |group| group.timer }
|
80
86
|
time = Time.now.to_i
|
81
87
|
return if time == @time_int
|
82
88
|
@time_int = time
|
83
89
|
move_cycle_counter
|
84
90
|
move_startup_sequence if @startup_sequence_active
|
91
|
+
|
92
|
+
@signal_groups.each { |group| group.timer }
|
93
|
+
|
85
94
|
output_states
|
86
95
|
end
|
87
96
|
|
@@ -98,6 +107,8 @@ module RSMP
|
|
98
107
|
|
99
108
|
def initiate_startup_sequence
|
100
109
|
log "Initiating startup sequence", level: :info
|
110
|
+
reset_modes
|
111
|
+
@dark_mode = false
|
101
112
|
@startup_sequence_active = true
|
102
113
|
@startup_sequence_initiated_at = nil
|
103
114
|
@startup_sequence_pos = nil
|
@@ -107,7 +118,6 @@ module RSMP
|
|
107
118
|
@startup_sequence_active = false
|
108
119
|
@startup_sequence_initiated_at = nil
|
109
120
|
@startup_sequence_pos = nil
|
110
|
-
|
111
121
|
@yellow_flash = false
|
112
122
|
@dark_mode = false
|
113
123
|
end
|
@@ -127,26 +137,44 @@ module RSMP
|
|
127
137
|
|
128
138
|
def output_states
|
129
139
|
return unless @live_output
|
140
|
+
|
130
141
|
str = @signal_groups.map do |group|
|
131
|
-
|
132
|
-
|
142
|
+
state = group.state
|
143
|
+
s = "#{group.c_id}:#{state}"
|
144
|
+
if state =~ /^[1-9]$/
|
133
145
|
s.colorize(:green)
|
134
|
-
elsif
|
146
|
+
elsif state =~ /^[NOP]$/
|
135
147
|
s.colorize(:yellow)
|
136
|
-
elsif
|
137
|
-
s.colorize(:
|
138
|
-
elsif
|
148
|
+
elsif state =~ /^[ae]$/
|
149
|
+
s.colorize(:light_black)
|
150
|
+
elsif state =~ /^[f]$/
|
139
151
|
s.colorize(:yellow)
|
140
|
-
elsif
|
152
|
+
elsif state =~ /^[g]$/
|
141
153
|
s.colorize(:red)
|
142
154
|
else
|
143
155
|
s.colorize(:red)
|
144
156
|
end
|
145
157
|
end.join ' '
|
158
|
+
|
159
|
+
modes = '.'*9
|
160
|
+
modes[0] = 'B' if @booting
|
161
|
+
modes[1] = 'S' if @startup_sequence_active
|
162
|
+
modes[2] = 'D' if @dark_mode
|
163
|
+
modes[3] = 'Y' if @yellow_flash
|
164
|
+
modes[4] = 'M' if @manual_control
|
165
|
+
modes[5] = 'F' if @fixed_time_control
|
166
|
+
modes[6] = 'R' if @all_red
|
167
|
+
modes[7] = 'I' if @isolated_control
|
168
|
+
modes[8] = 'P' if @police_key != 0
|
169
|
+
|
146
170
|
plan = "P#{@plan}"
|
147
171
|
|
172
|
+
# create folders if needed
|
173
|
+
FileUtils.mkdir_p File.dirname(@live_output)
|
174
|
+
|
175
|
+
# append a line with the current state to the file
|
148
176
|
File.open @live_output, 'w' do |file|
|
149
|
-
file.puts "#{plan.rjust(
|
177
|
+
file.puts "#{modes} #{plan.rjust(2)} #{@cycle_counter.to_s.rjust(3)} #{str}\r"
|
150
178
|
end
|
151
179
|
end
|
152
180
|
|
@@ -206,18 +234,27 @@ module RSMP
|
|
206
234
|
end
|
207
235
|
end
|
208
236
|
|
237
|
+
def recompute_input idx
|
238
|
+
if @input_forced[idx] == '1'
|
239
|
+
@input_results[idx] = @input_forced_values[idx]
|
240
|
+
elsif @input_activations[idx]=='1'
|
241
|
+
@input_results[idx] = '1'
|
242
|
+
else
|
243
|
+
@input_results[idx] = bool_to_digit( @inputs[idx]=='1' )
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
209
247
|
def handle_m0006 arg
|
210
248
|
@node.verify_security_code 2, arg['securityCode']
|
211
249
|
input = arg['input'].to_i
|
212
250
|
idx = input - 1
|
213
251
|
return unless idx>=0 && input<@num_inputs # TODO should NotAck
|
214
|
-
@input_activations[idx] =
|
215
|
-
|
216
|
-
@input_results[idx] = (result ? '1' : '0')
|
252
|
+
@input_activations[idx] = bool_string_to_digit arg['status']
|
253
|
+
recompute_input idx
|
217
254
|
if @input_activations[idx]
|
218
|
-
log "
|
255
|
+
log "Activating input #{idx+1}", level: :info
|
219
256
|
else
|
220
|
-
log "
|
257
|
+
log "Deactivating input #{idx+1}", level: :info
|
221
258
|
end
|
222
259
|
end
|
223
260
|
|
@@ -280,8 +317,39 @@ module RSMP
|
|
280
317
|
@node.verify_security_code 2, arg['securityCode']
|
281
318
|
end
|
282
319
|
|
320
|
+
def bool_string_to_digit bool
|
321
|
+
case bool
|
322
|
+
when 'True'
|
323
|
+
'1'
|
324
|
+
when 'False'
|
325
|
+
'0'
|
326
|
+
else
|
327
|
+
raise RSMP::MessageRejected.new "Invalid boolean '#{bool}', must be 'True' or 'False'"
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
def bool_to_digit bool
|
332
|
+
bool ? '1' : '0'
|
333
|
+
end
|
334
|
+
|
283
335
|
def handle_m0019 arg
|
284
336
|
@node.verify_security_code 2, arg['securityCode']
|
337
|
+
input = arg['input'].to_i
|
338
|
+
idx = input - 1
|
339
|
+
unless idx>=0 && input<@num_inputs # TODO should NotAck
|
340
|
+
log "Can't force input #{idx+1}, only have #{@num_inputs} inputs", level: :warning
|
341
|
+
return
|
342
|
+
end
|
343
|
+
@input_forced[idx] = bool_string_to_digit arg['status']
|
344
|
+
if @input_forced[idx]
|
345
|
+
@input_forced_values[idx] = bool_string_to_digit arg['inputValue']
|
346
|
+
end
|
347
|
+
recompute_input idx
|
348
|
+
if @input_forced[idx]
|
349
|
+
log "Forcing input #{idx+1} to #{@input_forced_values[idx]}, #{@input_results}", level: :info
|
350
|
+
else
|
351
|
+
log "Releasing input #{idx+1}", level: :info
|
352
|
+
end
|
285
353
|
end
|
286
354
|
|
287
355
|
def handle_m0020 arg
|
@@ -314,9 +382,9 @@ module RSMP
|
|
314
382
|
|
315
383
|
def set_input i, value
|
316
384
|
return unless i>=0 && i<@num_inputs
|
317
|
-
@inputs[i] =
|
385
|
+
@inputs[i] = bool_to_digit arg['value']
|
318
386
|
end
|
319
|
-
|
387
|
+
|
320
388
|
def set_fixed_time_control status
|
321
389
|
@fixed_time_control = status
|
322
390
|
end
|
@@ -380,7 +448,7 @@ module RSMP
|
|
380
448
|
def handle_s0002 status_code, status_name=nil
|
381
449
|
case status_name
|
382
450
|
when 'detectorlogicstatus'
|
383
|
-
TrafficControllerSite.make_status @detector_logics.map { |dl| dl.value
|
451
|
+
TrafficControllerSite.make_status @detector_logics.map { |dl| bool_to_digit(dl.value) }.join
|
384
452
|
end
|
385
453
|
end
|
386
454
|
|
@@ -535,7 +603,7 @@ module RSMP
|
|
535
603
|
def handle_s0021 status_code, status_name=nil
|
536
604
|
case status_name
|
537
605
|
when 'detectorlogics'
|
538
|
-
TrafficControllerSite.make_status @detector_logics.map { |logic| logic.forced
|
606
|
+
TrafficControllerSite.make_status @detector_logics.map { |logic| bool_to_digit(logic.forced)}.join
|
539
607
|
end
|
540
608
|
end
|
541
609
|
|
@@ -589,7 +657,7 @@ module RSMP
|
|
589
657
|
def handle_s0029 status_code, status_name=nil
|
590
658
|
case status_name
|
591
659
|
when 'status'
|
592
|
-
TrafficControllerSite.make_status
|
660
|
+
TrafficControllerSite.make_status @input_forced
|
593
661
|
end
|
594
662
|
end
|
595
663
|
|
@@ -18,6 +18,18 @@ module RSMP
|
|
18
18
|
unless @main
|
19
19
|
raise ConfigurationError.new "TLC must have a main component"
|
20
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
|
21
33
|
end
|
22
34
|
|
23
35
|
def build_plans signal_plans
|
@@ -56,49 +68,45 @@ module RSMP
|
|
56
68
|
end
|
57
69
|
end
|
58
70
|
|
59
|
-
def
|
60
|
-
super
|
61
|
-
start_timer
|
62
|
-
@main.initiate_startup_sequence
|
63
|
-
end
|
64
|
-
|
65
|
-
def start_timer
|
71
|
+
def start_tlc_timer
|
66
72
|
task_name = "tlc timer"
|
67
73
|
log "Starting #{task_name} with interval #{@interval} seconds", level: :debug
|
68
74
|
|
69
75
|
@timer = @task.async do |task|
|
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
|
-
next_time += @interval
|
95
|
-
duration = next_time - Time.now.to_f
|
96
|
-
task.sleep duration
|
97
|
-
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
|
98
100
|
end
|
99
101
|
end
|
100
102
|
end
|
101
103
|
|
104
|
+
def stop_tlc_timer
|
105
|
+
return unless @timer
|
106
|
+
@timer.stop
|
107
|
+
@timer = nil
|
108
|
+
end
|
109
|
+
|
102
110
|
def timer now
|
103
111
|
return unless @main
|
104
112
|
@main.timer now
|
@@ -142,7 +150,6 @@ module RSMP
|
|
142
150
|
when :restart
|
143
151
|
log "Restarting TLC", level: :info
|
144
152
|
restart
|
145
|
-
initiate_startup_sequence
|
146
153
|
end
|
147
154
|
end
|
148
155
|
end
|
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.1
|
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-
|
11
|
+
date: 2022-02-21 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"
|
@@ -200,9 +201,11 @@ files:
|
|
200
201
|
- bin/setup
|
201
202
|
- config/supervisor.yaml
|
202
203
|
- config/tlc.yaml
|
204
|
+
- cucumber.yml
|
203
205
|
- documentation/classes_and_modules.md
|
204
206
|
- documentation/collecting_message.md
|
205
207
|
- documentation/message_distribution.md
|
208
|
+
- documentation/tasks.md
|
206
209
|
- exe/rsmp
|
207
210
|
- lib/rsmp.rb
|
208
211
|
- lib/rsmp/archive.rb
|
@@ -234,18 +237,16 @@ files:
|
|
234
237
|
- lib/rsmp/rsmp.rb
|
235
238
|
- lib/rsmp/site.rb
|
236
239
|
- lib/rsmp/site_proxy.rb
|
237
|
-
- lib/rsmp/site_proxy_wait.rb
|
238
240
|
- lib/rsmp/supervisor.rb
|
239
241
|
- lib/rsmp/supervisor_proxy.rb
|
242
|
+
- lib/rsmp/task.rb
|
240
243
|
- lib/rsmp/tlc/detector_logic.rb
|
241
244
|
- lib/rsmp/tlc/signal_group.rb
|
242
245
|
- lib/rsmp/tlc/signal_plan.rb
|
243
246
|
- lib/rsmp/tlc/traffic_controller.rb
|
244
247
|
- lib/rsmp/tlc/traffic_controller_site.rb
|
245
248
|
- lib/rsmp/version.rb
|
246
|
-
- lib/rsmp/wait.rb
|
247
249
|
- rsmp.gemspec
|
248
|
-
- test.rb
|
249
250
|
homepage: https://github.com/rsmp-nordic/rsmp
|
250
251
|
licenses:
|
251
252
|
- MIT
|
@@ -269,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
269
270
|
- !ruby/object:Gem::Version
|
270
271
|
version: '0'
|
271
272
|
requirements: []
|
272
|
-
rubygems_version: 3.
|
273
|
+
rubygems_version: 3.3.3
|
273
274
|
signing_key:
|
274
275
|
specification_version: 4
|
275
276
|
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
|