rsmp 0.13.7 → 0.14.1

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: 5e7dfc4d62630bc941181c506e6fe777e817a91270ff2797ecbfc5d0069e7d68
4
- data.tar.gz: bacbfe1c630fdbae4eebf0604339820b00352b3cf7c312683f9e48751bef77a9
3
+ metadata.gz: ba4c1b6249ff89f55eeed34cbff4d10afe0fb50c1857549e97762d72680f40fe
4
+ data.tar.gz: 7b46db97a6a1366c9ec0ff2eb6a1262007644b91e0003ff2afd55ab0b3c47649
5
5
  SHA512:
6
- metadata.gz: c9ddb8ba148e22c1919f7ba04cb727138db1e4d56750eac87a0ab03e63431990a31950c0a1ee83d45ca09e105adb478709061e7e59cfebf5d0e794a841152341
7
- data.tar.gz: 1bd48de932a481cec40499c0f82cf34daab58620bb3795ca3789098424baa32e47a014373c51e0e3631229d079e3facf7a703b7cbc02f0f14cab7e032ff6e75a
6
+ metadata.gz: 7d3aeaf54ab86793ee3b4890f94a89989cc732b46b1fb4f192986be234c58587d1a9599577a64c75aab9645db7011a4ad4b86dc685f0c78197d15b99444c362b
7
+ data.tar.gz: 223926d281192692ea70e62c916cb21b132fc489a492676318e23d8479c7b11cde0893d7e2e4adaa1cfa0f636df506ecbf50c04a440cbce2b951ecc98b0a43ed
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.0
1
+ 3.1.2
data/Gemfile.lock CHANGED
@@ -1,28 +1,28 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.13.7)
5
- async (~> 1.29.1)
6
- async-io (~> 1.32.2)
4
+ rsmp (0.14.1)
5
+ async (~> 1.30.3)
6
+ async-io (~> 1.33.0)
7
7
  colorize (~> 0.8.1)
8
- rsmp_schemer
8
+ rsmp_schema (~> 0.1.0)
9
9
  thor (~> 1.2.1)
10
10
 
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- aruba (2.0.0)
14
+ aruba (2.0.1)
15
15
  bundler (>= 1.17, < 3.0)
16
16
  childprocess (>= 2.0, < 5.0)
17
17
  contracts (>= 0.16.0, < 0.18.0)
18
18
  cucumber (>= 4.0, < 8.0)
19
19
  rspec-expectations (~> 3.4)
20
20
  thor (~> 1.0)
21
- async (1.29.2)
21
+ async (1.30.3)
22
22
  console (~> 1.10)
23
23
  nio4r (~> 2.3)
24
24
  timers (~> 4.1)
25
- async-io (1.32.2)
25
+ async-io (1.33.0)
26
26
  async
27
27
  builder (3.2.4)
28
28
  childprocess (4.1.0)
@@ -80,25 +80,26 @@ GEM
80
80
  nio4r (2.5.8)
81
81
  rake (13.0.6)
82
82
  regexp_parser (2.5.0)
83
- rsmp_schemer (0.4.1)
83
+ rsmp_schema (0.1.0)
84
84
  json_schemer (~> 0.2.21)
85
+ thor (~> 1.2.1)
85
86
  rspec (3.10.0)
86
87
  rspec-core (~> 3.10.0)
87
88
  rspec-expectations (~> 3.10.0)
88
89
  rspec-mocks (~> 3.10.0)
89
- rspec-core (3.10.1)
90
+ rspec-core (3.10.2)
90
91
  rspec-support (~> 3.10.0)
91
92
  rspec-expectations (3.10.2)
92
93
  diff-lcs (>= 1.2.0, < 2.0)
93
94
  rspec-support (~> 3.10.0)
94
- rspec-mocks (3.10.2)
95
+ rspec-mocks (3.10.3)
95
96
  diff-lcs (>= 1.2.0, < 2.0)
96
97
  rspec-support (~> 3.10.0)
97
98
  rspec-support (3.10.3)
98
99
  sys-uname (1.2.2)
99
100
  ffi (~> 1.1)
100
101
  thor (1.2.1)
101
- timecop (0.9.4)
102
+ timecop (0.9.5)
102
103
  timers (4.3.3)
103
104
  uri_template (0.7.0)
104
105
 
@@ -112,7 +113,7 @@ PLATFORMS
112
113
 
113
114
  DEPENDENCIES
114
115
  aruba (~> 2.0.0)
115
- bundler (~> 2.3.6)
116
+ bundler (~> 2.3.7)
116
117
  cucumber (~> 7.1.0)
117
118
  rake (~> 13.0.6)
118
119
  rsmp!
@@ -121,4 +122,4 @@ DEPENDENCIES
121
122
  timecop (~> 0.9.4)
122
123
 
