rsmp 0.53.0 → 0.53.2

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: 66bd0079bb76c72ad04ce15f191ac3f33a06bcaf4f941c8d23f10b8239c3f308
4
- data.tar.gz: 34f6fb37b13637ffe1bdf3f92064e103fc3b8b798fce11e2764d0ab810f23190
3
+ metadata.gz: c18e33005250515e950be688be2ed3d0070c379724885ca10268846a85d0b5d7
4
+ data.tar.gz: e9b7ab8838542eb7d0ece090c3944614dbbcd2d6b83c27e15de9a510bbd60856
5
5
  SHA512:
6
- metadata.gz: 140f8cd7c0f9f5b542d4b4f47fd4d99095ff7eecaaf784bc6b6ae92e5dee1014b4f0a6338159c21e3bdda86e3ef06764f17b9d0055c3880b213a2c18e0e18708
7
- data.tar.gz: ab5da12c73a27485b2e94d73cc2090adce96b69aa97dbb4530b5d5819aad20ecf0fa466d2b3b3f5068e678cbe41fcfefdf9808155c25656ad4fb52e78432ce7c
6
+ metadata.gz: 0cf38acb9093a3939e55d6b21d54ec37459b5950793105ea23a5c8a6633b24e9fb5a2cc53293fa7dc5f1580aa1eb8e412b5fcb987ad6080d6c4a4358a1a9ce13
7
+ data.tar.gz: 533839b68ef17834741085c7d0e7d1d023f7d997b335608e5f00365c45ba6e28af13d9deab55b1062f58f2f9f323aa1f0a463de09a34febac6ff32c909c18b1c
data/CHANGELOG.md CHANGED
@@ -738,3 +738,10 @@ Initial release.
738
738
  ## 0.53.0
739
739
  - update core 3.3.0 support to sync with latest core 3.3.0 draft
740
740
  - allow fractional status subscription intervals for all older core versions to align with their specs.
741
+
742
+ ## 0.53.1
743
+ - skip repeated status value checks for buffered values (`q=old`) and unknown subscription settings
744
+
745
+ ## 0.53.2
746
+ - fix issues with Alarm enum casing
747
+ - update TLC schemas
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.53.0)
4
+ rsmp (0.53.2)
5
5
  async (~> 2.45)
6
6
  colorize (~> 1.1)
7
7
  io-endpoint (~> 0.17)
@@ -1,6 +1,8 @@
1
1
  module RSMP
2
2
  # Class for waiting for specific command responses
3
3
  class AlarmCollector < Collector
4
+ ENUM_ATTRIBUTES = %w[aSp ack aS sS cat pri].freeze
5
+
4
6
  def initialize(proxy, options = {})
5
7
  @matcher = options[:matcher] || {}
