rsmp 0.17.1 → 0.17.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rsmp/tlc/traffic_controller.rb +45 -10
- data/lib/rsmp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b1e7b64edaac39cb76f67bc47625a0af95688d70a50b84ec8692cc645bc2bfd
|
4
|
+
data.tar.gz: 25ef625f7effbd9e50112f9495cb5511f17f06465e75325c1f324cf4810db19c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe2bea264b7d19cf768897e657d784fb150cfb8df759835547eefabf28aa12afce331156e1c58911adaf6dc2efe60c28767d685d96061e52f142350c84f0f3d4
|
7
|
+
data.tar.gz: c1fb46cd25c0d6ad5312575f9e186580e74bfe8f8bdaf3711fde77f0e7921648781da7e38ea763287c6699661f515d38f80c43c501ad26011ed3c4b475f92d2b
|
data/Gemfile.lock
CHANGED
@@ -33,6 +33,7 @@ module RSMP
|
|
33
33
|
|
34
34
|
def reset_modes
|
35
35
|
@function_position = 'NormalControl'
|
36
|
+
@function_position_source = 'startup'
|
36
37
|
@previous_functional_position = nil
|
37
38
|
@functional_position_timeout = nil
|
38
39
|
|
@@ -40,9 +41,13 @@ module RSMP
|
|
40
41
|
@is_starting = false
|
41
42
|
@control_mode = 'control'
|
42
43
|
@manual_control = false
|
44
|
+
@manual_control_source = 'startup'
|
43
45
|
@fixed_time_control = false
|
46
|
+
@fixed_time_control_source = 'startup'
|
44
47
|
@isolated_control = false
|
48
|
+
@isolated_control_source = 'startup'
|
45
49
|
@all_red = false
|
50
|
+
@all_red_source = 'startup'
|
46
51
|
@police_key = 0
|
47
52
|
end
|
48
53
|
|
@@ -50,10 +55,13 @@ module RSMP
|
|
50
55
|
reset_modes
|
51
56
|
@cycle_counter = 0
|
52
57
|
@plan = 1
|
58
|
+
@plan_source = 'startup'
|
53
59
|
@intersection = 0
|
60
|
+
@intersection_source = 'startup'
|
54
61
|
@emergency_route = false
|
55
62
|
@emergency_route_number = 0
|
56
63
|
@traffic_situation = 0
|
64
|
+
@traffic_situation_source = 'startup'
|
57
65
|
@day_time_table = {}
|
58
66
|
@startup_sequence_active = false
|
59
67
|
@startup_sequence_initiated_at = nil
|
@@ -140,7 +148,7 @@ module RSMP
|
|
140
148
|
def check_functional_position_timeout
|
141
149
|
return unless @functional_position_timeout
|
142
150
|
if clock.now >= @functional_position_timeout
|
143
|
-
switch_functional_position @previous_functional_position, reverting: true
|
151
|
+
switch_functional_position @previous_functional_position, reverting: true, source: 'calendar_clock'
|
144
152
|
@functional_position_timeout = nil
|
145
153
|
@previous_functional_position = nil
|
146
154
|
end
|
@@ -242,21 +250,29 @@ module RSMP
|
|
242
250
|
|
243
251
|
def handle_m0001 arg, options={}
|
244
252
|
@node.verify_security_code 2, arg['securityCode']
|
245
|
-
switch_functional_position arg['status'],
|
253
|
+
switch_functional_position arg['status'],
|
254
|
+
timeout: arg['timeout'].to_i*60,
|
255
|
+
source: 'forced'
|
256
|
+
|
246
257
|
end
|
247
258
|
|
248
259
|
def handle_m0002 arg, options={}
|
249
260
|
@node.verify_security_code 2, arg['securityCode']
|
250
261
|
if TrafficControllerSite.from_rsmp_bool(arg['status'])
|
251
|
-
switch_plan arg['timeplan']
|
262
|
+
switch_plan arg['timeplan'], source: 'force'
|
252
263
|
else
|
253
|
-
switch_plan 0
|
264
|
+
switch_plan 0, source: 'startup' # TODO use clock/calender
|
254
265
|
end
|
255
266
|
end
|
256
267
|
|
257
268
|
def handle_m0003 arg, options={}
|
258
269
|
@node.verify_security_code 2, arg['securityCode']
|
259
|
-
|
270
|
+
switch_traffic_situation arg['traficsituation'], source: 'forced'
|
271
|
+
end
|
272
|
+
|
273
|
+
def switch_traffic_situation situation, source:
|
274
|
+
@traffic_situation = situation.to_i
|
275
|
+
@traffic_situation_source = 'forced'
|
260
276
|
end
|
261
277
|
|
262
278
|
def handle_m0004 arg, options={}
|
@@ -313,7 +329,7 @@ module RSMP
|
|
313
329
|
|
314
330
|
def handle_m0007 arg, options={}
|
315
331
|
@node.verify_security_code 2, arg['securityCode']
|
316
|
-
set_fixed_time_control arg['status']
|
332
|
+
set_fixed_time_control arg['status'], source: 'forced'
|
317
333
|
end
|
318
334
|
|
319
335
|
def handle_m0012 arg, options={}
|
@@ -483,11 +499,12 @@ module RSMP
|
|
483
499
|
@inputs[i] = bool_to_digit arg['value']
|
484
500
|
end
|
485
501
|
|
486
|
-
def set_fixed_time_control status
|
502
|
+
def set_fixed_time_control status, source:
|
487
503
|
@fixed_time_control = status
|
504
|
+
@fixed_time_control_source = source
|
488
505
|
end
|
489
506
|
|
490
|
-
def switch_plan plan
|
507
|
+
def switch_plan plan, source:
|
491
508
|
plan_nr = plan.to_i
|
492
509
|
if plan_nr == 0
|
493
510
|
log "Switching to plan selection by time table", level: :info
|
@@ -496,9 +513,10 @@ module RSMP
|
|
496
513
|
log "Switching to plan #{plan_nr}", level: :info
|
497
514
|
end
|
498
515
|
@plan = plan_nr
|
516
|
+
@plan_source = source
|
499
517
|
end
|
500
518
|
|
501
|
-
def switch_functional_position mode, timeout: nil, reverting: false
|
519
|
+
def switch_functional_position mode, timeout: nil, reverting: false, source:
|
502
520
|
unless ['NormalControl','YellowFlash','Dark'].include? mode
|
503
521
|
raise RSMP::MessageRejected.new "Invalid functional position '#{mode}', must be NormalControl, YellowFlash or Dark'"
|
504
522
|
end
|
@@ -516,6 +534,7 @@ module RSMP
|
|
516
534
|
initiate_startup_sequence if @function_position != 'NormalControl'
|
517
535
|
end
|
518
536
|
@function_position = mode
|
537
|
+
@function_position_source = source
|
519
538
|
mode
|
520
539
|
end
|
521
540
|
|
@@ -594,6 +613,8 @@ module RSMP
|
|
594
613
|
TrafficControllerSite.make_status @intersection
|
595
614
|
when 'status'
|
596
615
|
TrafficControllerSite.make_status @function_position != 'Dark'
|
616
|
+
when 'source'
|
617
|
+
TrafficControllerSite.make_status @function_position_source
|
597
618
|
end
|
598
619
|
end
|
599
620
|
|
@@ -603,6 +624,8 @@ module RSMP
|
|
603
624
|
TrafficControllerSite.make_status @intersection
|
604
625
|
when 'status'
|
605
626
|
TrafficControllerSite.make_status @manual_control
|
627
|
+
when 'source'
|
628
|
+
TrafficControllerSite.make_status @manual_control_source
|
606
629
|
end
|
607
630
|
end
|
608
631
|
|
@@ -612,6 +635,8 @@ module RSMP
|
|
612
635
|
TrafficControllerSite.make_status @intersection
|
613
636
|
when 'status'
|
614
637
|
TrafficControllerSite.make_status @fixed_time_control
|
638
|
+
when 'source'
|
639
|
+
TrafficControllerSite.make_status @fixed_time_control_source
|
615
640
|
end
|
616
641
|
end
|
617
642
|
|
@@ -621,6 +646,8 @@ module RSMP
|
|
621
646
|
TrafficControllerSite.make_status @intersection
|
622
647
|
when 'status'
|
623
648
|
TrafficControllerSite.make_status @isolated_control
|
649
|
+
when 'source'
|
650
|
+
TrafficControllerSite.make_status @isolated_control_source
|
624
651
|
end
|
625
652
|
end
|
626
653
|
|
@@ -630,6 +657,8 @@ module RSMP
|
|
630
657
|
TrafficControllerSite.make_status @intersection
|
631
658
|
when 'status'
|
632
659
|
TrafficControllerSite.make_status TrafficControllerSite.to_rmsp_bool( @function_position == 'YellowFlash' )
|
660
|
+
when 'source'
|
661
|
+
TrafficControllerSite.make_status @function_position_source
|
633
662
|
end
|
634
663
|
end
|
635
664
|
|
@@ -639,6 +668,8 @@ module RSMP
|
|
639
668
|
TrafficControllerSite.make_status @intersection
|
640
669
|
when 'status'
|
641
670
|
TrafficControllerSite.make_status @all_red
|
671
|
+
when 'source'
|
672
|
+
TrafficControllerSite.make_status @all_red_source
|
642
673
|
end
|
643
674
|
end
|
644
675
|
|
@@ -655,6 +686,8 @@ module RSMP
|
|
655
686
|
case status_name
|
656
687
|
when 'status'
|
657
688
|
TrafficControllerSite.make_status @plan
|
689
|
+
when 'source'
|
690
|
+
TrafficControllerSite.make_status @plan_source
|
658
691
|
end
|
659
692
|
end
|
660
693
|
|
@@ -662,6 +695,8 @@ module RSMP
|
|
662
695
|
case status_name
|
663
696
|
when 'status'
|
664
697
|
TrafficControllerSite.make_status @traffic_situation
|
698
|
+
when 'source'
|
699
|
+
TrafficControllerSite.make_status @traffic_situation_source
|
665
700
|
end
|
666
701
|
end
|
667
702
|
|
@@ -784,7 +819,7 @@ module RSMP
|
|
784
819
|
when 'status'
|
785
820
|
TrafficControllerSite.make_status 'local'
|
786
821
|
when 'source'
|
787
|
-
TrafficControllerSite.make_status
|
822
|
+
TrafficControllerSite.make_status @intersection_source
|
788
823
|
end
|
789
824
|
end
|
790
825
|
|
data/lib/rsmp/version.rb
CHANGED
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.17.
|
4
|
+
version: 0.17.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emil Tin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|