123
124
  BUNDLED WITH
124
- 2.3.6
125
+ 2.3.7
data/lib/rsmp/cli.rb CHANGED
@@ -74,9 +74,9 @@ module RSMP
74
74
  end
75
75
  rescue Interrupt
76
76
  # cntr-c
77
- rescue RSMP::Schemer::UnknownSchemaTypeError => e
77
+ rescue RSMP::Schema::UnknownSchemaTypeError => e
78
78
  puts "Cannot start site: #{e}"
79
- rescue RSMP::Schemer::UnknownSchemaVersionError => e
79
+ rescue RSMP::Schema::UnknownSchemaVersionError => e
80
80
  puts "Cannot start site: #{e}"
81
81
  rescue Psych::SyntaxError => e
82
82
  puts "Cannot read config file #{e}"
@@ -25,6 +25,8 @@ module RSMP
25
25
  sCI, n, s, q = item['sCI'], item['n'], item['s'], item['q']
26
26
  uRt = subscription_list.dig(c_id,sCI,n,'uRt')
27
27
  next if uRt.to_i > 0
28
+ sOc = subscription_list.dig(c_id,sCI,n,'sOc')
29
+ next if sOc == 'False'
28
30
  next if @allow_repeat_updates[sCI] && @allow_repeat_updates[sCI].include?(n)
29
31
  new_values = {'s'=>s,'q'=>q}
30
32
  old_values = @statuses.dig(sCI,n)
@@ -31,9 +31,9 @@ module RSMP
31
31
  if item['list']
32
32
  case item['type']
33
33
  when "boolean"
34
- out["$ref"] = "../../core/definitions.json#/boolean_list"
34
+ out["$ref"] = "../../../core/3.1.1/definitions.json#/boolean_list"
35
35
  when "integer", "ordinal", "unit", "scale", "long"
36
- out["$ref"] = "../../core/definitions.json#/integer_list"
36
+ out["$ref"] = "../../../core/3.1.1/definitions.json#/integer_list"
37
37
  else
38
38
  raise "Error: List of #{item['type']} is not supported: #{item.inspect}"
39
39
  end
@@ -51,11 +51,11 @@ module RSMP
51
51
  when "string", "base64"
52
52
  out["type"] = "string"
53
53
  when "boolean"
54
- out["$ref"] = "../../core/definitions.json#/boolean"
54
+ out["$ref"] = "../../../core/3.1.1/definitions.json#/boolean"
55
55
  when "timestamp"
56
- out["$ref"] = "../../core/definitions.json#/timestamp"
56
+ out["$ref"] = "../../../core/3.1.1/definitions.json#/timestamp"
57
57
  when "integer", "ordinal", "unit", "scale", "long"
58
- out["$ref"] = "../../core/definitions.json#/integer"
58
+ out["$ref"] = "../../../core/3.1.1/definitions.json#/integer"
59
59
  else
60
60
  out["type"] = "string"
61
61
  end
@@ -153,9 +153,11 @@ module RSMP
153
153
  out["commands/#{key}.json"] = output_json json
154
154
  end
155
155
 
