rsmp 0.4.1 → 0.4.5
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/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: 3bc44d46482f9db419fd057094d14b4291231c572ca67722739e555d71524694
|
4
|
+
data.tar.gz: 8363b9dc14cbd3b342f727a1343e16dac721faaa160e52f1d103f98dc3220e3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d37d3d4b13f1f896287abaaa6a3deda07bae2e0e2fc6b612413ccf2937cd56531f42045b98f1ebe9ae64e7ce4bae6e13adec07bb3c767e967fd8bb0ddf069890
|
7
|
+
data.tar.gz: e9806ea30d7747b421844264ad3ab0af79b98a2accc48299372a924a1adee001b6d4dc6f662e714e217d6c29b9aced77a4e0ddfdc7e3a111a7b38a2e2753ca7a
|
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/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.5
|
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.
|