rsmp 0.1.19 → 0.1.31

Sign up to get free protection for your applications and to get access to all the features.
data/rsmp.gemspec CHANGED
@@ -26,28 +26,17 @@ Gem::Specification.new do |spec|
26
26
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
27
  end
28
28
 
29
- # Add schema files in rsmp_schema submodule
30
- gem_dir = Pathname.new(__dir__).expand_path
31
- submodule_path = File.expand_path 'lib/rsmp_schema/schema'
32
- Dir.chdir(submodule_path) do
33
- submodule_relative_path = Pathname.new(submodule_path).relative_path_from(gem_dir)
34
- `git ls-files`.split($\).each do |filename|
35
- # for each git file, prepend relative submodule path and add to spec
36
- spec.files << submodule_relative_path.join(filename).to_s
37
- end
38
- end
39
-
40
29
  spec.bindir = "exe"
41
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
42
31
  spec.require_paths = ["lib"]
43
32
 
44
- spec.add_dependency "async", "~> 1.23.0"
45
- spec.add_dependency "async-io", "~> 1.27.4"
33
+ spec.add_dependency "async", "~> 1.28.7"
34
+ spec.add_dependency "async-io", "~> 1.30.2"
46
35
  spec.add_dependency "colorize", "~> 0.8.1"
47
36
  spec.add_dependency "thor", "~> 1.0.1"
48
- spec.add_dependency "json_schemer", "~> 0.2.11"
37
+ spec.add_dependency "rsmp_schemer", "~> 0.2.0"
49
38
 
50
- spec.add_development_dependency "bundler", "~> 2.1.4"
39
+ spec.add_development_dependency "bundler", "~> 2.2.3"
51
40
  spec.add_development_dependency "rake", "~> 13.0.1"
52
41
  spec.add_development_dependency "rspec", "~> 3.9.0"
53
42
  spec.add_development_dependency "rspec-expectations", "~> 3.9.1"
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.1.19
4
+ version: 0.1.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Tin
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-22 00:00:00.000000000 Z
11
+ date: 2021-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.23.0
19
+ version: 1.28.7
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.23.0
26
+ version: 1.28.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: async-io
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.27.4
33
+ version: 1.30.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.27.4
40
+ version: 1.30.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: colorize
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -67,33 +67,33 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.0.1
69
69
  - !ruby/object:Gem::Dependency
70
- name: json_schemer
70
+ name: rsmp_schemer
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.2.11
75
+ version: 0.2.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.2.11
82
+ version: 0.2.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 2.1.4
89
+ version: 2.2.3
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 2.1.4
96
+ version: 2.2.3
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -197,136 +197,39 @@ files:
197
197
  - Rakefile
198
198
  - bin/console
199
199
  - bin/setup
200
- - config/site.yaml
201
200
  - config/supervisor.yaml
202
201
  - config/tlc.yaml
203
- - documentation/classes.md
202
+ - documentation/classes_and_modules.md
203
+ - documentation/message_distribution.md
204
204
  - exe/rsmp
205
205
  - lib/rsmp.rb
206
206
  - lib/rsmp/alarm.rb
207
207
  - lib/rsmp/archive.rb
208
- - lib/rsmp/base.rb
209
208
  - lib/rsmp/cli.rb
209
+ - lib/rsmp/collector.rb
210
210
  - lib/rsmp/component.rb
211
+ - lib/rsmp/components.rb
212
+ - lib/rsmp/convert/export/json_schema.rb
213
+ - lib/rsmp/convert/import/yaml.rb
214
+ - lib/rsmp/deep_merge.rb
211
215
  - lib/rsmp/error.rb
216
+ - lib/rsmp/inspect.rb
217
+ - lib/rsmp/listener.rb
212
218
  - lib/rsmp/logger.rb
219
+ - lib/rsmp/logging.rb
213
220
  - lib/rsmp/message.rb
214
221
  - lib/rsmp/node.rb
215
- - lib/rsmp/probe.rb
216
- - lib/rsmp/probe_collection.rb
222
+ - lib/rsmp/notifier.rb
217
223
  - lib/rsmp/proxy.rb
218
224
  - lib/rsmp/rsmp.rb
219
225
  - lib/rsmp/site.rb
220
- - lib/rsmp/site_base.rb
221
226
  - lib/rsmp/site_proxy.rb
227
+ - lib/rsmp/site_proxy_wait.rb
222
228
  - lib/rsmp/supervisor.rb
223
229
  - lib/rsmp/supervisor_proxy.rb
224
230
  - lib/rsmp/tlc.rb
