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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b37598da5f9d49f45c771f6cefeae320304caeaa4c9e8c50ba005442554c88f4
4
- data.tar.gz: 29f72fa255248e3c3bb27946877714f262235f252da551d6e4941efbc5b12547
3
+ metadata.gz: 3bc44d46482f9db419fd057094d14b4291231c572ca67722739e555d71524694
4
+ data.tar.gz: 8363b9dc14cbd3b342f727a1343e16dac721faaa160e52f1d103f98dc3220e3c
5
5
  SHA512:
6
- metadata.gz: d1dd3458a8a619ee06bffd194f93aa16b7b00874d0c76ff52c00b23f5081ea6dde7dbe3e8eb5c5736b6e05938894a6278a1a870a5ea0cb318c962ff2663cddc2
7
- data.tar.gz: 70f633dc8a56995df2b1439467664fc00c861208d80fa2da14fc473413aa3d6186a9fd5bc0a727632757a6fececbb5fd5ed6456cdfcb74623db97eeb321637ab
6
+ metadata.gz: d37d3d4b13f1f896287abaaa6a3deda07bae2e0e2fc6b612413ccf2937cd56531f42045b98f1ebe9ae64e7ce4bae6e13adec07bb3c767e967fd8bb0ddf069890
7
+ data.tar.gz: e9806ea30d7747b421844264ad3ab0af79b98a2accc48299372a924a1adee001b6d4dc6f662e714e217d6c29b9aced77a4e0ddfdc7e3a111a7b38a2e2753ca7a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.4.1)
4
+ rsmp (0.4.5)
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
 
@@ -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.1"
2
+ VERSION = "0.4.5"
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.1
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-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.