rsmp 0.20.2 → 0.20.4

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: edab8c5a4e106585dd62c4c2596a6df4cda363da8d96174bba51639e5ccad54c
4
- data.tar.gz: 95bc098d37c13ff5c66c6a8da7d3f43ec5dfc1e0a4360b5b29cea7f1d41a7a69
3
+ metadata.gz: d4c2f0ad26f341d78dba43980b9f873a75bf06d2233ffa3f27b30b3f7d83e297
4
+ data.tar.gz: 84187fc4d5c836233397ff20ffff5cdf236435069d3edb436999fe5f8de1436b
5
5
  SHA512:
6
- metadata.gz: 7a39eda6d493a3f182c91851fc0c2c6f233efb1fe095f8a6d4fe0cc7c5865afad0f12e4144184e30444a1f042766c5653ead38593c506049d6e3080b088fa553
7
- data.tar.gz: 286591ea4f8bac4d8a61b98e989286dfec24340c2dbc28fdd3db82d2a9b2a644428ed21410318320c6a321900461a4d45ec475e347908b9c173e71ee51c2a357
6
+ metadata.gz: 1950948c8087db84fbf12069e4fcee10160efa8e4031ba618dcbdf04c130104df5f6e8467f0cfdb647615ab5de3b96fcb7cc9cfeaf5ec458bc0471e9f09676e2
7
+ data.tar.gz: c9999221cc2b49d5320d2769230e8ba7c9e54bf5a4f4e37c7efdef599b7745f8d85dbb29c2ed7fc01304604e591a5303422e813e9dee978286760e3897705aa2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.20.2)
4
+ rsmp (0.20.4)
5
5
  async (~> 2.6.2)
6
6
  async-io (~> 1.35.0)
7
7
  colorize (~> 0.8.1)
@@ -45,7 +45,7 @@ module RSMP
45
45
  def find_component component_id, build: true
46
46
  component = @components[component_id]
47
47
  return component if component
48
- if build
48
+ if build && !component_id.empty?
49
49
  inferred = infer_component_type component_id
50
50
  component = inferred.new node: self, id: component_id
51
51
  @components[ component_id] = component
data/lib/rsmp/message.rb CHANGED
@@ -66,7 +66,11 @@ module RSMP
66
66
  when /^Request$/i
67
67
  AlarmRequest.new attributes
68
68
  when /^Acknowledge$/i
69
+ if attributes['ack'] =~ /^acknowledged$/i
69
70
  AlarmAcknowledged.new attributes
71
+ else
72
+ AlarmAcknowledge.new attributes
73
+ end
70
74
  when /^Suspend$/i
71
75
  if attributes['sS'] =~ /^suspended$/i
72
76
  AlarmSuspended.new attributes
@@ -63,7 +63,7 @@ module RSMP
63
63
  process_aggregated_status message
64
64
  when AggregatedStatusRequest
65
65
  will_not_handle message
66
- when AlarmIssue, AlarmSuspended, AlarmResumed
66
+ when AlarmIssue, AlarmSuspended, AlarmResumed, AlarmAcknowledged
67
67
  process_alarm message
68
68
  when CommandResponse
69
69
  process_command_response message
@@ -197,7 +197,7 @@ module RSMP
197
197
 
198
198
  def process_alarm message
199
199
  case message
200
- when AlarmAcknowledged
200
+ when AlarmAcknowledge
201
201
  handle_alarm_acknowledge message
202
202
  when AlarmSuspend
203
203
  handle_alarm_suspend message
@@ -261,19 +261,31 @@ module RSMP
261
261
  end
262
262
 
263
263
  def process_command_request message
264
- log "Received #{message.type}", message: message, level: :log
265
264
  component_id = message.attributes["cId"]
266
- component = @site.find_component component_id
267
- commands = simplify_command_requests message.attributes["arg"]
268
- commands.each_pair do |command_code,arg|
269
- component.handle_command command_code,arg
270
- end
271
265
 
272
266
  rvs = message.attributes["arg"].map do |item|
273
267
  item = item.dup.merge('age'=>'recent')
274
268
  item.delete 'cO'
275
269
  item
276
270
  end
271
+
272
+ begin
273
+ component = @site.find_component component_id
274
+ commands = simplify_command_requests message.attributes["arg"]
275
+ commands.each_pair do |command_code,arg|
276
+ component.handle_command command_code,arg
277
+ end
278
+ log "Received #{message.type}", message: message, level: :log
279
+ rescue UnknownComponent => e
280
+ log "Received #{message.type} with unknown component id '#{component_id}'", message: message, level: :warning
281
+ # If the component is unknown, we must set age=undefined for all items,
282
+ # while still acknowledge the message.
283
+ # See https://github.com/rsmp-nordic/rsmp_validator/issues/271
284
+ rvs.map do |item|
285
+ item['age'] = 'undefined'
286
+ end
287
+ end
288
+
277
289
  response = CommandResponse.new({
278
290
  "cId"=>component_id,
279
291
  "cTS"=>clock.to_s,
data/lib/rsmp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RSMP
2
- VERSION = "0.20.2"
2
+ VERSION = "0.20.4"
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.20.2
4
+ version: 0.20.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Tin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-22 00:00:00.000000000 Z
11
+ date: 2023-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async