225
231
  - lib/rsmp/version.rb
226
232
  - lib/rsmp/wait.rb
227
- - lib/rsmp_schema/schema/core/aggregated_status.json
228
- - lib/rsmp_schema/schema/core/alarm.json
229
- - lib/rsmp_schema/schema/core/command_request.json
230
- - lib/rsmp_schema/schema/core/command_response.json
231
- - lib/rsmp_schema/schema/core/core.json
232
- - lib/rsmp_schema/schema/core/definitions.json
233
- - lib/rsmp_schema/schema/core/message_ack.json
234
- - lib/rsmp_schema/schema/core/message_not_ack.json
235
- - lib/rsmp_schema/schema/core/rsmp.json
236
- - lib/rsmp_schema/schema/core/status.json
237
- - lib/rsmp_schema/schema/core/status_request.json
238
- - lib/rsmp_schema/schema/core/status_response.json
239
- - lib/rsmp_schema/schema/core/status_subscribe.json
240
- - lib/rsmp_schema/schema/core/status_unsubscribe.json
241
- - lib/rsmp_schema/schema/core/status_update.json
242
- - lib/rsmp_schema/schema/core/version.json
243
- - lib/rsmp_schema/schema/core/watchdog.json
244
- - lib/rsmp_schema/schema/tlc/alarms/A0001.json
245
- - lib/rsmp_schema/schema/tlc/alarms/A0002.json
246
- - lib/rsmp_schema/schema/tlc/alarms/A0003.json
247
- - lib/rsmp_schema/schema/tlc/alarms/A0004.json
248
- - lib/rsmp_schema/schema/tlc/alarms/A0005.json
249
- - lib/rsmp_schema/schema/tlc/alarms/A0006.json
250
- - lib/rsmp_schema/schema/tlc/alarms/A0007.json
251
- - lib/rsmp_schema/schema/tlc/alarms/A0008.json
252
- - lib/rsmp_schema/schema/tlc/alarms/A0009.json
253
- - lib/rsmp_schema/schema/tlc/alarms/A0101.json
254
- - lib/rsmp_schema/schema/tlc/alarms/A0201.json
255
- - lib/rsmp_schema/schema/tlc/alarms/A0202.json
256
- - lib/rsmp_schema/schema/tlc/alarms/A0301.json
257
- - lib/rsmp_schema/schema/tlc/alarms/A0302.json
258
- - lib/rsmp_schema/schema/tlc/alarms/alarms.json
259
- - lib/rsmp_schema/schema/tlc/commands/M0001.json
260
- - lib/rsmp_schema/schema/tlc/commands/M0002.json
261
- - lib/rsmp_schema/schema/tlc/commands/M0003.json
262
- - lib/rsmp_schema/schema/tlc/commands/M0004.json
263
- - lib/rsmp_schema/schema/tlc/commands/M0005.json
264
- - lib/rsmp_schema/schema/tlc/commands/M0006.json
265
- - lib/rsmp_schema/schema/tlc/commands/M0007.json
266
- - lib/rsmp_schema/schema/tlc/commands/M0008.json
267
- - lib/rsmp_schema/schema/tlc/commands/M0010.json
268
- - lib/rsmp_schema/schema/tlc/commands/M0011.json
269
- - lib/rsmp_schema/schema/tlc/commands/M0012.json
270
- - lib/rsmp_schema/schema/tlc/commands/M0013.json
271
- - lib/rsmp_schema/schema/tlc/commands/M0014.json
272
- - lib/rsmp_schema/schema/tlc/commands/M0015.json
273
- - lib/rsmp_schema/schema/tlc/commands/M0016.json
274
- - lib/rsmp_schema/schema/tlc/commands/M0017.json
275
- - lib/rsmp_schema/schema/tlc/commands/M0018.json
276
- - lib/rsmp_schema/schema/tlc/commands/M0019.json
277
- - lib/rsmp_schema/schema/tlc/commands/M0020.json
278
- - lib/rsmp_schema/schema/tlc/commands/M0021.json
279
- - lib/rsmp_schema/schema/tlc/commands/M0103.json
280
- - lib/rsmp_schema/schema/tlc/commands/M0104.json
281
- - lib/rsmp_schema/schema/tlc/commands/command_requests.json
282
- - lib/rsmp_schema/schema/tlc/commands/command_responses.json
283
- - lib/rsmp_schema/schema/tlc/commands/commands.json
284
- - lib/rsmp_schema/schema/tlc/statuses/S0001.json
285
- - lib/rsmp_schema/schema/tlc/statuses/S0002.json
286
- - lib/rsmp_schema/schema/tlc/statuses/S0003.json
287
- - lib/rsmp_schema/schema/tlc/statuses/S0004.json
288
- - lib/rsmp_schema/schema/tlc/statuses/S0005.json
289
- - lib/rsmp_schema/schema/tlc/statuses/S0006.json
290
- - lib/rsmp_schema/schema/tlc/statuses/S0007.json
291
- - lib/rsmp_schema/schema/tlc/statuses/S0008.json
292
- - lib/rsmp_schema/schema/tlc/statuses/S0009.json
293
- - lib/rsmp_schema/schema/tlc/statuses/S0010.json
294
- - lib/rsmp_schema/schema/tlc/statuses/S0011.json
295
- - lib/rsmp_schema/schema/tlc/statuses/S0012.json
296
- - lib/rsmp_schema/schema/tlc/statuses/S0013.json
297
- - lib/rsmp_schema/schema/tlc/statuses/S0014.json
298
- - lib/rsmp_schema/schema/tlc/statuses/S0015.json
299
- - lib/rsmp_schema/schema/tlc/statuses/S0016.json
300
- - lib/rsmp_schema/schema/tlc/statuses/S0017.json
301
- - lib/rsmp_schema/schema/tlc/statuses/S0018.json
302
- - lib/rsmp_schema/schema/tlc/statuses/S0019.json
303
- - lib/rsmp_schema/schema/tlc/statuses/S0020.json
304
- - lib/rsmp_schema/schema/tlc/statuses/S0021.json
305
- - lib/rsmp_schema/schema/tlc/statuses/S0022.json
306
- - lib/rsmp_schema/schema/tlc/statuses/S0023.json
307
- - lib/rsmp_schema/schema/tlc/statuses/S0024.json
308
- - lib/rsmp_schema/schema/tlc/statuses/S0025.json
309
- - lib/rsmp_schema/schema/tlc/statuses/S0026.json
310
- - lib/rsmp_schema/schema/tlc/statuses/S0027.json
311
- - lib/rsmp_schema/schema/tlc/statuses/S0028.json
312
- - lib/rsmp_schema/schema/tlc/statuses/S0029.json
313
- - lib/rsmp_schema/schema/tlc/statuses/S0030.json
314
- - lib/rsmp_schema/schema/tlc/statuses/S0031.json
315
- - lib/rsmp_schema/schema/tlc/statuses/S0091.json
316
- - lib/rsmp_schema/schema/tlc/statuses/S0092.json
317
- - lib/rsmp_schema/schema/tlc/statuses/S0095.json
318
- - lib/rsmp_schema/schema/tlc/statuses/S0096.json
319
- - lib/rsmp_schema/schema/tlc/statuses/S0097.json
320
- - lib/rsmp_schema/schema/tlc/statuses/S0201.json
321
- - lib/rsmp_schema/schema/tlc/statuses/S0202.json
322
- - lib/rsmp_schema/schema/tlc/statuses/S0203.json
323
- - lib/rsmp_schema/schema/tlc/statuses/S0204.json
324
- - lib/rsmp_schema/schema/tlc/statuses/S0205.json
325
- - lib/rsmp_schema/schema/tlc/statuses/S0206.json
326
- - lib/rsmp_schema/schema/tlc/statuses/S0207.json
327
- - lib/rsmp_schema/schema/tlc/statuses/S0208.json
328
- - lib/rsmp_schema/schema/tlc/statuses/statuses.json
329
- - lib/rsmp_schema/schema/tlc/sxl.json
330
233
  - rsmp.gemspec