156
- def self.output_root out
156
+ def self.output_root out, meta
157
157
  json = {
158
- "description"=> "A schema validatating message against the RSMP SXL for Traffic Light Controllers",
158
+ "name"=> meta['name'],
159
+ "description"=> meta['description'],
160
+ "version"=> meta['version'],
159
161
  "allOf" => [
160
162
  {
161
163
  "if" => { "required" => ["type"], "properties" => { "type" => { "const" => "CommandRequest" }}},
@@ -180,7 +182,7 @@ module RSMP
180
182
 
181
183
  def self.generate sxl
182
184
  out = {}
183
- output_root out
185
+ output_root out, sxl[:meta]
184
186
  output_alarms out, sxl[:alarms]
185
187
  output_statuses out, sxl[:statuses]
186
188
  output_commands out, sxl[:commands]
@@ -19,15 +19,18 @@ module RSMP
19
19
 
20
20
  def self.convert yaml
21
21
  sxl = {
22
+ meta: {},
22
23
  alarms: {},
23
24
  statuses: {},
24
25
  commands: {}
25
26
  }
26
27
 
28
+ sxl[:meta] = yaml['meta']
29
+
27
30
  yaml['objects'].each_pair do |type,object|
28
- object["alarms"].each { |id,item| sxl[:alarms][id] = item }
29
- object["statuses"].each { |id,item| sxl[:statuses][id] = item }
30
- object["commands"].each { |id,item| sxl[:commands][id] = item }
31
+ object["alarms"].each { |id,item| sxl[:alarms][id] = item } if object["alarms"]
32
+ object["statuses"].each { |id,item| sxl[:statuses][id] = item } if object["statuses"]
33
+ object["commands"].each { |id,item| sxl[:commands][id] = item } if object["commands"]
31
34
  end
32
35
  sxl
33
36
  end
data/lib/rsmp/message.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'rsmp_schemer'
1
+ require 'rsmp_schema'
2
2
 
3
3
  # rsmp messages
4
4
  module RSMP
@@ -146,7 +146,7 @@ module RSMP
146
146
  end
147
147
 
148
148
  def validate schemas
149
- errors = RSMP::Schemer.validate attributes, schemas
149
+ errors = RSMP::Schema.validate attributes, schemas
150
150
  if errors
151
151
  error_string = errors.map {|item| item.reject {|e| e=='' } }.compact.join(', ').strip
152
152
  raise SchemaError.new error_string
data/lib/rsmp/proxy.rb CHANGED
@@ -230,7 +230,7 @@ module RSMP
230
230
  begin
231
231
  now = Clock.now
232
232
  timer(now)
233
- rescue RSMP::Schemer::Error => e
233
+ rescue RSMP::Schema::Error => e
234
234
  log "Timer: Schema error: #{e}", level: :warning
235
235
  rescue EOFError => e
236
236
  log "Timer: Connection closed: #{e}", level: :warning
@@ -319,7 +319,7 @@ module RSMP
319
319
  # TODO
320
320
  # what schema should we use to validate the intial Version and MessageAck messages?
321
321
  schemas = { core: '3.1.5' }
322
- schemas[sxl] = RSMP::Schemer.sanitize_version(sxl_version) if sxl && sxl_version
322
+ schemas[sxl] = RSMP::Schema.sanitize_version(sxl_version) if sxl && sxl_version
323
323
  schemas
324
324
  end
325
325
 
@@ -335,7 +335,7 @@ module RSMP
335
335
  log_send message, reason
336
336
  rescue EOFError, IOError
337
337
  buffer_message message
338
- rescue SchemaError, RSMP::Schemer::Error => e
338
+ rescue SchemaError, RSMP::Schema::Error => e
339
339
  str = "Could not send #{message.type} because schema validation failed: #{e.message}"
340
340
  log str, message: message, level: :error
341
341
  notify_error e.exception("#{str} #{message.json}")
@@ -398,7 +398,7 @@ module RSMP
398
398
  log str, message: Malformed.new(attributes), level: :warning
399
399
  # cannot send NotAcknowledged for a malformed message since we can't read it, just ignore it
400
400
  nil
401
- rescue SchemaError, RSMP::Schemer::Error => e
401
+ rescue SchemaError, RSMP::Schema::Error => e
402
402
  reason = "schema errors: #{e.message}"
403
403
  str = "Received invalid #{message.type}, #{reason}"
404
404
  log str, message: message, level: :warning
data/lib/rsmp/site.rb CHANGED
@@ -60,7 +60,7 @@ module RSMP
60
60
  def check_sxl_version
61
61
  sxl = @site_settings['sxl']
62
62
  version = @site_settings['sxl_version']
63
- RSMP::Schemer::find_schema! sxl, version, lenient: true
63
+ RSMP::Schema::find_schema! sxl, version, lenient: true
64
64
  end
65
65
 
66
66
  def run
@@ -47,7 +47,7 @@ module RSMP
47
47
 
48
48
  def handshake_complete
49
49
  super
50
- sanitized_sxl_version = RSMP::Schemer.sanitize_version(@site_sxl_version)
50
+ sanitized_sxl_version = RSMP::Schema.sanitize_version(@site_sxl_version)
51
51
  log "Connection to site #{@site_id} established, using core #{@rsmp_version}, #{@sxl} #{sanitized_sxl_version}", level: :log
52
52
  start_watchdog
53
53
  end
@@ -212,7 +212,7 @@ module RSMP
212
212
 
213
213
  # additional items can be used when verifying the response,
214
214
  # but must be removed from the subscribe message
215
- subscribe_list = status_list.map { |item| item.slice('sCI','n','uRt') }
215
+ subscribe_list = status_list.map { |item| item.slice('sCI','n','uRt','sOc') }
216
216
 
217
217
  # update our subcription list
218
218
  @status_subscriptions[component_id] ||= {}
@@ -220,9 +220,11 @@ module RSMP
220
220
  sCI = item["sCI"]
221
221
  n = item["n"]
222
222
  uRt = item["uRt"]
223
+ sOc = item["sOc"]
223
224
  @status_subscriptions[component_id][sCI] ||= {}
224
225
  @status_subscriptions[component_id][sCI][n] ||= {}
225
226
  @status_subscriptions[component_id][sCI][n]['uRt'] = uRt
227
+ @status_subscriptions[component_id][sCI][n]['sOc'] = sOc
226
228
  end
227
229
 
228
230
  component = find_component component_id
@@ -312,12 +314,12 @@ module RSMP
312
314
  # comes from the Version message send by the site
313
315
  type = 'tlc'
314
316
  version = message.attribute 'SXL'
315
- RSMP::Schemer::find_schema! type, version, lenient: true
317
+ RSMP::Schema::find_schema! type, version, lenient: true
316
318
 
317
319
  # store sxl version requested by site
318
320
  # TODO should check agaist site settings
319
321
  @site_sxl_version = message.attribute 'SXL'
320
- rescue RSMP::Schemer::UnknownSchemaError => e
322
+ rescue RSMP::Schema::UnknownSchemaError => e
321
323
  dont_acknowledge message, "Rejected #{message.type} message,", "#{e}"
322
324
  end
323
325
 
@@ -52,8 +52,8 @@ module RSMP
52
52
  unless sxl
53
53
  raise RSMP::ConfigurationError.new("Configuration error for site '#{site_id}': No SXL specified")
54
54
  end
55
- RSMP::Schemer.find_schemas! sxl if sxl
56
- rescue RSMP::Schemer::UnknownSchemaError => e
55
+ RSMP::Schema.find_schemas! sxl if sxl
56
+ rescue RSMP::Schema::UnknownSchemaError => e
57
57
  raise RSMP::ConfigurationError.new("Configuration error for site '#{site_id}': #{e}")
58
58
  end
59
59
  end
@@ -82,7 +82,7 @@ module RSMP
82
82
  end
83
83
 
84
84
  def handshake_complete
85
- sanitized_sxl_version = RSMP::Schemer.sanitize_version(sxl_version)
85
+ sanitized_sxl_version = RSMP::Schema.sanitize_version(sxl_version)
86
86
  log "Connection to supervisor established, using core #{@rsmp_version}, #{sxl} #{sanitized_sxl_version}", level: :info
87
87
  start_watchdog
88
88
  if @site_settings['send_after_connect']
data/lib/rsmp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RSMP
2
- VERSION = "0.13.7"
2
+ VERSION = "0.14.1"
3
3
  end
data/rsmp.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.description = %q{Easy RSMP site and supervisor communication.}
14
14
  spec.homepage = "https://github.com/rsmp-nordic/rsmp"
15
15
  spec.licenses = ['MIT']
16
- spec.required_ruby_version = '>= 2.0.0'
16
+ spec.required_ruby_version = '>= 3.0.0'
17
17
 
18
18
  spec.metadata["homepage_uri"] = spec.homepage
19
19
  spec.metadata["source_code_uri"] = "https://github.com/rsmp-nordic/rsmp"
@@ -30,13 +30,13 @@ Gem::Specification.new do |spec|
30
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
 
33
- spec.add_dependency "async", "~> 1.29.1"
34
- spec.add_dependency "async-io", "~> 1.32.2"
33
+ spec.add_dependency "async", "~> 1.30.3"
34
+ spec.add_dependency "async-io", "~> 1.33.0"
35
35
  spec.add_dependency "colorize", "~> 0.8.1"
36
36
  spec.add_dependency "thor", "~> 1.2.1"
37
- spec.add_dependency "rsmp_schemer"
37
+ spec.add_dependency "rsmp_schema", "~> 0.1.0"
38
38
 
39
- spec.add_development_dependency "bundler", "~> 2.3.6"
39
+ spec.add_development_dependency "bundler", "~> 2.3.7"
40
40
  spec.add_development_dependency "rake", "~> 13.0.6"
41
41
  spec.add_development_dependency "rspec", "~> 3.10.0"
42
42
  spec.add_development_dependency "rspec-expectations", "~> 3.10.2"
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.13.7
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Tin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-05 00:00:00.000000000 Z
11
+ date: 2022-08-17 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.29.1
19
+ version: 1.30.3
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.29.1
26
+ version: 1.30.3
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.32.2
33
+ version: 1.33.0
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.32.2
40
+ version: 1.33.0
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.2.1
69
69
  - !ruby/object:Gem::Dependency
70
- name: rsmp_schemer
70
+ name: rsmp_schema
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 0.1.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'
82
+ version: 0.1.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.3.6
89
+ version: 2.3.7
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.3.6
96
+ version: 2.3.7
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -269,14 +269,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
269
269
  requirements:
270
270
  - - ">="
271
271
  - !ruby/object:Gem::Version
272
- version: 2.0.0
272
+ version: 3.0.0
273
273
  required_rubygems_version: !ruby/object:Gem::Requirement
274
274
  requirements:
275
275
  - - ">="
276
276
  - !ruby/object:Gem::Version
277
277
  version: '0'
278
278
  requirements: []
279
- rubygems_version: 3.3.3
279
+ rubygems_version: 3.3.7
280
280
  signing_key:
281
281
  specification_version: 4
282
282
  summary: RoadSide Message Protocol (RSMP) library.