rsmp 0.4.2 → 0.4.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ba7b8acadb23f7da783edca08dd93f77ba6183a69d446916a2761945f0e18a2
4
- data.tar.gz: 3ac4ae7510f2bb97e2b399e3ae1b4c7d8a8921ae1937c305244d907ff67a1109
3
+ metadata.gz: c975252bdf622f3e6bd545e2eca8f4fcf2c9c5a5f04acf159cd162882bf4f491
4
+ data.tar.gz: ec26cc377c14611389a8f0c9b82cf2137a76523cca3ce445513bc7e2ea5466d6
5
5
  SHA512:
6
- metadata.gz: 62e4656b7628db4d059a9b3375558016e87fc52bfc9e0d605936adbb4a41d07f963d568f331c9498e7bd730bfa947b16c4b0fe20a881d63fdc13dbbbc70a7b2d
7
- data.tar.gz: d54c99af5cd58d20c37715ca757ce946a5e0223a3ab64a892ef98f8ff71cf370d5099a459060a050f2f29f63167cf1770315677674cae1efef6c19bd980bb634
6
+ metadata.gz: 243e70433cafb8573fc9e4ffcd6a55ece6d369df6201041e6481f88810ffdf907830197854330a28c91cfc2075b767cf379590bd7f80214189a94d4a0b3c03e9
7
+ data.tar.gz: ac86a77b8685491c0f08fb14bd4e15552eabf73d177b7f5415b809628bab2684a71e4df3aad451fc2822c808b44d036d4c4910998b369cb373f0a4b8b2294ece
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.4.2)
4
+ rsmp (0.4.6)
5
5
  async (~> 1.29.1)
6
6
  async-io (~> 1.32.1)
7
7
  colorize (~> 0.8.1)
@@ -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 ahve been matched.
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
- # We iterate through each of the status items or return values in the message
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 status items in message
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=>'positive',false=>'negative'}[matched]
99
- @proxy.log "Query #{query.want} has #{type} match with item #{item}, reached #{summary}", message: message, level: :info
100
- break matched
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
- # @proxy.log "match", level: :info
105
- nil
103
+ @proxy.log "#{@title.capitalize} collect reached #{summary}", level: :debug
106
104
  end
107
105
 
108
106
  end
@@ -2,6 +2,8 @@
2
2
 
3
3
  module RSMP
4
4
  module Notifier
5
+ attr_reader :listeners
6
+
5
7
  include Inspect
6
8
 
7
9
  def inspect
@@ -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
- # Always store the item and corresponding message.
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
- @done = matched if matched != nil
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
 
@@ -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 options={}
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(options[:supervisor_settings] || {})
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
@@ -1,3 +1,3 @@
1
1
  module RSMP
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.6"
3
3
  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.2
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-10-28 00:00:00.000000000 Z
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.15
261
+ rubygems_version: 3.2.26
262
262
  signing_key:
263
263
  specification_version: 4
264
264
  summary: RoadSide Message Protocol (RSMP) library.