331
234
  homepage: https://github.com/rsmp-nordic/rsmp
332
235
  licenses:
@@ -336,7 +239,7 @@ metadata:
336
239
  source_code_uri: https://github.com/rsmp-nordic/rsmp
337
240
  changelog_uri: https://github.com/rsmp-nordic/rsmp/blob/master/CHANGELOG.md
338
241
  bug_tracker_uri: https://github.com/rsmp-nordic/rsmp/issues
339
- post_install_message:
242
+ post_install_message:
340
243
  rdoc_options: []
341
244
  require_paths:
342
245
  - lib
@@ -351,8 +254,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
351
254
  - !ruby/object:Gem::Version
352
255
  version: '0'
353
256
  requirements: []
354
- rubygems_version: 3.1.2
355
- signing_key:
257
+ rubygems_version: 3.2.3
258
+ signing_key:
356
259
  specification_version: 4
357
260
  summary: RoadSide Message Protocol (RSMP) library.
358
261
  test_files: []
data/config/site.yaml DELETED
@@ -1,40 +0,0 @@
1
- site_id: RN+SI0001
2
- supervisors:
3
- - ip: 127.0.0.1
4
- port: 12111
5
-
6
- sxl: traffic_light_controller
7
-
8
- rsmp_versions:
9
- - 3.1.1
10
- - 3.1.2
11
- - 3.1.3
12
- - 3.1.4
13
-
14
- components:
15
- main:
16
- C1:
17
-
18
- watchdog_interval: 1
19
- watchdog_timeout: 2
20
- acknowledgement_timeout: 1
21
- command_response_timeout: 1
22
- status_response_timeout: 1
23
- status_update_timeout: 1
24
- reconnect_interval: 0.1
25
-
26
- log:
27
- active: true
28
- color: true
29
- timestamp: true
30
- id: true
31
- component: true
32
- ip: false
33
- site_id: true
34
- level: false
35
- text: true
36
- direction: true
37
- json: true
38
- acknowledgements: false
39
- watchdogs: false
40
-
data/lib/rsmp/probe.rb DELETED
@@ -1,101 +0,0 @@
1
- # A probe checks incoming messages and store matches
2
- # Once it has collected what it needs, it triggers a condition variable
3
- # and the client wakes up.
4
-
5
- module RSMP
6
- class Probe
7
- attr_reader :condition, :items, :done
8
-
9
- def initialize archive
10
- raise ArgumentError.new("Archive expected") unless archive.is_a? Archive
11
- @archive = archive
12
- @items = []
13
- @condition = Async::Notification.new
14
- end
15
-
16
- def capture task, options={}, &block
17
- raise ArgumentError.new("timeout option is missing") unless options[:timeout]
18
- @options = options
19
- @block = block
20
- @num = options[:num]
21
-
22
- if options[:earliest]
23
- from = find_timestamp_index options[:earliest]
24
- backscan from
25
- end
26
-
27
- # if backscan didn't find enough items, then
28
- # insert ourself as probe and sleep until enough items are captured
29
- if @items.size < @num
30
- begin
31
- @archive.probes.add self
32
- task.with_timeout(options[:timeout]) do
33
- @condition.wait
34
- end
35
- ensure
36
- @archive.probes.remove self
37
- end
38
- end
39
-
40
- if @num == 1
41
- @items.first # if one item was requested, return item instead of array
42
- else
43
- @items[0..@num-1] # return array, but ensure we never return more than requested
44
- end
45
- end
46
-
47
- def find_timestamp_index earliest
48
- return 0 if earliest == :start
49
- (0..@archive.items.size).bsearch do |i| # use binary search to find item index
50
- @archive.items[i][:timestamp] >= earliest
51
- end
52
- end
53
-
54
- def backscan from
55
- from.upto(@archive.items.size-1) do |i|
56
- return if process @archive.items[i]
57
- end
58
- end
59
-
60
- def reset
61
- @items.clear
62
- @done = false
63
- end
64
-
65
- def process item
66
- raise ArgumentError unless item
67
- return true if @done
68
- if matches? item
69
- @items << item
70
- if @num && @items.size >= @num
71
- @done = true
72
- @condition.signal
73
- return true
74
- end
75
- end
76
- false
77
- end
78
-
79
- def matches? item
80
- raise ArgumentError unless item
81
-
82
- if @options[:type]
83
- return false if item[:message] == nil
84
- if @options[:type].is_a? Array
85
- return false unless @options[:type].include? item[:message].type
86
- else
87
- return false unless item[:message].type == @options[:type]
88
- end
89
- end
90
- return if @options[:level] && item[:level] != @options[:level]
91
- return false if @options[:with_message] && !(item[:direction] && item[:message])
92
- if @options[:component]
93
- return false if item[:message].attributes['cId'] && item[:message].attributes['cId'] != @options[:component]
94
- end
95
- if @block
96
- return false if @block.call(item) == false
97
- end
98
- true
99
- end
100
- end
101
- end
@@ -1,28 +0,0 @@
1
- # Collection of probes
2
-
3
- module RSMP
4
- class ProbeCollection
5
-
6
- def initialize
7
- @probes = []
8
- end
9
-
10
- def add probe
11
- raise ArgumentError unless probe
12
- @probes << probe
13
- end
14
-
15
- def remove probe
16
- raise ArgumentError unless probe
17
- @probes.delete probe
18
- end
19
-
20
- def process item
21
- @probes.each { |probe| probe.process item }
22
- end
23
-
24
- def clear
25
- @probes.each { |probe| probe.clear }
26
- end
27
- end
28
- end