6
8
  super(proxy, options.merge(
@@ -27,12 +29,17 @@ module RSMP
27
29
  when Regexp
28
30
  return false if got !~ want
29
31
  when String
30
- return false if got != want
32
+ return false unless string_attribute_matches?(key, want, got)
31
33
  end
32
34
  end
33
35
  true
34
36
  end
35
37
 
38
+ def string_attribute_matches?(key, want, got)
39
+ # Schemas enforce wire casing; enum matching also supports older Core versions.
40
+ ENUM_ATTRIBUTES.include?(key) ? want.casecmp?(got) : want == got
41
+ end
42
+
36
43
  def rvs_attributes_match?(message)
37
44
  return true unless @matcher['rvs']
38
45
 
@@ -9,9 +9,9 @@ module RSMP
9
9
  def self.create_from_message(component, message)
10
10
  options = {
11
11
  timestamp: RSMP::Clock.parse(message.attribute('aTs')),
12
- acknowledged: message.attribute('ack') == 'Acknowledged',
13
- suspended: message.attribute('aS') == 'Suspended',
14
- active: message.attribute('sS') == 'Active',
12
+ acknowledged: message.attribute('ack').downcase == 'acknowledged',
13
+ suspended: message.attribute('sS').downcase == 'suspended',
14
+ active: message.attribute('aS').downcase == 'active',
15
15
  category: message.attribute('cat'),
16
16
  priority: message.attribute('pri').to_i,
17
17
  rvs: message.attribute('rvs')
@@ -121,9 +121,9 @@ module RSMP
121
121
  raise TimestampError, "timestamp is earlier than previous alarm #{message.m_id_short}" if older_message? message
122
122
  ensure
123
123
  @timestamp = RSMP::Clock.parse message.attribute('aTs')
124
- @acknowledged = message.attribute('ack') == 'True'
125
- @suspended = message.attribute('sS') == 'True'
126
- @active = message.attribute('aS') == 'True'
124
+ @acknowledged = message.attribute('ack').downcase == 'acknowledged'
125
+ @suspended = message.attribute('sS').downcase == 'suspended'
126
+ @active = message.attribute('aS').downcase == 'active'
127
127
  @category = message.attribute('cat')
128
128
  @priority = message.attribute('pri').to_i
129
129
  @rvs = message.attribute('rvs')
@@ -18,8 +18,8 @@ module RSMP
18
18
  end
19
19
  end
20
20
 
21
- # Check that were not receiving repeated update values.
22
- # The check is not performed for item with an update interval.
21
+ # Check live values only for known change-only subscriptions. Buffered
22
+ # values may have been generated under different subscription settings.
23
23
  def check_repeat_values(message, subscription_list)
24
24
  message.attribute('sS').each do |item|
25
25
  check_status_item_for_repeats(item, subscription_list)
@@ -27,6 +27,8 @@ module RSMP
27
27
  end
28
28
 
29
29
  def check_status_item_for_repeats(item, subscription_list)
30
+ return if item['q'] == 'old'
31
+
30
32
  status_code = item['sCI']
31
33
  status_name = item['n']
32
34
  return if update_rate_set?(subscription_list, status_code, status_name)
@@ -43,8 +45,9 @@ module RSMP
43
45
  end
44
46
 
45
47
  def should_check_repeats?(subscription_list, status_code, status_name)
46
- soc = subscription_list.dig(c_id, status_code, status_name, 'sOc')
47
- return false if soc == false
48
+ subscription = subscription_list.dig(c_id, status_code, status_name)
49
+ return false unless subscription
50
+ return false if subscription['sOc'] == false
48
51
  return false if @allow_repeat_updates[status_code]&.include?(status_name)
49
52
 
50
53
  true
data/lib/rsmp/message.rb CHANGED
@@ -329,7 +329,7 @@ module RSMP
329
329
  def initialize(attributes = {})
330
330
  super({
331
331
  'aSp' => 'Acknowledge',
332
- 'ack' => 'acknowledged'
332
+ 'ack' => 'Acknowledged'
333
333
  }.merge attributes)
334
334
  end
335
335
  end
data/lib/rsmp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RSMP
2
- VERSION = '0.53.0'.freeze
2
+ VERSION = '0.53.2'.freeze
3
3
  end
@@ -13,7 +13,7 @@
13
13
  "sS" : {
14
14
  "description" : "Suspend status",
15
15
  "type" : "string",
16
- "enum" : [ "suspended", "notSuspended" ]
16
+ "enum" : [ "Suspended", "notSuspended" ]
17
17
  },
18
18
  "aTs" : { "$ref": "definitions.json#/timestamp" },
19
19
  "cat" : {
@@ -13,7 +13,7 @@
13
13
  "sS" : {
14
14
  "description" : "Suspend status",
15
15
  "type" : "string",
16
- "enum" : [ "suspended", "notSuspended" ]
16
+ "enum" : [ "Suspended", "notSuspended" ]
17
17
  },
18
18
  "aTs" : { "$ref": "definitions.json#/timestamp" },
19
19
  "cat" : {
@@ -13,7 +13,7 @@
13
13
  "sS" : {
14
14
  "description" : "Suspend status",
15
15
  "type" : "string",
16
- "enum" : [ "suspended", "notSuspended" ]
16
+ "enum" : [ "Suspended", "notSuspended" ]
17
17
  },
18
18
  "aTs" : { "$ref": "definitions.json#/timestamp" },
19
19
  "cat" : {
@@ -13,7 +13,7 @@
13
13
  "sS" : {
14
14
  "description" : "Suspend status",
15
15
  "type" : "string",
16
- "enum" : [ "suspended", "notSuspended" ]
16
+ "enum" : [ "Suspended", "notSuspended" ]
17
17
  },
18
18
  "aTs" : { "$ref": "definitions.json#/timestamp" },
19
19
  "cat" : {
@@ -68,9 +68,23 @@
68
68
  ]
69
69
  },
70
70
  "component_id": {
71
- "description" : "Compoment id",
71
+ "description" : "Component ID",
72
72
  "allOf" : [
73
- { "$ref" : "#/rsmp_string" }
73
+ { "$ref" : "#/rsmp_string" },
74
+ { "pattern" : "^[A-Za-z0-9_+=-]+(?:/[A-Za-z0-9_+=-]+)*$" }
75
+ ]
76
+ },
77
+ "component_id_selector": {
78
+ "description" : "Component selector",
79
+ "anyOf" : [
80
+ { "$ref" : "#/component_id" },
81
+ {
82
+ "allOf" : [
83
+ { "$ref" : "#/rsmp_string" },
84
+ { "pattern" : "^[A-Za-z0-9_+=-]+(?:/[A-Za-z0-9_+=-]+)*/$" }
85
+ ]
86
+ },
87
+ { "enum" : [ "/", "", null ] }
74
88
  ]
75
89
  },
76
90
  "component_type": {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsmp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.53.0
4
+ version: 0.53.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Tin