rsmp 0.4.2 → 0.4.6
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/collect/matcher.rb +7 -9
- data/lib/rsmp/collect/notifier.rb +2 -0
- data/lib/rsmp/collect/query.rb +6 -4
- data/lib/rsmp/proxy.rb +1 -1
- data/lib/rsmp/supervisor.rb +4 -4
- data/lib/rsmp/tlc.rb +0 -1
- data/lib/rsmp/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c975252bdf622f3e6bd545e2eca8f4fcf2c9c5a5f04acf159cd162882bf4f491
|
4
|
+
data.tar.gz: ec26cc377c14611389a8f0c9b82cf2137a76523cca3ce445513bc7e2ea5466d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 243e70433cafb8573fc9e4ffcd6a55ece6d369df6201041e6481f88810ffdf907830197854330a28c91cfc2075b767cf379590bd7f80214189a94d4a0b3c03e9
|
7
|
+
data.tar.gz: ac86a77b8685491c0f08fb14bd4e15552eabf73d177b7f5415b809628bab2684a71e4df3aad451fc2822c808b44d036d4c4910998b369cb373f0a4b8b2294ece
|
data/Gemfile.lock
CHANGED
data/lib/rsmp/collect/matcher.rb
CHANGED
@@ -81,28 +81,26 @@ module RSMP
|
|
81
81
|
@queries.map { |query| [query.want, query.done?] }.to_h
|
82
82
|
end
|
83
83
|
|
84
|
-
# Get a simply array of bools, showing which queries
|
84
|
+
# Get a simply array of bools, showing which queries have been matched.
|
85
85
|
def summary
|
86
86
|
@queries.map { |query| query.done? }
|
87
87
|
end
|
88
88
|
|
89
89
|
# Check if a messages matches our criteria.
|
90
|
-
#
|
91
|
-
# Breaks as soon as where done matching all queries
|
90
|
+
# Match each query against each item in the message
|
92
91
|
def check_match message
|
93
92
|
return unless match?(message)
|
94
93
|
@queries.each do |query| # look through queries
|
95
|
-
get_items(message).each do |item| # look through
|
94
|
+
get_items(message).each do |item| # look through items in message
|
96
95
|
matched = query.check_match(item,message)
|
97
96
|
if matched != nil
|
98
|
-
type = {true=>'
|
99
|
-
@proxy.log "
|
100
|
-
break
|
97
|
+
type = {true=>'match',false=>'mismatch'}[matched]
|
98
|
+
@proxy.log "#{@title.capitalize} #{message.m_id_short} collect #{type} #{query.want}, item #{item}", level: :debug
|
99
|
+
break
|
101
100
|
end
|
102
101
|
end
|
103
102
|
end
|
104
|
-
|
105
|
-
nil
|
103
|
+
@proxy.log "#{@title.capitalize} collect reached #{summary}", level: :debug
|
106
104
|
end
|
107
105
|
|
108
106
|
end
|
data/lib/rsmp/collect/query.rb
CHANGED
@@ -17,12 +17,14 @@ module RSMP
|
|
17
17
|
end
|
18
18
|
|
19
19
|
# Check an item and set @done to true if it matches
|
20
|
-
#
|
20
|
+
# Store the item and corresponding message if there's a positive or negative match
|
21
21
|
def check_match item, message
|
22
|
-
@message = message
|
23
|
-
@got = item
|
24
22
|
matched = match? item
|
25
|
-
|
23
|
+
if matched != nil
|
24
|
+
@message = message
|
25
|
+
@got = item
|
26
|
+
@done = matched
|
27
|
+
end
|
26
28
|
matched
|
27
29
|
end
|
28
30
|
|
data/lib/rsmp/proxy.rb
CHANGED
@@ -266,7 +266,7 @@ module RSMP
|
|
266
266
|
# TODO
|
267
267
|
# what schema should we use to validate the intial Version and MessageAck messages?
|
268
268
|
schemas = { core: '3.1.5' }
|
269
|
-
schemas[sxl] = RSMP::Schemer.sanitize_version(sxl_version) if sxl
|
269
|
+
schemas[sxl] = RSMP::Schemer.sanitize_version(sxl_version) if sxl && sxl_version
|
270
270
|
schemas
|
271
271
|
end
|
272
272
|
|
data/lib/rsmp/supervisor.rb
CHANGED
@@ -7,7 +7,7 @@ module RSMP
|
|
7
7
|
attr_reader :rsmp_versions, :site_id, :supervisor_settings, :proxies, :logger
|
8
8
|
|
9
9
|
def initialize options={}
|
10
|
-
handle_supervisor_settings options
|
10
|
+
handle_supervisor_settings( options[:supervisor_settings] || {} )
|
11
11
|
super options
|
12
12
|
@proxies = []
|
13
13
|
@site_id_condition = Async::Notification.new
|
@@ -17,7 +17,7 @@ module RSMP
|
|
17
17
|
@supervisor_settings['site_id']
|
18
18
|
end
|
19
19
|
|
20
|
-
def handle_supervisor_settings
|
20
|
+
def handle_supervisor_settings supervisor_settings
|
21
21
|
defaults = {
|
22
22
|
'port' => 12111,
|
23
23
|
'ips' => 'all',
|
@@ -36,8 +36,8 @@ module RSMP
|
|
36
36
|
}
|
37
37
|
|
38
38
|
# merge options into defaults
|
39
|
-
@supervisor_settings = defaults.deep_merge(
|
40
|
-
@rsmp_versions = @supervisor_settings["rsmp_versions"]
|
39
|
+
@supervisor_settings = defaults.deep_merge(supervisor_settings)
|
40
|
+
@rsmp_versions = @supervisor_settings["guest"]["rsmp_versions"]
|
41
41
|
check_site_sxl_types
|
42
42
|
end
|
43
43
|
|
data/lib/rsmp/tlc.rb
CHANGED
@@ -293,7 +293,6 @@ module RSMP
|
|
293
293
|
def handle_s0002 status_code, status_name=nil
|
294
294
|
case status_name
|
295
295
|
when 'detectorlogicstatus'
|
296
|
-
RSMP::Tlc.make_status @detector_logics.each { |dl| p dl.value }
|
297
296
|
RSMP::Tlc.make_status @detector_logics.map { |dl| dl.value ? '1' : '0' }.join
|
298
297
|
end
|
299
298
|
end
|
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.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emil Tin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -258,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
258
258
|
- !ruby/object:Gem::Version
|
259
259
|
version: '0'
|
260
260
|
requirements: []
|
261
|
-
rubygems_version: 3.2.
|
261
|
+
rubygems_version: 3.2.26
|
262
262
|
signing_key:
|
263
263
|
specification_version: 4
|
264
264
|
summary: RoadSide Message Protocol (RSMP) library.
|