rsmp 0.20.4 → 0.20.7
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/Gemfile.lock +5 -5
- data/lib/rsmp/components.rb +5 -6
- data/lib/rsmp/proxy.rb +1 -2
- data/lib/rsmp/supervisor_proxy.rb +27 -9
- data/lib/rsmp/tlc/traffic_controller.rb +1 -1
- 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: 77314f562ebf956079f50f9cabd90be180010d39d55ecc2b96aceeab7b6da553
|
4
|
+
data.tar.gz: 2c67e8fcca60ecdefec7edb539f56b7625046f3ef7e8d7a0801640c05f8f0535
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68a66a9531bff5c01cd743ae61a2b159bae2ce0dc6cfd393b5fa9deddda3838d771cfd1025a25ec8231a5d099d5e1976bbbc9418738ee0ba528875e3d8e63327
|
7
|
+
data.tar.gz: bac2a033fa66291905fa0ba5a66d79a9bb114900ff7d62f4ec696b7ba5271b8454793c1866f9607f0de0638c9950a09822640935541e9663ee01f74295469834
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rsmp (0.20.
|
4
|
+
rsmp (0.20.7)
|
5
5
|
async (~> 2.6.2)
|
6
6
|
async-io (~> 1.35.0)
|
7
7
|
colorize (~> 0.8.1)
|
@@ -18,7 +18,7 @@ GEM
|
|
18
18
|
cucumber (>= 4.0, < 9.0)
|
19
19
|
rspec-expectations (~> 3.4)
|
20
20
|
thor (~> 1.0)
|
21
|
-
async (2.6.
|
21
|
+
async (2.6.3)
|
22
22
|
console (~> 1.10)
|
23
23
|
fiber-annotation
|
24
24
|
io-event (~> 1.1)
|
@@ -28,7 +28,7 @@ GEM
|
|
28
28
|
builder (3.2.4)
|
29
29
|
childprocess (4.1.0)
|
30
30
|
colorize (0.8.1)
|
31
|
-
console (1.
|
31
|
+
console (1.21.0)
|
32
32
|
fiber-annotation
|
33
33
|
fiber-local
|
34
34
|
contracts (0.17)
|
@@ -63,7 +63,7 @@ GEM
|
|
63
63
|
fiber-annotation (0.2.0)
|
64
64
|
fiber-local (1.0.0)
|
65
65
|
hana (1.3.7)
|
66
|
-
io-event (1.2.
|
66
|
+
io-event (1.2.3)
|
67
67
|
json_schemer (0.2.25)
|
68
68
|
ecma-re-validator (~> 0.3)
|
69
69
|
hana (~> 1.3)
|
@@ -76,7 +76,7 @@ GEM
|
|
76
76
|
multi_test (1.1.0)
|
77
77
|
rake (13.0.6)
|
78
78
|
regexp_parser (2.8.1)
|
79
|
-
rsmp_schema (0.4.
|
79
|
+
rsmp_schema (0.4.5)
|
80
80
|
json_schemer (~> 0.2.21)
|
81
81
|
thor (~> 1.2.1)
|
82
82
|
rspec (3.12.0)
|
data/lib/rsmp/components.rb
CHANGED
@@ -39,22 +39,21 @@ module RSMP
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def infer_component_type component_id
|
42
|
-
Component
|
42
|
+
raise UnknownComponent.new("Component #{component_id} mising and cannot infer type")
|
43
43
|
end
|
44
44
|
|
45
45
|
def find_component component_id, build: true
|
46
46
|
component = @components[component_id]
|
47
47
|
return component if component
|
48
|
-
if build
|
49
|
-
|
50
|
-
component =
|
48
|
+
if build
|
49
|
+
inferred_type = infer_component_type component_id
|
50
|
+
component = inferred_type.new node: self, id: component_id
|
51
51
|
@components[ component_id] = component
|
52
52
|
class_name = component.class.name.split('::').last
|
53
53
|
class_name << " component" unless (class_name == 'Component' || class_name == 'ComponentProxy')
|
54
|
-
log "
|
54
|
+
log "Added component #{component_id} with the inferred type #{class_name}", level: :debug
|
55
55
|
component
|
56
56
|
else
|
57
|
-
raise UnknownComponent.new("Component #{component_id} not found") unless component
|
58
57
|
end
|
59
58
|
end
|
60
59
|
|
data/lib/rsmp/proxy.rb
CHANGED
@@ -403,8 +403,7 @@ module RSMP
|
|
403
403
|
nil
|
404
404
|
rescue SchemaError, RSMP::Schema::Error => e
|
405
405
|
reason = "schema errors: #{e.message}"
|
406
|
-
str = "Received invalid #{message.type}
|
407
|
-
log str, message: message, level: :warning
|
406
|
+
str = "Received invalid #{message.type}"
|
408
407
|
notify_error e.exception(str), message: message
|
409
408
|
dont_acknowledge message, str, reason
|
410
409
|
message
|
@@ -67,8 +67,9 @@ module RSMP
|
|
67
67
|
def connect_tcp
|
68
68
|
@endpoint = Async::IO::Endpoint.tcp(@ip, @port)
|
69
69
|
|
70
|
+
error = nil
|
70
71
|
# Async::IO::Endpoint#connect renames the current task. run in a subtask to avoid this see issue #22
|
71
|
-
@task.async do |task|
|
72
|
+
result = @task.async do |task|
|
72
73
|
task.annotate 'socket task'
|
73
74
|
# this timeout is a workaround for connect hanging on windows if the other side is not present yet
|
74
75
|
timeout = @site_settings.dig('timeouts','connect') || 1.1
|
@@ -77,7 +78,11 @@ module RSMP
|
|
77
78
|
end
|
78
79
|
delay = @site_settings.dig('intervals','after_connect')
|
79
80
|
task.sleep delay if delay
|
81
|
+
rescue Errno::ECONNREFUSED => e # rescue to avoid log output
|
82
|
+
log "Connection refused", level: :warning
|
83
|
+
error = e
|
80
84
|
end.wait
|
85
|
+
raise error if error # reraise any error outside task
|
81
86
|
|
82
87
|
@stream = Async::IO::Stream.new(@socket)
|
83
88
|
@protocol = Async::IO::Protocol::Line.new(@stream,WRAPPING_DELIMITER) # rsmp messages are json terminated with a form-feed
|
@@ -276,8 +281,8 @@ module RSMP
|
|
276
281
|
component.handle_command command_code,arg
|
277
282
|
end
|
278
283
|
log "Received #{message.type}", message: message, level: :log
|
279
|
-
rescue UnknownComponent
|
280
|
-
log "Received #{message.type} with unknown component id '#{component_id}'", message: message, level: :warning
|
284
|
+
rescue UnknownComponent
|
285
|
+
log "Received #{message.type} with unknown component id '#{component_id}' and cannot infer type", message: message, level: :warning
|
281
286
|
# If the component is unknown, we must set age=undefined for all items,
|
282
287
|
# while still acknowledge the message.
|
283
288
|
# See https://github.com/rsmp-nordic/rsmp_validator/issues/271
|
@@ -302,19 +307,32 @@ module RSMP
|
|
302
307
|
end
|
303
308
|
|
304
309
|
def process_status_request message, options={}
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
310
|
+
sS = []
|
311
|
+
begin
|
312
|
+
component_id = message.attributes["cId"]
|
313
|
+
component = @site.find_component component_id
|
314
|
+
sS = message.attributes["sS"].map do |arg|
|
315
|
+
value, quality = component.get_status arg['sCI'], arg['n'], {sxl_version: sxl_version}
|
316
|
+
{ "s" => rsmpify_value(value), "q" => quality.to_s }.merge arg
|
317
|
+
end
|
318
|
+
log "Received #{message.type}", message: message, level: :log
|
319
|
+
|
320
|
+
rescue UnknownComponent
|
321
|
+
log "Received #{message.type} with unknown component id '#{component_id}' and cannot infer type", message: message, level: :warning
|
322
|
+
# If the component is unknown, we must set q=undefined and s=nil for all items,
|
323
|
+
# while still acknowledge the message.
|
324
|
+
sS = message.attributes["sS"].map do |arg|
|
325
|
+
arg.dup.merge('q'=>'undefined','s'=>nil)
|
326
|
+
end
|
311
327
|
end
|
328
|
+
|
312
329
|
response = StatusResponse.new({
|
313
330
|
"cId"=>component_id,
|
314
331
|
"sTs"=>clock.to_s,
|
315
332
|
"sS"=>sS,
|
316
333
|
"mId" => options[:m_id]
|
317
334
|
})
|
335
|
+
|
318
336
|
set_nts_message_attributes response
|
319
337
|
acknowledge message
|
320
338
|
send_message response
|
@@ -538,7 +538,7 @@ module RSMP
|
|
538
538
|
|
539
539
|
def switch_functional_position mode, timeout: nil, reverting: false, source:
|
540
540
|
unless ['NormalControl','YellowFlash','Dark'].include? mode
|
541
|
-
raise RSMP::MessageRejected.new "Invalid functional position
|
541
|
+
raise RSMP::MessageRejected.new "Invalid functional position #{mode.inspect}, must be NormalControl, YellowFlash or Dark"
|
542
542
|
end
|
543
543
|
if reverting
|
544
544
|
log "Reverting to functional position #{mode} after timeout", level: :info
|
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.20.
|
4
|
+
version: 0.20.7
|
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-07
|
11
|
+
date: 2023-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|